mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Some minor code clean up and a test.
This commit is contained in:
parent
15719fea0f
commit
40b7d723ef
5 changed files with 85 additions and 10 deletions
|
@ -41,7 +41,9 @@ public final class FeatherTheRedeemed extends CardImpl {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever you cast an instant or sorcery spell that targets a creature you control, exile that card instead of putting it into your graveyard as it resolves. If you do, return it to your hand at the beginning of the next end step.
|
||||
// Whenever you cast an instant or sorcery spell that targets a creature you control,
|
||||
// exile that card instead of putting it into your graveyard as it resolves.
|
||||
// If you do, return it to your hand at the beginning of the next end step.
|
||||
this.addAbility(new FeatherTheRedeemedTriggeredAbility());
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -34,7 +34,9 @@ public final class VeilOfSummer extends CardImpl {
|
|||
public VeilOfSummer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}");
|
||||
|
||||
// Draw a card if an opponent has cast a blue or black spell this turn. Spells you control can't be countered this turn. You and permanents you control gain hexproof from blue and from black until end of turn.
|
||||
// Draw a card if an opponent has cast a blue or black spell this turn.
|
||||
// Spells you control can't be countered this turn. You and permanents you control
|
||||
// gain hexproof from blue and from black until end of turn.
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new DrawCardSourceControllerEffect(1),
|
||||
VeilOfSummerCondition.instance, "Draw a card " +
|
||||
|
|
|
@ -35,14 +35,20 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testHideaway() {
|
||||
addCard(Zone.HAND, playerA, "Shelldock Isle");
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
|
||||
skipInitShuffling();
|
||||
|
||||
this.playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shelldock Isle");
|
||||
setChoice(playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Shelldock Isle", 1);
|
||||
assertExileCount(playerA, 1);
|
||||
assertExileCount(playerA, "Silvercoat Lion", 1);
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame));
|
||||
}
|
||||
|
@ -73,10 +79,15 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
setChoice(playerA, "Ulamog, the Ceaseless Hunger");
|
||||
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{G},");
|
||||
setChoice(playerA, "Yes"); // play Ghost Quarter
|
||||
|
||||
addTarget(playerA, "Dross Crocodile^Dross Crocodile");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertExileCount("Dross Crocodile", 2);
|
||||
assertPermanentCount(playerA, "Mosswort Bridge", 1);
|
||||
|
@ -94,6 +105,9 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testCannotPlayLandIfPlayedLand() {
|
||||
// Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)
|
||||
// {tap}: Add {W}.
|
||||
// {W}, {T}: You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
|
||||
addCard(Zone.HAND, playerA, "Windbrisk Heights");
|
||||
addCard(Zone.HAND, playerA, "Plains");
|
||||
addCard(Zone.LIBRARY, playerA, "Ghost Quarter");
|
||||
|
@ -112,9 +126,13 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
attack(3, playerA, "Auriok Champion");
|
||||
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{W},");
|
||||
setChoice(playerA, "Yes"); // play Ghost Quarter
|
||||
|
||||
setStopAt(3, PhaseStep.END_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Ghost Quarter", 0);
|
||||
assertTapped("Windbrisk Heights", true);
|
||||
|
@ -122,6 +140,9 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void testCannotPlayLandIfNotOwnTurn() {
|
||||
// Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)
|
||||
// {T}: Add {G}.
|
||||
// {G}, {T}: You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
|
||||
addCard(Zone.HAND, playerA, "Mosswort Bridge");
|
||||
addCard(Zone.LIBRARY, playerA, "Ghost Quarter");
|
||||
skipInitShuffling();
|
||||
|
@ -135,6 +156,7 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{G},");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Ghost Quarter", 0);
|
||||
|
@ -158,13 +180,17 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
attack(3, playerA, "Auriok Champion");
|
||||
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{W},");
|
||||
setChoice(playerA, "Yes"); // play Ghost Quarter
|
||||
|
||||
setStopAt(3, PhaseStep.END_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Ghost Quarter", 1);
|
||||
assertTapped("Windbrisk Heights", true);
|
||||
Assert.assertEquals(playerA.getLandsPlayed(), 1);
|
||||
Assert.assertEquals(1, playerA.getLandsPlayed());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -188,13 +214,17 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
attack(3, playerA, "Auriok Champion");
|
||||
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{W},");
|
||||
setChoice(playerA, "Yes"); // play Ghost Quarter
|
||||
|
||||
setStopAt(3, PhaseStep.END_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Ghost Quarter", 1);
|
||||
assertTapped("Windbrisk Heights", true);
|
||||
Assert.assertEquals(playerA.getLandsPlayed(), 2);
|
||||
Assert.assertEquals(2, playerA.getLandsPlayed());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,7 +234,7 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
* never the opponents is 20 or fewer
|
||||
*/
|
||||
@Test
|
||||
public void shelldockIsleHideawayConditionOwnLibrary() {
|
||||
public void testShelldockIsleHideawayConditionOwnLibrary() {
|
||||
|
||||
/*
|
||||
Shelldock Isle
|
||||
|
@ -224,9 +254,13 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, sIsle);
|
||||
setChoice(playerA, ulamog);
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{U}");
|
||||
setChoice(playerA, "Yes"); // play Ulamog's Crusher
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertTappedCount("Island", true, 1);
|
||||
assertPermanentCount(playerA, sIsle, 1);
|
||||
|
@ -243,7 +277,7 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
* NOTE: test is currently failing due to bug in code. see issue #3310
|
||||
*/
|
||||
@Test
|
||||
public void shelldockIsleHideawayConditionOpponentsLibrary() {
|
||||
public void testShelldockIsleHideawayConditionOpponentsLibrary() {
|
||||
|
||||
/*
|
||||
Shelldock Isle
|
||||
|
@ -265,6 +299,7 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, sIsle);
|
||||
setChoice(playerA, ulamog);
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{U}");
|
||||
setChoice(playerA, "Yes"); // play Ulamog's Crusher
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
@ -281,7 +316,7 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
* blocking.
|
||||
*/
|
||||
@Test
|
||||
public void blinkWatcherFortomorrow() {
|
||||
public void testBlinkWatcherForTomorrow() {
|
||||
|
||||
/* Hideaway (This permanent enters the battlefield tapped" and
|
||||
"When this permanent enters the battlefield, look at the top four cards of
|
||||
|
@ -316,4 +351,41 @@ public class HideawayTest extends CardTestPlayerBase {
|
|||
assertExileCount(playerA, 2);
|
||||
assertTapped("Watcher for Tomorrow", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible bug with the Hideaway mechanic or with Watcher for Tomorrow. If
|
||||
* it leaves the bf before Hideaway resolves you don't get to exile a card
|
||||
* when the former eventually resolves, that shouldn't be the case.
|
||||
*/
|
||||
@Test
|
||||
public void testWatcherForTomorrowLeft() {
|
||||
|
||||
// Hideaway
|
||||
// When Watcher for Tomorrow leaves the battlefield, put the exiled card into its owner's hand.
|
||||
addCard(Zone.HAND, playerA, "Watcher for Tomorrow"); // Creature 2/1 - {1}{U}
|
||||
|
||||
// Exile target creature you control, then return it to the battlefield under its owner's control.
|
||||
// Rebound
|
||||
addCard(Zone.HAND, playerA, "Ephemerate"); // Instant {W}
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 4);
|
||||
skipInitShuffling();
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Watcher for Tomorrow");
|
||||
setChoice(playerA, "Silvercoat Lion");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Ephemerate", "Watcher for Tomorrow");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Watcher for Tomorrow", 1);
|
||||
assertExileCount(playerA, "Ephemerate", 1);
|
||||
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
assertExileCount(playerA, 2);
|
||||
assertTapped("Watcher for Tomorrow", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class UnattachedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(this.getSourceId()) ) {
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue