- Added Time Walk! Also some other similar cards.

- Fixed Sluggishness.
- Fixed an issue with Planeswalkers where their abilities can be used when there are other abilities on the stack (even during AIs turn).
- Added Ajani Vengeant.
- Fixed Strangling Soot bug.
This commit is contained in:
jendave
2011-08-06 02:50:40 +00:00
parent 7a697458e2
commit 25e1d3656d
8 changed files with 418 additions and 511 deletions

View File

@@ -1,3 +1,23 @@
Ajani Vengeant
2 R W
Planeswalker - Ajani
no text
Temporal Manipulation
3 U U
Sorcery
Take an extra turn after this one.
Capture of Jingzhou
3 U U
Sorcery
Take an extra turn after this one.
Time Walk
1 U
Sorcery
Take an extra turn after this one.
Jace Beleren
1 U U
Planeswalker - Jace

View File

@@ -1,6 +1,6 @@
program/mail=mtgerror@yahoo.com
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 97
program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 98
tokens--file=AllTokens.txt

View File

@@ -130,248 +130,6 @@ public class CardFactory implements NewConstants {
return -1;
}
/* //self-targeted power and/or toughness pumping abilities
//-1 means "PTPump" is not found
//any other int means that "PTPump" was found in the Card keyword
private final int shouldPTPumpCard(Card c)
{
ArrayList<String> a = c.getKeyword();
for(int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("PTPump"))
return i;
return -1;
}
//same thing, for "KPump" - self-targeted keyword adding abilities
private final int shouldKPumpCard(Card c)
{
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("KPump"))
return i;
return -1;
}
//same thing, for "PTKPump" - self-targeted power and/or toughness pumping
//plus keyword adding abilities
private final int shouldPTKPumpCard(Card c)
{
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("PTKPump"))
return i;
return -1;
}
//"TgtKPump" - targeted keyword adding abilities
private final int shouldTgtKPumpCard(Card c)
{
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if(a.get(i).toString().startsWith("TgtKPump"))
return i;
return -1;
}
// Check for self-regenerate ability
private final int shouldRegenerateMe(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("RegenerateMe"))
return i;
return -1;
}
// Check for Cycling ability
private final int shouldCycle(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Cycling"))
return i;
return -1;
}
private final int shouldSporeSaproling(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Remove three spore counters"))
return i;
return -1;
}
private final int shouldSpDamageTgt(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("spDamageTgt"))
return i;
}
return -1;
}
private final int shouldSpDamageCP(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("spDamageCP"))
return i;
}
return -1;
}
private final int shouldSpDamageP(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("spDamageP"))
return i;
}
return -1;
}
private final int shouldRebelSearch(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("SearchRebel"))
return i;
return -1;
}
private final int shouldMercSearch(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("SearchMerc"))
return i;
return -1;
}
private final int shouldMorph(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Morph"))
return i;
return -1;
}
private final int shouldDevour(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Devour"))
return i;
return -1;
}
private final int shouldSpellbomb(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("1, Sacrifice"))//
if(a.get(i).equals("1, Sacrifice "+c.getName()+": Draw a card."))
return i;
return -1;
}
private final int shouldModular(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("Modular"))
return i;
}
return -1;
}
private final int shouldUntap(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Untap"))
return i;
return -1;
}
private final int shouldFlashback(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("Flashback"))
return i;
return -1;
}
private final int shouldAbDamageCP(Card c) {
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
{
if (a.get(i).toString().startsWith("abDamageCP"))
return i;
}
return -1;
}
private final int shouldAbTgtPTPumpCard(Card c)
{
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("abTgtPTPump"))
return i;
return -1;
}
private final int shouldSpPumpTgt(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spPumpTgt"))
return i;
return -1;
}
private final int shouldSpDestroyTgt(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spDestroyTgt:"))
return i;
return -1;
}
private final int shouldSpDrawCards(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spDrawCards"))
return i;
return -1;
}
// spLoseLifeGainLife
private final int shouldSpLoseLifeGainLife(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spLoseLifeGainLife"))
return i;
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();
for (int i = 0; i < a.size(); i++)
@@ -2412,30 +2170,7 @@ public class CardFactory implements NewConstants {
if (ptk.length == 3)
keyword[0] = ptk[2];
/* String Desc = new String();
Desc = "Target creature ";
if (attack[0] != 0 || defense[0] != 0)
{
Desc = Desc + "gets ";
if (attack[0] > 0)
Desc = Desc + "+" + attack[0];
else
Desc = Desc + attack[0];
Desc = Desc + "/";
if (defense[0] > 0)
Desc = Desc + "+" + defense[0];
else
Desc = Desc + defense[0];
if (! keyword[0].equals("none"))
Desc = Desc + " and ";
}
if (! keyword[0].equals("none"))
Desc = Desc + "gains " + keyword;
Desc = Desc + " until end of turn.";
*/
SpellAbility spPump = new Spell(card)
{
private static final long serialVersionUID = 42244224L;
@@ -3365,152 +3100,7 @@ public class CardFactory implements NewConstants {
a1.setBeforePayMana(new Input_PayManaCost(a1));
}//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if(cardName.equals("Exploration"))
{
final int turn[] = new int[1];
turn[0] = -1;
final Ability ability = new Ability(card, "0")
{
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card))
return false;
}
String player = card.getController();
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
CardList lands = new CardList(hand.getCards());
lands = lands.getType("Land");
return lands.size() > 0 &&
(AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || AllZone.Phase.getPhase().equals(Constant.Phase.Main1))
&& AllZone.GameAction.isCardInPlay(card) && turn[0] != AllZone.Phase.getTurn();
}
public void resolve()
{
turn[0] = AllZone.Phase.getTurn();
String player = card.getController();
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
CardList lands = new CardList(hand.getCards());
lands = lands.getType("Land");
if (lands.size() > 0)
{
if (player.equals(Constant.Player.Human))
{
Object o = AllZone.Display.getChoiceOptional("Select land to play", lands.toArray());
if (o!=null)
{
Card c = (Card)o;
hand.remove(c);
play.add(c);
}
}
else
{
Card c = lands.get(0);
hand.remove(c);
play.add(c);
}
}
}
};
card.addSpellAbility(ability);
ability.setDescription("You may play an additional land each of your turns.");
ability.setStackDescription(card.getName() + " - " + card.getController() + " plays an additional land.");
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Fastbond"))
{
final Ability ability = new Ability(card, "0")
{
public boolean canPlayAI()
{
if(AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife() > 4)
return true;
else
return false;
}
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card))
return false;
}
String player = card.getController();
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
CardList lands = new CardList(hand.getCards());
lands = lands.getType("Land");
return !Input_Main.canPlayLand && lands.size() > 0 &&
(AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || AllZone.Phase.getPhase().equals(Constant.Phase.Main1))
&& AllZone.GameAction.isCardInPlay(card);
}
public void resolve()
{
String player = card.getController();
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
CardList fastbonds = new CardList(play.getCards());
fastbonds = fastbonds.getName("Fastbond"); //do this, because if there are more in play, fastbond will deal more damage per land
AllZone.GameAction.getPlayerLife(player).subtractLife(fastbonds.size());
CardList lands = new CardList(hand.getCards());
lands = lands.getType("Land");
if (lands.size() > 0)
{
if (player.equals(Constant.Player.Human))
{
Object o = AllZone.Display.getChoiceOptional("Select land to play", lands.toArray());
if (o!=null)
{
Card c = (Card)o;
hand.remove(c);
play.add(c);
}
}
else
{
Card c = lands.get(0);
hand.remove(c);
play.add(c);
}
}
}
};
card.addSpellAbility(ability);
ability.setDescription("You may play as many lands as you choose on your turn. Whenever you play a land other than the first land of the turn, Fastbond deals 1 damage to you.");
ability.setStackDescription(card.getName() + " - deals damage to " + card.getController() + ", plays another land.");
}//*************** END ************ END **************************
*/
//*************** START *********** START **************************
else if(cardName.equals("Conspiracy") || cardName.equals("Cover of Darkness") || cardName.equals("Door of Destinies") ||
@@ -3885,57 +3475,6 @@ public class CardFactory implements NewConstants {
}//*************** END ************ END **************************
/*
//*************** START *********** START **************************
if(cardName.equals("Raise Dead") || cardName.equals("Disentomb") || cardName.equals("Return to Battle") ||
cardName.equals("Recover"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = -5822375745105110975L;
public boolean canPlayAI() {return getGraveCreatures().size() != 0;}
public void chooseTargetAI()
{
CardList grave = getGraveCreatures();
Card target = CardFactoryUtil.AI_getBestCreature(grave);
setTargetCard(target);
}
public void resolve()
{
if(card.getController().equals(Constant.Player.Human))
{
Card c = (Card) AllZone.Display.getChoice("Select card", getGraveCreatures().toArray());
setTargetCard(c);
}
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
if(AllZone.GameAction.isCardInZone(getTargetCard(), grave))
AllZone.GameAction.moveTo(hand, getTargetCard());
}//resolve()
public boolean canPlay()
{
return getGraveCreatures().size() != 0;
}
CardList getGraveCreatures()
{
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
CardList list = new CardList(grave.getCards());
list = list.getType("Creature");
return list;
}
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
*/
//*************** START *********** START **************************
else if(cardName.equals("Terror"))
{
@@ -8079,17 +7618,18 @@ public class CardFactory implements NewConstants {
public boolean canPlayAI()
{
if(AllZone.Human_Life.getLife() <= damage)
return true;
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
CardList hand = new CardList(compHand.getCards());
if(AllZone.Human_Life.getLife() <= damage)
return AllZone.GameAction.isCardInZone(card, compHand);
if (hand.size() >= 8)
return true;
return true && AllZone.GameAction.isCardInZone(card, compHand);
check = getFlying();
return check != null;
return check != null && AllZone.GameAction.isCardInZone(card, compHand);
}
public void chooseTargetAI()
{
@@ -11232,7 +10772,8 @@ public class CardFactory implements NewConstants {
else
{
setTargetCard(c.get(0));
return true;
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer);
return AllZone.GameAction.isCardInZone(card, hand);
}
}//canPlayAI()
@@ -13583,6 +13124,7 @@ public class CardFactory implements NewConstants {
public boolean canPlayAI()
{
CardList list = new CardList(AllZone.Computer_Play.getCards());
list = list.getType("Creature");
if (list.size() > 0) {
setTargetCard(CardFactoryUtil.AI_getBestCreature(list));
return (getTargetCard() != null);
@@ -17169,6 +16711,16 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
}
}//while
AllZone.Display.getChoiceOptional("Revealed cards:", revealed.toArray());
if(getTargetCard() != null)
{
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
{
getTargetCard().addDamage(damage);
}
}
else
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage);
}
};
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
@@ -17462,7 +17014,54 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if (cardName.equals("Time Walk"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 8634822208146060381L;
public void resolve() {
final Command atEOT = new Command()
{
private static final long serialVersionUID = -8380743460207665203L;
public void execute()
{
AllZone.Phase.setPhase(Constant.Phase.Untap, card.getController());
int turn = AllZone.Phase.getTurn();
//System.out.println("Turn: " +turn);
AllZone.Phase.setTurn(++turn);
}
};
String opponent = AllZone.GameAction.getOpponent(AllZone.Phase.getActivePlayer());
AllZone.GameAction.setLastPlayerToDraw(opponent);
AllZone.EndOfTurn.addLast(atEOT);
}
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
*/
//*************** START *********** START **************************
else if (cardName.equals("Time Walk") || cardName.equals("Temporal Manipulation") || cardName.equals("Capture of Jingzhou"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 35300742940184315L;
public void resolve() {
System.out.println("Turn: " + AllZone.Phase.getTurn());
AllZone.Phase.addExtraTurn();
}
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
// Cards with Cycling abilities
// -1 means keyword "Cycling" not found

View File

@@ -3074,7 +3074,7 @@ class CardFactory_Auras {
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.addExtrinsicKeyword("This creature can't block");
crd.addExtrinsicKeyword("This creature cannot block");
}
}//execute()
};//Command
@@ -3090,7 +3090,7 @@ class CardFactory_Auras {
if (card.isEnchanting())
{
Card crd = card.getEnchanting().get(0);
crd.removeExtrinsicKeyword("This creature can't block");
crd.removeExtrinsicKeyword("This creature cannot block");
}

View File

@@ -75,12 +75,13 @@ class CardFactory_Planeswalkers {
@SuppressWarnings("unused") // library
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController());
return 0 < card2.getCounters(Counters.LOYALTY) &&
return 0 < card2.getCounters(Counters.LOYALTY) &&
AllZone.getZone(card2).is(Constant.Zone.Play) &&
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0 ;
}//canPlay()
@@ -145,7 +146,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -211,7 +213,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability1
@@ -317,7 +320,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability2
@@ -376,7 +380,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -462,7 +467,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability1
@@ -599,7 +605,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -706,7 +713,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability2
@@ -764,7 +772,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public void chooseTargetAI()
@@ -937,7 +946,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability2
@@ -994,7 +1004,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -1046,7 +1057,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability1
@@ -1170,7 +1182,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability2
@@ -1227,7 +1240,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -1288,7 +1302,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};//SpellAbility ability1
@@ -1393,7 +1408,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}
public boolean canPlayAI()
{
@@ -1432,9 +1448,6 @@ class CardFactory_Planeswalkers {
card2.addSpellAbility(ability1);
//end ability1
//ability 2
final int damage2[] = new int[1];
@@ -1464,7 +1477,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}
public boolean canPlayAI()
{
@@ -1557,7 +1571,8 @@ class CardFactory_Planeswalkers {
7 < card2.getCounters(Counters.LOYALTY) &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}
public boolean canPlayAI()
{
@@ -1655,7 +1670,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};
final Input targetLand = new Input()
@@ -1743,7 +1759,8 @@ class CardFactory_Planeswalkers {
0 < card2.getCounters(Counters.LOYALTY) &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -1830,7 +1847,8 @@ class CardFactory_Planeswalkers {
3 < card2.getCounters(Counters.LOYALTY) &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public boolean canPlayAI()
{
@@ -1915,7 +1933,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};
@@ -1946,7 +1965,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};
ability2.setDescription("-1: Target player draws a card.");
@@ -1990,7 +2010,8 @@ class CardFactory_Planeswalkers {
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"));
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};
ability3.setDescription("-10: Target player puts the top twenty cards of his or her library into his or her graveyard.");
@@ -2003,6 +2024,231 @@ class CardFactory_Planeswalkers {
return card2;
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Ajani Vengeant"))
{
final int turn[] = new int[1];
turn[0] = -1;
final Card card2 = new Card()
{
public void addDamage(int n)
{
subtractCounter(Counters.LOYALTY,n);
AllZone.GameAction.checkStateEffects();
}
};
card2.addCounter(Counters.LOYALTY, 3);
card2.setOwner(owner);
card2.setController(owner);
card2.setName(card.getName());
card2.setType(card.getType());
card2.setManaCost(card.getManaCost());
card2.addSpellAbility(new Spell_Permanent(card2));
//ability 1: destroy target noncreature permanent
final SpellAbility ability1 = new Ability(card2, "0")
{
public void resolve()
{
card2.addCounter(Counters.LOYALTY, 1);
turn[0] = AllZone.Phase.getTurn();
Card c = getTargetCard();
c.addExtrinsicKeyword("This card doesn't untap during your next untap step.");
}
public boolean canPlayAI()
{
return card2.getCounters(Counters.LOYALTY) < 8;
}
public boolean canPlay()
{
SpellAbility sa;
for (int i=0; i<AllZone.Stack.size(); i++)
{
sa = AllZone.Stack.peek(i);
if (sa.getSourceCard().equals(card2))
return false;
}
return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) &&
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
public void chooseTargetAI()
{
Card c = getPermanent();
if (getPermanent() != null)
setTargetCard(c);
}//chooseTargetAI()
Card getPermanent()
{
PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
int highestCost = 0;
Card bestCard = null;
CardList perms = new CardList(play.getCards());
perms = perms.filter(new CardListFilter()
{
public boolean addCard(Card c) {
return CardFactoryUtil.canTarget(card2, c) /* && c.isTapped()*/;
}
});
for(int i = 0; i < perms.size(); i++)
{
if(CardUtil.getConvertedManaCost(perms.get(i).getManaCost()) > highestCost && perms.get(i).isTapped())
{
highestCost = CardUtil.getConvertedManaCost(perms.get(i).getManaCost());
bestCard = perms.get(i);
}
}
if (bestCard == null && perms.size() > 0)
{
bestCard = perms.get(0);
return bestCard;
}
return null;
}
};//SpellAbility ability1
/*
ability1.setBeforePayMana(new Input()
{
private static final long serialVersionUID = 9167121234861249451L;
int check = -1;
public void showMessage()
{
if(check != AllZone.Phase.getTurn())
{
check = AllZone.Phase.getTurn();
turn[0] = AllZone.Phase.getTurn();
AllZone.Stack.push(ability1);
}
stop();
}//showMessage()
});
*/
ability1.setDescription("+1: Target permanent doesn't untap during its controller's next untap step..");
ability1.setBeforePayMana(CardFactoryUtil.input_targetPermanent(ability1));
final Ability ability2 = new Ability(card, "0")
{
int damage = 3;
public boolean canPlayAI()
{
setTargetPlayer(Constant.Player.Human);
return AllZone.Human_Life.getLife() <= damage;
}
public void resolve()
{
card2.subtractCounter(Counters.LOYALTY, 2);
if(getTargetCard() != null)
{
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card2, getTargetCard()))
{
Card c = getTargetCard();
c.addDamage(damage);
}
}
else
AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage);
AllZone.GameAction.getPlayerLife(card2.getController()).addLife(3);
}
};//ability2
Input target = new Input()
{
private static final long serialVersionUID = -6688689065812475609L;
public void showMessage()
{
AllZone.Display.showMessage("Select target Creature, Player or Planeswalker");
ButtonUtil.enableOnlyCancel();
}
public void selectButtonCancel() {stop();}
public void selectCard(Card card, PlayerZone zone)
{
if(!CardFactoryUtil.canTarget(ability2, card)){
AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?).");
}
else if((card.isCreature() || card.isPlaneswalker()) && zone.is(Constant.Zone.Play))
{
ability2.setTargetCard(card);
stopSetNext(new Input_PayManaCost(ability2));
}
}//selectCard()
public void selectPlayer(String player)
{
ability2.setTargetPlayer(player);
stopSetNext(new Input_PayManaCost(ability2));
}
};
ability2.setBeforePayMana(target);
ability2.setDescription("-2: Ajani Vengeant deals 3 damage to target creature or player and you gain 3 life.");
//ability3
final SpellAbility ability3 = new Ability(card2, "0")
{
public void resolve()
{
card2.subtractCounter(Counters.LOYALTY, 7);
turn[0] = AllZone.Phase.getTurn();
String player = getTargetPlayer();
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
CardList land = new CardList(play.getCards());
land = land.getType("Land");
for (Card c : land)
{
AllZone.GameAction.destroy(c);
}
}//resolve()
public boolean canPlayAI()
{
PlayerZone pz = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human);
CardList land = new CardList(pz.getCards());
land = land.getType("Land");
setTargetPlayer(Constant.Player.Human);
return card2.getCounters(Counters.LOYALTY) >= 8 && land.size() >= 4;
}
public boolean canPlay()
{
return AllZone.getZone(card2).is(Constant.Zone.Play) &&
card2.getCounters(Counters.LOYALTY) >= 7 &&
turn[0] != AllZone.Phase.getTurn() &&
AllZone.Phase.getActivePlayer().equals(card2.getController()) &&
!AllZone.Phase.getPhase().equals("End of Turn") &&
(AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2"))
&& AllZone.Stack.size() == 0;
}//canPlay()
};
ability3.setDescription("-7: Destroy all lands target player controls.");
ability3.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability3));
card2.addSpellAbility(ability1);
card2.addSpellAbility(ability2);
card2.addSpellAbility(ability3);
return card2;
}//*************** END ************ END **************************
return card;
}
}

View File

@@ -8,9 +8,11 @@ public class EndOfTurn implements java.io.Serializable
private CommandList at = new CommandList();
private CommandList until = new CommandList();
private CommandList last = new CommandList();
public void addAt(Command c) {at.add(c);}
public void addUntil(Command c) {until.add(c);}
public void addLast(Command c) {last.add(c);}
public void executeAt()
{
@@ -49,10 +51,14 @@ public class EndOfTurn implements java.io.Serializable
}//executeAt()
public void executeUntil() {execute(until);}
public void executeUntil() {
execute(until);
execute(last);
}
public int sizeAt() {return at.size();}
public int sizeUntil() {return until.size();}
public int sizeLast() { return last.size();}
private void execute(CommandList c)
{
@@ -60,7 +66,5 @@ public class EndOfTurn implements java.io.Serializable
for(int i = 0; i < length; i++)
c.remove(0).execute();
}
}

View File

@@ -679,6 +679,9 @@ private Card getCurrentCard(int ID)
private boolean shouldDraw = true;
private String lastPlayerToDraw = Constant.Player.Human;
public String getLastPlayerToDraw() { return lastPlayerToDraw; }
public void setLastPlayerToDraw(String s) { lastPlayerToDraw = s; }
public void drawCard(String player)
{
//TODO: show that milled player looses

View File

@@ -5,7 +5,9 @@ public class Phase extends MyObservable
{
private int phaseIndex;
private int turn;
private int extraTurns;
private String phases[][] =
{
//human's turn
@@ -52,6 +54,7 @@ public class Phase extends MyObservable
{
turn = 1;
phaseIndex = 0;
extraTurns = 0;
this.updateObservers();
}
public void setPhase(String phase, String player)
@@ -81,9 +84,6 @@ public class Phase extends MyObservable
}
}
if(getPhase().equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility))
System.out.println("HELLO");
//empty manapool:
//CardList cl = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
//cl = cl.getName("Mana Pool");
@@ -96,12 +96,31 @@ public class Phase extends MyObservable
AllZone.ManaPool.clear();
phaseIndex++;
if(phases.length <= phaseIndex)
phaseIndex = 0;
if (getPhase().equals(Constant.Phase.Cleanup) && extraTurns > 0)
{
//System.out.println("CLEANUP!");
String player = getActivePlayer();
String opponent = AllZone.GameAction.getOpponent(player);
AllZone.GameAction.setLastPlayerToDraw(opponent);
setPhase(Constant.Phase.Untap, player);
}
else
{
phaseIndex++;
if(phases.length <= phaseIndex)
phaseIndex = 0;
}
if(getPhase().equals(Constant.Phase.Untap))
if(getPhase().equals(Constant.Phase.Untap)) {
turn++;
if (extraTurns > 0)
extraTurns--;
else if(extraTurns < 0)
extraTurns++;
}
//for debugging: System.out.println(getPhase());
@@ -144,6 +163,22 @@ public class Phase extends MyObservable
{
turn = in_turn;
}
public void addExtraTurn()
{
extraTurns++;
}
public int getExtraTurns()
{
return extraTurns;
}
public void setExtraTurns(int i)
{
extraTurns = i;
}
public static void main(String args[])
{
Phase phase = new Phase();