- Fixed AI ignoring "DiscardValid" parameter.

This commit is contained in:
Sloth
2013-02-06 13:52:30 +00:00
parent 6777f40bd1
commit a942894fd7

View File

@@ -85,12 +85,13 @@ public class DiscardEffect extends RevealEffectBase {
} // discardStackDescription() } // discardStackDescription()
private List<Card> discardComputerChooses(SpellAbility sa, Player victim, Player chooser, int numCards, String[] dValid, boolean isReveal){ private List<Card> discardComputerChooses(SpellAbility sa, Player victim, Player chooser, int numCards, String[] dValid, boolean isReveal){
// AI final Card source = sa.getSourceCard();
final List<Card> dPChHand = new ArrayList<Card>(victim.getCardsIn(ZoneType.Hand)); List<Card> dPChHand = new ArrayList<Card>(victim.getCardsIn(ZoneType.Hand));
dPChHand = CardLists.getValidCards(dPChHand, dValid, source.getController(), source);
final List<Card> discarded = new ArrayList<Card>(); final List<Card> discarded = new ArrayList<Card>();
if (victim.isComputer()) { // discard AI cards if (victim.isComputer()) { // discard AI cards
int max = chooser.getCardsIn(ZoneType.Hand).size(); int max = dPChHand.size();
max = Math.min(max, numCards); max = Math.min(max, numCards);
List<Card> list = ((AIPlayer)victim).getAi().getCardsToDiscard(max, dValid, sa); List<Card> list = ((AIPlayer)victim).getAi().getCardsToDiscard(max, dValid, sa);
if (isReveal) { if (isReveal) {