- Cleanup in the code of Sovereigns of Lost Alara.

This commit is contained in:
jendave
2011-08-06 09:13:00 +00:00
parent 2f06273865
commit 9cfdd66b42
2 changed files with 19 additions and 4 deletions

View File

@@ -253,6 +253,15 @@ public class CardList implements Iterable<Card> {
});
}
//get all cards that don't have this string in their keywords
public CardList getKeywordsDontContain(final String keyword) {
return this.filter(new CardListFilter() {
public boolean addCard(Card c) {
return !c.KeywordsContain(keyword);
}
});
}
public CardList getTokens() {
return this.filter(new CardListFilter() {
public boolean addCard(Card c) {

View File

@@ -2744,10 +2744,14 @@ public class CombatUtil {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, attacker.getController());
CardList enchantments = new CardList(library.getCards());
final String turn = attacker.getController();
//final String turn = attacker.getController();
enchantments = enchantments.filter(new CardListFilter() {
public boolean addCard(Card c) {
if(attacker.hasKeyword("Protection from enchantments") || (attacker.hasKeyword("Protection from everything"))) return false;
return(c.isEnchantment() && c.getKeyword().contains("Enchant creature")
&& !CardFactoryUtil.hasProtectionFrom(c,attacker));
/* What a mess ???
ArrayList<String> keywords = c.getKeyword();
for(String keyword:keywords) {
if(keyword.startsWith("Enchant creature")) {
@@ -2765,7 +2769,7 @@ public class CombatUtil {
}
} return true;
}
if(turn == "Human") {
if(turn == "Human") {
if(keyword.startsWith("Enchant Creature")) {
if(keyword.endsWith("Curse")) {
String [] colors = new String[6];
@@ -2783,7 +2787,7 @@ public class CombatUtil {
}
}
}
return false;
return false; */
}
});
String player = attacker.getController();
@@ -2799,7 +2803,9 @@ public class CombatUtil {
Enchantment = ((Card) check);
}
} else {
Enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments,attacker, false);
//enchantments = enchantments.getKeywordsContain("enPump"); Doesn't seem to work
//enchantments = enchantments.getKeywordsDontContain("enPumpCurse");
Enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments,attacker, false);
}
if(Enchantment != null && AllZone.GameAction.isCardInPlay(attacker)){
library.remove(Enchantment);