* Deals damage divided as you choose - fixed that some cards can't choose planeswalkers (example: Arc Lightning, see #7276);

Refactor: simplified FilterCreaturePlayerOrPlaneswalker to use single permanent filter;
This commit is contained in:
Oleg Agafonov 2020-12-23 02:31:41 +04:00
parent 347a3b1e1a
commit 255c292104
18 changed files with 162 additions and 222 deletions

View file

@ -0,0 +1,39 @@
package org.mage.test.cards.single.m11;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class InfernoTitanTest extends CardTestPlayerBase {
@Test
public void test_MustAbleToTargetPlaneswalkers() {
// bug: https://github.com/magefree/mage/issues/7276
// Whenever Inferno Titan enters the battlefield or attacks, it deals 3 damage divided as you choose among one, two, or three targets.
addCard(Zone.HAND, playerA, "Inferno Titan"); // {4}{R}{R}
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
//
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Acolyte of Flame", 1); // 4
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); // 2/2
// cast and devide damage (2x to creature and 1x to planeswalker)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Inferno Titan");
addTargetAmount(playerA, "Grizzly Bears", 2);
addTargetAmount(playerA, "Chandra, Acolyte of Flame", 1);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Inferno Titan", 1);
assertGraveyardCount(playerA, "Grizzly Bears", 1);
assertCounterCount(playerA, "Chandra, Acolyte of Flame", CounterType.LOYALTY, 4 - 1);
}
}

View file

@ -8,61 +8,61 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* 4RR
* Creature - Angel
* Flying
*
* Whenever a source an opponent controls deals damage to you or a permanent you control,
* you may have Flameblade Angel deal 1 damage to that source's controller.
*
* 4RR
* Creature - Angel
* Flying
* <p>
* Whenever a source an opponent controls deals damage to you or a permanent you control,
* you may have Flameblade Angel deal 1 damage to that source's controller.
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class FlamebladeAngelTest extends CardTestPlayerBase {
/**
* Reported bug: Not triggering when damage is dealt to the creatures I control.
*/
@Test
public void testDamageToCreature() {
addCard(Zone.BATTLEFIELD, playerA, "Flameblade Angel");
addCard(Zone.BATTLEFIELD, playerA, "Wall of Roots"); // 0/5
addCard(Zone.HAND, playerB, "Shock"); // instant deals 2 dmg to creature/player
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock");
addTarget(playerB, "Wall of Roots");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
Permanent roots = getPermanent("Wall of Roots", playerA);
Assert.assertEquals("Wall of Roots should have 2 damage dealt to it", 2, roots.getDamage());
assertGraveyardCount(playerB, "Shock", 1);
assertLife(playerA, 20);
assertLife(playerB, 19); // Angel should deal 1 damage to Shock's controller
}
/**
* Reported bug: Not triggering when damage is dealt to the creatures I control.
*/
@Test
public void testDamageToMultipleCreatures() {
addCard(Zone.BATTLEFIELD, playerA, "Flameblade Angel");
addCard(Zone.BATTLEFIELD, playerA, "Wall of Roots"); // 0/5
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); // 2/2
addCard(Zone.HAND, playerB, "Shock", 2); // instant deals 2 dmg to creature/player
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock");
addTarget(playerB, "Wall of Roots");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock");
addTarget(playerB, "Grizzly Bears");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
Permanent roots = getPermanent("Wall of Roots", playerA);
Assert.assertEquals("Wall of Roots should have 2 damage dealt to it", 2, roots.getDamage());
assertGraveyardCount(playerB, "Shock", 2);
@ -70,27 +70,27 @@ public class FlamebladeAngelTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 18); // Angel should deal 1 damage twice to Shock's controller
}
/**
* Reported bug: Not triggering when damage is dealt to the creatures I control.
*/
@Test
public void testCombatDamageToCreatures() {
addCard(Zone.BATTLEFIELD, playerA, "Flameblade Angel");
addCard(Zone.BATTLEFIELD, playerA, "Wall of Roots"); // 0/5
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard"); // 2/1
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // 3/3
attack(2, playerB, "Elite Vanguard");
attack(2, playerB, "Hill Giant");
block(2, playerA, "Wall of Roots", "Hill Giant");
block(2, playerA, "Grizzly Bears", "Elite Vanguard");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
Permanent roots = getPermanent("Wall of Roots", playerA);
Assert.assertEquals("Wall of Roots should have 3 damage dealt to it", 3, roots.getDamage());
assertGraveyardCount(playerA, "Grizzly Bears", 1);

View file

@ -2281,9 +2281,6 @@ public class TestPlayer implements Player {
if (filter instanceof FilterCreatureOrPlayer) {
filter = ((FilterCreatureOrPlayer) filter).getCreatureFilter();
}
if (filter instanceof FilterCreaturePlayerOrPlaneswalker) {
filter = ((FilterCreaturePlayerOrPlaneswalker) filter).getCreatureFilter();
}
if (filter instanceof FilterPermanentOrPlayer) {
filter = ((FilterPermanentOrPlayer) filter).getPermanentFilter();
}