- Simplified the code found in forge.card.cardFactory.CardFactory_Auras.

This commit is contained in:
jendave
2011-08-07 01:00:00 +00:00
parent 6705407f62
commit 7eaee90084

View File

@@ -363,7 +363,7 @@ class CardFactory_Auras {
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
if(crd.getKeyword().contains("Flying")) {
if (crd.hasKeyword("Flying")) {
badTarget[0] = false;
crd.addDamage(2, card);
crd.removeIntrinsicKeyword("Flying");
@@ -423,7 +423,7 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))
&& !list.get(i).getKeyword().contains("Defender")) {
&& !list.get(i).hasKeyword("Defender")) {
setTargetCard(list.get(i));
return super.canPlayAI();
}
@@ -580,7 +580,7 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))
&& !list.get(i).getKeyword().contains("Vigilance")) {
&& !list.get(i).hasKeyword("Vigilance")) {
setTargetCard(list.get(i));
return super.canPlayAI();
}
@@ -688,8 +688,8 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))
&& !list.get(i).getKeyword().contains("Lifelink")
&& !list.get(i).getKeyword().contains("Defender")
&& !list.get(i).hasKeyword("Lifelink")
&& !list.get(i).hasKeyword("Defender")
&& !list.get(i).isEnchanted()) {
setTargetCard(list.get(i));
return super.canPlayAI();
@@ -948,7 +948,7 @@ class CardFactory_Auras {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
if (AllZoneUtil.isCardInPlay(crd)) {
if(crd.getKeyword().contains("Haste")) {
if (crd.hasKeyword("Haste")) {
crd.setSickness(false);
} else {
crd.setSickness(true);
@@ -1020,8 +1020,8 @@ class CardFactory_Auras {
for (int i = 0; i < list.size(); i++) {
if (CardFactoryUtil.canTarget(card, list.get(i))
&& !list.get(i).getKeyword().contains("Fear")
&& !list.get(i).getKeyword().contains("Defender")
&& !list.get(i).hasKeyword("Fear")
&& !list.get(i).hasKeyword("Defender")
&& !list.get(i).isEnchanted()) {
setTargetCard(list.get(i));
return super.canPlayAI();
@@ -1108,11 +1108,11 @@ class CardFactory_Auras {
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardFactoryUtil.canTarget(card, c) &&
!c.getKeyword().contains("CARDNAME doesn't untap during your untap step.");
! c.hasKeyword("CARDNAME doesn't untap during your untap step.");
}
});
if (card.getKeyword().contains("Enchant tapped creature")) {
if (card.hasKeyword("Enchant tapped creature")) {
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isTapped();
@@ -1120,10 +1120,10 @@ class CardFactory_Auras {
});
}
if (card.getKeyword().contains("Enchant creature without flying")) {
if (card.hasKeyword("Enchant creature without flying")) {
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return ! c.getKeyword().contains("Flying");
return ! c.hasKeyword("Flying");
}
});
}
@@ -1132,7 +1132,7 @@ class CardFactory_Auras {
return false;
} else {
CardListUtil.sortAttack(list);
if (! card.getKeyword().contains("Enchant creature without flying")) {
if (! card.hasKeyword("Enchant creature without flying")) {
CardListUtil.sortFlying(list);
}
setTargetCard(list.get(0));
@@ -1147,7 +1147,7 @@ class CardFactory_Auras {
Card c = getTargetCard();
if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
if (card.getKeyword().contains("When CARDNAME enters the battlefield, tap enchanted creature.")) {
if (card.hasKeyword("When CARDNAME enters the battlefield, tap enchanted creature.")) {
c.tap();
}
card.enchantCard(c);
@@ -1164,7 +1164,7 @@ class CardFactory_Auras {
public void execute() {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
if (! crd.getKeyword().contains("CARDNAME doesn't untap during your untap step."))
if (! crd.hasKeyword("CARDNAME doesn't untap during your untap step."))
crd.addExtrinsicKeyword("CARDNAME doesn't untap during your untap step.");
}
}//execute()
@@ -1203,16 +1203,16 @@ class CardFactory_Auras {
String instruction = "Select target creature";
if (card.getKeyword().contains("Enchant tapped creature")) {
if (card.hasKeyword("Enchant tapped creature")) {
instruction = "Select target tapped creature";
creatures = creatures.filter(AllZoneUtil.tapped);
}
if (card.getKeyword().contains("Enchant creature without flying")) {
if (card.hasKeyword("Enchant creature without flying")) {
instruction = "Select target creature without flying";
creatures = creatures.filter(new CardListFilter() {
public boolean addCard(Card c) {
return ! c.getKeyword().contains("Flying");
return ! c.hasKeyword("Flying");
}
});
}
@@ -1489,7 +1489,7 @@ class CardFactory_Auras {
* no need to parse the CMC number at this time
*/
if (option.contains("CMC 2 or less") ||
card.getKeyword().contains("Enchant creature with converted mana cost 2 or less")) {
card.hasKeyword("Enchant creature with converted mana cost 2 or less")) {
optionCmcTwoOrLess[0] = true;
}
@@ -1498,7 +1498,7 @@ class CardFactory_Auras {
* no need to parse the colors at this time
*/
if (option.contains("red or green") ||
card.getKeyword().contains("Enchant red or green creature")) {
card.hasKeyword("Enchant red or green creature")) {
optionRedOrGreen[0] = true;
}
@@ -1587,7 +1587,7 @@ class CardFactory_Auras {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
//set summoning sickness
if(crd.getKeyword().contains("Haste")) {
if (crd.hasKeyword("Haste")) {
crd.setSickness(false);
} else {
crd.setSickness(true);
@@ -1606,7 +1606,7 @@ class CardFactory_Auras {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
if (AllZoneUtil.isCardInPlay(crd)) {
if(crd.getKeyword().contains("Haste")) {
if (crd.hasKeyword("Haste")) {
crd.setSickness(false);
} else {
crd.setSickness(true);
@@ -1723,7 +1723,7 @@ class CardFactory_Auras {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
//set summoning sickness
if(crd.getKeyword().contains("Haste")) {
if (crd.hasKeyword("Haste")) {
crd.setSickness(false);
} else {
crd.setSickness(true);
@@ -1742,7 +1742,7 @@ class CardFactory_Auras {
if (card.isEnchanting()) {
Card crd = card.getEnchanting().get(0);
if (AllZoneUtil.isCardInPlay(crd)) {
if(crd.getKeyword().contains("Haste")) {
if (crd.hasKeyword("Haste")) {
crd.setSickness(false);
} else {
crd.setSickness(true);