mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00: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;
|
||||
|
||||
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,30 +93,30 @@ 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);
|
||||
if (opponent != null) {
|
||||
int numberOfCardsToExile = Math.min(2, opponent.getHand().size());
|
||||
if(numberOfCardsToExile > 0) {
|
||||
if (numberOfCardsToExile > 0) {
|
||||
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
|
||||
target.setRequired(true);
|
||||
if (opponent.chooseTarget(Outcome.Exile, target, source, game)) {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue