From 6c8999875933741927a880deb9952cc3df8bb913 Mon Sep 17 00:00:00 2001 From: StartForKiller Date: Sun, 11 Jun 2023 11:57:34 -0400 Subject: [PATCH] Fix KillSelf --- .../game/ability/actions/ActionKillSelf.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionKillSelf.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionKillSelf.java index 3e43c8078..40096df1d 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionKillSelf.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionKillSelf.java @@ -1,6 +1,7 @@ package emu.grasscutter.game.ability.actions; import com.google.protobuf.ByteString; +import emu.grasscutter.Grasscutter; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.game.ability.Ability; import emu.grasscutter.game.entity.GameEntity; @@ -10,9 +11,14 @@ public final class ActionKillSelf extends AbilityActionHandler { @Override public boolean execute( Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { - GameEntity owner = ability.getOwner(); - owner.getScene().killEntity(owner); + // KillSelf should not have a target field, so target it's the actual entity to be applied. + // 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; } }