From e67f6df0d6dbcffe1e1c00428662b9402c756e54 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Tue, 26 Jul 2022 01:08:32 +0100 Subject: [PATCH] [CMD] Fixed Ruhan of the Fomori and cards with similar effects. Closes #9096 --- ...AttacksIfAbleTargetPlayerSourceEffect.java | 2 +- ...fAbleTargetRandomOpponentSourceEffect.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/AttacksIfAbleTargetPlayerSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AttacksIfAbleTargetPlayerSourceEffect.java index aea698d141..39cf613069 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AttacksIfAbleTargetPlayerSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AttacksIfAbleTargetPlayerSourceEffect.java @@ -11,7 +11,7 @@ import java.util.UUID; public class AttacksIfAbleTargetPlayerSourceEffect extends RequirementEffect { public AttacksIfAbleTargetPlayerSourceEffect() { - super(Duration.EndOfTurn); + super(Duration.EndOfCombat); staticText = "{this} attacks that player this combat if able"; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/AttackIfAbleTargetRandomOpponentSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/AttackIfAbleTargetRandomOpponentSourceEffect.java index 8d49f4525b..2d1ab06f3c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/AttackIfAbleTargetRandomOpponentSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/AttackIfAbleTargetRandomOpponentSourceEffect.java @@ -33,16 +33,17 @@ public class AttackIfAbleTargetRandomOpponentSourceEffect extends OneShotEffect @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - List opponents = new ArrayList<>(); - opponents.addAll(game.getOpponents(controller.getId())); - Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size()))); - if (opponent != null) { - ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect(); - effect.setTargetPointer(new FixedTarget(opponent.getId())); - game.addEffect(effect, source); - return true; - } + if (controller == null) { + return false; + } + List opponents = new ArrayList<>(game.getOpponents(controller.getId())); + Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size()))); + if (opponent != null) { + game.informPlayers(opponent.getLogName() + " was chosen at random."); + ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect(); + effect.setTargetPointer(new FixedTarget(opponent.getId())); + game.addEffect(effect, source); + return true; } return false; }