* Pyromancer's Gauntlet - Fixed that the effect was applied to all damage of planeswalker not only to planeswalker of the Gauntlets's controller (fixes #6877).

This commit is contained in:
LevelX2 2020-07-23 11:52:09 +02:00
parent 152d4f1b6a
commit 04176350db
4 changed files with 240 additions and 12 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID; import java.util.UUID;
@ -25,7 +24,7 @@ import mage.util.CardUtil;
public final class PyromancersGauntlet extends CardImpl { public final class PyromancersGauntlet extends CardImpl {
public PyromancersGauntlet(UUID ownerId, CardSetInfo setInfo) { public PyromancersGauntlet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
// If a red instant or sorcery spell you control or a red planeswalker you control would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead. // If a red instant or sorcery spell you control or a red planeswalker you control would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PyromancersGauntletReplacementEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PyromancersGauntletReplacementEffect()));
@ -65,15 +64,14 @@ class PyromancersGauntletReplacementEffect extends ReplacementEffectImpl {
if (object instanceof Spell) { if (object instanceof Spell) {
if (((Spell) object).isControlledBy(source.getControllerId()) if (((Spell) object).isControlledBy(source.getControllerId())
&& (object.isInstant() && (object.isInstant()
|| object.isSorcery())){ || object.isSorcery())) {
return true; return true;
} }
} }
Permanent permanent = game.getBattlefield().getPermanent(event.getSourceId()); Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
if(permanent != null && permanent.isPlaneswalker()){ return permanent != null
return true; && permanent.isPlaneswalker()
} && source.isControlledBy(permanent.getControllerId());
return false;
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -14,8 +15,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID;
/** /**
* @author TheElk801 * @author TheElk801
*/ */

View file

@ -0,0 +1,117 @@
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PyromancersGauntletTest extends CardTestPlayerBase {
@Test
public void basicTest() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerA, "Pyromancer's Gauntlet"); // Artifact {5}
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Pillarfield Ox");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 15); // Bolt 3 + 2
assertGraveyardCount(playerA, "Lightning Bolt", 2);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
@Test
public void opponentsPyromancersGauntletAppliedToOwnPlaneswalkerTest() {
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerB, "Pyromancer's Gauntlet"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(2, playerB, "Barbarian Horde");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 13); // Attack from Horde 3 + Dmage 2+2 from planeswalker
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
@Test
public void with3PlayersTest() throws GameException {
playerC = createPlayer(currentGame, playerC, "PlayerC");
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerC, "Pyromancer's Gauntlet"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(3, playerB, "Barbarian Horde");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(4, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3 + Dmage 2 from planeswalker
assertLife(playerB, 18); // Damage from planeswalker 2
assertLife(playerC, 20);
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
}

View file

@ -0,0 +1,114 @@
package org.mage.test.cards.single.eld;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class TorbranThaneOfRedFellTest extends CardTestPlayerBase {
@Test
public void basicTest() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerA, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
attack(1, playerA, "Torbran, Thane of Red Fell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Pillarfield Ox");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 11); // damage from: attack 2 + 2 Bolt 3 + 2
assertGraveyardCount(playerA, "Lightning Bolt", 2);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
@Test
public void opponentsTornbanAppliedToOwnPlaneswalkerTest() {
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerB, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(2, playerB, "Barbarian Horde");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3+2
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount("Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
}
@Test
public void with3PlayersTest() throws GameException {
playerC = createPlayer(currentGame, playerC, "PlayerC");
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerC, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(3, playerB, "Barbarian Horde", playerA);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(4, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3+2
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
}