Module:BTD6 stats: Difference between revisions
mNo edit summary |
saving progress |
||
| Line 131: | Line 131: | ||
end | end | ||
ret[#ret+1] = "|-\n!" .. table.concat(headingLower, "!!") | ret[#ret+1] = "|-\n!" .. table.concat(headingLower, "!!") | ||
-- -- -- -- -- -- -- | |||
-- CALCULATE STATS | |||
-- -- -- -- -- -- -- | |||
-- current scale | |||
local scale | |||
-- attack cooldown | |||
local insertRate = function(amt) | |||
tinsert(ret, sformat("|%gs", amt - (data.cooldownScaleRange*scale))) | |||
end | |||
-- ability cooldown | |||
local insertAbilityCooldown = function(amt, mainAttackRate) | |||
tinsert(ret, sformat("|%gs", amt - (data.cooldownScaleRange*scale/mainAttackRate))) | |||
end | |||
-- damage | |||
local insertDamage = function(amt) | |||
tinsert(ret, sformat("|%g", amt + mfloor(data.damageRange*scale))) | |||
end | |||
-- dino stun damage | |||
local insertStunDamage = function(amt) | |||
tinsert(ret, sformat("|%g", amt + mfloor(data.damagePierceRange*scale/data.stunBonusDivideMicroraptor))) | |||
end | |||
-- pierce | |||
local insertPierce = function(amt) | |||
tinsert(ret, sformat("|%g", amt + mfloor(data.pierceRange*scale))) | |||
end | |||
-- thrash knockback duration | |||
local insertKnockback = function(amt) | |||
tinsert(ret, sformat("|%gs", amt + (data.thrashKnockbackLifetimeRange*scale))) | |||
end | |||
-- bird flight speed | |||
local insertGyrfalconSpeed = function(amt) | |||
tinsert(ret, sformat("|%g units/s", amt + (data.speedRangeGyrfalcon*scale))) | |||
end | |||
local parseEffects = function(effects) | |||
for i, v in ipairs(effects["_order"]) do | |||
local effect = effects[v] | |||
if i == "Knockback" and effect.duration then insertKnockback(effect.lifespan) end | |||
end | |||
end | |||
local parseProjectiles = function(projectiles) | |||
for i, v in ipairs(projectiles["_order"]) do | |||
local projectile = projectiles[v] | |||
if projectile.maxPierce < 1 and projectile.pierce < 99999 then insertPierce(projectile.pierce) end | |||
if projectile.damage and projectile.damage > 0 then insertDamage(projectile.damage) end | |||
if projectile.damageModifierForStunned then insertStunDamage(projectile.damage) end | |||
if projectile.effects then parseEffects(projectile.effects) end | |||
end | |||
end | |||
local parseAttacks = function(attacks) | |||
for i, v in ipairs(attacks["_order"]) do | |||
local attack = attacks[v] | |||
if attack.rate and attack.rate < 9999 and not attack.rateMin then insertRate(attack.rate) end | |||
if attack.initialDamage and attack.initialDamage > 0 then insertDamage(attack.initialDamage) end | |||
if attack.grapplingDamage and attack.grapplingDamage > 0 then insertDamage(attack.initialDamage) end | |||
-- projectiles | |||
if attack.projectiles then parse_projectiles(attack.projectiles) end | |||
end | |||
end | |||
local parseAbilities = function(abils) | |||
for i, v in ipairs(abils["_order"]) do | |||
local abil = abils[v] | |||
local attackRate = data.attacks[1].rate | |||
-- rate | |||
insertAbilityCooldown(abil.cooldown, attackRate) | |||
if abil.projectiles ~= nil then parseProjectiles(abil.projectiles) end | |||
end | |||
end | |||
for i = minPower[tiers], maxPower[tiers] do | for i = minPower[tiers], maxPower[tiers] do | ||
scale = ((i - minPower[tiers]) / (maxPower[tiers] - minPower[tiers])) | |||
ret[#ret+1] = sformat("|-\n!%i\n|%g%%", i, scale*100) | ret[#ret+1] = sformat("|-\n!%i\n|%g%%", i, scale*100) | ||
-- calculations | |||
if data["attacks"] then parseAttacks(data["attacks"]) end | |||
if data["abilities"] then parseAbilities(data["abilities"]) end | |||
end | end | ||