mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-14 07:55:57 +01:00
Fix some revives; improve dungeon exit flow (#2409)
This commit is contained in:
@@ -67,6 +67,11 @@ public class EntityAvatar extends GameEntity {
|
||||
}
|
||||
|
||||
this.initAbilities();
|
||||
|
||||
// New EntityAvatar instances are created on every scene transition.
|
||||
// Ensure that isDead is properly carried over between scenes.
|
||||
// Otherwise avatars could have 0 HP but not considered dead.
|
||||
this.checkIfDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user