* Fixed a bug that put back auras always under owners control instead of abilities controller (e.g. triggered ability of It That Betrays).

This commit is contained in:
LevelX2 2016-01-27 00:23:28 +01:00
parent b4e7403d82
commit c4868cfa99
6 changed files with 80 additions and 42 deletions

View file

@ -87,4 +87,44 @@ public class ItThatBetraysTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Flooded Strand", 1);
}
/**
* I just sacrificed a Spreading Seas to an attacking It That Betrays, and
* it returned the Spreading Seas under my control. It made me choose a land
* to enchant, and I drew a card.
*/
@Test
public void testExileItThatBetraysEffectEnchantment() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
addCard(Zone.HAND, playerA, "Spreading Seas", 1); // {1}{U}
// Annihilator 2 (Whenever this creature attacks, defending player sacrifices two permanents.)
// Whenever an opponent sacrifices a nontoken permanent, put that card onto the battlefield under your control.
addCard(Zone.BATTLEFIELD, playerB, "It That Betrays"); // 11/11
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
// Enchant land
// When Spreading Seas enters the battlefield, draw a card.
// Enchanted land is an Island.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spreading Seas", "Mountain");
attack(2, playerB, "It That Betrays");
setChoice(playerA, "Spreading Seas");
setChoice(playerA, "Silvercoat Lion");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 9);
assertLife(playerB, 20);
assertHandCount(playerA, "Spreading Seas", 0);
// Player B now controls a Silvercoat Lion and Spreading Seas
assertPermanentCount(playerB, "Silvercoat Lion", 1);
assertPermanentCount(playerA, "Spreading Seas", 0);
assertGraveyardCount(playerA, "Spreading Seas", 0);
assertPermanentCount(playerB, "Spreading Seas", 1);
}
}

View file

@ -601,7 +601,7 @@ public class TestPlayer implements Player {
targetName = targetName.substring(0, targetName.length() - 11);
}
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterPermanent, game)) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterPermanent, getId(), sourceId, game)) {
if (target.getTargets().contains(permanent.getId())) {
continue;
}