- Moved Vanishing to postFactoryKeywords. This removes the need for it to be in each CardFactory file.

- Removed unneeded Vanishing code blocks.
- Updated Aven Riftwatcher and Calciderm to use Vanishing.
This commit is contained in:
jendave
2011-08-06 08:06:27 +00:00
parent 24600f2c54
commit 6a30a45cd5
6 changed files with 19 additions and 125 deletions

View File

@@ -1,7 +1,8 @@
Name:Aven Riftwatcher
ManaCost:2 W
Types:Creature Bird Rebel Soldier
Text:Vanishing 3. When Aven Riftwatcher comes into play or leaves play, you gain 2 life.
Text:When Aven Riftwatcher comes into play or leaves play, you gain 2 life.
K:Vanishing:3
PT:2/3
K:Flying
SVar:Rarity:Common

View File

@@ -1,7 +1,8 @@
Name:Calciderm
ManaCost:2 W W
Types:Creature Beast
Text:Vanishing 4
Text:no text
K:Vanishing:4
PT:5/5
K:Shroud
SVar:Rarity:Uncommon

View File

@@ -10270,21 +10270,6 @@ public class CardFactory implements NewConstants {
}
}//Soulshift
if(hasKeyword(card, "Vanishing") != -1) {
int n = hasKeyword(card, "Vanishing");
if(n != -1) {
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
final int power = Integer.parseInt(k[1]);
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
}
}//Vanishing
if(hasKeyword(card, "Echo") != -1) {
int n = hasKeyword(card, "Echo");
if(n != -1) {
@@ -10434,6 +10419,20 @@ public class CardFactory implements NewConstants {
public Card postFactoryKeywords(Card card){
// this function should handle any keywords that need to be added after a spell goes through the factory
if(hasKeyword(card, "Vanishing") != -1) {
int n = hasKeyword(card, "Vanishing");
if(n != -1) {
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
final int power = Integer.parseInt(k[1]);
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
}
}//Vanishing
// Spell has Additional Cost. Reuse Ability_Cost
if (hasKeyword(card, "ACost") != -1){

View File

@@ -17,14 +17,6 @@ class CardFactory_Auras {
return -1;
}
public static int shouldVanish(Card c) {
ArrayList<String> a = c.getKeyword();
for(int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("Vanishing")) return i;
return -1;
}
public static int shouldEnchant(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
@@ -6657,20 +6649,6 @@ class CardFactory_Auras {
}// SpellAbility spell
}// enControlCreature
if(shouldVanish(card) != -1) {
int n = shouldVanish(card);
if(n != -1) {
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
final int power = Integer.parseInt(k[1]);
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
}
}//Vanishing
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found
if(shouldCycle(card) != -1) {

View File

@@ -53,15 +53,7 @@ public class CardFactory_Creatures {
return -1;
}
public static int shouldVanish(Card c) {
ArrayList<String> a = c.getKeyword();
for(int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("Vanishing")) return i;
return -1;
}
public static Card getCard(final Card card, String cardName, String owner, CardFactory cf) {
//*************** START *********** START **************************
@@ -14797,17 +14789,9 @@ public class CardFactory_Creatures {
Command gain2Life = new Command() {
private static final long serialVersionUID = 5588978023269625349L;
public boolean firstTime = true;
public void execute() {
PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController());
life.addLife(2);
//testAndSet - only needed when comes into play.
if(firstTime) {
card.addCounter(Counters.TIME, 3); //vanishing
}
firstTime = false;
}
};
@@ -14816,25 +14800,6 @@ public class CardFactory_Creatures {
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Calciderm")) {
Command ageCounters = new Command() {
private static final long serialVersionUID = 431920157968451817L;
public boolean firstTime = true;
public void execute() {
//testAndSet - only needed when comes into play.
if(firstTime) {
card.addCounter(Counters.TIME, 4);
}
firstTime = false;
}
};
card.addComesIntoPlayCommand(ageCounters);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Blastoderm")) {
Command fadeCounters = new Command() {
@@ -21520,20 +21485,6 @@ public class CardFactory_Creatures {
}
}//Soulshift
if(shouldVanish(card) != -1) {
int n = shouldVanish(card);
if(n != -1) {
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
final int power = Integer.parseInt(k[1]);
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
}
}//Vanishing
if(hasKeyword(card, "Echo") != -1) {
int n = hasKeyword(card, "Echo");
if(n != -1) {

View File

@@ -119,8 +119,6 @@ public class GameActionUtil {
upkeep_Mycoloth();
upkeep_Spore_Counters();
upkeep_Vanishing();
upkeep_Aven_Riftwatcher();
upkeep_Calciderm();
upkeep_Blastoderm();
upkeep_Masticore();
upkeep_Eldrazi_Monument();
@@ -7546,40 +7544,6 @@ public class GameActionUtil {
}
}
private static void upkeep_Aven_Riftwatcher() {
// get all Aven Riftwatcher in play under the control of this player
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
CardList list = new CardList(playZone.getCards());
list = list.getName("Aven Riftwatcher");
if(list.size() > 0) {
for(int i = 0; i < list.size(); i++) {
Card card = list.get(i);
card.setCounter(Counters.TIME, card.getCounters(Counters.TIME) - 1);
if(card.getCounters(Counters.TIME) <= 0) {
AllZone.GameAction.sacrifice(card);
}
}
}
}
private static void upkeep_Calciderm() {
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
CardList list = new CardList(playZone.getCards());
list = list.getName("Calciderm");
if(list.size() > 0) {
for(int i = 0; i < list.size(); i++) {
Card card = list.get(i);
card.setCounter(Counters.TIME, card.getCounters(Counters.TIME) - 1);
if(card.getCounters(Counters.TIME) <= 0) {
AllZone.GameAction.sacrifice(card);
}
}
}
}
private static void upkeep_Blastoderm() {
final String player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);