- Convert Gilt-Leaf Archdruid to Cost and Target and streamlined code

- Fixed SacrificePermanent to send in Message if it has one
- Tokens will no longer set mana costs where one doesn't exist
This commit is contained in:
jendave
2011-08-06 13:37:17 +00:00
parent 437fc9483e
commit 5a289a7780
7 changed files with 69 additions and 210 deletions

View File

@@ -1,7 +1,7 @@
Name:Gilt-Leaf Archdruid Name:Gilt-Leaf Archdruid
ManaCost:3 G G ManaCost:3 G G
Types:Creature Elf Druid Types:Creature Elf Druid
Text:Whenever you play a Druid spell, you may draw a card.\r\nTap seven untapped Druids you control: Gain control of all lands target player controls. Text:Whenever you play a Druid spell, you may draw a card.
PT:3/3 PT:3/3
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/gilt_leaf_archdruid.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/gilt_leaf_archdruid.jpg

View File

@@ -857,7 +857,7 @@ public class CardFactoryUtil {
}//input_sacrifice() }//input_sacrifice()
public static Input input_sacrificePermanent(final CardList choices, final String message) { public static Input input_sacrificePermanent(final CardList choices, final String message) {
return input_sacrificePermanentsFromList(1, choices, "Select a permanent to sacrifice"); return input_sacrificePermanentsFromList(1, choices, message);
}//input_sacrifice() }//input_sacrifice()
public static Input input_sacrificePermanents(final int nCards) { public static Input input_sacrificePermanents(final int nCards) {
@@ -4328,7 +4328,7 @@ public class CardFactoryUtil {
//c.setOwner(controller); //c.setOwner(controller);
// todo: most tokens mana cost is 0, this needs to be fixed // todo: most tokens mana cost is 0, this needs to be fixed
c.setManaCost(manaCost); //c.setManaCost(manaCost);
c.addColor(manaCost); c.addColor(manaCost);
c.setToken(true); c.setToken(true);

View File

@@ -10118,170 +10118,41 @@ public class CardFactory_Creatures {
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Gilt-Leaf Archdruid")) { else if(cardName.equals("Gilt-Leaf Archdruid")) {
final SpellAbility a1 = new Ability(card, "0") { Ability_Cost abCost = new Ability_Cost("tapXType<7/Druid>", cardName, true);
Target tgt = new Target("Select a player to gain lands from", "Player".split(","));
final SpellAbility stealLands = new Ability_Activated(card, abCost, tgt){
private static final long serialVersionUID = 636594487143500891L;
@Override @Override
public boolean canPlay() { public boolean canPlayAI(){
Player controller = card.getController(); Player p = AllZone.HumanPlayer;
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, controller);
CardList druids = new CardList(); if (!p.canTarget(card))
return false;
druids.addAll(play.getCards()); setTargetPlayer(p);
druids = druids.getType("Druid");
//System.out.println("Druids size: " + druids.size()); CardList lands = AllZoneUtil.getPlayerCardsInPlay(p);
lands = lands.getType("Land");
int druidsUntapped = 0; // Don't steal lands if Human has less than 2
for(int i = 0; i < druids.size(); i++) { return lands.size() >= 2;
Card c = druids.get(0);
if(!c.isTapped()) druidsUntapped++;
}
if(druids.size() > 6 && druidsUntapped > 6 && AllZone.GameAction.isCardInPlay(card) && super.canPlay()) return true;
else return false;
} }
@Override @Override
public void resolve() { public void resolve() {
Player activator = this.getActivatingPlayer();
Player player = card.getController(); CardList lands = AllZoneUtil.getPlayerCardsInPlay(getTargetPlayer());
if(player.equals(AllZone.HumanPlayer)) humanResolve();
else computerResolve();
}
public void humanResolve() {
Player controller = card.getController();
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, controller);
CardList druids = new CardList();
druids.addAll(play.getCards());
druids = druids.getType("Druid");
CardList tappedDruids = new CardList();
Object o = AllZone.Display.getChoice("Pick first druid to tap", druids.toArray());
if(o != null) {
Card c1 = (Card) o;
druids.remove(c1);
tappedDruids.add(c1);
} else return;
o = AllZone.Display.getChoice("Pick second druid to tap", druids.toArray());
if(o != null) {
Card c2 = (Card) o;
druids.remove(c2);
tappedDruids.add(c2);
} else return;
o = AllZone.Display.getChoice("Pick third druid to tap", druids.toArray());
if(o != null) {
Card c3 = (Card) o;
druids.remove(c3);
tappedDruids.add(c3);
} else return;
o = AllZone.Display.getChoice("Pick fourth druid to tap", druids.toArray());
if(o != null) {
Card c4 = (Card) o;
druids.remove(c4);
tappedDruids.add(c4);
} else return;
o = AllZone.Display.getChoice("Pick fifth druid to tap", druids.toArray());
if(o != null) {
Card c5 = (Card) o;
druids.remove(c5);
tappedDruids.add(c5);
} else return;
o = AllZone.Display.getChoice("Pick sixth druid to tap", druids.toArray());
if(o != null) {
Card c6 = (Card) o;
druids.remove(c6);
tappedDruids.add(c6);
} else return;
o = AllZone.Display.getChoice("Pick seventh druid to tap", druids.toArray());
if(o != null) {
Card c7 = (Card) o;
druids.remove(c7);
tappedDruids.add(c7);
} else return;
for(int i = 0; i < tappedDruids.size(); i++) {
Card tapDruid = tappedDruids.get(i);
tapDruid.tap();
}
Player opponent = controller.getOpponent();
PlayerZone opponentPlay = AllZone.getZone(Constant.Zone.Battlefield, opponent);
CardList lands = new CardList();
lands.addAll(opponentPlay.getCards());
lands = lands.getType("Land");
//System.out.println("Land size: " +lands.size());
for(int i = 0; i < lands.size(); i++) {
Card land = lands.get(i);
if(AllZone.GameAction.isCardInPlay(land)) {
land.setController(controller);
//set summoning sickness
if(land.getKeyword().contains("Haste")) {
land.setSickness(false);
} else {
land.setSickness(true);
}
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(false);
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(false);
PlayerZone from = AllZone.getZone(land);
from.remove(land);
PlayerZone to = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
to.add(land);
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(true);
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true);
}//if
}
}//humanResolve
public void computerResolve() {
Player controller = card.getController();
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, controller);
CardList druids = new CardList();
druids.addAll(play.getCards());
druids = druids.getType("Druid");
for(int i = 0; i < 7; i++) {
Card c = druids.get(i);
c.tap();
}
Player opponent = controller.getOpponent();
PlayerZone opponentPlay = AllZone.getZone(Constant.Zone.Battlefield, opponent);
CardList lands = new CardList();
lands.addAll(opponentPlay.getCards());
lands = lands.getType("Land"); lands = lands.getType("Land");
for(int i = 0; i < lands.size(); i++) { for(int i = 0; i < lands.size(); i++) {
Card land = lands.get(i); Card land = lands.get(i);
if(AllZone.GameAction.isCardInPlay(land)) { if(AllZone.GameAction.isCardInPlay(land)) { // this really shouldn't fail in the middle of resolution
land.setController(controller); land.setController(activator);
//set summoning sickness // i don't know how the code handles Sum Sickness so I'm leaving this
// but a card changing controllers should always gain this no matter if it has haste or not
if(land.getKeyword().contains("Haste")) { if(land.getKeyword().contains("Haste")) {
land.setSickness(false); land.setSickness(false);
} else { } else {
@@ -10301,28 +10172,16 @@ public class CardFactory_Creatures {
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true); ((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true);
}//if }//if
} }
}
};
}//computerResolve card.addSpellAbility(stealLands);
};//a1
card.clearSpellAbility();
card.addSpellAbility(a1);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(card.getController()).append(" taps seven untapped Druids and gains control of all opponent's land."); sb.append(card.toString()).append(" - Gain control of all lands target player controls.");
a1.setStackDescription(sb.toString()); stealLands.setStackDescription(sb.toString());
a1.setDescription("Tap seven untapped Druids you control: Gain control of all lands target player controls."); stealLands.setDescription("Tap seven untapped Druids you control: Gain control of all lands target player controls.");
card.addSpellAbility(new Spell_Permanent(card) {
private static final long serialVersionUID = -4621346281051305833L;
@Override
public boolean canPlayAI() {
return true;
}
});
}//*************** END ************ END ************************** }//*************** END ************ END **************************

View File

@@ -306,6 +306,9 @@ public class CardList implements Iterable<Card> {
}); });
} }
public CardList getValidCards(String Restrictions, final Player sourceController, final Card source) {
return getValidCards(Restrictions.split(","), sourceController, source);
}
public CardList getValidCards(final String Restrictions[], final Player sourceController, final Card source) { public CardList getValidCards(final String Restrictions[], final Player sourceController, final Card source) {
return this.filter(new CardListFilter() { return this.filter(new CardListFilter() {

View File

@@ -10528,7 +10528,7 @@ public class GameActionUtil {
c.setName("Dragon"); c.setName("Dragon");
c.setImageName("RG 1 1 Dragon"); c.setImageName("RG 1 1 Dragon");
c.setManaCost("RG"); //c.setManaCost("RG");
c.addColor("RG"); c.addColor("RG");
c.setToken(true); c.setToken(true);

View File

@@ -122,7 +122,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("G"); //c.setManaCost("G");
c.addColor("G"); c.addColor("G");
c.setToken(true); c.setToken(true);
@@ -208,7 +208,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("G"); //c.setManaCost("G");
c.addColor("G"); c.addColor("G");
c.setToken(true); c.setToken(true);
@@ -265,7 +265,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("B"); //c.setManaCost("B");
c.addColor("B"); c.addColor("B");
c.setToken(true); c.setToken(true);
@@ -322,7 +322,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("W"); //c.setManaCost("W");
c.addColor("W"); c.addColor("W");
c.setToken(true); c.setToken(true);
@@ -381,7 +381,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("R"); //c.setManaCost("R");
c.addColor("R"); c.addColor("R");
c.setToken(true); c.setToken(true);
@@ -503,7 +503,7 @@ public class QuestUtil {
c.setController(AllZone.HumanPlayer); c.setController(AllZone.HumanPlayer);
c.setOwner(AllZone.HumanPlayer); c.setOwner(AllZone.HumanPlayer);
c.setManaCost("G"); //c.setManaCost("G");
c.addColor("G"); c.addColor("G");
c.setToken(true); c.setToken(true);

View File

@@ -155,9 +155,6 @@ public class SpellAbility_Restriction {
if (activationLimit != -1 && numberTurnActivations >= activationLimit) if (activationLimit != -1 && numberTurnActivations >= activationLimit)
return false; return false;
/*if( activationNumberSacrifice != -1 && numberTurnActivations >= (activationNumberSacrifice - 1))
return false;*/
if (activatePhases.size() > 0){ if (activatePhases.size() > 0){
boolean isPhase = false; boolean isPhase = false;
String currPhase = AllZone.Phase.getPhase(); String currPhase = AllZone.Phase.getPhase();