From 59cf0cf1f353a94adc37b5e046c96c9799e02225 Mon Sep 17 00:00:00 2001 From: Galatolol Date: Fri, 13 Jan 2017 20:57:44 +0100 Subject: [PATCH] Fixed target and changed name of the effect --- .../src/mage/cards/s/SpectralSearchlight.java | 10 ++++++---- ...naOfAnyColorToManaPoolTargetPlayerEffect.java} | 15 +++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) rename Mage/src/main/java/mage/abilities/effects/common/{AddManaOfAnyColorToManaPoolTargetControllerEffect.java => AddManaOfAnyColorToManaPoolTargetPlayerEffect.java} (66%) diff --git a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java index 7e9b57beae..6b5f75d84b 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java +++ b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java @@ -31,13 +31,14 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.AddManaOfAnyColorToManaPoolTargetControllerEffect; +import mage.abilities.effects.common.AddManaOfAnyColorToManaPoolTargetPlayerEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Zone; -import mage.target.TargetPlayer; +import mage.abilities.effects.common.ChoosePlayerEffect; import mage.abilities.effects.common.ManaEffect; /** @@ -51,10 +52,11 @@ public class SpectralSearchlight extends CardImpl { // {tap}: Choose a player. That player adds one mana of any color he or she chooses to his or her mana pool. - ManaEffect effect = new AddManaOfAnyColorToManaPoolTargetControllerEffect("chosen player"); + ManaEffect effect = new AddManaOfAnyColorToManaPoolTargetPlayerEffect("chosen player"); effect.setText("Choose a player. That player adds one mana of any color he or she chooses to his or her mana pool"); Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); - ability.addTarget(new TargetPlayer(1, 1, true)); + // choosing player as first effect, before adding mana effect + ability.getEffects().add(0, new ChoosePlayerEffect(Outcome.PutManaInPool)); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetPlayerEffect.java similarity index 66% rename from Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetControllerEffect.java rename to Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetPlayerEffect.java index 0951f1459e..072484d19c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyColorToManaPoolTargetPlayerEffect.java @@ -6,24 +6,27 @@ import mage.choices.ChoiceColor; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * Created by Galatolol */ -public class AddManaOfAnyColorToManaPoolTargetControllerEffect extends ManaEffect { +public class AddManaOfAnyColorToManaPoolTargetPlayerEffect extends ManaEffect { - public AddManaOfAnyColorToManaPoolTargetControllerEffect(String textManaPoolOwner) { + public AddManaOfAnyColorToManaPoolTargetPlayerEffect(String textManaPoolOwner) { super(); this.staticText = (textManaPoolOwner.equals("his or her")?"that player adds ":"add ") + "one mana of any color" + " to " + textManaPoolOwner + " mana pool"; } - public AddManaOfAnyColorToManaPoolTargetControllerEffect(final AddManaOfAnyColorToManaPoolTargetControllerEffect effect) { + public AddManaOfAnyColorToManaPoolTargetPlayerEffect(final AddManaOfAnyColorToManaPoolTargetPlayerEffect effect) { super(effect); } @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player"); + Player player = game.getPlayer(playerId); if (player != null) { ChoiceColor choice = new ChoiceColor(); while (!player.choose(outcome, choice, game)) { @@ -42,8 +45,8 @@ public class AddManaOfAnyColorToManaPoolTargetControllerEffect extends ManaEffec } @Override - public AddManaOfAnyColorToManaPoolTargetControllerEffect copy() { - return new AddManaOfAnyColorToManaPoolTargetControllerEffect(this); + public AddManaOfAnyColorToManaPoolTargetPlayerEffect copy() { + return new AddManaOfAnyColorToManaPoolTargetPlayerEffect(this); } @Override