mirror of
https://github.com/correl/mage.git
synced 2024-12-28 11:14:13 +00:00
* Nicol Bolas, God-Pharaoh - fixed rollback error if someone disconnects while choosing cards to exile;
This commit is contained in:
parent
126c2f9b92
commit
14744ef85b
1 changed files with 18 additions and 18 deletions
|
@ -1,8 +1,5 @@
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||||
|
@ -26,8 +23,11 @@ import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Will
|
* @author Will
|
||||||
*/
|
*/
|
||||||
public final class NicolBolasGodPharaoh extends CardImpl {
|
public final class NicolBolasGodPharaoh extends CardImpl {
|
||||||
|
@ -93,6 +93,7 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
|
||||||
Boolean applied = false;
|
Boolean applied = false;
|
||||||
// Store for each player the cards to exile, that's important because all exile shall happen at the same time
|
// 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<>();
|
Map<UUID, Cards> cardsToExile = new HashMap<>();
|
||||||
|
|
||||||
// Each player chooses 2 cards to discard
|
// Each player chooses 2 cards to discard
|
||||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
Player opponent = game.getPlayer(opponentId);
|
||||||
|
@ -105,18 +106,17 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
|
||||||
Cards cards = new CardsImpl(target.getTargets());
|
Cards cards = new CardsImpl(target.getTargets());
|
||||||
cardsToExile.put(opponentId, cards);
|
cardsToExile.put(opponentId, cards);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
cardsToExile.put(opponentId, new CardsImpl());
|
cardsToExile.put(opponentId, new CardsImpl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exile all chosen cards at the same time
|
// Exile all chosen cards at the same time
|
||||||
Cards cardsOpponentsChoseToExile = new CardsImpl();
|
Cards cardsOpponentsChoseToExile = new CardsImpl();
|
||||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
Player opponent = game.getPlayer(opponentId);
|
||||||
if (opponent != null) {
|
if (opponent != null && cardsToExile.containsKey(opponentId)) {
|
||||||
cardsOpponentsChoseToExile.addAll(cardsToExile.get(opponentId));
|
cardsOpponentsChoseToExile.addAll(cardsToExile.get(opponentId));
|
||||||
opponent.moveCards(cardsOpponentsChoseToExile, Zone.EXILED, source, game);
|
opponent.moveCards(cardsOpponentsChoseToExile, Zone.EXILED, source, game);
|
||||||
applied = true;
|
applied = true;
|
||||||
|
|
Loading…
Reference in a new issue