Update ActionLoseHP.java to ignore Infinite CUR_HP

This commit is contained in:
Nazrin 2024-04-06 19:51:06 -07:00 committed by GitHub
parent 72b854204a
commit 0a8b030f79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,10 @@ public class ActionLoseHP extends AbilityActionHandler {
float amountToLose = amount;
amountToLose += amountByCasterMaxHPRatio * owner.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP);
amountToLose += amountByCasterAttackRatio * owner.getFightProperty(FightProperty.FIGHT_PROP_CUR_ATTACK);
amountToLose += amountByCasterCurrentHPRatio * owner.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
//Ignore amountByCasterCurrentHPRatio if owner has Infinite HP
if(owner.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) != Float.POSITIVE_INFINITY) {
amountToLose += amountByCasterCurrentHPRatio * owner.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
}
float currentHp = target.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
float maxHp = target.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP);