* Added ID name instead of only the name to the replacement effect selector list. Otherwise you can't identify the related source if you have multiple sources with the same name (related #6298).

This commit is contained in:
LevelX2 2020-06-09 16:37:42 +02:00
parent 3e3c43f010
commit eb846c0499
5 changed files with 69 additions and 9 deletions

View file

@ -65,7 +65,7 @@ class PalisadeGiantReplacementEffect extends ReplacementEffectImpl {
PalisadeGiantReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.RedirectDamage);
staticText = "All damage that would be dealt to you or another permanent you control is dealt to Palisade Giant instead";
staticText = "All damage that would be dealt to you or another permanent you control is dealt to {this} instead";
}
PalisadeGiantReplacementEffect(final PalisadeGiantReplacementEffect effect) {

View file

@ -177,15 +177,15 @@ public class MadnessTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Forest");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Falkenrath Gorger");
setChoice(playerA, "Yes"); // Discard a card and put a +1/+1 counter on that creature, it gains haste until end of turn, and it becomes a Vampire in addition to its other types?
setChoice(playerA, "Asylum Visitor");
setChoice(playerA, "Asylum Visitor: Madness {1}{B}"); // choose replacement effect (TODO: 2 same madness effetcs: one from Asylum Visitor, one from Falkenrath -- is that ok?!)
//
setChoice(playerA, "Yes"); // use madness triggered ability
setChoice(playerA, "Yes"); // use madness cast
setChoice(playerA, "Asylum Visitor"); // Card to discard from Falkenrath entering by Olivia effect
setChoice(playerA, "Asylum Visito"); // Madness {1}{B}
setChoice(playerA, "Yes"); // use madness triggered ability
setChoice(playerA, "Yes"); // use madness cast
setChoice(playerA, "Yes"); // Discard a card and put a +1/+1 counter on that creature, it gains haste until end of turn, and it becomes a Vampire in addition to its other types?
setChoice(playerA, "Forest");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();

View file

@ -101,7 +101,7 @@ public class RiotTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); // Creature {1}{W} 2/2
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
setChoice(playerA, "Rhythm of the Wild: Nontoken creatu"); // choose replacement effect
setChoice(playerA, "Rhythm of the Wild"); // choose replacement effect
setChoice(playerA, "Yes"); // yes - counter
setChoice(playerA, "Yes"); // yes - counter

View file

@ -0,0 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.replacement.redirect;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PalisadeGiantTest extends CardTestPlayerBase {
/**
* when you have two Palisade Giants in play and your opponent deals you
* damage, the damage is applied to both of them rather than allowing you to
* choose which replacement effect applies (as it should). I experienced
* this multiple times in games vs the A.I.
*/
@Test
public void testRedirectDamage() {
// All damage that would be dealt to you or another permanent you control is dealt to Palisade Giant instead.
addCard(Zone.BATTLEFIELD, playerA, "Palisade Giant", 2); // Creature 2/7
addCard(Zone.HAND, playerB, "Lightning Bolt"); // Instant {R}
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
setChoice(playerA, "Palisade Giant");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
int damage = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
if (permanent.getName().equals("Palisade Giant")) {
damage += permanent.getDamage();
}
}
Assert.assertEquals("Only 3 damage in sum should be dealt to the Palisade Giants", 3, damage);
}
}

View file

@ -1349,7 +1349,7 @@ public class ContinuousEffects implements Serializable {
for (Ability ability : entry.getValue()) {
MageObject object = game.getObject(ability.getSourceId());
if (object != null) {
texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName()));
texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), object.getIdName() + ": " + ability.getRule(object.getName()));
} else {
texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), entry.getKey().getText(null));
}