* Fixed Leech Bonder -1/-1 Tokens don't kill off enemy creatures (fixes #1975).

This commit is contained in:
LevelX2 2016-08-06 11:33:24 +02:00
parent d0db2d51ed
commit 9df373e8f3
4 changed files with 73 additions and 30 deletions

View file

@ -123,13 +123,16 @@ class LeechBonderEffect extends OneShotEffect {
possibleChoices.add(counterName); possibleChoices.add(counterName);
} }
choice.setChoices(possibleChoices); choice.setChoices(possibleChoices);
if (controller.choose(Outcome.AIDontUseIt, choice, game)) { if (controller.choose(outcome, choice, game)) {
String chosen = choice.getChoice(); String chosen = choice.getChoice();
if (fromPermanent.getCounters().containsKey(chosen)) { if (fromPermanent.getCounters().containsKey(chosen)) {
Counter counter = new Counter(chosen, 1); CounterType counterType = CounterType.findByName(chosen);
fromPermanent.removeCounters(counter, game); if (counterType != null) {
toPermanent.addCounters(counter, game); Counter counter = counterType.createInstance();
return true; fromPermanent.removeCounters(counter, game);
toPermanent.addCounters(counter, game);
return true;
}
} }
} }
return false; return false;

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package org.mage.test.cards.abilities.keywords; package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
@ -38,15 +37,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class ProliferateTest extends CardTestPlayerBase {
public class ProliferateTest extends CardTestPlayerBase{
/** /**
* Volt Charge {2}{R} * Volt Charge {2}{R} Instant Volt Charge deals 3 damage to target creature
* Instant * or player. Proliferate. (You choose any number of permanents and/or
* Volt Charge deals 3 damage to target creature or player. * players with counters on them, then give each another counter of a kind
* Proliferate. (You choose any number of permanents and/or players with counters * already there.)
* on them, then give each another counter of a kind already there.)
*/ */
@Test @Test
public void testCastFromHandMovedToExile() { public void testCastFromHandMovedToExile() {
@ -55,11 +52,9 @@ public class ProliferateTest extends CardTestPlayerBase{
addCard(Zone.HAND, playerA, "Volt Charge"); addCard(Zone.HAND, playerA, "Volt Charge");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volt Charge", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volt Charge", playerB);
addTarget(playerA, "Chandra, Pyromaster"); addTarget(playerA, "Chandra, Pyromaster");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -69,19 +64,22 @@ public class ProliferateTest extends CardTestPlayerBase{
assertCounterCount("Chandra, Pyromaster", CounterType.LOYALTY, 5); // 4 + 1 from proliferate assertCounterCount("Chandra, Pyromaster", CounterType.LOYALTY, 5); // 4 + 1 from proliferate
} }
/** /**
* Counters aren't cancelling each other out. Reproducible with any creature (graft and bloodthirst in my case) * Counters aren't cancelling each other out. Reproducible with any creature
* with a single +1/+1 counter on it, with a single -1/-1 placed on it (Grim Affliction, Instill Infection, etc). * (graft and bloodthirst in my case) with a single +1/+1 counter on it,
* The counters should cancel each other out, leaving neither on the creature, which they don't (though visually * with a single -1/-1 placed on it (Grim Affliction, Instill Infection,
* there aren't any counters sitting on the card). Triggering proliferate at any point now (Thrumming Bird, * etc). The counters should cancel each other out, leaving neither on the
* Steady Progress, etc) will give you the option to add another of either counter, where you shouldn't have any as an option. * creature, which they don't (though visually there aren't any counters
* sitting on the card). Triggering proliferate at any point now (Thrumming
* Bird, Steady Progress, etc) will give you the option to add another of
* either counter, where you shouldn't have any as an option.
*/ */
@Test @Test
public void testValidTargets() { public void testValidTargets() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
// Put a +1/+1 counter on target creature. // Put a +1/+1 counter on target creature.
addCard(Zone.HAND, playerA, "Battlegrowth"); // {G} addCard(Zone.HAND, playerA, "Battlegrowth"); // {G}
// Proliferate. (You choose any number of permanents and/or players with counters on them, then give each another counter of a kind already there.) // Proliferate. (You choose any number of permanents and/or players with counters on them, then give each another counter of a kind already there.)
@ -90,27 +88,27 @@ public class ProliferateTest extends CardTestPlayerBase{
addCard(Zone.BATTLEFIELD, playerB, "Sporeback Troll"); // has two +1/+1 counter addCard(Zone.BATTLEFIELD, playerB, "Sporeback Troll"); // has two +1/+1 counter
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3);
// Put a -1/-1 counter on target creature, then proliferate. // Put a -1/-1 counter on target creature, then proliferate.
addCard(Zone.HAND, playerB, "Grim Affliction"); // {B}{2} addCard(Zone.HAND, playerB, "Grim Affliction"); // {B}{2}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth", "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth", "Silvercoat Lion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grim Affliction", "Silvercoat Lion"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grim Affliction", "Silvercoat Lion");
// proliferate Sporeback Troll // proliferate Sporeback Troll
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Steady Progress"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Steady Progress");
// Silvercoat Lion may not be a valid target now // Silvercoat Lion may not be a valid target now
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertGraveyardCount(playerA, "Battlegrowth", 1); assertGraveyardCount(playerA, "Battlegrowth", 1);
assertGraveyardCount(playerA, "Steady Progress", 1); assertGraveyardCount(playerA, "Steady Progress", 1);
assertGraveyardCount(playerB, "Grim Affliction", 1); assertGraveyardCount(playerB, "Grim Affliction", 1);
assertCounterCount("Silvercoat Lion", CounterType.P1P1, 0); // no valid target because no counter assertCounterCount("Silvercoat Lion", CounterType.P1P1, 0); // no valid target because no counter
assertCounterCount("Sporeback Troll", CounterType.P1P1, 3); // 2 + 1 from proliferate assertCounterCount("Sporeback Troll", CounterType.P1P1, 3); // 2 + 1 from proliferate
assertPowerToughness(playerB, "Sporeback Troll", 3, 3);
} }
} }

View file

@ -106,4 +106,37 @@ public class MovingCounterTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Ruin Processor", 3, 4); assertPowerToughness(playerA, "Ruin Processor", 3, 4);
} }
/**
* The card Leech Bonder (or the token mechanic) doesn't seem to work quite
* as intended. If moving a -1/-1 counter from the Leech Bonder onto an
* enemy creature with 1/1 the creature stays as a 1/1 with the token being
* displayed on it. Going by the rules the creature should have 0/0 and thus
* be put into the graveyard.
*/
@Test
public void testLeechBonder() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// Leech Bonder enters the battlefield with two -1/-1 counters on it.
// {U}, {untap}: Move a counter from target creature onto another target creature.
addCard(Zone.HAND, playerA, "Leech Bonder", 1);// Creature 3/3 - {2}{U}
addCard(Zone.BATTLEFIELD, playerB, "Ley Druid", 1); // 1/1
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Leech Bonder");
attack(3, playerA, "Leech Bonder");
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{U},", "Leech Bonder");
addTarget(playerA, "Ley Druid");
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerB, 19);
assertGraveyardCount(playerB, "Ley Druid", 1);
assertPowerToughness(playerA, "Leech Bonder", 2, 2);
}
} }

View file

@ -166,4 +166,13 @@ public enum CounterType {
return new Counter(name, amount); return new Counter(name, amount);
} }
} }
public static CounterType findByName(String name) {
for (CounterType counterType : values()) {
if (counterType.getName().equals(name)) {
return counterType;
}
}
return null;
}
} }