Fixed some tests that failed after changes to rule text generation.

This commit is contained in:
LevelX2 2013-10-22 14:05:40 +02:00
parent da099c2da5
commit dfa91ceeaf
10 changed files with 27 additions and 47 deletions

View file

@ -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;

View file

@ -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<HelixPinnacle> {
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<HelixPinnacle> {
return new HelixPinnacle(this);
}
}
class HelixPinnacleEffect extends OneShotEffect<HelixPinnacleEffect> {
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;
}
}

View file

@ -101,4 +101,4 @@ class UnwillingRecruitEffect extends OneShotEffect<UnwillingRecruitEffect> {
}
return false;
}
}
}

View file

@ -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);

View file

@ -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();

View file

@ -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();

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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();

View file

@ -140,10 +140,14 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
if (counter.getCount() > 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();