From 5d13559ef14244dff138064b0e499e43f1be339b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 24 Sep 2013 13:43:56 +0200 Subject: [PATCH] Gather Specimens, simplified replacement effect, some other minor changes. --- .../sets/shardsofalara/GatherSpecimens.java | 74 ++++--------------- Mage/src/mage/cards/Card.java | 1 + Mage/src/mage/cards/CardImpl.java | 17 +++-- .../src/mage/game/events/ZoneChangeEvent.java | 10 +++ Mage/src/mage/game/stack/Spell.java | 14 +++- 5 files changed, 45 insertions(+), 71 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shardsofalara/GatherSpecimens.java b/Mage.Sets/src/mage/sets/shardsofalara/GatherSpecimens.java index a8c306ac849..7fbcb5d3e5a 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/GatherSpecimens.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/GatherSpecimens.java @@ -37,15 +37,10 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import static mage.constants.Zone.EXILED; -import static mage.constants.Zone.GRAVEYARD; -import static mage.constants.Zone.HAND; -import static mage.constants.Zone.LIBRARY; -import static mage.constants.Zone.PICK; +import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; -import mage.game.permanent.PermanentCard; /** * @@ -76,6 +71,8 @@ public class GatherSpecimens extends CardImpl { class GatherSpecimensReplacementEffect extends ReplacementEffectImpl { + private static final FilterCreatureCard filter = new FilterCreatureCard(); + public GatherSpecimensReplacementEffect() { super(Duration.EndOfTurn, Outcome.GainControl); staticText = "If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead"; @@ -97,57 +94,12 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl> extends MageObjectImpl event.setTarget(permanent); break; default: - logger.fatal("invalid zone for card - " + toZone); + logger.fatal(new StringBuilder("Invalid from zone [").append(toZone).append("] for card [").append(this.getName()).toString()); return false; } setControllerId(ownerId); @@ -435,13 +435,18 @@ public abstract class CardImpl> extends MageObjectImpl @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { - return putOntoBattlefield(game, fromZone, sourceId, controllerId, false); + return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, false); } + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped){ + return this.putOntoBattlefield(game, fromZone, sourceId, controllerId, tapped, null); + + } @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped){ - ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD); + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, ArrayList appliedEffects){ + ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped); if (!game.replaceEvent(event)) { if (fromZone != null) { boolean removed = false; @@ -476,7 +481,7 @@ public abstract class CardImpl> extends MageObjectImpl game.addPermanent(permanent); game.setZone(objectId, Zone.BATTLEFIELD); game.setScopeRelevant(true); - game.applyEffects(); // magenoxx: this causes bugs - LevelX2: but it's neccessary for casting e.g. Kird Ape which must trigger evolve + game.applyEffects(); permanent.setTapped(tapped); permanent.entersBattlefield(sourceId, game, event.getFromZone(), true); game.setScopeRelevant(false); diff --git a/Mage/src/mage/game/events/ZoneChangeEvent.java b/Mage/src/mage/game/events/ZoneChangeEvent.java index 1832d5aeb8b..14cea4ccc0a 100644 --- a/Mage/src/mage/game/events/ZoneChangeEvent.java +++ b/Mage/src/mage/game/events/ZoneChangeEvent.java @@ -67,12 +67,17 @@ public class ZoneChangeEvent extends GameEvent { } public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, ArrayList appliedEffects) { + this(targetId, sourceId, playerId, fromZone, toZone, appliedEffects, false); + } + + public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, ArrayList appliedEffects, boolean comesIntoPlayTapped) { super(EventType.ZONE_CHANGE, targetId, sourceId, playerId); this.fromZone = fromZone; this.toZone = toZone; if (appliedEffects != null) { this.appliedEffects = appliedEffects; } + this.flag = comesIntoPlayTapped; } public ZoneChangeEvent(Permanent target, UUID playerId, Zone fromZone, Zone toZone) { @@ -106,4 +111,9 @@ public class ZoneChangeEvent extends GameEvent { public boolean isDiesEvent() { return (toZone == Zone.GRAVEYARD && fromZone == Zone.BATTLEFIELD); } + + public boolean comesIntoPlayTapped() { + return this.flag; + } + } diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index bf8e51f2e71..2e632e08558 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -522,16 +522,22 @@ public class Spell> implements StackObject, Card { } - @Override - public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) { - throw new UnsupportedOperationException("Not supported yet."); - } @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { throw new UnsupportedOperationException("Unsupported operation"); } + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, ArrayList appliedEffects) { + throw new UnsupportedOperationException("Not supported yet."); + } + @Override public int getCardNumber() { return card.getCardNumber();