Fixed mind swap not properly being reverted when the caster dies

This commit is contained in:
Sollace 2022-10-13 19:55:24 +02:00
parent a8e1c66e0f
commit 8e12c683b8

View file

@ -48,6 +48,7 @@ public class MindSwapSpell extends MimicSpell {
other.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1); other.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1);
caster.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(); setDead();
return false; 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); return super.tick(caster, situation);