mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Some changes to EnterTheBattlefield events, some other fixes (fixes #2765).
This commit is contained in:
parent
dd810f2678
commit
75cbfdf3b9
24 changed files with 562 additions and 319 deletions
|
|
@ -35,10 +35,12 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllOfChosenSubtypeEffect;
|
||||
import mage.abilities.effects.common.enterAttribute.EnterAttributeAddChosenSubtypeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EnterEventType;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
|
|
@ -61,15 +63,18 @@ public class AdaptiveAutomaton extends CardImpl {
|
|||
}
|
||||
|
||||
public AdaptiveAutomaton(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
|
||||
this.subtype.add("Construct");
|
||||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// As Adaptive Automaton enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)));
|
||||
// Adaptive Automaton is the chosen type in addition to its other types.
|
||||
AsEntersBattlefieldAbility ability = new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature), null, EnterEventType.SELF);
|
||||
ability.addEffect(new EnterAttributeAddChosenSubtypeEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AdaptiveAutomatonAddSubtypeEffect()));
|
||||
// Other creatures you control of the chosen type get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllOfChosenSubtypeEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
|
||||
|
|
|
|||
|
|
@ -1,160 +1,135 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
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.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class MetallicMimic extends CardImpl {
|
||||
|
||||
public MetallicMimic(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
|
||||
|
||||
this.subtype.add("Shapeshifter");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// As Metallic Mimic enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)));
|
||||
|
||||
// Metallic Mimic is the chosen type in addition to its other types.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MetallicMimicEffect()));
|
||||
|
||||
// Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MetallicMimicReplacementEffect()));
|
||||
|
||||
}
|
||||
|
||||
public MetallicMimic(final MetallicMimic card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetallicMimic copy() {
|
||||
return new MetallicMimic(this);
|
||||
}
|
||||
|
||||
class MetallicMimicEffect extends ContinuousEffectImpl {
|
||||
|
||||
public MetallicMimicEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "{this} is the chosen type in addition to its other types";
|
||||
}
|
||||
|
||||
public MetallicMimicEffect(final MetallicMimicEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
|
||||
if (subtype != null && !permanent.getSubtype(game).contains(subtype)) {
|
||||
permanent.getSubtype(game).add(subtype);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetallicMimicEffect copy() {
|
||||
return new MetallicMimicEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MetallicMimicReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
MetallicMimicReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
staticText = "Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it";
|
||||
}
|
||||
|
||||
MetallicMimicReplacementEffect(MetallicMimicReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent enteringCreature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return enteringCreature != null && sourcePermanent != null
|
||||
&& enteringCreature.getControllerId().equals(source.getControllerId())
|
||||
&& enteringCreature.getCardType().contains(CardType.CREATURE)
|
||||
&& enteringCreature.getSubtype(game).contains(game.getState().getValue(sourcePermanent.getId() + "_type"))
|
||||
&& !event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetallicMimicReplacementEffect copy() {
|
||||
return new MetallicMimicReplacementEffect(this);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
import mage.abilities.effects.common.enterAttribute.EnterAttributeAddChosenSubtypeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EnterEventType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public class MetallicMimic extends CardImpl {
|
||||
|
||||
public MetallicMimic(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
|
||||
|
||||
this.subtype.add("Shapeshifter");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// As Metallic Mimic enters the battlefield, choose a creature type.
|
||||
AsEntersBattlefieldAbility ability = new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature), null, EnterEventType.SELF);
|
||||
// Metallic Mimic is the chosen type in addition to its other types.
|
||||
ability.addEffect(new EnterAttributeAddChosenSubtypeEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MetallicMimicReplacementEffect()));
|
||||
|
||||
}
|
||||
|
||||
public MetallicMimic(final MetallicMimic card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetallicMimic copy() {
|
||||
return new MetallicMimic(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MetallicMimicReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
MetallicMimicReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
staticText = "Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it";
|
||||
setCharacterDefining(true);
|
||||
}
|
||||
|
||||
MetallicMimicReplacementEffect(MetallicMimicReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent enteringCreature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (enteringCreature != null && sourcePermanent != null
|
||||
&& enteringCreature.getControllerId().equals(source.getControllerId())
|
||||
&& enteringCreature.getCardType().contains(CardType.CREATURE)
|
||||
&& !event.getTargetId().equals(source.getSourceId())) {
|
||||
String subtype = (String) game.getState().getValue(sourcePermanent.getId() + "_type");
|
||||
return subtype != null && enteringCreature.getSubtype(game).contains(subtype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetallicMimicReplacementEffect copy() {
|
||||
return new MetallicMimicReplacementEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
|
|
@ -36,24 +36,23 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North, Loki, noxx
|
||||
*/
|
||||
public class SphereOfTheSuns extends CardImpl {
|
||||
|
||||
private static final String ruleText = "Sphere of the Suns enters the battlefield tapped and with three charge counters on it.";
|
||||
|
||||
private static final String ruleText = "{this} enters the battlefield tapped and with three charge counters on it.";
|
||||
|
||||
public SphereOfTheSuns(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// Sphere of the Suns enters the battlefield tapped and with three charge counters on it.
|
||||
Ability ability = new EntersBattlefieldTappedAbility(ruleText);
|
||||
((EntersBattlefieldEffect)ability.getEffects().get(0)).addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)));
|
||||
((EntersBattlefieldEffect) ability.getEffects().get(0)).addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)));
|
||||
this.addAbility(ability);
|
||||
|
||||
RemoveCountersSourceCost removeCounterCost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance());
|
||||
|
|
|
|||
|
|
@ -27,16 +27,21 @@
|
|||
*/
|
||||
package mage.cards.v;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
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.Duration;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -49,6 +54,7 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -57,7 +63,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
public class VanishIntoMemory extends CardImpl {
|
||||
|
||||
public VanishIntoMemory(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}{U}");
|
||||
|
||||
// Exile target creature. You draw cards equal to that creature's power.
|
||||
// At the beginning of your next upkeep, return that card to the battlefield under its owner's control. If you do, discard cards equal to that creature's toughness.
|
||||
|
|
@ -79,7 +85,7 @@ class VanishIntoMemoryEffect extends OneShotEffect {
|
|||
|
||||
public VanishIntoMemoryEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Exile target creature. You draw cards equal to that creature's power. At the beginning of your next upkeep, return that card to the battlefield under its owner's control. If you do, discard cards equal to that creature's toughness.";
|
||||
staticText = "Exile target creature. You draw cards equal to that creature's power. At the beginning of your next upkeep, return that card to the battlefield under its owner's control. If you do, discard cards equal to that creature's toughness";
|
||||
}
|
||||
|
||||
public VanishIntoMemoryEffect(final VanishIntoMemoryEffect effect) {
|
||||
|
|
@ -89,20 +95,18 @@ class VanishIntoMemoryEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (permanent != null && sourceObject != null) {
|
||||
if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) {
|
||||
you.drawCards(permanent.getPower().getValue(), game);
|
||||
if (controller != null && permanent != null && sourceObject != null) {
|
||||
if (controller.moveCardsToExile(permanent, source, game, true, source.getSourceId(), sourceObject.getIdName())) {
|
||||
controller.drawCards(permanent.getPower().getValue(), game);
|
||||
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
|
||||
// only if permanent is in exile (tokens would be stop to exist)
|
||||
if (exile != null && !exile.isEmpty()) {
|
||||
Card card = game.getCard(permanent.getId());
|
||||
if (card != null) {
|
||||
//create delayed triggered ability
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(
|
||||
new VanishIntoMemoryReturnFromExileEffect(new MageObjectReference(card, game))), source);
|
||||
}
|
||||
//create delayed triggered ability
|
||||
Effect effect = new VanishIntoMemoryReturnFromExileEffect();
|
||||
effect.setTargetPointer(new FixedTargets(exile, game));
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -118,17 +122,13 @@ class VanishIntoMemoryEffect extends OneShotEffect {
|
|||
|
||||
class VanishIntoMemoryReturnFromExileEffect extends OneShotEffect {
|
||||
|
||||
MageObjectReference objectToReturn;
|
||||
|
||||
public VanishIntoMemoryReturnFromExileEffect(MageObjectReference objectToReturn) {
|
||||
public VanishIntoMemoryReturnFromExileEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.objectToReturn = objectToReturn;
|
||||
staticText = "return that card to the battlefield under its owner's control";
|
||||
}
|
||||
|
||||
public VanishIntoMemoryReturnFromExileEffect(final VanishIntoMemoryReturnFromExileEffect effect) {
|
||||
super(effect);
|
||||
this.objectToReturn = effect.objectToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -138,31 +138,30 @@ class VanishIntoMemoryReturnFromExileEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(objectToReturn.getSourceId());
|
||||
if (card != null && objectToReturn.refersTo(card, game)) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
if (owner != null) {
|
||||
game.addEffect(new VanishIntoMemoryEntersBattlefieldEffect(objectToReturn), source);
|
||||
owner.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
}
|
||||
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Set<Card> cardsToBattlefield = new HashSet<>();
|
||||
cardsToBattlefield.addAll(cards.getCards(game));
|
||||
ContinuousEffect effect = new VanishIntoMemoryEntersBattlefieldEffect();
|
||||
effect.setTargetPointer(new FixedTargets(cards, game));
|
||||
game.addEffect(effect, source);
|
||||
controller.moveCards(cardsToBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||
|
||||
MageObjectReference objectToReturn;
|
||||
|
||||
public VanishIntoMemoryEntersBattlefieldEffect(MageObjectReference objectToReturn) {
|
||||
super(Duration.Custom, Outcome.BoostCreature);
|
||||
this.objectToReturn = objectToReturn;
|
||||
public VanishIntoMemoryEntersBattlefieldEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Discard);
|
||||
staticText = "discard cards equal to that creature's toughness.";
|
||||
}
|
||||
|
||||
public VanishIntoMemoryEntersBattlefieldEffect(VanishIntoMemoryEntersBattlefieldEffect effect) {
|
||||
super(effect);
|
||||
this.objectToReturn = effect.objectToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -172,10 +171,7 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
return event.getTargetId().equals(objectToReturn.getSourceId());
|
||||
}
|
||||
return false;
|
||||
return getTargetPointer().getTargets(game, source).contains(event.getTargetId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -186,7 +182,6 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
if (you != null) {
|
||||
you.discard(permanent.getToughness().getValue(), false, source, game);
|
||||
}
|
||||
discard(); // use only once
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue