* Archive Trap - fixed that it doesn't apply alternative cost after searched library (#7274);

This commit is contained in:
Oleg Agafonov 2020-12-28 07:10:15 +04:00
parent ced4f44213
commit aa7226a1af
2 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,50 @@
package org.mage.test.cards.single.zen;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class ArchiveTrapTest extends CardTestPlayerBase {
@Test
public void test_CostReductionOnLibrarySearched() {
removeAllCardsFromLibrary(playerA);
skipInitShuffling();
addCard(Zone.LIBRARY, playerA, "Grizzly Bears", 13);
addCard(Zone.LIBRARY, playerA, "Swamp", 1);
addCard(Zone.LIBRARY, playerA, "Mountain", 1);
// If an opponent searched their library this turn, you may pay {0} rather than pay this spells mana cost.
// Target opponent mills thirteen cards.
addCard(Zone.HAND, playerB, "Archive Trap"); // {3}{U}{U}
//
// Search your library for a basic land card, put it onto the battlefield tapped, then shuffle your library.
addCard(Zone.HAND, playerA, "Beneath the Sands"); // {2}{G}
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
// search for land
checkPlayableAbility("can't cast before", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Archive Trap", false);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Beneath the Sands");
addTarget(playerA, "Swamp");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("after search", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Swamp", 1);
// must able to cast trap for {0}
checkPlayableAbility("must able to cast", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cast Archive Trap", true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Archive Trap");
setChoice(playerB, "Yes"); // use alternative cost
addTarget(playerB, playerA);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertLibraryCount(playerA, 15 - 1 - 13); // -1 by search, -13 by trap's mill
}
}

View file

@ -2668,8 +2668,8 @@ public abstract class PlayerImpl implements Player, Serializable {
}
LibrarySearchedEvent searchedEvent = new LibrarySearchedEvent(targetPlayer.getId(), source, searchingPlayer.getId(), target);
if (game.replaceEvent(searchedEvent)) {
return false;
if (!game.replaceEvent(searchedEvent)) {
game.fireEvent(searchedEvent);
}
break;
} while (true);