code cleanup related to tokens

This commit is contained in:
jendave
2011-08-06 09:29:54 +00:00
parent 1a02e4fa30
commit dcc6400139
2 changed files with 6 additions and 368 deletions

View File

@@ -6902,73 +6902,9 @@ public class CardFactory_Creatures {
ability.setBeforePayMana(targetInput); ability.setBeforePayMana(targetInput);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if(cardName.equals("Imperious Perfect")) {
//mana tap ability
final Ability_Tap ability = new Ability_Tap(card, "G") {
private static final long serialVersionUID = -3266607637871879336L;
@Override
public boolean canPlayAI() {
String phase = AllZone.Phase.getPhase();
return phase.equals(Constant.Phase.Main2);
}
@Override
public void chooseTargetAI() {
card.tap();
}
@Override
public void resolve() {
CardFactoryUtil.makeToken("Elf Warrior", "G 1 1 Elf Warrior", card, "G", new String[] {
"Creature", "Elf", "Warrior"}, 1, 1, new String[] {""});
}//resolve()
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("G, tap: Put a 1/1 green Elf Warrior creature token into play.");
ability.setStackDescription("Imperious Perfect - Put a 1/1 green Elf Warrior creature token into play.");
ability.setBeforePayMana(new Input_PayManaCost(ability));
}//*************** END ************ END **************************
*/
/*
//*************** START *********** START **************************
else if(cardName.equals("Wall of Kelp")) {
//mana tap ability
final Ability_Tap ability = new Ability_Tap(card, "U U") {
private static final long serialVersionUID = 2893813929304858905L;
@Override
public boolean canPlayAI() {
String phase = AllZone.Phase.getPhase();
return phase.equals(Constant.Phase.Main2);
}
@Override
public void chooseTargetAI() {
card.tap();
}
@Override
public void resolve() {
CardFactoryUtil.makeToken("Kelp", "U 0 1 Kelp", card, "U", new String[] {
"Creature", "Plant", "Wall"}, 0, 1, new String[] {"Defender"});
}//resolve()
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("UU, tap: Put a 0/1 blue Kelp Wall creature token with defender into play.");
ability.setStackDescription("Wall of Kelp - Put a 0/1 blue Kelp Wall creature token with defender into play");
ability.setBeforePayMana(new Input_PayManaCost(ability));
}//*************** END ************ END **************************
*/
//*************** START *********** START ************************** //*************** START *********** START **************************
if(cardName.equals("Mayael the Anima")) { else if(cardName.equals("Mayael the Anima")) {
final Ability_Tap ability = new Ability_Tap(card, "3 R G W") { final Ability_Tap ability = new Ability_Tap(card, "3 R G W") {
private static final long serialVersionUID = -9076784333448226913L; private static final long serialVersionUID = -9076784333448226913L;
@@ -9243,251 +9179,6 @@ public class CardFactory_Creatures {
}//*************** END ************ END ************************** }//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if(cardName.equals("Llanowar Mentor")) {
final Ability_Tap ability = new Ability_Tap(card, "G") {
private static final long serialVersionUID = 752280918226277729L;
@Override
public void resolve() {
CardList cl = CardFactoryUtil.makeToken("Llanowar Elves", "G 1 1 Llanowar Elves", card, "G",
new String[] {"Creature", "Elf", "Druid"}, 1, 1, new String[] {""});
for(Card c:cl) {
c.addSpellAbility(new Ability_Mana(card, "tap: add G") {
private static final long serialVersionUID = 7871036527184588884L;
});
}
//computer discards here, todo: should discard when ability put on stack
if(card.getController().equals(AllZone.ComputerPlayer)) AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
}
@Override
public boolean canPlay() {
Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards();
return super.canPlay() && (0 < c.length);
}
@Override
public boolean canPlayAI() {
boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length;
return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2);
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("G, tap, Discard a card: Put a 1/1 green Elf Druid creature token named Llanowar Elves into play with \"tap: add G\" ");
ability.setStackDescription("Llanowar Mentor - Put a 1/1 token into play");
ability.setBeforePayMana(new Input_PayManaCost_Ability("G", new Command() {
private static final long serialVersionUID = -8140640118045101485L;
public void execute() {
card.tap();
AllZone.InputControl.setInput(CardFactoryUtil.input_discard(ability));
AllZone.Stack.add(ability);
}
}));
}//*************** END ************ END **************************
*/
/*
//*************** START *********** START **************************
else if(cardName.equals("Sparkspitter")) {
final Ability_Tap ability = new Ability_Tap(card, "R") {
private static final long serialVersionUID = -6381252527344512333L;
@Override
public void resolve() {
makeToken();
//computer discards here, todo: should discard when ability put on stack
if(card.getController().equals(AllZone.ComputerPlayer)) AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
}
void makeToken() {
//CardList cl = CardFactoryUtil.makeToken("Elemental", "R 3 1 Elemental", card, "R", new String[]{"Creature", "Elemental"}, 1, 1, String[] {"Trample", "Haste"});
//Cannot use the generic CardFactoryUtil.makeToken yet (token has CIP and destroy commands).
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
int multiplier = 1;
int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", card.getController()).size();
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
for(int i = 0; i < multiplier; i++) {
final Card c = new Card();
c.setOwner(card.getController());
c.setController(card.getController());
c.setManaCost("R");
c.setToken(true);
c.addType("Creature");
c.addType("Elemental");
c.setBaseAttack(3);
c.setBaseDefense(1);
c.addIntrinsicKeyword("Trample");
c.addIntrinsicKeyword("Haste");
//custom settings
c.setName("Spark Elemental");
c.setImageName("R 3 1 Spark Elemental");
/*final SpellAbility spell = new Ability(card, "0") {
@Override
public void resolve() {
if(AllZone.GameAction.isCardInPlay(c)) AllZone.GameAction.sacrifice(c);
}
};
spell.setStackDescription("Sacrifice " + c);
final Command destroy = new Command() {
private static final long serialVersionUID = -8633713067929006933L;
public void execute() {
if(AllZone.GameAction.isCardInPlay(c)) AllZone.Stack.add(spell);
}
};
Command intoPlay = new Command() {
private static final long serialVersionUID = -7174114937547707480L;
public void execute() {
if(!c.isFaceDown()) AllZone.EndOfTurn.addAt(destroy);
}
};
c.addComesIntoPlayCommand(intoPlay);
c.setSacrificeAtEOT(true);
c.addIntrinsicKeyword("At the beginning of the end step, sacrifice CARDNAME.");
play.add(c);
}
}//makeToken()
@Override
public boolean canPlay() {
Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards();
return super.canPlay() && (0 < c.length);
}
@Override
public boolean canPlayAI() {
boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length;
return canPlay() && canDiscard;
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("R, tap, Discard a card: Put a 3/1 red Elemental creature token named Spark Elemental into play with trample, haste, and \"At end of turn, sacrifice Spark Elemental.\" ");
ability.setStackDescription("Sparkspitter - Put a 3/1 token into play");
ability.setBeforePayMana(new Input_PayManaCost_Ability("R", new Command() {
private static final long serialVersionUID = 4717424466422508064L;
public void execute() {
card.tap();
AllZone.InputControl.setInput(CardFactoryUtil.input_discard(ability));
AllZone.Stack.add(ability);
}
}));
}//*************** END ************ END **************************
*/
/*
//*************** START *********** START **************************
else if(cardName.equals("Sliversmith")) {
final Ability_Tap ability = new Ability_Tap(card, "1") {
private static final long serialVersionUID = -901356795848120643L;
@Override
public void resolve() {
CardFactoryUtil.makeToken("Metallic Sliver", "C 1 1 Metallic Sliver", card, "", new String[] {
"Artifact", "Creature", "Sliver"}, 1, 1, new String[] {""});
//computer discards here, todo: should discard when ability put on stack
if(card.getController().equals(AllZone.ComputerPlayer)) AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
}
@Override
public boolean canPlay() {
Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards();
return super.canPlay() && (0 < c.length);
}
@Override
public boolean canPlayAI() {
boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length;
return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2);
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("1, tap, Discard a card: Put a 1/1 Sliver artifact creature token named Metallic Sliver into play.");
ability.setStackDescription(card + " - Put a 1/1 token into play");
ability.setBeforePayMana(new Input_PayManaCost_Ability("1", new Command() {
private static final long serialVersionUID = 7980998398222481323L;
public void execute() {
card.tap();
AllZone.InputControl.setInput(CardFactoryUtil.input_discard(ability));
AllZone.Stack.add(ability);
}
}));
}//*************** END ************ END **************************
*/
/*
//*************** START *********** START **************************
else if(cardName.equals("Cloudseeder")) {
final Ability_Tap ability = new Ability_Tap(card, "U") {
private static final long serialVersionUID = -4685908556244137496L;
@Override
public void resolve() {
CardFactoryUtil.makeToken("Cloud Sprite", "U 1 1 Cloud Sprite", card, "U", new String[] {
"Creature", "Faerie"}, 1, 1, new String[] {
"Flying", "CARDNAME can block only creatures with flying."});
//computer discards here, todo: should discard when ability put on stack
if(card.getController().equals(AllZone.ComputerPlayer)) AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
}
@Override
public boolean canPlay() {
Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards();
return super.canPlay() && (0 < c.length);
}
@Override
public boolean canPlayAI() {
boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length;
return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2);
}
};//SpellAbility
card.addSpellAbility(ability);
ability.setDescription("U, tap, Discard a card: Put a 1/1 blue Sprite creature token named Cloud Sprite into play with flying and \"Cloud Sprite can block only creatures with flying.\".");
ability.setStackDescription("Cloudseeker - Put a 1/1 token into play");
ability.setBeforePayMana(new Input_PayManaCost_Ability("U", new Command() {
private static final long serialVersionUID = 7707504858274558816L;
public void execute() {
card.tap();
AllZone.InputControl.setInput(CardFactoryUtil.input_discard(ability));
AllZone.Stack.add(ability);
}
}));
}//*************** END ************ END **************************
*/
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Goldmeadow Lookout")) { else if(cardName.equals("Goldmeadow Lookout")) {

View File

@@ -8907,60 +8907,6 @@ public class GameActionUtil {
}// for }// for
}// upkeep_Mycoloth() }// upkeep_Mycoloth()
/*
private static void upkeep_Luminous_Angel() {
final Player player = AllZone.Phase.getActivePlayer();
PlayerZone playZone = AllZone.getZone(Constant.Zone.Play, player);
CardList list = new CardList(playZone.getCards());
list = list.getName("Luminous Angel");
Ability ability;
for(int i = 0; i < list.size(); i++) {
final Card card = list.get(i);
ability = new Ability(card, "0") {
@Override
public void resolve() {
int multiplier = 1;
int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", card.getController()).size();
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
for(int i = 0; i < multiplier; i++)
makeToken();
}// resolve()
public void makeToken() {
final Card c = new Card();
c.setOwner(card.getController());
c.setController(card.getController());
c.setName("Spirit");
c.setImageName("W 1 1 Spirit");
c.setManaCost("W");
c.setToken(true);
c.addType("Creature");
c.addType("Spirit");
c.addIntrinsicKeyword("Flying");
c.setBaseAttack(1);
c.setBaseDefense(1);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(c);
}
};// Ability
ability.setStackDescription("Luminous Angel - put a 1/1 white Spirit token into play.");
AllZone.Stack.add(ability);
}// for
}// upkeep_Luminous_Angel()
*/
private static void upkeep_Verdant_Force() { private static void upkeep_Verdant_Force() {
//final Player player = AllZone.Phase.getActivePlayer(); //final Player player = AllZone.Phase.getActivePlayer();
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, AllZone.HumanPlayer); PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, AllZone.HumanPlayer);
@@ -8976,10 +8922,11 @@ public class GameActionUtil {
ability = new Ability(card, "0") { ability = new Ability(card, "0") {
@Override @Override
public void resolve() { public void resolve() {
int multiplier = 1; //Doubling Season is handled in CardFactoryUtil.makeToken
int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", card.getController()).size(); //int multiplier = 1;
if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons); //int doublingSeasons = CardFactoryUtil.getCards("Doubling Season", card.getController()).size();
for(int i = 0; i < multiplier; i++) //if(doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons);
//for(int i = 0; i < multiplier; i++)
makeToken(); makeToken();
}// resolve() }// resolve()