From 2e01d2ec52abbaaeefa25d489834d8aeb27715ae Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 23 Jul 2015 16:00:15 +0200 Subject: [PATCH] * Swift Warkite - Fixed that it returned object also if the object changed zone meanwhile. --- .../sets/dragonsoftarkir/SwiftWarkite.java | 8 ++--- .../sets/returntoravnica/GraveBetrayal.java | 35 +++++++------------ .../sets/scarsofmirrodin/ArgentSphinx.java | 24 +++++++------ .../scarsofmirrodin/VenserTheSojourner.java | 8 ++--- 4 files changed, 33 insertions(+), 42 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SwiftWarkite.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SwiftWarkite.java index d3a8b1757e..7cf4b87280 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/SwiftWarkite.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SwiftWarkite.java @@ -126,10 +126,10 @@ class SwiftWarkiteEffect extends OneShotEffect { Permanent creature = game.getPermanent(card.getId()); if (creature != null) { ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); - effect.setTargetPointer(new FixedTarget(creature.getId())); + effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game))); game.addEffect(effect, source); Effect effect2 = new ReturnToHandTargetEffect(); - effect2.setTargetPointer(new FixedTarget(creature.getId())); + effect2.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game))); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2); delayedAbility.setControllerId(source.getControllerId()); delayedAbility.setSourceId(source.getSourceId()); @@ -147,10 +147,10 @@ class SwiftWarkiteEffect extends OneShotEffect { Permanent creature = game.getPermanent(card.getId()); if (creature != null) { ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom); - effect.setTargetPointer(new FixedTarget(creature.getId())); + effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game))); game.addEffect(effect, source); Effect effect2 = new ReturnToHandTargetEffect(); - effect2.setTargetPointer(new FixedTarget(creature.getId())); + effect2.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game))); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2); delayedAbility.setControllerId(source.getControllerId()); delayedAbility.setSourceId(source.getSourceId()); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java b/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java index d28418b909..dab0ee466f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.returntoravnica; import java.util.UUID; @@ -58,21 +57,19 @@ import mage.target.targetpointer.FixedTarget; * * @author LevelX2 */ - public class GraveBetrayal extends CardImpl { - public GraveBetrayal (UUID ownerId) { + public GraveBetrayal(UUID ownerId) { super(ownerId, 67, "Grave Betrayal", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{5}{B}{B}"); this.expansionSetCode = "RTR"; - // Whenever a creature you don't control dies, return it to the battlefield under // your control with an additional +1/+1 counter on it at the beginning of the // next end step. That creature is a black Zombie in addition to its other colors and types. this.addAbility(new GraveBetrayalTriggeredAbility()); } - public GraveBetrayal (final GraveBetrayal card) { + public GraveBetrayal(final GraveBetrayal card) { super(card); } @@ -108,13 +105,10 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl { && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && !permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { - Card card = (Card)game.getObject(permanent.getId()); + Card card = (Card) game.getObject(permanent.getId()); if (card != null) { Effect effect = new GraveBetrayalEffect(); - effect.setTargetPointer(new FixedTarget(card.getId())); - Integer zoneChanges = card.getZoneChangeCounter(game); - effect.setValue("zoneChanges", zoneChanges); - + effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); delayedAbility.setSourceId(this.getSourceId()); delayedAbility.setControllerId(this.getControllerId()); @@ -153,17 +147,14 @@ class GraveBetrayalEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card card = game.getCard(targetPointer.getFirst(game, source)); if (card != null) { - Integer zoneChanges = (Integer) getValue("zoneChanges"); - if (card.getZoneChangeCounter(game) == zoneChanges) { - Zone currentZone = game.getState().getZone(card.getId()); - if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), source.getControllerId())) { - Permanent creature = game.getPermanent(card.getId()); - creature.addCounters(CounterType.P1P1.createInstance(), game); - ContinuousEffect effect = new GraveBetrayalContiniousEffect(); - effect.setTargetPointer(new FixedTarget(creature.getId())); - game.addEffect(effect, source); - return true; - } + Zone currentZone = game.getState().getZone(card.getId()); + if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), source.getControllerId())) { + Permanent creature = game.getPermanent(card.getId()); + creature.addCounters(CounterType.P1P1.createInstance(), game); + ContinuousEffect effect = new GraveBetrayalContiniousEffect(); + effect.setTargetPointer(new FixedTarget(creature.getId())); + game.addEffect(effect, source); + return true; } } return false; @@ -220,4 +211,4 @@ class GraveBetrayalContiniousEffect extends ContinuousEffectImpl { return layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/ArgentSphinx.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/ArgentSphinx.java index 3613ce6d0d..3863832e51 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/ArgentSphinx.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/ArgentSphinx.java @@ -25,15 +25,11 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; @@ -43,7 +39,10 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ReturnFromExileEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -53,7 +52,7 @@ import mage.game.permanent.Permanent; */ public class ArgentSphinx extends CardImpl { - public ArgentSphinx (UUID ownerId) { + public ArgentSphinx(UUID ownerId) { super(ownerId, 28, "Argent Sphinx", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); this.expansionSetCode = "SOM"; this.subtype.add("Sphinx"); @@ -66,7 +65,7 @@ public class ArgentSphinx extends CardImpl { this.addAbility(ability); } - public ArgentSphinx (final ArgentSphinx card) { + public ArgentSphinx(final ArgentSphinx card) { super(card); } @@ -81,7 +80,7 @@ class ArgentSphinxEffect extends OneShotEffect { private static final String effectText = "Exile {this}. Return it to the battlefield under your control at the beginning of the next end step"; - ArgentSphinxEffect ( ) { + ArgentSphinxEffect() { super(Outcome.Benefit); staticText = effectText; } @@ -93,10 +92,13 @@ class ArgentSphinxEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Argent Sphinx Exile", source.getSourceId(), game)) { + MageObject sourceObject = game.getObject(source.getSourceId()); + if (permanent != null && sourceObject != null) { + if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) { //create delayed triggered ability - AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)); + AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility + = new AtTheBeginOfNextEndStepDelayedTriggeredAbility( + new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)); delayedAbility.setSourceId(source.getSourceId()); delayedAbility.setControllerId(source.getControllerId()); delayedAbility.setSourceObject(source.getSourceObject(game), game); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java index 2182a3dd8a..2f4def3ecf 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.scarsofmirrodin; import java.util.UUID; @@ -81,8 +80,6 @@ public class VenserTheSojourner extends CardImpl { this.expansionSetCode = "SOM"; this.subtype.add("Venser"); - - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); // +2: Exile target permanent you own. Return it to the battlefield under your control at the beginning of the next end step. @@ -131,7 +128,7 @@ class VenserTheSojournerEffect extends OneShotEffect { if (getTargetPointer().getFirst(game, source) != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { //create delayed triggered ability AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)); delayedAbility.setSourceId(source.getSourceId()); @@ -174,7 +171,8 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl { protected FilterSpell filter; /** - * If true, the source that triggered the ability will be set as target to effect. + * If true, the source that triggered the ability will be set as target to + * effect. */ protected boolean rememberSource = false;