hp.can_explode
patf0rd opened this issue ยท 0 comments
Unfortunately, I wasn't able to reproduce it, but a while ago I had a situation where the hp.can_explode
condition for an Explode left my opponent alive with 1 hitpoint left.
Addon:RegisterCondition('hp.can_explode', { type = 'boolean', arg = false }, function(owner, pet)
return C_PetBattles.GetHealth(owner, pet) < floor(C_PetBattles.GetMaxHealth(getOpponentActivePet(owner)) * 0.4)
end)
Maybe there's an issue with in-game rounding weirdness so we need to add +0.5
or -0.5
somewhere in that code?
Example (only speculation):
The player pet has 1339MaxHP, the enemy pet is shown with 535HP left but internally it's 535.8
The function compares 1339*0.4 (535.6) with the exact number 535.8 and returns true but the pet explodes with rounded 535 damage and leaves 0.8HP which I see in a 1HP surviving enemy? idk