fix #11532 (Animist's Might)

This commit is contained in:
xenohedron 2023-12-09 16:12:52 -05:00
parent 4bb39f9078
commit 3b603595a2

View file

@ -41,16 +41,18 @@ public class DamageWithPowerFromOneToAnotherTargetEffect extends OneShotEffect {
if (source.getTargets().size() != 2) {
throw new IllegalStateException("It must have two targets, but found " + source.getTargets().size());
}
Permanent myPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (myPermanent == null) {
return false;
}
int damageValue = myPermanent.getPower().getValue() * multiplier;
Permanent anotherPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
Player anotherPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget());
if (myPermanent != null && anotherPermanent != null) {
anotherPermanent.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game, false, true);
if (anotherPermanent != null) {
anotherPermanent.damage(damageValue, myPermanent.getId(), source, game, false, true);
return true;
} else if (myPermanent != null && anotherPlayer != null) {
anotherPlayer.damage(myPermanent.getPower().getValue(), myPermanent.getId(), source, game);
} else if (anotherPlayer != null) {
anotherPlayer.damage(damageValue, myPermanent.getId(), source, game);
return true;
}
return false;