Module:BTD6 stats: Difference between revisions

mNo edit summary
Pymonkibot (talk | contribs)
m Text replacement - "[[Bloons TD 6 v" to "[[Update history:Bloons TD 6/Version "
 
(10 intermediate revisions by 2 users not shown)
Line 72: Line 72:
local amount = 0
local amount = 0
if attack.rate then headingLower[#headingLower+1] = "Cooldown" amount = amount + 1 end
if attack.rate and attack.rate < 9999 and not attack.rateMin then headingLower[#headingLower+1] = "Cooldown" amount = amount + 1 end
if attack.initialDamage and attack.initialDamage > 0 then headingLower[#headingLower+1] = "Scratch damage" amount = amount + 1 end
if attack.initialDamage and attack.initialDamage > 0 then headingLower[#headingLower+1] = "Scratch damage" amount = amount + 1 end
if attack.grapplingDamage and attack.grapplingDamage > 0 then headingLower[#headingLower+1] = "Grappling damage" amount = amount + 1 end
if attack.grapplingDamage and attack.grapplingDamage > 0 then headingLower[#headingLower+1] = "Grappling damage" amount = amount + 1 end
if attack.thrashingProjectileRate then headingLower[#headingLower+1] = "Thrash cooldown" amount = amount + 1 end
if attack.thrashingProjectileRate then headingLower[#headingLower+1] = "Thrash cooldown" amount = amount + 1 end
if amount > 0 then
if amount > 0 then
Line 84: Line 84:
-- projectiles
-- projectiles
if attack.projectiles then headingProjectiles(attack.projectiles) end
if attack.projectiles then headingProjectiles(attack.projectiles) end
end
end
local headingAbilities = function(abils)
for i, v in ipairs(abils["_order"]) do
local abil = abils[v]
local amount = 0
if abil.cooldown then headingLower[#headingLower+1] = "Cooldown" amount = amount + 1 end
if amount > 0 then
headingUpper[#headingUpper+1] = v
upperColspans[#upperColspans+1] = amount
end
-- projectiles
if abil.projectiles then headingProjectiles(abil.projectiles) end
end
end
end
end
Line 124: Line 141:
end
end
if data.attacks then headingAttacks(data.attacks) end
if data.attacks then headingAttacks(data.attacks) end
if data.abilities then
if data.abilities then headingAbilities(data.abilities) end
for i, v in ipairs(data.abilities["_order"]) do
if data.abilities[v]["projectiles"] then headingProjectiles(data.abilities[v]["projectiles"]) end
end
end
ret[#ret+1] = "!rowspan=2|Power!!rowspan=2|Scale"
ret[#ret+1] = "!rowspan=2|Power!!rowspan=2|Scale"
Line 146: Line 159:
-- attack cooldown
-- attack cooldown
local insertRate = function(amt)
local insertRate = function(amt)
ret[#ret+1] = sformat("|%gs", amt - (data.cooldownScaleRange*scale))
ret[#ret+1] = sformat("| %.4gs", amt - (data.cooldownScaleRange*scale))
end
-- thrash cooldown
local insertThrashRate = function(amt, thrashRate)
ret[#ret+1] = sformat("| %.4gs", (1 - data.cooldownScaleRange*scale/amt) * thrashRate)
end
end
-- ability cooldown
-- ability cooldown
local insertAbilityCooldown = function(amt, mainAttackRate)
local insertAbilityCooldown = function(amt, mainAttackRate)
ret[#ret+1] = sformat("|%gs", amt - (data.cooldownScaleRange*scale/mainAttackRate))
ret[#ret+1] = sformat("|%.4gs", amt * (1 - (data.cooldownScaleRange*scale/(mainAttackRate - (data.cooldownScaleRange*scale)))))
end
end
-- damage
-- damage
local insertDamage = function(amt)
local insertDamage = function(amt)
ret[#ret+1] = sformat("|%g", amt + mfloor(data.damageRange*scale))
ret[#ret+1] = sformat("|%i", amt + mfloor(data.damageRange*scale))
end
end
-- dino stun damage
-- dino stun damage
local insertStunDamage = function(amt)
local insertStunDamage = function(amt)
ret[#ret+1] = sformat("|%g", amt + mfloor(data.damageRange*scale/data.stunBonusDivideMicroraptor))
ret[#ret+1] = sformat("|%i", amt + mfloor(data.damageRange*scale/data.stunBonusDivideMicroraptor))
end
end
-- pierce
-- pierce
local insertPierce = function(amt)
local insertPierce = function(amt)
ret[#ret+1] = sformat("|%g", amt + mfloor(data.pierceRange*scale))
ret[#ret+1] = sformat("|%i", amt + mfloor(data.pierceRange*scale))
end
end
-- thrash knockback duration
-- thrash knockback duration
local insertKnockback = function(amt)
local insertKnockback = function(amt)
ret[#ret+1] = sformat("|%gs", amt + (data.thrashKnockbackLifetimeRange*scale))
ret[#ret+1] = sformat("|%.4gs", amt + (data.thrashKnockbackLifetimeRange*scale))
end
end
-- bird flight speed
-- bird flight speed
local insertGyrfalconSpeed = function()
local insertGyrfalconSpeed = function()
ret[#ret+1] = sformat("|%g units/s", data.speedRangeGyrfalcon + (data.speedRangeGyrfalcon*scale))
ret[#ret+1] = sformat("|%.4g units/s", data.speed + (data.speedRangeGyrfalcon*scale))
end
end
Line 193: Line 211:
if projectile.maxPierce < 1 and projectile.pierce < 99999 then insertPierce(projectile.pierce) end
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.damage and projectile.damage > 0 then insertDamage(projectile.damage) end
if projectile.damageModifierForStunned then insertStunDamage(projectile.damage) end
if projectile.damageModifierForStunned then insertStunDamage(projectile.damageModifierForStunned) end
if projectile.effects then parseEffects(projectile.effects) end
if projectile.effects then parseEffects(projectile.effects) end
Line 206: Line 224:
if attack.initialDamage and attack.initialDamage > 0 then insertDamage(attack.initialDamage) 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
if attack.grapplingDamage and attack.grapplingDamage > 0 then insertDamage(attack.initialDamage) end
if attack.thrashingProjectileRate then insertRate(attack.thrashingProjectileRate) end
if attack.thrashingProjectileRate then insertThrashRate(attack.rate, attack.thrashingProjectileRate) end
-- projectiles
-- projectiles
Line 228: Line 246:
for i = minPower[tiers], maxPower[tiers] do
for i = minPower[tiers], maxPower[tiers] do
scale = ((i - minPower[tiers]) / (maxPower[tiers] - minPower[tiers]))
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|%.4g%%", i, scale*100)
-- calculations
-- calculations
Line 364: Line 382:
-- attack cooldowns and ability cooldowns
-- attack cooldowns and ability cooldowns
local insert_rate = function(amt)
local insert_rate = function(amt)
tinsert(ret, sformat("|%gs", amt / (1 + (0.01 * msqrt((d-1)*50)))))
tinsert(ret, sformat("|%.4gs", amt / (1 + (0.01 * msqrt((d-1)*50)))))
end
end
-- damage
-- damage
local insert_damage = function(amt)
local insert_damage = function(amt)
if d == 100 then tinsert(ret, sformat("|%g", amt * 2 + 10))
if d == 100 then tinsert(ret, sformat("|%.4g", amt * 2 + 10))
else tinsert(ret, sformat("|%g", amt * (1 + (d-1) * 0.01) + mfloor((d-1)/10))) end
else tinsert(ret, sformat("|%.4g", amt * (1 + (d-1) * 0.01) + mfloor((d-1)/10))) end
end
end
-- pierce
-- pierce
local insert_pierce = function(amt)
local insert_pierce = function(amt)
if d == 100 then tinsert(ret, sformat("|%g", amt * 2 + 10))
if d == 100 then tinsert(ret, sformat("|%.4g", amt * 2 + 10))
else tinsert(ret, sformat("|%g", mfloor(amt * (1 + (d-1) * 0.01)) + (d-1)/10)) end
else tinsert(ret, sformat("|%.4g", mfloor(amt * (1 + (d-1) * 0.01)) + (d-1)/10)) end
end
end
-- damage modifiers
-- damage modifiers
local insert_damage_mod = function(amt)
local insert_damage_mod = function(amt)
if d == 100 then tinsert(ret, sformat("| +%g", amt * 2 + 10))
if d == 100 then tinsert(ret, sformat("| +%.4g", amt * 2 + 10))
else tinsert(ret, sformat("| +%g", amt * (1 + (d-1) * 0.01))) end
else tinsert(ret, sformat("| +%.4g", amt * (1 + (d-1) * 0.01))) end
end
end
Line 753: Line 771:
local out = parse_tower_base(frame, data, "<h3>%s</h3>", true)
local out = parse_tower_base(frame, data, "<h3>%s</h3>", true)
return string.format("<div class='hatnote'>This data was last updated for: [[Bloons TD 6 v%s|version %s]]</div>", data["_last_updated"], data["_last_updated"]) .. out
return string.format("<div class='hatnote'>This data was last updated for: [[Update history:Bloons TD 6/Version %s|version %s]]</div>", data["_last_updated"], data["_last_updated"]) .. out
end
end


Line 788: Line 806:
}
}
tinsert(ret, sformat("<div class='hatnote'>This data was last updated for: [[Bloons TD 6 v%s|version %s]]</div>", data["_last_updated"], data["_last_updated"]))
tinsert(ret, sformat("<div class='hatnote'>This data was last updated for: [[Update history:Bloons TD 6/Version %s|version %s]]</div>", data["_last_updated"], data["_last_updated"]))
for i, v in ipairs(upgrade_crosspaths[frame.args[2]]) do
for i, v in ipairs(upgrade_crosspaths[frame.args[2]]) do
my_data = {}
local result = parse_tower(frame, base_data, my_data, "<h3>%s</h3>", false)
local result = parse_tower(frame, base_data, my_data, "<h3>%s</h3>", false)
Line 858: Line 877:
function p.last_updated(frame)
function p.last_updated(frame)
local data = mw.loadJsonData(string.format("Module:BTD6 stats/%s/new", frame.args[1]))
local data = mw.loadJsonData(string.format("Module:BTD6 stats/%s/new", frame.args[1]))
return string.format("<div class='hatnote'>This data was last updated for: [[Bloons TD 6 v%s|version %s]]</div>", data["_last_updated"], data["_last_updated"])
return string.format("<div class='hatnote'>This data was last updated for: [[Update history:Bloons TD 6/Version %s|version %s]]</div>", data["_last_updated"], data["_last_updated"])
end
end


return p
return p