From 608f7bd3e36bff68e46ddae66dd77296036865d2 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 28 Sep 2013 01:17:18 +0200 Subject: [PATCH] * Nemesis of Mortals - Fixed wrong cost calculation of monstrosity ability. --- .../mage/sets/theros/NemesisOfMortals.java | 32 +++++++++++++------ .../src/mage/sets/theros/ReadTheBones.java | 1 - .../abilities/keyword/MonstrosityAbility.java | 26 +++++++++------ 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Mage.Sets/src/mage/sets/theros/NemesisOfMortals.java b/Mage.Sets/src/mage/sets/theros/NemesisOfMortals.java index de094ac4566..63bebf23fe0 100644 --- a/Mage.Sets/src/mage/sets/theros/NemesisOfMortals.java +++ b/Mage.Sets/src/mage/sets/theros/NemesisOfMortals.java @@ -30,7 +30,9 @@ package mage.sets.theros; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.MonstrosityAbility; import mage.cards.CardImpl; @@ -61,20 +63,32 @@ public class NemesisOfMortals extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new NemesisOfMortalsEffect())); // {7}{G}{G}: Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard. - this.addAbility(new MonstrosityAbility("{7}{G}{G}", 5)); + Ability ability = new MonstrosityAbility("{7}{G}{G}", 5); + for (Effect effect : ability.getEffects()) { + effect.setText("Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard"); + } + this.addAbility(ability); } @Override public void adjustCosts(Ability ability, Game game) { - Player player = game.getPlayer(this.getOwnerId()); - int creatureCount = player.getGraveyard().count(new FilterCreatureCard(), game); - int cost = 4 - creatureCount; - String adjustedCost = "{G}{G}"; - if (cost > 0) { - adjustedCost = "{" + String.valueOf(cost) + "}" + adjustedCost; + if (ability instanceof SpellAbility || ability instanceof MonstrosityAbility) { + Player player = game.getPlayer(this.getOwnerId()); + int creatureCount = player.getGraveyard().count(new FilterCreatureCard(), game); + int genericMana; + if (ability instanceof MonstrosityAbility) { + genericMana = 7 - creatureCount; + } else { + genericMana = 4 - creatureCount; + } + StringBuilder adjustedCost = new StringBuilder(); + if (genericMana > 0) { + adjustedCost.append("{").append(genericMana).append("}"); + } + adjustedCost.insert(0,"{G}{G}"); + ability.getManaCostsToPay().clear(); + ability.getManaCostsToPay().load(adjustedCost.toString()); } - ability.getManaCostsToPay().clear(); - ability.getManaCostsToPay().load(adjustedCost); } public NemesisOfMortals(final NemesisOfMortals card) { diff --git a/Mage.Sets/src/mage/sets/theros/ReadTheBones.java b/Mage.Sets/src/mage/sets/theros/ReadTheBones.java index d1cc96db4d5..d1ee535e7e4 100644 --- a/Mage.Sets/src/mage/sets/theros/ReadTheBones.java +++ b/Mage.Sets/src/mage/sets/theros/ReadTheBones.java @@ -30,7 +30,6 @@ package mage.sets.theros; import java.util.UUID; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardControllerEffect; -import mage.abilities.effects.common.LoseLifeControllerEffect; import mage.abilities.effects.common.LoseLifeSourceEffect; import mage.abilities.effects.common.ScryEffect; import mage.cards.CardImpl; diff --git a/Mage/src/mage/abilities/keyword/MonstrosityAbility.java b/Mage/src/mage/abilities/keyword/MonstrosityAbility.java index 81234fca64d..280ebf1d1de 100644 --- a/Mage/src/mage/abilities/keyword/MonstrosityAbility.java +++ b/Mage/src/mage/abilities/keyword/MonstrosityAbility.java @@ -78,7 +78,7 @@ public class MonstrosityAbility extends ActivatedAbilityImpl * @param monstrosityValue use Integer.MAX_VALUE for monstrosity X. */ public MonstrosityAbility(String manaString, int monstrosityValue) { - super(Zone.BATTLEFIELD, new BecomeMonstrousSourceEffect(),new ManaCostsImpl(manaString)); + super(Zone.BATTLEFIELD, new BecomeMonstrousSourceEffect(monstrosityValue),new ManaCostsImpl(manaString)); this.monstrosityValue = monstrosityValue; } @@ -94,25 +94,21 @@ public class MonstrosityAbility extends ActivatedAbilityImpl @Override public String getRule() { - return new StringBuilder(manaCosts.getText()).append(": Monstrosity ") - .append(monstrosityValue == Integer.MAX_VALUE ? "X":monstrosityValue) - .append(". (If this creature isn't monstrous, put ") - .append(monstrosityValue == Integer.MAX_VALUE ? "X":CardUtil.numberToText(monstrosityValue)) - .append(" +1/+1 counters on it and it becomes monstrous.)").toString(); + return new StringBuilder(manaCosts.getText()).append(": ").append(super.getRule()).toString(); } public int getMonstrosityValue() { return monstrosityValue; } - - } + + class BecomeMonstrousSourceEffect extends OneShotEffect { - public BecomeMonstrousSourceEffect() { + public BecomeMonstrousSourceEffect(int monstrosityValue) { super(Outcome.BoostCreature); - this.staticText = ""; + this.staticText = setText(monstrosityValue); } public BecomeMonstrousSourceEffect(final BecomeMonstrousSourceEffect effect) { @@ -140,4 +136,14 @@ class BecomeMonstrousSourceEffect extends OneShotEffect(If this creature isn't monstrous, put ") + .append(monstrosityValue == Integer.MAX_VALUE ? "X":CardUtil.numberToText(monstrosityValue)) + .append(" +1/+1 counters on it and it becomes monstrous.)").toString(); + return sb.toString(); + } + }