forked from External/mage
* Fixed for some cards that allow to play the top card of a players library that it also was possible to play the top card of other players libraries if the card was revealed (MagusOfTheFuture, Future Sight, Melek Izzet Paragon, Courser o fKruphix, Garruk's Horde, Oracle of Mul-Daya).
This commit is contained in:
parent
f955316225
commit
80d045f6cc
2 changed files with 14 additions and 12 deletions
|
|
@ -27,19 +27,19 @@
|
|||
*/
|
||||
package mage.sets.magic2012;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.PlayTheTopCardEffect;
|
||||
import mage.abilities.effects.common.continuous.PlayWithTheTopCardRevealedEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
|
@ -57,7 +57,9 @@ public class GarruksHorde extends CardImpl {
|
|||
// Play with the top card of your library revealed.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect()));
|
||||
// You may cast the top card of your library if it's a creature card.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayTheTopCardEffect(new FilterCreatureCard())));
|
||||
Effect effect = new PlayTheTopCardEffect(new FilterCreatureCard());
|
||||
effect.setText("You may cast the top card of your library if it's a creature card");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
||||
public GarruksHorde(final GarruksHorde card) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -37,8 +38,6 @@ import mage.filter.FilterCard;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
|
@ -50,7 +49,7 @@ public class PlayTheTopCardEffect extends AsThoughEffectImpl {
|
|||
this(new FilterCard());
|
||||
staticText = "You may play the top card of your library";
|
||||
}
|
||||
|
||||
|
||||
public PlayTheTopCardEffect(FilterCard filter) {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
this.filter = filter;
|
||||
|
|
@ -75,9 +74,10 @@ public class PlayTheTopCardEffect extends AsThoughEffectImpl {
|
|||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
Card cardOnTop = game.getCard(objectId);
|
||||
if (cardOnTop != null &&
|
||||
affectedControllerId.equals(source.getControllerId()) &&
|
||||
filter.match(cardOnTop, game)) {
|
||||
if (cardOnTop != null
|
||||
&& affectedControllerId.equals(source.getControllerId())
|
||||
&& cardOnTop.getOwnerId().equals(source.getControllerId())
|
||||
&& filter.match(cardOnTop, game)) {
|
||||
Player player = game.getPlayer(cardOnTop.getOwnerId());
|
||||
if (player != null && cardOnTop.equals(player.getLibrary().getFromTop(game))) {
|
||||
return true;
|
||||
|
|
@ -86,4 +86,4 @@ public class PlayTheTopCardEffect extends AsThoughEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue