Fixed Expropriate
-
-
package mage.cards.e;
import java.util.ArrayList;
@@ -69,7 +67,9 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect {
Player controller = game.getPlayer(source.getControllerId());
//If not controller, exit out here and do not vote.
- if (controller == null) return false;
+ if (controller == null) {
+ return false;
+ }
this.vote("time", "money", controller, game, source);
@@ -92,7 +92,6 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect {
} else {
game.informPlayers(controller.getName() + " will take " + timeCount + " extra turns");
}
-
do {
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), false));
timeCount--;
@@ -109,13 +108,17 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect {
Target target = new TargetPermanent(filter);
target.setNotTarget(true);
- if (controller.choose(Outcome.GainControl, target, source.getSourceId(), game)) {
+ if (controller != null
+ && controller != game.getPlayer(playerId)
+ && controller.choose(Outcome.GainControl, target, source.getSourceId(), game)) {
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
- if (targetPermanent != null) chosenCards.add(targetPermanent);
+ if (targetPermanent != null) {
+ chosenCards.add(targetPermanent);
}
}
-
+ }
+ if (controller != null) {
for (Permanent permanent : chosenCards) {
ContinuousEffect effect = new ExpropriateControlEffect(controller.getId());
effect.setTargetPointer(new FixedTarget(permanent.getId()));
@@ -123,12 +126,15 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect {
game.informPlayers(controller.getName() + " gained control of " + permanent.getName() + " owned by " + game.getPlayer(permanent.getOwnerId()).getName());
}
}
+ }
@Override
protected void vote(String choiceOne, String choiceTwo, Player controller, Game game, Ability source) {
- for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
+ for (UUID playerId : game.getState().getPlayerList(controller.getId())) {
Player player = game.getPlayer(playerId);
- if (player != null) {
+ if (player != null
+ && player.canRespond()
+ && player.isInGame()) {
if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) {
voteOneCount++;
game.informPlayers(player.getName() + " has voted for " + choiceOne);
@@ -150,7 +156,7 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect {
class ExpropriateControlEffect extends ContinuousEffectImpl {
- private UUID controllerId;
+ private final UUID controllerId;
public ExpropriateControlEffect(UUID controllerId) {
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
@@ -170,7 +176,8 @@ class ExpropriateControlEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
- return permanent != null && controllerId != null &&
- permanent.changeControllerId(controllerId, game);
+ return permanent != null
+ && controllerId != null
+ && permanent.changeControllerId(controllerId, game);
}
}
