mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-16 14:23:28 +08:00
Apply changes from #2310
This commit is contained in:
@@ -15,9 +15,10 @@ import emu.grasscutter.scripts.data.controller.EntityController;
|
||||
import emu.grasscutter.server.event.entity.*;
|
||||
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import java.util.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class GameEntity {
|
||||
@Getter private final Scene scene;
|
||||
@Getter protected int id;
|
||||
@@ -33,6 +34,9 @@ public abstract class GameEntity {
|
||||
|
||||
@Getter @Setter private boolean lockHP;
|
||||
|
||||
@Setter(AccessLevel.PROTECTED)
|
||||
@Getter private boolean isDead = false;
|
||||
|
||||
// Lua controller for specific actions
|
||||
@Getter @Setter private EntityController entityController;
|
||||
@Getter private ElementType lastAttackType = ElementType.None;
|
||||
@@ -63,7 +67,7 @@ public abstract class GameEntity {
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
return true;
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
public LifeState getLifeState() {
|
||||
@@ -172,10 +176,9 @@ public abstract class GameEntity {
|
||||
this.lastAttackType = attackType;
|
||||
|
||||
// Check if dead
|
||||
boolean isDead = false;
|
||||
if (this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) <= 0f) {
|
||||
this.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 0f);
|
||||
isDead = true;
|
||||
this.isDead = true;
|
||||
}
|
||||
|
||||
this.runLuaCallbacks(event);
|
||||
@@ -186,7 +189,7 @@ public abstract class GameEntity {
|
||||
new PacketEntityFightPropUpdateNotify(this, FightProperty.FIGHT_PROP_CUR_HP));
|
||||
|
||||
// Check if dead.
|
||||
if (isDead) {
|
||||
if (this.isDead) {
|
||||
this.getScene().killEntity(this, killerId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user