Fix some revives; improve dungeon exit flow (#2409)

This commit is contained in:
longfruit
2023-10-25 19:27:48 -07:00
committed by GitHub
Unverified
parent 837e30e04b
commit f86259a430
8 changed files with 145 additions and 31 deletions
@@ -174,13 +174,7 @@ public abstract class GameEntity {
}
this.lastAttackType = attackType;
// Check if dead
if (this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
this.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0f);
this.isDead = true;
}
this.checkIfDead();
this.runLuaCallbacks(event);
// Packets
@@ -194,6 +188,17 @@ public abstract class GameEntity {
}
}
public void checkIfDead() {
if (this.getFightProperties() == null || !hasFightProperty(FightProperty.FIGHT_PROP_CUR_HP)) {
return;
}
if (this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
this.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0f);
this.isDead = true;
}
}
/**
* Runs the Lua callbacks for {@link EntityDamageEvent}.
*
@@ -333,6 +338,8 @@ public abstract class GameEntity {
if (entityController != null) {
entityController.onDie(this, getLastAttackType());
}
this.isDead = true;
}
/** Invoked when a global ability value is updated. */