* Nicol Bolas, God-Pharaoh - fixed rollback error if someone disconnects while choosing cards to exile;
package mage.cards.n;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
@@ -26,8 +23,11 @@ import mage.target.common.TargetCardInHand;
import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
/**
- *
* @author Will
*/
public final class NicolBolasGodPharaoh extends CardImpl {
@@ -93,6 +93,7 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
Boolean applied = false;
// Store for each player the cards to exile, that's important because all exile shall happen at the same time
Map<UUID, Cards> cardsToExile = new HashMap<>();
+
// Each player chooses 2 cards to discard
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
@@ -105,18 +106,17 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
Cards cards = new CardsImpl(target.getTargets());
cardsToExile.put(opponentId, cards);
}
- }
- else
- {
+ } else {
cardsToExile.put(opponentId, new CardsImpl());
}
}
}
+
// Exile all chosen cards at the same time
Cards cardsOpponentsChoseToExile = new CardsImpl();
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
- if (opponent != null) {
+ if (opponent != null && cardsToExile.containsKey(opponentId)) {
cardsOpponentsChoseToExile.addAll(cardsToExile.get(opponentId));
opponent.moveCards(cardsOpponentsChoseToExile, Zone.EXILED, source, game);
applied = true;
