From 33918623aa92b7a761a79643b352e169f17d84be Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 30 Jul 2014 10:47:51 +0200 Subject: [PATCH] Fixed some more mixed up parameters of target classes. --- .../mage/sets/betrayersofkamigawa/NekoTe.java | 2 -- .../src/mage/sets/darkascension/Seance.java | 32 +++++++++++-------- .../mage/test/cards/single/SeanceTest.java | 7 ++++ Mage/src/mage/target/TargetPlayer.java | 2 +- .../mage/target/common/TargetCardInHand.java | 2 +- .../common/TargetCardInYourGraveyard.java | 2 +- .../common/TargetCreatureOrPlayerAmount.java | 2 +- .../common/TargetCreaturePermanentAmount.java | 2 +- .../mage/target/common/TargetDefender.java | 2 +- .../common/TargetPermanentOrPlayer.java | 2 +- .../target/common/TargetSpellOrPermanent.java | 2 +- 11 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/NekoTe.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/NekoTe.java index ac9ed3cb540..d61a5e0d39d 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/NekoTe.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/NekoTe.java @@ -34,9 +34,7 @@ import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility; import mage.abilities.condition.common.SourceOnBattelfieldCondition; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; -import mage.abilities.decorator.ConditionalReplacementEffect; import mage.abilities.effects.ContinuousRuleModifiyingEffect; -import mage.abilities.effects.ReplacementEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.SkipUntapTargetEffect; import mage.abilities.effects.common.TapTargetEffect; diff --git a/Mage.Sets/src/mage/sets/darkascension/Seance.java b/Mage.Sets/src/mage/sets/darkascension/Seance.java index 87bc28fae06..3de5763d778 100644 --- a/Mage.Sets/src/mage/sets/darkascension/Seance.java +++ b/Mage.Sets/src/mage/sets/darkascension/Seance.java @@ -41,9 +41,11 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.Outcome; import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.permanent.token.EmptyToken; +import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; @@ -95,22 +97,24 @@ class SeanceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getFirstTarget()); - if (card != null) { - card.moveToExile(null, "", source.getSourceId(), game); - EmptyToken token = new EmptyToken(); - CardUtil.copyTo(token).from(card); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null && card != null) { + if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD)) { + EmptyToken token = new EmptyToken(); + CardUtil.copyTo(token).from(card); - if (!token.hasSubtype("Spirit")) { - token.getSubtype().add("Spirit"); + if (!token.hasSubtype("Spirit")) { + token.getSubtype().add("Spirit"); + } + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + + ExileTargetEffect exileEffect = new ExileTargetEffect(); + exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken())); + DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); } - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); - - ExileTargetEffect exileEffect = new ExileTargetEffect(); - exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken())); - DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); - game.addDelayedTriggeredAbility(delayedAbility); return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/SeanceTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/SeanceTest.java index 41b07567d01..0af26956ed8 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/SeanceTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/SeanceTest.java @@ -11,6 +11,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class SeanceTest extends CardTestPlayerBase { + /** + * Seance Enchantment {2}{W}{W} + * + * At the beginning of each upkeep, you may exile target creature card from your graveyard. + * If you do, put a token onto the battlefield that's a copy of that card except it's a + * Spirit in addition to its other types. Exile it at the beginning of the next end step. + */ @Test public void testCard() { addCard(Zone.BATTLEFIELD, playerA, "Seance"); diff --git a/Mage/src/mage/target/TargetPlayer.java b/Mage/src/mage/target/TargetPlayer.java index ec90e9bf4d4..bfa1ca748b6 100644 --- a/Mage/src/mage/target/TargetPlayer.java +++ b/Mage/src/mage/target/TargetPlayer.java @@ -184,7 +184,7 @@ public class TargetPlayer extends TargetImpl { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); } diff --git a/Mage/src/mage/target/common/TargetCardInHand.java b/Mage/src/mage/target/common/TargetCardInHand.java index 29f7eb96199..4d990b8eb8a 100644 --- a/Mage/src/mage/target/common/TargetCardInHand.java +++ b/Mage/src/mage/target/common/TargetCardInHand.java @@ -68,7 +68,7 @@ public class TargetCardInHand extends TargetCard { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { Card card = game.getPlayer(playerId).getHand().get(id, game); if (card != null) { return filter.match(card, source.getSourceId(), playerId, game); diff --git a/Mage/src/mage/target/common/TargetCardInYourGraveyard.java b/Mage/src/mage/target/common/TargetCardInYourGraveyard.java index 181f09020c3..a6e26451369 100644 --- a/Mage/src/mage/target/common/TargetCardInYourGraveyard.java +++ b/Mage/src/mage/target/common/TargetCardInYourGraveyard.java @@ -80,7 +80,7 @@ public class TargetCardInYourGraveyard extends TargetCard { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability ability, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability ability, Game game) { Card card = game.getCard(id); if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { if (game.getPlayer(playerId).getGraveyard().contains(id)) { diff --git a/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java b/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java index d1a3d47eb4a..47e582a861e 100644 --- a/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java +++ b/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java @@ -116,7 +116,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); } diff --git a/Mage/src/mage/target/common/TargetCreaturePermanentAmount.java b/Mage/src/mage/target/common/TargetCreaturePermanentAmount.java index 4f26a9d7573..8cdfb2389e7 100644 --- a/Mage/src/mage/target/common/TargetCreaturePermanentAmount.java +++ b/Mage/src/mage/target/common/TargetCreaturePermanentAmount.java @@ -99,7 +99,7 @@ public class TargetCreaturePermanentAmount extends TargetAmount { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); } diff --git a/Mage/src/mage/target/common/TargetDefender.java b/Mage/src/mage/target/common/TargetDefender.java index 6ecf4b84781..a4ab49eec12 100644 --- a/Mage/src/mage/target/common/TargetDefender.java +++ b/Mage/src/mage/target/common/TargetDefender.java @@ -213,7 +213,7 @@ public class TargetDefender extends TargetImpl { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); } diff --git a/Mage/src/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/mage/target/common/TargetPermanentOrPlayer.java index f5ea0a1447f..60c48f65392 100644 --- a/Mage/src/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/mage/target/common/TargetPermanentOrPlayer.java @@ -104,7 +104,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); } diff --git a/Mage/src/mage/target/common/TargetSpellOrPermanent.java b/Mage/src/mage/target/common/TargetSpellOrPermanent.java index 3d623cd03f1..1ee12156213 100644 --- a/Mage/src/mage/target/common/TargetSpellOrPermanent.java +++ b/Mage/src/mage/target/common/TargetSpellOrPermanent.java @@ -127,7 +127,7 @@ public class TargetSpellOrPermanent extends TargetImpl { } @Override - public boolean canTarget(UUID id, UUID playerId, Ability source, Game game) { + public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) { return canTarget(id, source, game); }