From dfa91ceeaf5bb7a3a9a74eb6fd273b42e286118d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 22 Oct 2013 14:05:40 +0200 Subject: [PATCH] Fixed some tests that failed after changes to rule text generation. --- .../src/mage/sets/eventide/BloomTender.java | 1 - .../src/mage/sets/eventide/HelixPinnacle.java | 35 ++++--------------- .../mage/sets/eventide/UnwillingRecruit.java | 2 +- .../cards/single/FiendOfTheShadowsTest.java | 2 +- .../test/cards/single/HomicidalBruteTest.java | 8 ++--- .../single/SorinLordOfInnistradTest.java | 2 +- .../test/cards/single/TurnToFrogTest.java | 6 ++-- .../abilities/ProtectionFromColorTest.java | 6 ++-- .../abilities/ProtectionFromTypeTest.java | 4 +-- .../counter/AddCountersSourceEffect.java | 8 +++-- 10 files changed, 27 insertions(+), 47 deletions(-) diff --git a/Mage.Sets/src/mage/sets/eventide/BloomTender.java b/Mage.Sets/src/mage/sets/eventide/BloomTender.java index 7325f0670c..ae74d382ec 100644 --- a/Mage.Sets/src/mage/sets/eventide/BloomTender.java +++ b/Mage.Sets/src/mage/sets/eventide/BloomTender.java @@ -30,7 +30,6 @@ package mage.sets.eventide; import java.util.UUID; import mage.MageInt; import mage.Mana; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; diff --git a/Mage.Sets/src/mage/sets/eventide/HelixPinnacle.java b/Mage.Sets/src/mage/sets/eventide/HelixPinnacle.java index c139d8fbc2..a7da5c5d57 100644 --- a/Mage.Sets/src/mage/sets/eventide/HelixPinnacle.java +++ b/Mage.Sets/src/mage/sets/eventide/HelixPinnacle.java @@ -35,8 +35,10 @@ import mage.abilities.condition.Condition; import mage.abilities.condition.common.HasCounterCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.WinGameEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.ShroudAbility; import mage.cards.CardImpl; import mage.constants.CardType; @@ -66,8 +68,10 @@ public class HelixPinnacle extends CardImpl { this.addAbility(ShroudAbility.getInstance()); // {X}: Put X tower counters on Helix Pinnacle. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new HelixPinnacleEffect(), new ManaCostsImpl("{X}"))); - + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.TOWER.createInstance(), new ManacostVariableValue(), true), + new ManaCostsImpl("{X}"))); + // At the beginning of your upkeep, if there are 100 or more tower counters on Helix Pinnacle, you win the game. Condition condition = new HasCounterCondition(CounterType.TOWER, 100); this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new ConditionalOneShotEffect(new WinGameEffect(), condition, rule), TargetController.YOU, false)); @@ -83,30 +87,3 @@ public class HelixPinnacle extends CardImpl { return new HelixPinnacle(this); } } - -class HelixPinnacleEffect extends OneShotEffect { - - HelixPinnacleEffect() { - super(Outcome.Benefit); - staticText = "Put X tower counters on {this}"; - } - - HelixPinnacleEffect(HelixPinnacleEffect effect) { - super(effect); - } - - @Override - public HelixPinnacleEffect copy() { - return new HelixPinnacleEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - permanent.addCounters(CounterType.TOWER.createInstance(source.getManaCostsToPay().getX()), game); - return true; - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/eventide/UnwillingRecruit.java b/Mage.Sets/src/mage/sets/eventide/UnwillingRecruit.java index 09605465c8..d4ad2c4472 100644 --- a/Mage.Sets/src/mage/sets/eventide/UnwillingRecruit.java +++ b/Mage.Sets/src/mage/sets/eventide/UnwillingRecruit.java @@ -101,4 +101,4 @@ class UnwillingRecruitEffect extends OneShotEffect { } return false; } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/FiendOfTheShadowsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/FiendOfTheShadowsTest.java index d18134f117..837796e960 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/FiendOfTheShadowsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/FiendOfTheShadowsTest.java @@ -21,7 +21,7 @@ public class FiendOfTheShadowsTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Mountain"); addCard(Zone.HAND, playerB, "Lightning Bolt"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a human: Regenerate {this}. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a human: Regenerate {this}."); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Fiend of the Shadows"); setStopAt(1, PhaseStep.END_TURN); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/HomicidalBruteTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/HomicidalBruteTest.java index cb8bf00b18..35411eabbf 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/HomicidalBruteTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/HomicidalBruteTest.java @@ -18,7 +18,7 @@ public class HomicidalBruteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Civilized Scholar"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card."); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -36,7 +36,7 @@ public class HomicidalBruteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Civilized Scholar"); addCard(Zone.LIBRARY, playerA, "Lightning Bolt"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card."); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -54,7 +54,7 @@ public class HomicidalBruteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Civilized Scholar"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card."); setStopAt(2, PhaseStep.UPKEEP); execute(); @@ -72,7 +72,7 @@ public class HomicidalBruteTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Civilized Scholar"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk", 2); - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card. "); + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then discard a card."); attack(3, playerA, "Homicidal Brute"); setStopAt(4, PhaseStep.UPKEEP); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/SorinLordOfInnistradTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/SorinLordOfInnistradTest.java index 0a8917b227..7bfbe86c11 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/SorinLordOfInnistradTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/SorinLordOfInnistradTest.java @@ -19,7 +19,7 @@ public class SorinLordOfInnistradTest extends CardTestPlayerBase { public void testCard() { addCard(Zone.BATTLEFIELD, playerA, "Sorin, Lord of Innistrad"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Put a a 1/1 black Vampire creature token with lifelink onto the battlefield. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Put a a 1/1 black Vampire creature token with lifelink onto the battlefield."); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/TurnToFrogTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/TurnToFrogTest.java index 597dc87111..576289817e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/TurnToFrogTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/TurnToFrogTest.java @@ -23,7 +23,7 @@ public class TurnToFrogTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.HAND, playerB, "Turn to Frog"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land."); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Turn to Frog", "Raging Ravine"); attack(1, playerA, "Raging Ravine"); @@ -44,10 +44,10 @@ public class TurnToFrogTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.HAND, playerB, "Turn to Frog"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land. "); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land."); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Turn to Frog", "Raging Ravine"); - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land. "); + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{R}{G}: Until end of turn {this} becomes a 3/3 red and green Elemental creature with \"Whenever this creature attacks, put a +1/+1 counter on it.\" that's still a land."); attack(3, playerA, "Raging Ravine"); setStopAt(3, PhaseStep.END_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java index a03c04598c..0836462b60 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java @@ -17,7 +17,7 @@ public class ProtectionFromColorTest extends CardTestPlayerBase { // tapped White Knight with Protection from Black addCard(Zone.BATTLEFIELD, playerB, "White Knight", 1, true); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target tapped creature. ", "White Knight"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target tapped creature.", "White Knight"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -31,11 +31,11 @@ public class ProtectionFromColorTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Runeclaw Bear", 1, true); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target tapped creature. ", "Runeclaw Bear"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target tapped creature.", "Runeclaw Bear"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - // One should have beendestroyed by Royal Assassin + // One should have been destroyed by Royal Assassin assertPermanentCount(playerB, "Runeclaw Bear", 0); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java index 685f2a296c..8f6f42e441 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java @@ -17,7 +17,7 @@ public class ProtectionFromTypeTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Tel-Jilad Fallen"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},Remove a Charge counter from {this}, {T}: put a -1/-1 counter on target creature. ", "Tel-Jilad Fallen"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},Remove a Charge counter from {this}, {T}: put a -1/-1 counter on target creature.", "Tel-Jilad Fallen"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -32,7 +32,7 @@ public class ProtectionFromTypeTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Coral Merfolk"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},Remove a Charge counter from {this}, {T}: Put a -1/-1 counter on target creature. ", "Coral Merfolk"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},Remove a Charge counter from {this}, {T}: Put a -1/-1 counter on target creature.", "Coral Merfolk"); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index e9f50a9124..8eeb56825b 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -140,10 +140,14 @@ public class AddCountersSourceEffect extends OneShotEffect 1) { sb.append(CardUtil.numberToText(counter.getCount())).append(" "); } else { - sb.append("a "); + if (amount.toString().equals("X") && amount.getMessage().isEmpty()) { + sb.append("X "); + } else { + sb.append("a "); + } } sb.append(counter.getName().toLowerCase()).append(" counter on {this}"); - if (amount.getMessage().length() > 0) { + if (!amount.getMessage().isEmpty()) { sb.append(" for each ").append(amount.getMessage()); } staticText = sb.toString();