mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 04:12:54 +08:00
Fix KillSelf
This commit is contained in:
parent
3cc5e6b4e8
commit
6c89998759
@ -1,6 +1,7 @@
|
|||||||
package emu.grasscutter.game.ability.actions;
|
package emu.grasscutter.game.ability.actions;
|
||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
|
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
|
||||||
import emu.grasscutter.game.ability.Ability;
|
import emu.grasscutter.game.ability.Ability;
|
||||||
import emu.grasscutter.game.entity.GameEntity;
|
import emu.grasscutter.game.entity.GameEntity;
|
||||||
@ -10,9 +11,14 @@ public final class ActionKillSelf extends AbilityActionHandler {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(
|
public boolean execute(
|
||||||
Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) {
|
Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) {
|
||||||
GameEntity owner = ability.getOwner();
|
// KillSelf should not have a target field, so target it's the actual entity to be applied.
|
||||||
owner.getScene().killEntity(owner);
|
// TODO: Check if this is always true.
|
||||||
|
if (target == null) {
|
||||||
|
Grasscutter.getLogger().warn("Tried killing null target");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.getScene().killEntity(target);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user