From b18e6b31f330030061a0e0c44a1ba6a9a7b3033e Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:51:29 +0000 Subject: [PATCH] Improved the AI for enPumpCurse. --- src/forge/CardFactoryUtil.java | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index f71fc3418eb..7d2eed2ab84 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -1567,11 +1567,31 @@ public class CardFactoryUtil { if (list.isEmpty()) return false; - // If extrinsicKeywords contains "This creature can't attack" or "This creature can't attack or block" + //else we may need to filter the list and remove inappropriate targets + + // If extrinsicKeywords contains "This creature can't attack" or "This creature can't attack or block" // then remove creatures with Defender from the list + final ArrayList extKeywords = new ArrayList(Arrays.asList(extrinsicKeywords)); + + if (extKeywords.contains("This creature can't attack") || extKeywords.contains("This creature can't attack or block")) { + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.isCreature() && !c.getKeyword().contains("Defender"); + } + }); + } + // If extrinsicKeywords contains "This card doesn't untap during your untap step." - // then remove creatures with Vigilence from the list + // then remove creatures with Vigilance from the list + + if (extKeywords.contains("This card doesn't untap during your untap step.")) { + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.isCreature() && !c.getKeyword().contains("Vigilance"); + } + }); + } //else (if aura is keyword only)