mirror of
https://github.com/correl/mage.git
synced 2025-04-12 01:01:04 -09:00
* Leyline of Anticipation - Fixed that it only worked for creatures instead of all nonland permanents.
This commit is contained in:
parent
a8bf35e39a
commit
484a4fe0f6
4 changed files with 80 additions and 14 deletions
Mage.Sets/src/mage/sets/magic2011
Mage.Tests/src/test/java/org/mage/test
Mage/src/mage/abilities/effects/common/continious
|
@ -37,7 +37,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
||||
|
@ -47,7 +47,8 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
*/
|
||||
public class LeylineOfAnticipation extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("nonland cards");
|
||||
private static final FilterCard filter = new FilterCard("nonland cards");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
@ -55,8 +56,13 @@ public class LeylineOfAnticipation extends CardImpl {
|
|||
public LeylineOfAnticipation(UUID ownerId) {
|
||||
super(ownerId, 61, "Leyline of Anticipation", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
|
||||
this.expansionSetCode = "M11";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// If Leyline of Anticipation is in your opening hand, you may begin the game with it on the battlefield.
|
||||
this.addAbility(LeylineAbility.getInstance());
|
||||
|
||||
// You may cast nonland cards as though they had flash. (You may cast them any time you could cast an instant.)
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CastAsThoughItHadFlashEffect(Duration.WhileOnBattlefield, filter)));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.asthough;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class LeylineOfAnticipationTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCastAsThoughHasFlashDuringCombat() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains",2);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Leyline of Anticipation");
|
||||
addCard(Zone.HAND, playerA, "Silvercoat Lion");
|
||||
setChoice(playerA, "Yes");
|
||||
castSpell(2, PhaseStep.DRAW, playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Leyline of Anticipation", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests playing card with flash from graveyard with Yawgmoth's Agenda in play works also
|
||||
*/
|
||||
@Test
|
||||
public void testNoCastPossibleOnOpponentsTurn() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains",2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Yawgmoth's Agenda",1);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Leyline of Anticipation");
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(2, PhaseStep.DRAW, playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Leyline of Anticipation", 1);
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -136,6 +136,7 @@ public class DamageDistributionTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 14);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Leyline of Sanctity", 1);
|
||||
assertPermanentCount(playerB, "Battle Mastery", 1);
|
||||
// no creatures dies
|
||||
assertPermanentCount(playerA, "Heliod, God of the Sun", 1);
|
||||
|
|
|
@ -37,7 +37,6 @@ import mage.constants.Duration;
|
|||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -77,17 +76,10 @@ public class CastAsThoughItHadFlashEffect extends AsThoughEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
Card card = game.getCard(sourceId);
|
||||
if (card != null && filter.match(card, game) && card.getSpellAbility().isInUseableZone(game, card, false)) {
|
||||
if (anyPlayer) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
return controller.getInRange().contains(card.getOwnerId());
|
||||
}
|
||||
} else {
|
||||
return card.getOwnerId().equals(source.getControllerId());
|
||||
}
|
||||
public boolean applies(UUID affectedSpellId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (anyPlayer || source.getControllerId().equals(affectedControllerId)) {
|
||||
Card card = game.getCard(affectedSpellId);
|
||||
return card != null && filter.match(card, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue