- Add support for RememberDiscarded for everything except for DiscardUnless

This commit is contained in:
Sol
2011-10-10 02:28:32 +00:00
parent 957917df5f
commit 0a81cc3d72

View File

@@ -931,6 +931,8 @@ public class AbilityFactory_ZoneAffecting {
else else
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa); tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
CardList discarded = new CardList();
for (Player p : tgtPlayers) { for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) { if (tgt == null || p.canTarget(sa)) {
if (mode.equals("Hand")) { if (mode.equals("Hand")) {
@@ -943,11 +945,12 @@ public class AbilityFactory_ZoneAffecting {
numCards = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("NumCards"), sa); numCards = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("NumCards"), sa);
if (mode.equals("Random")) { if (mode.equals("Random")) {
p.discardRandom(numCards, sa); discarded.addAll(p.discardRandom(numCards, sa));
} else if (mode.equals("TgtChoose")) { } else if (mode.equals("TgtChoose")) {
if (params.containsKey("UnlessType")) { if (params.containsKey("UnlessType")) {
p.discardUnless(numCards, params.get("UnlessType"), sa); p.discardUnless(numCards, params.get("UnlessType"), sa);
} else p.discard(numCards, sa, true); } else
discarded.addAll(p.discard(numCards, sa, true));
} else if (mode.equals("RevealDiscardAll")) { } else if (mode.equals("RevealDiscardAll")) {
// Reveal // Reveal
CardList dPHand = p.getCardsIn(Zone.Hand); CardList dPHand = p.getCardsIn(Zone.Hand);
@@ -970,6 +973,7 @@ public class AbilityFactory_ZoneAffecting {
// Reveal cards that will be discarded? // Reveal cards that will be discarded?
for (Card c : dPChHand) { for (Card c : dPChHand) {
p.discard(c, sa); p.discard(c, sa);
discarded.add(c);
} }
} else if (mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose")) { } else if (mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose")) {
// Is Reveal you choose right? I think the wrong player is being used? // Is Reveal you choose right? I think the wrong player is being used?
@@ -1014,7 +1018,7 @@ public class AbilityFactory_ZoneAffecting {
CardList dCs = new CardList(); CardList dCs = new CardList();
dCs.add(dC); dCs.add(dC);
GuiUtils.getChoiceOptional("Computer has chosen", dCs.toArray()); GuiUtils.getChoiceOptional("Computer has chosen", dCs.toArray());
discarded.add(dC);
AllZone.getComputerPlayer().discard(dC, sa); // is this right? AllZone.getComputerPlayer().discard(dC, sa); // is this right?
} }
} }
@@ -1027,6 +1031,7 @@ public class AbilityFactory_ZoneAffecting {
Card dC = GuiUtils.getChoice("Choose a card to be discarded", dPChHand.toArray()); Card dC = GuiUtils.getChoice("Choose a card to be discarded", dPChHand.toArray());
dPChHand.remove(dC); dPChHand.remove(dC);
discarded.add(dC);
AllZone.getHumanPlayer().discard(dC, sa); // is this right? AllZone.getHumanPlayer().discard(dC, sa); // is this right?
} }
} }
@@ -1035,7 +1040,14 @@ public class AbilityFactory_ZoneAffecting {
} }
} }
} }
}//discardResolve()
if (params.containsKey("RememberDiscarded")) {
for (Card c : discarded) {
source.addRemembered(c);
}
}
} //discardResolve()
/** /**
* <p>discardStackDescription.</p> * <p>discardStackDescription.</p>