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 class AttacksIfAbleTargetPlayerSourceEffect extends RequirementEffect {
|
||||||
|
|
||||||
public AttacksIfAbleTargetPlayerSourceEffect() {
|
public AttacksIfAbleTargetPlayerSourceEffect() {
|
||||||
super(Duration.EndOfTurn);
|
super(Duration.EndOfCombat);
|
||||||
staticText = "{this} attacks that player this combat if able";
|
staticText = "{this} attacks that player this combat if able";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,17 @@ public class AttackIfAbleTargetRandomOpponentSourceEffect extends OneShotEffect
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller == null) {
|
||||||
List<UUID> opponents = new ArrayList<>();
|
return false;
|
||||||
opponents.addAll(game.getOpponents(controller.getId()));
|
}
|
||||||
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
|
List<UUID> opponents = new ArrayList<>(game.getOpponents(controller.getId()));
|
||||||
if (opponent != null) {
|
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
|
||||||
ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect();
|
if (opponent != null) {
|
||||||
effect.setTargetPointer(new FixedTarget(opponent.getId()));
|
game.informPlayers(opponent.getLogName() + " was chosen at random.");
|
||||||
game.addEffect(effect, source);
|
ContinuousEffect effect = new AttacksIfAbleTargetPlayerSourceEffect();
|
||||||
return true;
|
effect.setTargetPointer(new FixedTarget(opponent.getId()));
|
||||||
}
|
game.addEffect(effect, source);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue