Closed biax closed 7 years ago
Are you referring to this loop?
for _,creep in pairs(creeps) do
local damage = ApplyAbilityDamageFromModifiers(unit.napalmDamage, self.tower)
local damage_done = DamageEntity(creep, self.tower, damage)
end
This only applies the damage once to each creep. ApplyAbilityDamageFromModifiers
doesn't deal damage, it simply calculate and returns it. This loop could be optimized, however, since there is no need to recalculate the damage for each creep since it will be the same each time.
Upon death of unit (rather than triggered by duration) I see that the damage is mentioned twice. However it's extremely difficult to calculate whether the damage has actually been applied twice.
Yeah currently in the [flamethrower ability file] there's both OnDeath and OnDestroy, if the creep dies it will call both events, so the OnNapalmCreepDied
method will be called twice.
We should first copy the whole code to another method definition (OnNapalmDestroy
or similar) while changing the datadriven ability to call this new name.
In OnNapalmDestroy
, only do the effect if the unit is alive.
Fixed.
Noya, could you check the logic of flamethrower tower? I think it applies napalm damage twice (on death)