* Fixed some cards/effects that checked for permanents with the same name and did not work correctly with face down creatures.

This commit is contained in:
LevelX2 2014-12-13 16:47:24 +01:00
parent 062ce8dd41
commit bc7a64677e
19 changed files with 214 additions and 115 deletions

View file

@ -359,4 +359,43 @@ public class MorphTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "face down creature", 1);
}
/**
* Check that an effect like "arget creature and all other creatures with the same name" does
* only effect one face down creature, also if multiple on the battlefield. Because they have no
* name, they don't have the same name.
*
*/
@Test
public void testEchoingDecaySameNameEffect() {
// Sagu Mauler 6/6 - Creature - Beast
// Trample, hexproof
// Morph {3}{G}{B} (You may cast this card face down as a 2/2 creature for . Turn it face up any time for its morph cost.)
addCard(Zone.HAND, playerA, "Sagu Mauler", 2);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
// Echoing Decay {1}{B}
// Instant
// Target creature and all other creatures with the same name as that creature get -2/-2 until end of turn.
addCard(Zone.HAND, playerB, "Echoing Decay");
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Echoing Decay", "face down creature");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 20);
assertHandCount(playerA, "Sagu Mauler", 0);
assertHandCount(playerB, "Echoing Decay", 0);
assertPermanentCount(playerA, "face down creature", 1);
}
}

View file

@ -592,7 +592,7 @@ public class TestPlayer extends ComputerPlayer {
}
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
MageObject object = game.getObject(id);
if (object != null && object.getName().equals(targetName)) {
if (object != null && object.getLogName().equals(targetName)) {
if (index >= ability.getTargets().size()) {
index--;
}