updated cards.txt, card-pictures.txt and added some extra cards, minor fixes. Added Chris' spRaiseDead keyword.

This commit is contained in:
jendave
2011-08-06 02:44:10 +00:00
parent 386669b84e
commit fd9f203db1
6 changed files with 954 additions and 30 deletions

View File

@@ -351,6 +351,16 @@ public class CardFactory implements NewConstants {
return -1;
}
// spRaiseDead
private final int shouldSpRaiseDead(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spRaiseDead"))
return i;
return -1;
}
private final int shouldManaAbility(Card c){
ArrayList<String> a = c.getIntrinsicKeyword();
@@ -2590,6 +2600,174 @@ public class CardFactory implements NewConstants {
card.clearSpellAbility();
card.addSpellAbility(spPump);
}
if (shouldSpRaiseDead(card) != -1)
{
int n = shouldSpRaiseDead(card);
if (n != -1)
{
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":"); // charm descriptions will appear at k[2] and k[3]
final String kk[] = k[1].split("/"); // numCreatures = kk[0], other fields = kk[1] through kk[2]
int numFieldsKK = kk.length;
final int numCreatures = Integer.parseInt(kk[0]);
boolean quantifier = false;
String tmpTgt = "Creature";
for (int i=2; i<=numFieldsKK; i++)
{
if (kk[(i-1)].equals ("Some"))
{
quantifier = true;
}
else // can only be a specific creature type at his time, Goblin for goblin creatures and Tarfire
{
tmpTgt = kk[i-1];
}
}
final String targetTypeToReturn = tmpTgt;
final boolean weReturnUpTo = quantifier;
final String spDesc[] = {"none"};
final String stDesc[] = {"none"};
if (k.length > 2)
spDesc[0] = k[2];
if (k.length > 3)
stDesc[0] = k[3];
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 6938982619919149188L;
public boolean canPlayAI() {return getGraveCreatures().size() >= numCreatures;}
CardList targets;
public void chooseTargetAI()
{
CardList grave = getGraveCreatures();
targets = new CardList();
if (targetTypeToReturn.equals ("Creature"))
{
for (int i=0; i<numCreatures; i++)
{
Card c = CardFactoryUtil.AI_getBestCreature(grave);
targets.add(c);
grave.remove(c);
}
}
else // this is for returning Goblins and Tarfire (and Changelings ?)
{
for (int i=0; i<numCreatures; i++)
{
Card c = CardFactoryUtil.getRandomCard(grave); // getRandomCard(grave);
targets.add(c);
grave.remove(c);
}
}
}
public void resolve()
{
if (card.getController().equals(Constant.Player.Human))
{
CardList grave = getGraveCreatures();
targets = new CardList();
if (weReturnUpTo) // this is for spells which state Return up to X target creature card
{
for (int i=0; i<numCreatures ; i++)
{
Card c = AllZone.Display.getChoiceOptional("Select card", grave.toArray());
targets.add(c);
grave.remove(c);
}
}
else if (grave.size() > numCreatures) // this is for spells which state Return target creature card
for (int i=0; i<numCreatures ; i++)
{
Card c = AllZone.Display.getChoice("Select card", grave.toArray());
targets.add(c);
grave.remove(c);
}
else targets = grave;
}
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
for (Card c : targets)
if (AllZone.GameAction.isCardInZone(c, grave))
AllZone.GameAction.moveTo(hand, c);
}//resolve()
public boolean canPlay()
{
return getGraveCreatures().size() >= numCreatures;
}
CardList getGraveCreatures()
{
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
CardList list = new CardList(grave.getCards());
String cardController = card.getController();
if (cardController.equals ("Human") || (cardController.equals ("Computer")) && (targetTypeToReturn.equals ("Creature")))
{
list = list.getType(targetTypeToReturn);
}
else // prevent the computer from using a Boggart Birth Rite to return a Boggart Birth Rite
{
CardList tempList = new CardList(grave.getCards());
tempList = list.getType(targetTypeToReturn);
list = new CardList();
for (int i=0; i<tempList.size(); i++)
{
if (! cardName.equals (tempList.get(i).getName()))
{
list.add(tempList.get(i));
}
}
}
return list;
}
};//SpellAbility
if (spDesc[0].equals("none")) // create the card descriptiopn
{
spDesc[0] = ("Return ");
if (weReturnUpTo)
{ spDesc[0] = (spDesc[0] + "up to "); }
if (numCreatures > 1)
{ spDesc[0] = (spDesc[0] + numCreatures + " "); }
spDesc[0] = (spDesc[0] + "target ");
if (targetTypeToReturn.equals ("Creature"))
{ spDesc[0] = (spDesc[0] + "creature"); }
else
{ spDesc[0] = (spDesc[0] + targetTypeToReturn); }
if (numCreatures > 1)
{ spDesc[0] = (spDesc[0] + "s"); }
spDesc[0] = (spDesc[0] + " card");
if (numCreatures > 1)
{ spDesc[0] = (spDesc[0] + "s"); }
spDesc[0] = (spDesc[0] + " from your graveyard to your hand.");
}
if (stDesc[0].equals("none")) // create the card stack descriptiopn
{
stDesc[0] = (card.getName() + " - returns target card");
if (numCreatures > 1)
{ stDesc[0] = (stDesc[0] + "s"); }
stDesc[0] = (stDesc[0] + " from " + card.getController() + "'s graveyard to " + card.getController() + "'s hand.");
}
spell.setDescription(spDesc[0]);
spell.setStackDescription(stDesc[0]);
card.clearSpellAbility();
card.addSpellAbility(spell);
}
}// spRaiseDead
while (shouldManaAbility(card) != -1)
@@ -3873,6 +4051,7 @@ public class CardFactory implements NewConstants {
/*
//*************** START *********** START **************************
if(cardName.equals("Raise Dead") || cardName.equals("Disentomb") || cardName.equals("Return to Battle") ||
cardName.equals("Recover"))
@@ -3919,7 +4098,7 @@ public class CardFactory implements NewConstants {
card.addSpellAbility(spell);
}//*************** END ************ END **************************
*/
//*************** START *********** START **************************
@@ -16591,6 +16770,48 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
}//*************** END ************ END **************************
//*************** START *********** START **************************
if(cardName.equals("Onyx Goblet"))
{
final Ability_Tap ability = new Ability_Tap(card)
{
private static final long serialVersionUID = -5726693225692494554L;
public boolean canPlayAI() {return AllZone.Phase.getPhase().equals(Constant.Phase.Main2);}
public void resolve()
{
String opponent = AllZone.GameAction.getOpponent(card.getController());
AllZone.GameAction.getPlayerLife(opponent).subtractLife(1);
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("tap: Target player loses 1 life.");
ability.setStackDescription(card.getName() + " - Opponent loses 1 life.");
ability.setBeforePayMana(new Input_NoCost_TapAbility(ability));
}//*************** END ************ END **************************
//*************** START *********** START **************************
if(cardName.equals("Braidwood Cup"))
{
final Ability_Tap ability = new Ability_Tap(card)
{
private static final long serialVersionUID = -7784976576326683976L;
public boolean canPlayAI() {return AllZone.Phase.getPhase().equals(Constant.Phase.Main2);}
public void resolve()
{
AllZone.GameAction.getPlayerLife(card.getController()).addLife(1);
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("tap: You gain 1 life.");
ability.setStackDescription("Braidwood Cup -"+card.getController() + " gains 1 life.");
ability.setBeforePayMana(new Input_NoCost_TapAbility(ability));
}//*************** END ************ END **************************
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found
if (shouldCycle(card) != -1)

View File

@@ -5139,6 +5139,209 @@ class CardFactory_Auras {
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Lightning Talons"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = -5377796694870681717L;
public boolean canPlayAI()
{
CardList list = new CardList(AllZone.Computer_Play.getCards());
list = list.getType("Creature");
if(list.isEmpty())
return false;
//else
CardListUtil.sortAttack(list);
CardListUtil.sortFlying(list);
for (int i=0;i<list.size();i++) {
if (CardFactoryUtil.canTarget(card, list.get(i)))
{
setTargetCard(list.get(i));
return true;
}
}
return false;
}//canPlayAI()
public void resolve()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(card);
Card c = getTargetCard();
if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) )
{
card.enchantCard(c);
System.out.println("Enchanted: " +getTargetCard());
}
}//resolve()
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);
Command onEnchant = new Command()
{
private static final long serialVersionUID = 4365727560058046700L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(3);
crd.addExtrinsicKeyword("First Strike");
}
}//execute()
};//Command
Command onUnEnchant = new Command()
{
private static final long serialVersionUID = 6407641511899731357L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(-3);
crd.removeExtrinsicKeyword("First Strike");
}
}//execute()
};//Command
Command onLeavesPlay = new Command()
{
private static final long serialVersionUID = -1674039264513052930L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
card.unEnchantCard(crd);
}
}
};
card.addEnchantCommand(onEnchant);
card.addUnEnchantCommand(onUnEnchant);
card.addLeavesPlayCommand(onLeavesPlay);
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************
//*************** START *********** START **************************
if(cardName.equals("Despondency"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 1125616183900458458L;
public boolean canPlayAI()
{
CardList list = new CardList(AllZone.Human_Play.getCards());
list = list.getType("Creature");
if(list.isEmpty())
return false;
//else
CardListUtil.sortAttack(list);
CardListUtil.sortFlying(list);
for (int i=0;i<list.size();i++) {
if (CardFactoryUtil.canTarget(card, list.get(i)))
{
setTargetCard(list.get(i));
return true;
}
}
return false;
}//canPlayAI()
public void resolve()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(card);
Card c = getTargetCard();
if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) )
{
card.enchantCard(c);
//System.out.println("Enchanted: " +getTargetCard());
}
}//resolve()
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);
Command onEnchant = new Command()
{
private static final long serialVersionUID = -8589566780713349434L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(-2);
}
}//execute()
};//Command
Command onUnEnchant = new Command()
{
private static final long serialVersionUID = -5769889616562358735L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.addSemiPermanentAttackBoost(2);
}
}//execute()
};//Command
Command onLeavesPlay = new Command()
{
private static final long serialVersionUID = 9095725091375284510L;
public void execute()
{
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
card.unEnchantCard(crd);
}
}
};
card.addEnchantCommand(onEnchant);
card.addUnEnchantCommand(onUnEnchant);
card.addLeavesPlayCommand(onLeavesPlay);
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************
return card;

View File

@@ -15143,6 +15143,146 @@ public class CardFactory_Creatures {
}//*************** END ************ END **************************
//*************** START *********** START **************************
if (cardName.equals("Jund Battlemage"))
{
final SpellAbility ability = new Ability_Tap(card, "G")
{
private static final long serialVersionUID = -2775698532993198968L;
public void resolve()
{
Card c = new Card();
c.setName("Saproling");
c.setImageName("G 1 1 Saproling");
c.setOwner(card.getController());
c.setController(card.getController());
c.setManaCost("G");
c.setToken(true);
c.addType("Creature");
c.addType("Saproling");
c.setBaseAttack(1);
c.setBaseDefense(1);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(c);
}//resolve()
};
final SpellAbility ability2 = new Ability_Tap(card, "B")
{
private static final long serialVersionUID = -8102068245477091900L;
public void resolve()
{
String opponent = AllZone.GameAction.getOpponent(card.getController());
AllZone.GameAction.getPlayerLife(opponent).subtractLife(1);
}
public boolean canPlayAI()
{
//computer should play ability if this creature doesn't attack
Combat c = ComputerUtil.getAttackers();
CardList list = new CardList(c.getAttackers());
//could this creature attack?, if attacks, do not use ability
return (! list.contains(card));
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("G , tap: put a 1/1 green Saproling creature token onto the battlefield.");
ability.setStackDescription(card.getName() + " - Put a 1/1 green Saproling token onto the battlefield.");
card.addSpellAbility(ability2);
ability2.setDescription("B, tap: Target player loses 1 life.");
ability2.setStackDescription(card.getName() + " - Opponent loses 1 life.");
}//*************** END ************ END **************************
//*************** START *********** START **************************
if (cardName.equals("Lich Lord of Unx"))
{
final SpellAbility ability = new Ability_Tap(card, "U B")
{
private static final long serialVersionUID = 8909297504020264315L;
public void resolve()
{
Card c = new Card();
c.setName("Zombie Wizard");
c.setImageName("UB 1 1 Zombie Wizard");
c.setOwner(card.getController());
c.setController(card.getController());
c.setManaCost("UB");
c.setToken(true);
c.addType("Creature");
c.addType("Zombie");
c.addType("Wizard");
c.setBaseAttack(1);
c.setBaseDefense(1);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(c);
}//resolve()
};
ability.setDescription("U B, Tap: Put a 1/1 blue and black Zombie Wizard creature token onto the battlefield.");
ability.setStackDescription(card.getName() + " - " + card.getController() + "puts a 1/1 blue and black Zombie Wizard creature token onto the battlefield.");
final Ability ability2 = new Ability(card, "U U B B")
{
public boolean canPlayAI()
{
setTargetPlayer(Constant.Player.Human);
return countZombies() >= 3;
}
public void resolve()
{
if (getTargetPlayer() != null) {
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, getTargetPlayer());
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, getTargetPlayer());
for (int i=0;i<countZombies();i++)
{
Card c = lib.get(0);
lib.remove(0);
grave.add(c);
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1);
}
}
}
public int countZombies()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
CardList list = new CardList(play.getCards());
list = list.getType("Zombie");
return list.size();
}
};
ability2.setDescription("U U B B: Target player loses X life and puts the top X cards of his or her library into his or her graveyard, where X is the number of Zombies you control.");
ability2.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability2));
card.addSpellAbility(ability);
card.addSpellAbility(ability2);
}//*************** END ************ END **************************
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found

View File

@@ -5320,6 +5320,172 @@ public class GameActionUtil
}// for outer
}// execute()
};// Muscles_Sliver
public static Command Knighthood = new Command()
{
private static final long serialVersionUID = -6904191523315339355L;
CardList gloriousAnthemList = new CardList();
public void execute()
{
String keyword = "First Strike";
CardList list = gloriousAnthemList;
Card c;
// reset all cards in list - aka "old" cards
for (int i = 0; i < list.size(); i++)
{
c = list.get(i);
c.removeExtrinsicKeyword(keyword);
}
list.clear();
PlayerZone[] zone = getZone("Knighthood");
for (int outer = 0; outer < zone.length; outer++)
{
CardList creature = new CardList(zone[outer].getCards());
creature = creature.getType("Creature");
for (int i = 0; i < creature.size(); i++)
{
c = creature.get(i);
if (!c.getKeyword().contains(keyword))
{
c.addExtrinsicKeyword(keyword);
gloriousAnthemList.add(c);
}
}// for inner
}// for outer
}// execute()
};
public static Command Levitation = new Command()
{
private static final long serialVersionUID = -6707183535529395830L;
CardList gloriousAnthemList = new CardList();
public void execute()
{
String keyword = "Flying";
CardList list = gloriousAnthemList;
Card c;
// reset all cards in list - aka "old" cards
for (int i = 0; i < list.size(); i++)
{
c = list.get(i);
c.removeExtrinsicKeyword(keyword);
}
list.clear();
PlayerZone[] zone = getZone("Levitation");
for (int outer = 0; outer < zone.length; outer++)
{
CardList creature = new CardList(zone[outer].getCards());
creature = creature.getType("Creature");
for (int i = 0; i < creature.size(); i++)
{
c = creature.get(i);
if (!c.getKeyword().contains(keyword))
{
c.addExtrinsicKeyword(keyword);
gloriousAnthemList.add(c);
}
}// for inner
}// for outer
}// execute()
};
public static Command Absolute_Grace = new Command()
{
private static final long serialVersionUID = -6904191523315339355L;
CardList gloriousAnthemList = new CardList();
public void execute()
{
String keyword = "Protection from black";
CardList list = gloriousAnthemList;
Card c;
// reset all cards in list - aka "old" cards
for (int i = 0; i < list.size(); i++)
{
c = list.get(i);
c.removeExtrinsicKeyword(keyword);
}
list.clear();
PlayerZone[] zone = getZone("Absolute Grace");
for (int outer = 0; outer < zone.length; outer++)
{
CardList creature = new CardList();
creature.addAll(AllZone.Human_Play.getCards());
creature.addAll(AllZone.Computer_Play.getCards());
creature = creature.getType("Creature");
for (int i = 0; i < creature.size(); i++)
{
c = creature.get(i);
if (!c.getKeyword().contains(keyword))
{
c.addExtrinsicKeyword(keyword);
gloriousAnthemList.add(c);
}
}// for inner
}// for outer
}// execute()
};
public static Command Absolute_Law = new Command()
{
private static final long serialVersionUID = -6707183535529395830L;
CardList gloriousAnthemList = new CardList();
public void execute()
{
String keyword = "Protection from red";
CardList list = gloriousAnthemList;
Card c;
// reset all cards in list - aka "old" cards
for (int i = 0; i < list.size(); i++)
{
c = list.get(i);
c.removeExtrinsicKeyword(keyword);
}
list.clear();
PlayerZone[] zone = getZone("Absolute Law");
for (int outer = 0; outer < zone.length; outer++)
{
CardList creature = new CardList();
creature.addAll(AllZone.Human_Play.getCards());
creature.addAll(AllZone.Computer_Play.getCards());
creature = creature.getType("Creature");
for (int i = 0; i < creature.size(); i++)
{
c = creature.get(i);
if (!c.getKeyword().contains(keyword))
{
c.addExtrinsicKeyword(keyword);
gloriousAnthemList.add(c);
}
}// for inner
}// for outer
}// execute()
};
public static Command Serras_Blessing = new Command()
{
@@ -10804,6 +10970,10 @@ public class GameActionUtil
commands.put("Castle", Castle);
commands.put("Castle_Raptors", Castle_Raptors);
commands.put("Levitation", Levitation);
commands.put("Knighthood", Knighthood);
commands.put("Absolute_Law", Absolute_Law);
commands.put("Absolute_Grace", Absolute_Grace);
commands.put("Mobilization", Mobilization);
commands.put("Serras_Blessing", Serras_Blessing);
commands.put("Cover_of_Darkness", Cover_of_Darkness);