diff --git a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java index 634161bb8a0..abce70035eb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java @@ -3,12 +3,12 @@ package mage.abilities.effects.common; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; +import java.util.Objects; import java.util.UUID; /** @@ -34,38 +34,28 @@ public class FightTargetsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Card card = game.getCard(source.getSourceId()); - if (card != null) { - UUID target1Id = null; - UUID target2Id = null; - boolean secondTargetOptional = false; - // first target is in target pointer, second target is a normal target - if (source.getTargets().size() < 2) { - if (!source.getTargets().get(0).isLegal(source, game)) { - return false; - } - target1Id = getTargetPointer().getFirst(game, source); - target2Id = source.getTargets().getFirstTarget(); - if (target1Id == target2Id) { - return false; - } - // two normal targets available, only if both targets are legal the effect will be applied - } else if (source.getTargets().get(0).isLegal(source, game) && source.getTargets().get(1).isLegal(source, game)) { - target1Id = source.getTargets().get(0).getFirstTarget(); - target2Id = source.getTargets().get(1).getFirstTarget(); - secondTargetOptional = source.getTargets().get(1).getMinNumberOfTargets() == 0; - } - Permanent creature1 = game.getPermanent(target1Id); - Permanent creature2 = game.getPermanent(target2Id); - // 20110930 - 701.10 - if (creature1 != null && creature2 != null) { - if (creature1.isCreature(game) && creature2.isCreature(game)) { - return creature1.fight(creature2, source, game); - } - } - if (!game.isSimulation() && !secondTargetOptional) { - game.informPlayers(card.getName() + " has been fizzled."); + UUID target1Id = null; + UUID target2Id = null; + // first target is in target pointer, second target is a normal target + if (source.getTargets().size() < 2) { + if (!source.getTargets().get(0).isLegal(source, game)) { + return false; } + target1Id = getTargetPointer().getFirst(game, source); + target2Id = source.getTargets().getFirstTarget(); + // two normal targets available, only if both targets are legal the effect will be applied + } else if (source.getTargets().get(0).isLegal(source, game) && source.getTargets().get(1).isLegal(source, game)) { + target1Id = source.getTargets().get(0).getFirstTarget(); + target2Id = source.getTargets().get(1).getFirstTarget(); + } + if (Objects.equals(target1Id, target2Id)) { + return false; + } + Permanent creature1 = game.getPermanent(target1Id); + Permanent creature2 = game.getPermanent(target2Id); + // 20110930 - 701.10 + if (creature1 != null && creature2 != null && creature1.isCreature(game) && creature2.isCreature(game)) { + return creature1.fight(creature2, source, game); } return false;