Fixed some more mixed up parameters of target classes.

This commit is contained in:
LevelX2 2014-07-30 10:47:51 +02:00
parent 8beca6ddaf
commit 33918623aa
11 changed files with 33 additions and 24 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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");

View file

@ -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);
}

View file

@ -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);

View file

@ -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)) {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}