* 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);
}
choice.setChoices(possibleChoices);
if (controller.choose(Outcome.AIDontUseIt, choice, game)) {
if (controller.choose(outcome, choice, game)) {
String chosen = choice.getChoice();
if (fromPermanent.getCounters().containsKey(chosen)) {
Counter counter = new Counter(chosen, 1);
fromPermanent.removeCounters(counter, game);
toPermanent.addCounters(counter, game);
return true;
CounterType counterType = CounterType.findByName(chosen);
if (counterType != null) {
Counter counter = counterType.createInstance();
fromPermanent.removeCounters(counter, game);
toPermanent.addCounters(counter, game);
return true;
}
}
}
return false;

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
@ -38,15 +37,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class ProliferateTest extends CardTestPlayerBase{
public class ProliferateTest extends CardTestPlayerBase {
/**
* Volt Charge {2}{R}
* Instant
* Volt Charge deals 3 damage to target creature or player.
* Proliferate. (You choose any number of permanents and/or players with counters
* on them, then give each another counter of a kind already there.)
* Volt Charge {2}{R} Instant Volt Charge deals 3 damage to target creature
* or player. Proliferate. (You choose any number of permanents and/or
* players with counters on them, then give each another counter of a kind
* already there.)
*/
@Test
public void testCastFromHandMovedToExile() {
@ -55,11 +52,9 @@ public class ProliferateTest extends CardTestPlayerBase{
addCard(Zone.HAND, playerA, "Volt Charge");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volt Charge", playerB);
addTarget(playerA, "Chandra, Pyromaster");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -69,19 +64,22 @@ public class ProliferateTest extends CardTestPlayerBase{
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)
* with a single +1/+1 counter on it, with a single -1/-1 placed on it (Grim Affliction, Instill Infection, etc).
* The counters should cancel each other out, leaving neither on the 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.
* Counters aren't cancelling each other out. Reproducible with any creature
* (graft and bloodthirst in my case) with a single +1/+1 counter on it,
* with a single -1/-1 placed on it (Grim Affliction, Instill Infection,
* etc). The counters should cancel each other out, leaving neither on the
* 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
public void testValidTargets() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
// Put a +1/+1 counter on target creature.
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.)
@ -90,27 +88,27 @@ public class ProliferateTest extends CardTestPlayerBase{
addCard(Zone.BATTLEFIELD, playerB, "Sporeback Troll"); // has two +1/+1 counter
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}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth", "Silvercoat Lion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grim Affliction", "Silvercoat Lion");
// proliferate Sporeback Troll
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Steady Progress");
// Silvercoat Lion may not be a valid target now
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Battlegrowth", 1);
assertGraveyardCount(playerA, "Steady Progress", 1);
assertGraveyardCount(playerB, "Grim Affliction", 1);
assertCounterCount("Silvercoat Lion", CounterType.P1P1, 0); // no valid target because no counter
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);
}
/**
* 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);
}
}
public static CounterType findByName(String name) {
for (CounterType counterType : values()) {
if (counterType.getName().equals(name)) {
return counterType;
}
}
return null;
}
}