From 8e12c683b8eb9153fec6297ba17bae7125665868 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 13 Oct 2022 19:55:24 +0200 Subject: [PATCH] Fixed mind swap not properly being reverted when the caster dies --- .../ability/magic/spell/effect/MindSwapSpell.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java index 8f1441d6..073db3b9 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java @@ -48,6 +48,7 @@ public class MindSwapSpell extends MimicSpell { other.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1); caster.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1); }); + counterpart.set(null); } } @@ -81,6 +82,15 @@ public class MindSwapSpell extends MimicSpell { setDead(); return false; } + + if (!caster.getEntity().isAlive()) { + counterpart.ifPresent(caster.getReferenceWorld(), e -> { + e.damage(DamageSource.MAGIC, Float.MAX_VALUE); + }); + onDestroyed(caster); + setDead(); + return false; + } } return super.tick(caster, situation);