Fix #10472 (Lae'zel, Vlaakith's Champion)

This commit is contained in:
xenohedron 2023-06-16 00:41:47 -04:00
parent f0da749e0a
commit 93726d6dd0
3 changed files with 138 additions and 5 deletions

View file

@ -76,7 +76,10 @@ class LaezelVlaakithsChampionEffect extends ReplacementEffectImpl {
if (source.isControlledBy(event.getTargetId())) {
return true;
}
Permanent permanent = game.getPermanent(event.getTargetId());
Permanent permanent = game.getPermanentEntering(event.getTargetId());
if (permanent == null) {
permanent = game.getPermanent(event.getTargetId());
}
return permanent != null
&& (permanent.isCreature(game) || permanent.isPlaneswalker(game))
&& permanent.isControlledBy(source.getControllerId());

View file

@ -88,13 +88,13 @@ class VorinclexMonstrousRaiderEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player targetPlayer = game.getPlayer(event.getTargetId());
Permanent targetPermanet = game.getPermanentEntering(event.getTargetId());
if (targetPermanet == null) {
targetPermanet = game.getPermanent(event.getTargetId());
Permanent targetPermanent = game.getPermanentEntering(event.getTargetId());
if (targetPermanent == null) {
targetPermanent = game.getPermanent(event.getTargetId());
}
// on a permanent or player
if (targetPlayer == null && targetPermanet == null) {
if (targetPlayer == null && targetPermanent == null) {
return false;
}

View file

@ -0,0 +1,130 @@
package org.mage.test.cards.single.clb;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class LaezelVlaakithsChampionTest extends CardTestPlayerBase {
// If you would put one or more counters on a creature or planeswalker you control or on yourself,
// put that many plus one of each of those kinds of counters on that permanent or player instead.
private static final String laezel = "Lae'zel, Vlaakith's Champion";
private static final String boon = "Dragonscale Boon";
private static final String bear = "Grizzly Bears";
private static final String rats = "Ichor Rats";
private static final String planeswalker = "Chandra, Fire Artisan"; // 4 loyalty
@Test
public void testExtraCounterOnMyStuff() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.BATTLEFIELD, playerA, bear);
addCard(Zone.HAND, playerA, boon);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, boon, bear);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(bear, CounterType.P1P1, 2 + 1);
}
@Test
public void testNoExtraCounterOnTheirStuff() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.BATTLEFIELD, playerB, bear);
addCard(Zone.HAND, playerA, boon);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, boon, bear);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(bear, CounterType.P1P1, 2);
}
@Test
public void testExtraCounterOnMyselfNotThem() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.HAND, playerA, rats);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, rats);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(playerA, CounterType.POISON, 1 + 1);
assertCounterCount(playerB, CounterType.POISON, 1);
}
@Test
public void testExtraCounterOnMyPlaneswalker() {
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.HAND, playerA, planeswalker); // {2}{R}{R}
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, planeswalker);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(playerA, planeswalker, CounterType.LOYALTY, 4 + 1);
}
@Test
public void testTheyPutCountersOnTheirStuff() {
addCard(Zone.BATTLEFIELD, playerB, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.BATTLEFIELD, playerB, bear);
addCard(Zone.HAND, playerB, boon);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, boon, bear);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(bear, CounterType.P1P1, 2);
}
@Test
public void testTheyPutCountersOnMyStuff() {
addCard(Zone.BATTLEFIELD, playerB, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, laezel);
addCard(Zone.BATTLEFIELD, playerA, bear);
addCard(Zone.HAND, playerB, boon);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, boon, bear);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(bear, CounterType.P1P1, 2);
}
@Test
public void testTheyPutCountersOnMe() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerB, laezel);
addCard(Zone.HAND, playerA, rats);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, rats);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(playerA, CounterType.POISON, 1);
assertCounterCount(playerB, CounterType.POISON, 1);
}
}