diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouEffect.java index cdd9e6b0b2b..462394887b2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouEffect.java @@ -13,12 +13,20 @@ import java.util.UUID; */ public class CantAttackYouEffect extends RestrictionEffect { + UUID controllerId; + public CantAttackYouEffect(Duration duration) { super(duration); } + public CantAttackYouEffect(Duration duration, UUID controllerId) { + super(duration); + this.controllerId = controllerId; + } + public CantAttackYouEffect(final CantAttackYouEffect effect) { super(effect); + this.controllerId = effect.controllerId; } @Override @@ -36,6 +44,9 @@ public class CantAttackYouEffect extends RestrictionEffect { if (defenderId == null) { return true; } - return !defenderId.equals(source.getControllerId()); + if (controllerId == null) { + controllerId = source.getControllerId(); + } + return !defenderId.equals(controllerId); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/GoadTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/GoadTargetEffect.java index e953e8b0585..fe5d9a89237 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/GoadTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/GoadTargetEffect.java @@ -41,7 +41,7 @@ public class GoadTargetEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (targetCreature != null && controller != null) { - // TODO: impoves goad to allows to target controller, current AttacksIfAbleTargetEffect is not support it + // TODO: Allow goad to target controller, current AttacksIfAbleTargetEffect is not support it // https://github.com/magefree/mage/issues/5283 /* If the creature doesn’t meet any of the above exceptions and can attack, it must attack a player other than @@ -52,7 +52,7 @@ public class GoadTargetEffect extends OneShotEffect { ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn); effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source))); game.addEffect(effect, source); - effect = new CantAttackYouEffect(Duration.UntilYourNextTurn); + effect = new CantAttackYouEffect(Duration.UntilYourNextTurn, source.getControllerId()); // remember current controller effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source))); game.addEffect(effect, source); game.informPlayers(controller.getLogName() + " is goading " + targetCreature.getLogName());