From fb6bd25d851e14c7689c41bcd4490d48951eb772 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 17 Apr 2017 20:11:01 +0200 Subject: [PATCH] * Soulstinger - Fixed a bug that a -1/-1 counter was put on target even if Soulstinger had no counters on it. --- Mage.Sets/src/mage/cards/s/Soulstinger.java | 12 ++-- .../AddingCountersToPermanentsTest.java | 62 +++++++++++++++++++ 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/Soulstinger.java b/Mage.Sets/src/mage/cards/s/Soulstinger.java index dc95c21c96c..7388b580993 100644 --- a/Mage.Sets/src/mage/cards/s/Soulstinger.java +++ b/Mage.Sets/src/mage/cards/s/Soulstinger.java @@ -33,8 +33,6 @@ import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.common.CountersSourceCount; -import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -52,21 +50,21 @@ public class Soulstinger extends CardImpl { public Soulstinger(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); - + this.subtype.add("Scorpion"); this.subtype.add("Demon"); this.power = new MageInt(4); this.toughness = new MageInt(5); // When Soulstinger enters the battlefield, put two -1/-1 counter on target creature you control. - Ability ability = new EntersBattlefieldTriggeredAbility( new AddCountersTargetEffect(CounterType.M1M1.createInstance(2))); + Ability ability = new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.M1M1.createInstance(2))); ability.addTarget(new TargetControlledCreaturePermanent()); this.addAbility(ability); // When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger. - AddCountersTargetEffect effect = - new AddCountersTargetEffect( - CounterType.M1M1.createInstance(), + AddCountersTargetEffect effect + = new AddCountersTargetEffect( + CounterType.M1M1.createInstance(0), new CountersSourceCount(CounterType.M1M1), Outcome.Detriment); effect.setText("you may put a -1/-1 counter on target creature for each -1/-1 counter on {this}"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java index f341e607f4b..5dd20d068df 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java @@ -91,4 +91,66 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { } + @Test + public void testSoulstingerNormal() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + // When Soulstinger enters the battlefield, put two -1/-1 counter on target creature you control. + // When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger. + addCard(Zone.HAND, playerA, "Soulstinger", 1); // Creature 4/5 {3}{B} + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5); + // Turn to Slag deals 5 damage to target creature. Destroy all Equipment attached to that creature. + addCard(Zone.HAND, playerB, "Turn to Slag", 1); // Sorcery {3}{R}{R} + addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soulstinger"); + addTarget(playerA, "Soulstinger"); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Turn to Slag", "Soulstinger"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Soulstinger", 1); + + assertGraveyardCount(playerB, "Turn to Slag", 1); + + assertPowerToughness(playerB, "Pillarfield Ox", 0, 2); + + } + + /** + * Soulstinger died and gave a -1/-1 counter to an opponent's creature. + * Soulstinger had no -1/-1 counters on it, but the opponent's creature did, + * so maybe checking quantity of counters on the wrong creature? + */ + @Test + public void testSoulstinger() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + // When Soulstinger enters the battlefield, put two -1/-1 counter on target creature you control. + // When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger. + addCard(Zone.HAND, playerA, "Soulstinger", 1); // Creature 4/5 {3}{B} + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5); + // Turn to Slag deals 5 damage to target creature. Destroy all Equipment attached to that creature. + addCard(Zone.HAND, playerB, "Turn to Slag", 1); // Sorcery {3}{R}{R} + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soulstinger"); + addTarget(playerA, "Silvercoat Lion"); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Turn to Slag", "Soulstinger"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerA, "Soulstinger", 1); + + assertGraveyardCount(playerB, "Turn to Slag", 1); + + assertPowerToughness(playerB, "Silvercoat Lion", 2, 2); + + } }