From 29101769b4d304c48b7086c2be1a81ae6d5b60e2 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 07:17:58 +0000 Subject: [PATCH] 1) fixed EndOfCombat.executeUntil() never being called 2) added a parameter to CardFactoryUtil.revertManland() for original cost 3) added Jade Statue (from original base Alpha) --- .gitattributes | 1 + res/cardsfolder/jade_statue.txt | 8 +++++ src/forge/CardFactory.java | 55 ++++++++++++++++++++++++++++++++ src/forge/CardFactoryUtil.java | 4 +-- src/forge/CardFactory_Lands.java | 30 ++++++++--------- src/forge/EndOfCombat.java | 2 +- src/forge/InputControl.java | 1 + src/forge/Phase.java | 15 +++++++++ 8 files changed, 98 insertions(+), 18 deletions(-) create mode 100644 res/cardsfolder/jade_statue.txt diff --git a/.gitattributes b/.gitattributes index eb35c97a77d..bf9a70b4880 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1801,6 +1801,7 @@ res/cardsfolder/jackal_pup.txt -text svneol=native#text/plain res/cardsfolder/jackalope_herd.txt -text svneol=native#text/plain res/cardsfolder/jacques_le_vert.txt -text svneol=native#text/plain res/cardsfolder/jade_leech.txt -text svneol=native#text/plain +res/cardsfolder/jade_statue.txt -text svneol=native#text/plain res/cardsfolder/jagwasp_swarm.txt -text svneol=native#text/plain res/cardsfolder/jalum_tome.txt -text svneol=native#text/plain res/cardsfolder/jamuraan_lion.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/jade_statue.txt b/res/cardsfolder/jade_statue.txt new file mode 100644 index 00000000000..3ca36df4c33 --- /dev/null +++ b/res/cardsfolder/jade_statue.txt @@ -0,0 +1,8 @@ +Name:Jade Statue +ManaCost:4 +Types:Artifact +Text:2: Jade Statue becomes a 3/6 Golem artifact creature until end of combat. Activate this ability only during combat. +K:SVar:RemAIDeck:True +K:SVar:Rarity:Rare +K:SVar:Picture:http://www.wizards.com/global/images/magic/general/jade_statue.jpg +End \ No newline at end of file diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 566bfb50565..8f03d9fa057 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -10105,6 +10105,61 @@ public class CardFactory implements NewConstants { ability.setStackDescription(cardName+" - Exchange life totals with target opponent."); card.addSpellAbility(ability); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Jade Statue")) { + /* + * 2: Jade Statue becomes a 3/6 Golem artifact creature until + * end of combat. Activate this ability only during combat. + */ + + final Command untilEOC = new Command() { + private static final long serialVersionUID = -8432597117196682284L; + + public void execute() { + Card c = card; + String[] types = { "Creature", "Golem" }; + String[] keywords = { }; + CardFactoryUtil.revertManland(c, types, keywords, "4"); + } + }; + + final SpellAbility a1 = new Ability(card, "2") { + @Override + public boolean canPlayAI() { + return false; + } + + @Override + public boolean canPlay() { + return Phase.canPlayDuringCombat(); + } + + @Override + public void resolve() { + Card c = card; + String[] types = { "Creature", "Golem" }; + String[] keywords = { }; + CardFactoryUtil.activateManland(c, 3, 6, types, keywords, "4"); + + AllZone.EndOfCombat.addUntil(untilEOC); + } + };//SpellAbility + + //card.clearSpellKeepManaAbility(); + card.addSpellAbility(a1); + a1.setStackDescription(card + " becomes a 3/6 Golem creature until End of Combat"); + + Command paid1 = new Command() { + private static final long serialVersionUID = 1531378274457977155L; + + public void execute() { + AllZone.Stack.add(a1); + } + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + }//*************** END ************ END ************************** // Cards with Cycling abilities diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 11a5218cd4f..455d3489798 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -4428,7 +4428,7 @@ public class CardFactoryUtil { } - public static void revertManland(Card c, String[] removeTypes, String[] removeKeywords) { + public static void revertManland(Card c, String[] removeTypes, String[] removeKeywords, String cost) { c.setBaseAttack(0); c.setBaseDefense(0); for(String r : removeTypes) @@ -4437,7 +4437,7 @@ public class CardFactoryUtil { for(String k : removeKeywords) c.removeIntrinsicKeyword(k); - c.setManaCost(""); + c.setManaCost(cost); c.unEquipAllCards(); } diff --git a/src/forge/CardFactory_Lands.java b/src/forge/CardFactory_Lands.java index 0f36643ed38..e3bb175fbbd 100644 --- a/src/forge/CardFactory_Lands.java +++ b/src/forge/CardFactory_Lands.java @@ -520,7 +520,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Faerie" }; String[] keywords = { "Flying" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -577,7 +577,7 @@ class CardFactory_Lands { String[] types = { "Creature", "Soldier" }; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -633,7 +633,7 @@ class CardFactory_Lands { String[] removeTypes = { "Creature", "Ape" }; String[] removeKeywords = { "Trample" }; - CardFactoryUtil.revertManland(c, removeTypes, removeKeywords); + CardFactoryUtil.revertManland(c, removeTypes, removeKeywords, ""); } }; @@ -687,7 +687,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Artifact", "Creature", "Blinkmoth" }; String[] keywords = { "Flying" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -854,7 +854,7 @@ class CardFactory_Lands { String[] types = { "Artifact", "Creature", "Assembly-Worker" }; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -2264,7 +2264,7 @@ class CardFactory_Lands { String[] types = { "Creature" }; String[] keywords = { "Changeling" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -2340,7 +2340,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Skeleton" }; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); c.removeSpellAbility(a2); } }; @@ -2950,7 +2950,7 @@ class CardFactory_Lands { String[] types = { "Creature", "Zombie", "Plant" }; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -2998,7 +2998,7 @@ class CardFactory_Lands { String[] types = { "Creature", "Warrior" }; String[] keywords = { "First Strike" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -3097,7 +3097,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Elemental" }; String[] keywords = { "Vigilance", "Flying" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -3188,7 +3188,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Elemental" }; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); c.removeSpellAbility(X_ability); } }; @@ -3241,7 +3241,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Elemental" }; String[] keywords = { "Reach" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -3280,7 +3280,7 @@ class CardFactory_Lands { Card c = card; String[] types = { "Creature", "Elemental" }; String[] keywords = { "Unblockable" }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -3319,7 +3319,7 @@ class CardFactory_Lands { String[] types = { "Creature", "Elemental"}; String[] keywords = { "Whenever this creature attacks, put a +1/+1 counter on it." }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; @@ -3361,7 +3361,7 @@ class CardFactory_Lands { String[] types = { "Artifact", "Creature", "Golem"}; String[] keywords = { }; - CardFactoryUtil.revertManland(c, types, keywords); + CardFactoryUtil.revertManland(c, types, keywords, ""); } }; diff --git a/src/forge/EndOfCombat.java b/src/forge/EndOfCombat.java index d8e967e4a8a..88fc7e6e78e 100644 --- a/src/forge/EndOfCombat.java +++ b/src/forge/EndOfCombat.java @@ -1,7 +1,7 @@ package forge; //import java.util.*; -//handles "until end of turn" and "at end of turn" commands from cards +//handles "until end of combat" and "at end of combat" commands from cards public class EndOfCombat implements java.io.Serializable { diff --git a/src/forge/InputControl.java b/src/forge/InputControl.java index 60249279ba3..166475cf7a3 100644 --- a/src/forge/InputControl.java +++ b/src/forge/InputControl.java @@ -198,6 +198,7 @@ public class InputControl extends MyObservable implements java.io.Serializable { } */ else if(phase.equals(Constant.Phase.End_Of_Combat)) { + AllZone.EndOfCombat.executeUntil(); AllZone.EndOfCombat.executeAt(); AllZone.Phase.setNeedToNextPhase(true); appliedExaltedEffects = false; diff --git a/src/forge/Phase.java b/src/forge/Phase.java index 024deb7a654..67d67163744 100644 --- a/src/forge/Phase.java +++ b/src/forge/Phase.java @@ -440,4 +440,19 @@ public class Phase extends MyObservable return ((AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)) && AllZone.GameAction.isPlayerTurn(player)) && AllZone.Stack.size() == 0); } + + public static boolean canPlayDuringCombat() { + String phase = AllZone.Phase.getPhase(); + ArrayList validPhases = new ArrayList(); + validPhases.add(Constant.Phase.Combat_Before_Declare_Attackers_InstantAbility); + validPhases.add(Constant.Phase.Combat_Declare_Attackers); + validPhases.add(Constant.Phase.Combat_Declare_Attackers_InstantAbility); + validPhases.add(Constant.Phase.Combat_Declare_Blockers); + validPhases.add(Constant.Phase.Combat_Declare_Blockers_InstantAbility); + validPhases.add(Constant.Phase.Combat_After_Declare_Blockers); + validPhases.add(Constant.Phase.Combat_FirstStrikeDamage); + validPhases.add(Constant.Phase.Combat_Damage); + + return validPhases.contains(phase); + } }