[CMD] Fixed Ruhan of the Fomori and cards with similar effects. Closes #9096

This commit is contained in:
PurpleCrowbar 2022-07-26 01:08:32 +01:00
parent e214c87f4b
commit e67f6df0d6
2 changed files with 12 additions and 11 deletions

View file

@ -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";
}

View file

@ -33,17 +33,18 @@ public class AttackIfAbleTargetRandomOpponentSourceEffect extends OneShotEffect
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<UUID> opponents = new ArrayList<>();
opponents.addAll(game.getOpponents(controller.getId()));
if (controller == null) {
return false;
}
List<UUID> 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;
}
}