From 8f90f653711ca25e8efe6f6663ead56149c492cf Mon Sep 17 00:00:00 2001 From: Sloth Date: Fri, 24 Oct 2014 14:22:10 +0000 Subject: [PATCH] - Added Merseine. --- .gitattributes | 1 + .../main/java/forge/game/cost/CostPartMana.java | 13 +++++++++++-- .../spellability/SpellAbilityRestriction.java | 11 ++++++++++- .../spellability/SpellAbilityVariables.java | 17 +++++++++++++++++ .../res/cardsfolder/b/back_from_the_brink.txt | 2 +- forge-gui/res/cardsfolder/m/merseine.txt | 11 +++++++++++ 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 forge-gui/res/cardsfolder/m/merseine.txt diff --git a/.gitattributes b/.gitattributes index 881416d6517..aa9c8a4cce8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8842,6 +8842,7 @@ forge-gui/res/cardsfolder/m/merrow_levitator.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/merrow_reejerey.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/merrow_wavebreakers.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/merrow_witsniper.txt svneol=native#text/plain +forge-gui/res/cardsfolder/m/merseine.txt -text forge-gui/res/cardsfolder/m/mesa_enchantress.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mesa_falcon.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mesa_pegasus.txt -text diff --git a/forge-game/src/main/java/forge/game/cost/CostPartMana.java b/forge-game/src/main/java/forge/game/cost/CostPartMana.java index 73604804a8b..88dbbc3290e 100644 --- a/forge-game/src/main/java/forge/game/cost/CostPartMana.java +++ b/forge-game/src/main/java/forge/game/cost/CostPartMana.java @@ -30,6 +30,7 @@ public class CostPartMana extends CostPart { private final ManaCost cost; private boolean xCantBe0 = false; private boolean isExiledCreatureCost = false; + private boolean isEnchantedCreatureCost = false; private final String restriction; public boolean shouldPayLast() { @@ -48,7 +49,8 @@ public class CostPartMana extends CostPart { this.cost = cost; this.xCantBe0 = "XCantBe0".equals(restriction); this.isExiledCreatureCost = "Exiled".equalsIgnoreCase(restriction); - this.restriction = xCantBe0 || isExiledCreatureCost ? null : restriction; + this.isEnchantedCreatureCost = "EnchantedCost".equalsIgnoreCase(restriction); + this.restriction = xCantBe0 || isExiledCreatureCost || isEnchantedCreatureCost? null : restriction; } /** @@ -87,6 +89,11 @@ public class CostPartMana extends CostPart { public boolean isExiledCreatureCost() { return isExiledCreatureCost; } + + public boolean isEnchantedCreatureCost() { + return isEnchantedCreatureCost; + } + @Override public boolean isReusable() { return true; } @@ -119,8 +126,10 @@ public class CostPartMana extends CostPart { if (isExiledCreatureCost() && sa.getPaidList(CostExile.HashLKIListKey)!= null && !sa.getPaidList(CostExile.HashLKIListKey).isEmpty()) { // back from the brink return sa.getPaidList(CostExile.HashLKIListKey).get(0).getManaCost(); + } if (isEnchantedCreatureCost() && sa.getHostCard().getEnchantingCard() != null) { + return sa.getHostCard().getEnchantingCard().getManaCost(); } else { - return getManaToPay(); + return getManaToPay(); } } diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java index f0ecf0206e1..cee7bbcd289 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java @@ -121,6 +121,10 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { this.setOpponentOnly(true); } + if (params.containsKey("EnchantedControllerActivator")) { + this.setEnchantedControllerOnly(true); + } + if (params.containsKey("OwnerOnly")) { this.setOwnerOnly(true); } @@ -277,13 +281,18 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { return activator.equals(c.getOwner()); } - if (activator.equals(c.getController()) && !this.isOpponentOnly()) { + if (activator.equals(c.getController()) && !this.isOpponentOnly() && !isEnchantedControllerOnly()) { return true; } if (activator.isOpponentOf(c.getController()) && this.isOpponentOnly()) { return true; } + + if (c.getEnchantingCard() != null && activator.equals(c.getEnchantingCard().getController()) && this.isEnchantedControllerOnly()) { + return true; + } + if (sa.isSpell() && activator.isOpponentOf(c.getController()) && c.hasKeyword("May be played by your opponent")) { return true; } diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java index 4fda1cd1038..5e488cbec65 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java @@ -59,6 +59,7 @@ public class SpellAbilityVariables { this.instantSpeed = sav.isInstantSpeed(); this.anyPlayer = sav.isAnyPlayer(); this.opponentOnly = sav.isOpponentOnly(); + this.enchantedControllerOnly = sav.isEnchantedControllerOnly(); this.ownerOnly = sav.isOwnerOnly(); this.opponentTurn = sav.isOpponentTurn(); this.playerTurn = sav.isPlayerTurn(); @@ -110,6 +111,9 @@ public class SpellAbilityVariables { /** The b opponent only. */ private boolean opponentOnly = false; + /** The b opponent only. */ + private boolean enchantedControllerOnly = false; + /** The b owner only. */ private boolean ownerOnly = false; @@ -964,6 +968,19 @@ public class SpellAbilityVariables { this.opponentOnly = opponentOnly; } + /** + * @return the opponentOnly + */ + public boolean isEnchantedControllerOnly() { + return enchantedControllerOnly; + } + + /** + * @param opponentOnly the opponentOnly to set + */ + public void setEnchantedControllerOnly(boolean enchantedControllerOnly) { + this.enchantedControllerOnly = enchantedControllerOnly; + } /** * @return the ownerOnly */ diff --git a/forge-gui/res/cardsfolder/b/back_from_the_brink.txt b/forge-gui/res/cardsfolder/b/back_from_the_brink.txt index b7b96be72e9..f3160e8fa57 100644 --- a/forge-gui/res/cardsfolder/b/back_from_the_brink.txt +++ b/forge-gui/res/cardsfolder/b/back_from_the_brink.txt @@ -1,7 +1,7 @@ Name:Back from the Brink ManaCost:4 U U Types:Enchantment -A:AB$ CopyPermanent | Cost$ ExileFromGrave<1/Creature> Mana<20\Exiled> | CostDesc$ Exile a creature card from your graveyard and pay its mana cost | Defined$ Exiled | SorcerySpeed$ True | SpellDescription$ Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery. +A:AB$ CopyPermanent | Cost$ ExileFromGrave<1/Creature> Mana<20\Exiled> | CostDesc$ Exile a creature card from your graveyard and pay its mana cost: | Defined$ Exiled | SorcerySpeed$ True | SpellDescription$ Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery. SVar:NonStackingEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/back_from_the_brink.jpg Oracle:Exile a creature card from your graveyard and pay its mana cost: Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery. diff --git a/forge-gui/res/cardsfolder/m/merseine.txt b/forge-gui/res/cardsfolder/m/merseine.txt new file mode 100644 index 00000000000..0ef5e491d9d --- /dev/null +++ b/forge-gui/res/cardsfolder/m/merseine.txt @@ -0,0 +1,11 @@ +Name:Merseine +ManaCost:2 U U +Types:Enchantment Aura +K:Enchant creature +A:SP$ Attach | Cost$ 2 U U | ValidTgts$ Creature | AILogic$ KeepTapped +K:etbCounter:NET:3 +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CARDNAME doesn't untap during your untap step. | CheckSVar$ X | Description$ Enchanted creature doesn't untap during its controller's untap step if Merseine has a net counter on it. +A:AB$ RemoveCounter | EnchantedControllerActivator$ True | Cost$ Mana<1\EnchantedCost> | | CostDesc$ Pay enchanted creature's mana cost: | CounterType$ NET | CounterNum$ 1 | SpellDescription$ Remove a net counter from CARDNAME. Any player may activate this ability, but only if he or she controls the enchanted creature. +SVar:X:Count$CardCounters.NET +Oracle:Enchant creature\nMerseine enters the battlefield with three net counters on it.\nEnchanted creature doesn't untap during its controller's untap step if Merseine has a net counter on it.\nPay enchanted creature's mana cost: Remove a net counter from Merseine. Any player may activate this ability, but only if he or she controls the enchanted creature. +SVar:Picture:http://www.wizards.com/global/images/magic/general/Merseine.jpg