Tibalt, Cosmic Impostor - fixed that emblem can't cast not owned cards (#7598)

* Fixed ability.canChooseTarget not using correct playerId

* Fixed Necrotic Plague

* Revert "Fixed Necrotic Plague"

This reverts commit 7659039670.

* Set target controller on Necrotic Plague and add check in canChooseTarget

* Add test for Tibalt + Ephemerate interaction

* Tests improved

Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
Daniel Bomar 2021-02-22 13:06:43 -06:00 committed by GitHub
parent b94af941df
commit bb0a995541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 84 additions and 31 deletions

View file

@ -0,0 +1,35 @@
package org.mage.test.cards.single.khm;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ValkiGodOfLiesTest extends CardTestPlayerBase {
@Test
public void ephmerateTest() {
removeAllCardsFromLibrary(playerB);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 7);
addCard(Zone.HAND, playerA, "Plains");
addCard(Zone.HAND, playerA, "Valki, God of Lies");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.LIBRARY, playerB, "Ephemerate");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tibalt, Cosmic Impostor");
setChoice(playerA, "Tibalt, Cosmic Impostor"); // two etb effects
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: Exile the top card of each player's library.");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plains");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephemerate", "Grizzly Bears");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Tibalt, Cosmic Impostor", 1);
assertPermanentCount(playerA, "Grizzly Bears", 1);
assertGraveyardCount(playerB, "Ephemerate", 1);
}
}

View file

@ -22,8 +22,10 @@ public class NecroticPlagueTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Necrotic Plague", "Sejiri Merfolk");
setStrictChooseMode(true);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 20);
@ -38,7 +40,7 @@ public class NecroticPlagueTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
/**
* Goblin Deathraiders English
* Goblin Deathraiders
* Creature Goblin Warrior 3/1, BR
* Trample
*/
@ -63,9 +65,12 @@ public class NecroticPlagueTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Necrotic Plague", "Sejiri Merfolk");
addTarget(playerB, "Goblin Deathraiders"); // target for new necro attach
setStrictChooseMode(true);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 20);

View file

@ -123,7 +123,7 @@ public class RandomPlayer extends ComputerPlayer {
@Override
public boolean triggerAbility(TriggeredAbility source, Game game) {
if (source != null && source.canChooseTarget(game)) {
if (source != null && source.canChooseTarget(game, playerId)) {
Ability ability;
List<Ability> options = getPlayableOptions(source, game);
if (options.isEmpty()) {