Module:BTD6 hero xp: Difference between revisions

There was a typo on Line 41, as it should be that xp = (total_rounds * 40 - 380), not xp = (total_rounds * 50 - 380). It led to errors previously present on heroes' leveling.
mNo edit summary
Line 42: Line 42:
else xp = (total_rounds * 90 - 2880) end
else xp = (total_rounds * 90 - 2880) end
total_xp = total_xp + mfloor((xp * mult) + 0.05)
local floor = mfloor(xp * mult)
    -- Check if it is a perfect half tie-breaker
    total_xp = total_xp + ((((xp * mult) - floor) == 0.5) and ((floor % 2 == 0) and floor or (floor + 1)) or mfloor((xp * mult) + 0.5))
end
end