forked from External/mage
broke out LookAtTopCardOfLibraryAnyTimeEffect into its own class
This commit is contained in:
parent
c780838d29
commit
0b11df3a00
5 changed files with 73 additions and 202 deletions
|
|
@ -1,30 +1,25 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.effects.common.DestroySourceEffect;
|
||||
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
|
||||
import mage.abilities.effects.common.continuous.PlayTheTopCardEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ExperimentalFrenzy extends CardImpl {
|
||||
|
|
@ -33,27 +28,19 @@ public final class ExperimentalFrenzy extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
|
||||
|
||||
// You may look at the top card of your library any time.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD, new ExperimentalFrenzyTopCardEffect()
|
||||
));
|
||||
this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect()));
|
||||
|
||||
// You may play the top card of your library.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD, new PlayTheTopCardEffect()
|
||||
));
|
||||
this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect()));
|
||||
|
||||
// You can't play cards from your hand.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD, new ExperimentalFrenzyRestrictionEffect()
|
||||
));
|
||||
this.addAbility(new SimpleStaticAbility(new ExperimentalFrenzyRestrictionEffect()));
|
||||
|
||||
// {3}{R}: Destroy Experimental Frenzy.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
new DestroySourceEffect(), new ManaCostsImpl("{3}{R}")
|
||||
));
|
||||
this.addAbility(new SimpleActivatedAbility(new DestroySourceEffect(), new ManaCostsImpl("{3}{R}")));
|
||||
}
|
||||
|
||||
public ExperimentalFrenzy(final ExperimentalFrenzy card) {
|
||||
private ExperimentalFrenzy(final ExperimentalFrenzy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
@ -63,49 +50,14 @@ public final class ExperimentalFrenzy extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ExperimentalFrenzyTopCardEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ExperimentalFrenzyTopCardEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "You may look at the top card of your library any time.";
|
||||
}
|
||||
|
||||
public ExperimentalFrenzyTopCardEffect(final ExperimentalFrenzyTopCardEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return true;
|
||||
}
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard == null) {
|
||||
return true;
|
||||
}
|
||||
MageObject obj = source.getSourceObject(game);
|
||||
if (obj == null) {
|
||||
return true;
|
||||
}
|
||||
controller.lookAtCards("Top card of " + obj.getIdName() + " controller's library", topCard, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExperimentalFrenzyTopCardEffect copy() {
|
||||
return new ExperimentalFrenzyTopCardEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ExperimentalFrenzyRestrictionEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public ExperimentalFrenzyRestrictionEffect() {
|
||||
ExperimentalFrenzyRestrictionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
this.staticText = "You can't play cards from your hand";
|
||||
}
|
||||
|
||||
public ExperimentalFrenzyRestrictionEffect(final ExperimentalFrenzyRestrictionEffect effect) {
|
||||
private ExperimentalFrenzyRestrictionEffect(final ExperimentalFrenzyRestrictionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -7,8 +6,8 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -27,14 +26,13 @@ public final class PrecognitionField extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
// You may look at the top card of your library.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrecognitionFieldTopCardRevealedEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect()));
|
||||
|
||||
// You may cast the top card of your library if it's an instant or sorcery card.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrecognitionFieldTopCardCastEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new PrecognitionFieldTopCardCastEffect()));
|
||||
|
||||
// {3}: Exile the top card of your library.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new PrecognitionFieldExileEffect(), new GenericManaCost(3)));
|
||||
this.addAbility(new SimpleActivatedAbility(new PrecognitionFieldExileEffect(), new GenericManaCost(3)));
|
||||
}
|
||||
|
||||
public PrecognitionField(final PrecognitionField card) {
|
||||
|
|
@ -47,38 +45,6 @@ public final class PrecognitionField extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PrecognitionFieldTopCardRevealedEffect extends ContinuousEffectImpl {
|
||||
|
||||
public PrecognitionFieldTopCardRevealedEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "You may look at the top card of your library any time.";
|
||||
}
|
||||
|
||||
public PrecognitionFieldTopCardRevealedEffect(final PrecognitionFieldTopCardRevealedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard != null) {
|
||||
MageObject precognitionField = source.getSourceObject(game);
|
||||
if (precognitionField != null) {
|
||||
controller.lookAtCards("Top card of " + precognitionField.getIdName() + " controller's library", topCard, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrecognitionFieldTopCardRevealedEffect copy() {
|
||||
return new PrecognitionFieldTopCardRevealedEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PrecognitionFieldTopCardCastEffect extends AsThoughEffectImpl {
|
||||
|
||||
public PrecognitionFieldTopCardCastEffect() {
|
||||
|
|
|
|||
|
|
@ -1,34 +1,24 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class SphinxOfJwarIsle extends CardImpl {
|
||||
|
||||
public SphinxOfJwarIsle(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
||||
this.subtype.add(SubType.SPHINX);
|
||||
|
||||
this.power = new MageInt(5);
|
||||
|
|
@ -36,12 +26,10 @@ public final class SphinxOfJwarIsle extends CardImpl {
|
|||
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(ShroudAbility.getInstance());
|
||||
// TODO: this should be a static ability
|
||||
this.addAbility(new SphinxOfJwarIsleLookAbility());
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect()));
|
||||
}
|
||||
|
||||
public SphinxOfJwarIsle(final SphinxOfJwarIsle card) {
|
||||
private SphinxOfJwarIsle(final SphinxOfJwarIsle card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
@ -50,56 +38,3 @@ public final class SphinxOfJwarIsle extends CardImpl {
|
|||
return new SphinxOfJwarIsle(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SphinxOfJwarIsleLookAbility extends ActivatedAbilityImpl {
|
||||
|
||||
public SphinxOfJwarIsleLookAbility() {
|
||||
super(Zone.BATTLEFIELD, new SphinxOfJwarIsleEffect(), new GenericManaCost(0));
|
||||
this.usesStack = false;
|
||||
}
|
||||
|
||||
public SphinxOfJwarIsleLookAbility(SphinxOfJwarIsleLookAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SphinxOfJwarIsleLookAbility copy() {
|
||||
return new SphinxOfJwarIsleLookAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SphinxOfJwarIsleEffect extends OneShotEffect {
|
||||
|
||||
public SphinxOfJwarIsleEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "You may look at the top card of your library any time";
|
||||
}
|
||||
|
||||
public SphinxOfJwarIsleEffect(final SphinxOfJwarIsleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SphinxOfJwarIsleEffect copy() {
|
||||
return new SphinxOfJwarIsleEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
player.lookAtCards("Sphinx of Jwar Isle", cards, game);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.AsThoughManaEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -31,7 +31,7 @@ public final class VizierOfTheMenagerie extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// You may look at the top card of your library. (You may do this at any time.)
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VizierOfTheMenagerieTopCardRevealedEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LookAtTopCardOfLibraryAnyTimeEffect()));
|
||||
|
||||
// You may cast the top card of your library if it's a creature card.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VizierOfTheMenagerieTopCardCastEffect()));
|
||||
|
|
@ -51,38 +51,6 @@ public final class VizierOfTheMenagerie extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class VizierOfTheMenagerieTopCardRevealedEffect extends ContinuousEffectImpl {
|
||||
|
||||
public VizierOfTheMenagerieTopCardRevealedEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "You may look at the top card of your library any time";
|
||||
}
|
||||
|
||||
public VizierOfTheMenagerieTopCardRevealedEffect(final VizierOfTheMenagerieTopCardRevealedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard != null) {
|
||||
MageObject vizierOfTheMenagerie = source.getSourceObject(game);
|
||||
if (vizierOfTheMenagerie != null) {
|
||||
controller.lookAtCards("Top card of " + vizierOfTheMenagerie.getIdName() + " controller's library", topCard, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VizierOfTheMenagerieTopCardRevealedEffect copy() {
|
||||
return new VizierOfTheMenagerieTopCardRevealedEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VizierOfTheMenagerieTopCardCastEffect extends AsThoughEffectImpl {
|
||||
|
||||
public VizierOfTheMenagerieTopCardCastEffect() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class LookAtTopCardOfLibraryAnyTimeEffect extends ContinuousEffectImpl {
|
||||
|
||||
public LookAtTopCardOfLibraryAnyTimeEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "You may look at the top card of your library any time.";
|
||||
}
|
||||
|
||||
private LookAtTopCardOfLibraryAnyTimeEffect(final LookAtTopCardOfLibraryAnyTimeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return true;
|
||||
}
|
||||
Card topCard = controller.getLibrary().getFromTop(game);
|
||||
if (topCard == null) {
|
||||
return true;
|
||||
}
|
||||
MageObject obj = source.getSourceObject(game);
|
||||
if (obj == null) {
|
||||
return true;
|
||||
}
|
||||
controller.lookAtCards("Top card of " + obj.getIdName() + " controller's library", topCard, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookAtTopCardOfLibraryAnyTimeEffect copy() {
|
||||
return new LookAtTopCardOfLibraryAnyTimeEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue