- Converted Elspeth Tirel to AFs

- Added checkStateEffects after UnfreezeStack so Planeswalkers Loyalty is checked after paying costs
This commit is contained in:
jendave
2011-08-06 12:43:37 +00:00
parent e1867c9055
commit 20d0d4f016
3 changed files with 5 additions and 186 deletions

View File

@@ -3,6 +3,10 @@ ManaCost:3 W W
Types:Planeswalker - Elspeth Types:Planeswalker - Elspeth
Text:no text Text:no text
Loyalty:4 Loyalty:4
A:AB$GainLife | Cost$ AddCounter<2/LOYALTY> | LifeAmount$ XLife | Planeswalker$ True | SpellDescription$ You gain 1 life for each creature you control.
A:AB$Token | Cost$ SubCounter<2/LOYALTY> |TokenAmount$ 3 | TokenName$ Soldier | TokenTypes$ Creature,Soldier | TokenOwner$ Controller | TokenColors$ White | TokenPower$ 1 | TokenToughness$ 1 | SpellDescription$ Put three 1/1 white Soldier creature tokens onto the battlefield.
A:AB$DestroyAll | Cost$ SubCounter<5/LOYALTY> | ValidCards$ Permanent.nonLand+nonToken+Other | SpellDescription$ Destroy all other permanents except for lands and tokens.
SVar:XLife:Count$TypeYouCtrl.Creature
SVar:Rarity:Mythic SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/elspeth_tirel.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/elspeth_tirel.jpg
SetInfo:SOM|Mythic|http://magiccards.info/scans/en/som/6.jpg SetInfo:SOM|Mythic|http://magiccards.info/scans/en/som/6.jpg

View File

@@ -2508,192 +2508,6 @@ class CardFactory_Planeswalkers {
return card; return card;
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Elspeth Tirel")) {
//Planeswalker book-keeping
final int turn[] = new int[1];
turn[0] = -1;
final SpellAbility ability3 = new Ability(card, "0")
{
public void resolve()
{
card.subtractCounter(Counters.LOYALTY, 5);
turn[0] = AllZone.Phase.getTurn();
CardList list = AllZoneUtil.getCardsInPlay();
list = list.filter(new CardListFilter(){
public boolean addCard(Card c)
{
return !c.isToken() && !c.isLand() && !c.equals(card);
}
});
CardListUtil.sortByIndestructible(list);
CardListUtil.sortByDestroyEffect(list);
for (int i=0;i<list.size();i++)
{
AllZone.GameAction.destroy(list.get(i));
}
}
public boolean canPlayAI()
{
CardList humanList = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
CardList compList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
CardListFilter filter = new CardListFilter()
{
public boolean addCard(Card c) {
return !c.getName().equals("Mana Pool") && !c.isLand() && !c.isToken() && !c.equals(card) &&
!c.getKeyword().contains("Indestructible");
}
};
humanList = humanList.filter(filter);
compList = compList.filter(filter);
return card.getCounters(Counters.LOYALTY) > 5 && (humanList.size() > (compList.size() +1));
}
public boolean canPlay() {
return card.getCounters(Counters.LOYALTY) >= 5
&& AllZone.getZone(card).is(Constant.Zone.Play)
&& turn[0] != AllZone.Phase.getTurn()
&& Phase.canCastSorcery(card.getController());
}//canPlay()
};
ability3.setBeforePayMana(new Input() {
private static final long serialVersionUID = -3310512279978705284L;
int check = -1;
@Override
public void showMessage() {
if(check != AllZone.Phase.getTurn()) {
check = AllZone.Phase.getTurn();
turn[0] = AllZone.Phase.getTurn();
AllZone.Stack.add(ability3);
}
stop();
}//showMessage()
});
//ability 1: gain 1 life for each creature
final SpellAbility ability1 = new Ability(card, "0") {
@Override
public void resolve() {
card.addCounterFromNonEffect(Counters.LOYALTY, 2);
turn[0] = AllZone.Phase.getTurn();
int life = AllZoneUtil.getCreaturesInPlay(card.getController()).size();
card.getController().gainLife(life, card);
Log.debug("Elspeth Tirel", "current phase: " + AllZone.Phase.getPhase());
}
@Override
public boolean canPlayAI() {
CardList list = AllZoneUtil.getCreaturesInPlay();
return (list.size() > 2 || card.getCounters(Counters.LOYALTY) < 4) &&
!(ability3.canPlay() && ability3.canPlayAI()) && card.getCounters(Counters.LOYALTY) < 12;
}
@Override
public boolean canPlay() {
return 0 < card.getCounters(Counters.LOYALTY)
&& AllZone.getZone(card).is(Constant.Zone.Play)
&& turn[0] != AllZone.Phase.getTurn()
&& Phase.canCastSorcery(card.getController());
}//canPlay()
};//SpellAbility ability1
ability1.setBeforePayMana(new Input() {
private static final long serialVersionUID = -7969603493514210825L;
int check = -1;
@Override
public void showMessage() {
if(check != AllZone.Phase.getTurn()) {
check = AllZone.Phase.getTurn();
turn[0] = AllZone.Phase.getTurn();
AllZone.Stack.add(ability1);
}
stop();
}//showMessage()
});
//ability 1: create 3 white 1/1 tokens
final SpellAbility ability2 = new Ability(card, "0") {
@Override
public void resolve() {
card.subtractCounter(Counters.LOYALTY, 2);
turn[0] = AllZone.Phase.getTurn();
for (int i=0;i<3;i++)
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
"Creature", "Soldier"}, 1, 1, new String[] {""});
}
@Override
public boolean canPlayAI() {
return card.getCounters(Counters.LOYALTY) >= 3 &&
!(ability3.canPlay() && ability3.canPlayAI());
}
@Override
public boolean canPlay() {
return card.getCounters(Counters.LOYALTY) >= 2
&& AllZone.getZone(card).is(Constant.Zone.Play)
&& turn[0] != AllZone.Phase.getTurn()
&& Phase.canCastSorcery(card.getController());
}//canPlay()
};//SpellAbility ability2
ability2.setBeforePayMana(new Input() {
private static final long serialVersionUID = 5089161242872591541L;
int check = -1;
@Override
public void showMessage() {
if(check != AllZone.Phase.getTurn()) {
check = AllZone.Phase.getTurn();
turn[0] = AllZone.Phase.getTurn();
AllZone.Stack.add(ability2);
}
stop();
}//showMessage()
});
ability1.setDescription("+2: You gain 1 life for each creature you control.");
StringBuilder stack1 = new StringBuilder();
stack1.append("Elspeth Tirel - ").append(card.getController()).append(" gains 1 life for each creature he/she controls.");
ability1.setStackDescription(stack1.toString());
// ability1.setStackDescription("Elspeth Tirel - " + card.getController() + " gains 1 life for each creature he/she controls.");
card.addSpellAbility(ability1);
ability2.setDescription("-2: Put three white 1/1 Soldier creature tokens onto the battlefield.");
ability2.setStackDescription("Elspeth Tirel - put three 1/1 Soldier creature tokens onto the battlefield.");
card.addSpellAbility(ability2);
ability3.setDescription("-5: Destroy all other permanents except for lands and tokens.");
StringBuilder stack3 = new StringBuilder();
stack3.append(card.getName()).append(" - Destroy all other permanents except for lands and tokens.");
ability3.setStackDescription(stack3.toString());
// ability3.setStackDescription(card + " - Destroy all other permanents except for lands and tokens.");
card.addSpellAbility(ability3);
card.setSVars(card.getSVars());
card.setSets(card.getSets());
return card;
}//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Koth of the Hammer")) { else if(cardName.equals("Koth of the Hammer")) {
//computer only plays ability 1 and 3, put 1/1 Soldier in play and make everything indestructible //computer only plays ability 1 and 3, put 1/1 Soldier in play and make everything indestructible

View File

@@ -39,6 +39,7 @@ public class MagicStack extends MyObservable {
frozenStack.remove(0); frozenStack.remove(0);
this.add(sa); this.add(sa);
} }
AllZone.GameAction.checkStateEffects();
} }
public void clearFrozen() { public void clearFrozen() {