mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* 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:
parent
152d4f1b6a
commit
04176350db
4 changed files with 240 additions and 12 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -25,7 +24,7 @@ import mage.util.CardUtil;
|
|||
public final class PyromancersGauntlet extends CardImpl {
|
||||
|
||||
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.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PyromancersGauntletReplacementEffect()));
|
||||
|
@ -58,22 +57,21 @@ class PyromancersGauntletReplacementEffect extends ReplacementEffectImpl {
|
|||
|| event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|
||||
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object instanceof Spell) {
|
||||
if (((Spell) object).isControlledBy(source.getControllerId())
|
||||
&& (object.isInstant()
|
||||
|| object.isSorcery())){
|
||||
|| object.isSorcery())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Permanent permanent = game.getBattlefield().getPermanent(event.getSourceId());
|
||||
if(permanent != null && permanent.isPlaneswalker()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
return permanent != null
|
||||
&& permanent.isPlaneswalker()
|
||||
&& source.isControlledBy(permanent.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -14,8 +15,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
@ -30,7 +29,7 @@ public final class TorbranThaneOfRedFell extends CardImpl {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// If a red source you control would deal damage to an opponent or a
|
||||
// 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.
|
||||
this.addAbility(new SimpleStaticAbility(new TorbranThaneOfRedFellEffect()));
|
||||
}
|
||||
|
|
117
Mage.Tests/src/test/java/PyromancersGauntletTest.java
Normal file
117
Mage.Tests/src/test/java/PyromancersGauntletTest.java
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue