mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[CMD] Fixed Ruhan of the Fomori and cards with similar effects. Closes #9096
This commit is contained in:
parent
e214c87f4b
commit
e67f6df0d6
2 changed files with 12 additions and 11 deletions
|
@ -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";
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue