From 3b386eb88d89e7129adf633e6624f7ca12931a87 Mon Sep 17 00:00:00 2001 From: moomarc Date: Wed, 29 Aug 2012 12:29:03 +0000 Subject: [PATCH] - Added Windbrisk Heights --- .gitattributes | 1 + res/cardsfolder/w/windbrisk_heights.txt | 16 +++++++++ .../card/cardfactory/CardFactoryUtil.java | 11 ++++++ .../java/forge/game/phase/CombatUtil.java | 1 + .../java/forge/game/phase/PhaseHandler.java | 1 + src/main/java/forge/game/player/Player.java | 35 +++++++++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 res/cardsfolder/w/windbrisk_heights.txt diff --git a/.gitattributes b/.gitattributes index e7d2b8a6217..b15ebbdd18f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10837,6 +10837,7 @@ res/cardsfolder/w/wind_spirit.txt -text res/cardsfolder/w/wind_zendikon.txt svneol=native#text/plain res/cardsfolder/w/windborn_muse.txt svneol=native#text/plain res/cardsfolder/w/windborne_charge.txt svneol=native#text/plain +res/cardsfolder/w/windbrisk_heights.txt -text res/cardsfolder/w/windbrisk_raptor.txt svneol=native#text/plain res/cardsfolder/w/windfall.txt svneol=native#text/plain res/cardsfolder/w/winding_canyons.txt -text diff --git a/res/cardsfolder/w/windbrisk_heights.txt b/res/cardsfolder/w/windbrisk_heights.txt new file mode 100644 index 00000000000..4d8cb52171a --- /dev/null +++ b/res/cardsfolder/w/windbrisk_heights.txt @@ -0,0 +1,16 @@ +Name:Windbrisk Heights +ManaCost:no cost +Types:Land +Text:no text +K:Hideaway +T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. +SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True +A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add W to your mana pool. +A:AB$ Play | Cost$ W T | Defined$ Remembered | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | ForgetRemembered$ True | PlayerTurn$ True | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn. +SVar:X:Count$AttackersDeclared +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/windbrisk_heights.jpg +SetInfo:LRW|Rare|http://magiccards.info/scans/en/lw/281.jpg +Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {W} to your mana pool.\n{W}, {T}: You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn. +End \ No newline at end of file diff --git a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java index 27537bae5b4..1d112ad2bfa 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java @@ -2487,6 +2487,12 @@ public class CardFactoryUtil { } } + if (sq[0].contains("AttackersDeclared")) { + if (players.size() > 0) { + return CardFactoryUtil.doXMath(players.get(0).getAttackersDeclaredThisTurn(), m, source); + } + } + return CardFactoryUtil.doXMath(n, m, source); } @@ -3036,6 +3042,11 @@ public class CardFactoryUtil { return CardFactoryUtil.doXMath(res.size(), m, c); } + // Count$AttackersDeclared + if (sq[0].contains("AttackersDeclared")) { + return CardFactoryUtil.doXMath(cardController.getAttackersDeclaredThisTurn(), m, c); + } + // Count$ThisTurnCast // Count$LastTurnCast if (sq[0].contains("ThisTurnCast") || sq[0].contains("LastTurnCast")) { diff --git a/src/main/java/forge/game/phase/CombatUtil.java b/src/main/java/forge/game/phase/CombatUtil.java index d965233fe2b..fbea2cd5d0f 100644 --- a/src/main/java/forge/game/phase/CombatUtil.java +++ b/src/main/java/forge/game/phase/CombatUtil.java @@ -2638,6 +2638,7 @@ public class CombatUtil { c.getDamageHistory().setCreatureAttackedThisCombat(true); c.getController().setAttackedWithCreatureThisTurn(true); + c.getController().incrementAttackersDeclaredThisTurn(); } // checkDeclareAttackers /** diff --git a/src/main/java/forge/game/phase/PhaseHandler.java b/src/main/java/forge/game/phase/PhaseHandler.java index 55feb218665..3246a83fcbc 100644 --- a/src/main/java/forge/game/phase/PhaseHandler.java +++ b/src/main/java/forge/game/phase/PhaseHandler.java @@ -459,6 +459,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { player.setAttackedWithCreatureThisTurn(false); player.setNumLandsPlayed(0); player.clearAssignedDamage(); + player.resetAttackersDeclaredThisTurn(); } this.getPlayerTurn().removeKeyword("Skip all combat phases of this turn."); break; diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index 68120e36640..ac1d4ae4468 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -31,6 +31,7 @@ import javax.swing.JOptionPane; import forge.AllZone; import forge.AllZoneUtil; import forge.Card; +import forge.CardDamageHistory; import forge.CardList; import forge.CardUtil; import forge.Constant; @@ -134,6 +135,9 @@ public abstract class Player extends GameEntity { /** The attackedWithCreatureThisTurn. */ private boolean attackedWithCreatureThisTurn = false; + /** The playerAttackCountThisTurn. */ + private int attackersDeclaredThisTurn = 0; + /** The zones. */ private final Map zones = new EnumMap(ZoneType.class); @@ -2042,6 +2046,37 @@ public abstract class Player extends GameEntity { this.attackedWithCreatureThisTurn = b; } + /** + *

+ * Gets the number of attackers declared by Player this turn. + *

+ * + * @return a boolean. + */ + public final int getAttackersDeclaredThisTurn() { + return this.attackersDeclaredThisTurn; + } + + /** + *

+ * Increase number of attackers declared by Player this turn. + *

+ * + */ + public final void incrementAttackersDeclaredThisTurn() { + this.attackersDeclaredThisTurn++; + } + + /** + *

+ * Resets number of attackers declared by Player this turn. + *

+ * + */ + public final void resetAttackersDeclaredThisTurn() { + this.attackersDeclaredThisTurn = 0; + } + // ////////////////////////////// /** *