1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-01-27 03:00:32 +00:00

updated target adjusters N and O

This commit is contained in:
Evan Kranzler 2018-09-27 21:30:41 -04:00
parent 1e94ebdd82
commit 212d09b0a3
12 changed files with 272 additions and 287 deletions

View file

@ -1,7 +1,6 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.VariableCost; import mage.abilities.costs.VariableCost;
@ -19,15 +18,17 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreatureOrPlaneswalker; import mage.target.common.TargetCreatureOrPlaneswalker;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class NahirisWrath extends CardImpl { public final class NahirisWrath extends CardImpl {
public NahirisWrath(UUID ownerId, CardSetInfo setInfo) { public NahirisWrath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// As an additional cost to cast Nahiri's Wrath, discard X cards. // As an additional cost to cast Nahiri's Wrath, discard X cards.
this.getSpellAbility().addCost(new NahirisWrathAdditionalCost()); this.getSpellAbility().addCost(new NahirisWrathAdditionalCost());
@ -36,21 +37,7 @@ public final class NahirisWrath extends CardImpl {
Effect effect = new DamageTargetEffect(new DiscardCostCardConvertedMana()); Effect effect = new DamageTargetEffect(new DiscardCostCardConvertedMana());
effect.setText("{this} deals damage equal to the total converted mana cost of the discarded cards to each of up to X target creatures and/or planeswalkers"); effect.setText("{this} deals damage equal to the total converted mana cost of the discarded cards to each of up to X target creatures and/or planeswalkers");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
} this.getSpellAbility().setTargetAdjuster(NahirisWrathAdjuster.instance);
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
int numTargets = 0;
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
if (cost instanceof NahirisWrathAdditionalCost) {
numTargets = ((NahirisWrathAdditionalCost) cost).getAmount();
break;
}
}
if (numTargets > 0) {
ability.addTarget(new TargetCreatureOrPlaneswalker(0, numTargets, new FilterCreatureOrPlaneswalkerPermanent(), false));
}
} }
public NahirisWrath(final NahirisWrath card) { public NahirisWrath(final NahirisWrath card) {
@ -63,6 +50,25 @@ public final class NahirisWrath extends CardImpl {
} }
} }
enum NahirisWrathAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
int numTargets = 0;
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
if (cost instanceof NahirisWrathAdditionalCost) {
numTargets = cost.getAmount();
break;
}
}
if (numTargets > 0) {
ability.addTarget(new TargetCreatureOrPlaneswalker(0, numTargets, new FilterCreatureOrPlaneswalkerPermanent(), false));
}
}
}
class NahirisWrathAdditionalCost extends VariableCostImpl { class NahirisWrathAdditionalCost extends VariableCostImpl {
NahirisWrathAdditionalCost() { NahirisWrathAdditionalCost() {

View file

@ -26,11 +26,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public final class NazahnReveredBladesmith extends CardImpl { public final class NazahnReveredBladesmith extends CardImpl {
@ -65,25 +65,10 @@ public final class NazahnReveredBladesmith extends CardImpl {
// Whenever an equipped creature you control attacks, you may tap target creature defending player controls. // Whenever an equipped creature you control attacks, you may tap target creature defending player controls.
Ability ability = new AttacksCreatureYouControlTriggeredAbility(new NazahnTapEffect(), true, equippedFilter, true); Ability ability = new AttacksCreatureYouControlTriggeredAbility(new NazahnTapEffect(), true, equippedFilter, true);
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls"))); ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
ability.setTargetAdjuster(NazahnReveredBladesmithAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof AttacksCreatureYouControlTriggeredAbility) {
FilterCreaturePermanent filterDefender = new FilterCreaturePermanent("creature defending player controls");
for (Effect effect : ability.getEffects()) {
if (effect instanceof NazahnTapEffect) {
filterDefender.add(new ControllerIdPredicate(game.getCombat().getDefendingPlayerId(effect.getTargetPointer().getFirst(game, ability), game)));
break;
}
}
ability.getTargets().clear();
TargetCreaturePermanent target = new TargetCreaturePermanent(filterDefender);
ability.addTarget(target);
}
}
public NazahnReveredBladesmith(final NazahnReveredBladesmith card) { public NazahnReveredBladesmith(final NazahnReveredBladesmith card) {
super(card); super(card);
} }
@ -94,6 +79,24 @@ public final class NazahnReveredBladesmith extends CardImpl {
} }
} }
enum NazahnReveredBladesmithAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
FilterCreaturePermanent filterDefender = new FilterCreaturePermanent("creature defending player controls");
for (Effect effect : ability.getEffects()) {
if (effect instanceof NazahnTapEffect) {
filterDefender.add(new ControllerIdPredicate(game.getCombat().getDefendingPlayerId(effect.getTargetPointer().getFirst(game, ability), game)));
break;
}
}
ability.getTargets().clear();
TargetCreaturePermanent target = new TargetCreaturePermanent(filterDefender);
ability.addTarget(target);
}
}
class NazahnTapEffect extends TapTargetEffect { class NazahnTapEffect extends TapTargetEffect {
NazahnTapEffect() { NazahnTapEffect() {

View file

@ -1,7 +1,6 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DiesAttachedTriggeredAbility; import mage.abilities.common.DiesAttachedTriggeredAbility;
@ -15,35 +14,24 @@ import mage.abilities.keyword.EnchantAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class NecroticPlague extends CardImpl { public final class NecroticPlague extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public NecroticPlague(UUID ownerId, CardSetInfo setInfo) { public NecroticPlague(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
@ -53,33 +41,18 @@ public final class NecroticPlague extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Enchanted creature has "At the beginning of your upkeep, sacrifice this creature." // Enchanted creature has "At the beginning of your upkeep, sacrifice this creature."
// When enchanted creature dies, its controller chooses target creature one of their opponents controls. Return Necrotic Plague from its owner's graveyard to the battlefield attached to that creature. // When enchanted creature dies, its controller chooses target creature one of their opponents controls. Return Necrotic Plague from its owner's graveyard to the battlefield attached to that creature.
Ability gainedAbility = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect(), TargetController.YOU, false); ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect(), TargetController.YOU, false);
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA, Duration.WhileOnBattlefield); Effect effect = new GainAbilityAttachedEffect(ability, AttachmentType.AURA, Duration.WhileOnBattlefield);
effect.setText("Enchanted creature has \"At the beginning of your upkeep, sacrifice this creature.\""); effect.setText("Enchanted creature has \"At the beginning of your upkeep, sacrifice this creature.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
this.addAbility(new DiesAttachedTriggeredAbility(new NecroticPlagueEffect(), "enchanted creature", false));
} ability = new DiesAttachedTriggeredAbility(new NecroticPlagueEffect(), "enchanted creature", false);
ability.setTargetAdjuster(NecroticPlagueAdjuster.instance);
this.addAbility(ability);
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof DiesAttachedTriggeredAbility) {
Permanent attachedTo = null;
for (Effect effect : ability.getEffects()) {
attachedTo = (Permanent) effect.getValue("attachedTo");
}
if (attachedTo != null) {
Player creatureController = game.getPlayer(attachedTo.getControllerId());
if (creatureController != null) {
ability.setControllerId(creatureController.getId());
ability.getTargets().clear();
TargetPermanent target = new TargetPermanent(filter);
ability.getTargets().add(target);
}
}
}
} }
public NecroticPlague(final NecroticPlague card) { public NecroticPlague(final NecroticPlague card) {
@ -93,11 +66,35 @@ public final class NecroticPlague extends CardImpl {
} }
enum NecroticPlagueAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
Permanent attachedTo = null;
for (Effect effect : ability.getEffects()) {
attachedTo = (Permanent) effect.getValue("attachedTo");
}
if (attachedTo == null) {
return;
}
Player creatureController = game.getPlayer(attachedTo.getControllerId());
if (creatureController == null) {
return;
}
ability.setControllerId(creatureController.getId());
ability.getTargets().clear();
TargetPermanent target = new TargetOpponentsCreaturePermanent();
ability.getTargets().add(target);
}
}
class NecroticPlagueEffect extends OneShotEffect { class NecroticPlagueEffect extends OneShotEffect {
public NecroticPlagueEffect() { public NecroticPlagueEffect() {
super(Outcome.PutCardInPlay); super(Outcome.PutCardInPlay);
staticText = "its controller chooses target creature one of their opponents controls. Return {this} from its owner's graveyard to the battlefield attached to that creature"; staticText = "its controller chooses target creature one of their opponents controls. " +
"Return {this} from its owner's graveyard to the battlefield attached to that creature";
} }
public NecroticPlagueEffect(final NecroticPlagueEffect effect) { public NecroticPlagueEffect(final NecroticPlagueEffect effect) {

View file

@ -1,9 +1,7 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.costs.common.DiscardXTargetCost; import mage.abilities.costs.common.DiscardXTargetCost;
import mage.abilities.dynamicvalue.common.GetXValue; import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -15,11 +13,12 @@ import mage.constants.CardType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class NostalgicDreams extends CardImpl { public final class NostalgicDreams extends CardImpl {
@ -33,27 +32,31 @@ public final class NostalgicDreams extends CardImpl {
Effect effect = new ReturnFromGraveyardToHandTargetEffect(); Effect effect = new ReturnFromGraveyardToHandTargetEffect();
effect.setText("Return X target cards from your graveyard to your hand"); effect.setText("Return X target cards from your graveyard to your hand");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
this.getSpellAbility().setTargetAdjuster(NostalgicDreamsAdjuster.instance);
// Exile Nostalgic Dreams. // Exile Nostalgic Dreams.
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
} }
public NostalgicDreams(final NostalgicDreams card) { public NostalgicDreams(final NostalgicDreams card) {
super(card); super(card);
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
int xValue = new GetXValue().calculate(game, ability, null);
Target target = new TargetCardInYourGraveyard(xValue, StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD);
ability.addTarget(target);
}
}
@Override @Override
public NostalgicDreams copy() { public NostalgicDreams copy() {
return new NostalgicDreams(this); return new NostalgicDreams(this);
} }
} }
enum NostalgicDreamsAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
ability.addTarget(new TargetCardInYourGraveyard(
new GetXValue().calculate(game, ability, null),
StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD
));
}
}

View file

@ -1,15 +1,10 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
@ -21,20 +16,15 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class OathOfDruids extends CardImpl { public final class OathOfDruids extends CardImpl {
private final UUID originalId;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfDruidsPredicate());
}
public OathOfDruids(UUID ownerId, CardSetInfo setInfo) { public OathOfDruids(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
@ -42,27 +32,12 @@ public final class OathOfDruids extends CardImpl {
// The first player may reveal cards from the top of their library until he or she reveals a creature card. // The first player may reveal cards from the top of their library until he or she reveals a creature card.
// If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into their graveyard. // If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into their graveyard.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, false);
ability.addTarget(new TargetPlayer(1, 1, false, filter)); ability.setTargetAdjuster(OathOfDruidsAdjuster.instance);
originalId = ability.getOriginalId();
this.addAbility(ability); this.addAbility(ability);
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
public OathOfDruids(final OathOfDruids card) { public OathOfDruids(final OathOfDruids card) {
super(card); super(card);
this.originalId = card.originalId;
} }
@Override @Override
@ -71,6 +46,26 @@ public final class OathOfDruids extends CardImpl {
} }
} }
enum OathOfDruidsAdjuster implements TargetAdjuster {
instance;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfDruidsPredicate());
}
@Override
public void adjustTargets(Ability ability, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
class OathOfDruidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> { class OathOfDruidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();

View file

@ -1,7 +1,6 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -15,57 +14,36 @@ import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.FilterPlayer; import mage.filter.FilterPlayer;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerIdPredicate; import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class OathOfGhouls extends CardImpl { public final class OathOfGhouls extends CardImpl {
private final UUID originalId;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfGhoulsPredicate());
}
public OathOfGhouls(UUID ownerId, CardSetInfo setInfo) { public OathOfGhouls(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
// At the beginning of each player's upkeep, that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand. // At the beginning of each player's upkeep, that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfGhoulsEffect(), TargetController.ANY, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfGhoulsEffect(), TargetController.ANY, false);
ability.addTarget(new TargetPlayer(1, 1, false, filter)); ability.setTargetAdjuster(OathOfGhoulsAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
originalId = ability.getOriginalId();
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
} }
public OathOfGhouls(final OathOfGhouls card) { public OathOfGhouls(final OathOfGhouls card) {
super(card); super(card);
this.originalId = card.originalId;
} }
@Override @Override
@ -74,14 +52,28 @@ public final class OathOfGhouls extends CardImpl {
} }
} }
class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> { enum OathOfGhoulsAdjuster implements TargetAdjuster {
instance;
private static final FilterCard filter = new FilterCard("creature cards"); private static final FilterPlayer filter = new FilterPlayer();
static { static {
filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new OathOfGhoulsPredicate());
} }
@Override
public void adjustTargets(Ability ability, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
@Override @Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) { public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject(); Player targetPlayer = input.getObject();
@ -91,8 +83,8 @@ class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|| !firstPlayer.hasOpponent(targetPlayer.getId(), game)) { || !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
return false; return false;
} }
int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(filter, game).size(); int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(filter, game).size(); int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
return countGraveyardTargetPlayer < countGraveyardFirstPlayer; return countGraveyardTargetPlayer < countGraveyardFirstPlayer;
} }
@ -105,13 +97,6 @@ class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
class OathOfGhoulsEffect extends OneShotEffect { class OathOfGhoulsEffect extends OneShotEffect {
// private static final FilterCard filter = new FilterCard("creature card");
//
// static {
// filter.add(new CardTypePredicate(CardType.CREATURE));
// filter.add(new OwnerPredicate(TargetController.ACTIVE));
// }
public OathOfGhoulsEffect() { public OathOfGhoulsEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand"; staticText = "that player chooses target player whose graveyard has fewer creature cards in it than their graveyard does and is their opponent. The first player may return a creature card from their graveyard to their hand";
@ -132,8 +117,7 @@ class OathOfGhoulsEffect extends OneShotEffect {
filter.add(new OwnerIdPredicate(firstPlayer.getId())); filter.add(new OwnerIdPredicate(firstPlayer.getId()));
Target target = new TargetCardInGraveyard(filter); Target target = new TargetCardInGraveyard(filter);
target.setNotTarget(true); target.setNotTarget(true);
// target.setTargetController(firstPlayer.getId()); if (target.canChoose(source.getSourceId(), firstPlayer.getId(), game)
if (target.canChoose(source.getSourceId(),firstPlayer.getId(), game)
&& firstPlayer.chooseUse(outcome, "Return a creature card from your graveyard to your hand?", source, game) && firstPlayer.chooseUse(outcome, "Return a creature card from your graveyard to your hand?", source, game)
&& firstPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game)) { && firstPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());

View file

@ -13,56 +13,33 @@ import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.FilterPlayer; import mage.filter.FilterPlayer;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.targetadjustment.TargetAdjuster;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class OathOfLieges extends CardImpl { public final class OathOfLieges extends CardImpl {
private final UUID originalId;
private static final FilterPlayer FILTER = new FilterPlayer("player who controls more lands than you do and is your opponent");
static {
FILTER.add(new OathOfLiegesPredicate());
}
public OathOfLieges(UUID ownerId, CardSetInfo setInfo) { public OathOfLieges(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is their opponent. The first player may search their library for a basic land card, put that card onto the battlefield, then shuffle their library. // At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is their opponent. The first player may search their library for a basic land card, put that card onto the battlefield, then shuffle their library.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfLiegesEffect(), TargetController.ANY, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfLiegesEffect(), TargetController.ANY, false);
ability.addTarget(new TargetPlayer(1, 1, false, FILTER)); ability.setTargetAdjuster(OathOfLiegesAdjuster.instance);
originalId = ability.getOriginalId();
this.addAbility(ability); this.addAbility(ability);
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, FILTER);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
public OathOfLieges(final OathOfLieges card) { public OathOfLieges(final OathOfLieges card) {
super(card); super(card);
this.originalId = card.originalId;
} }
@Override @Override
@ -71,6 +48,26 @@ public final class OathOfLieges extends CardImpl {
} }
} }
enum OathOfLiegesAdjuster implements TargetAdjuster {
instance;
private static final FilterPlayer FILTER = new FilterPlayer("player who controls more lands than you do and is your opponent");
static {
FILTER.add(new OathOfLiegesPredicate());
}
@Override
public void adjustTargets(Ability ability, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, FILTER);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
class OathOfLiegesEffect extends OneShotEffect { class OathOfLiegesEffect extends OneShotEffect {
public OathOfLiegesEffect() { public OathOfLiegesEffect() {
@ -106,8 +103,6 @@ class OathOfLiegesEffect extends OneShotEffect {
class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> { class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
private static final FilterLandPermanent FILTER = new FilterLandPermanent();
@Override @Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) { public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject(); Player targetPlayer = input.getObject();
@ -119,8 +114,8 @@ class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
if (!targetPlayer.hasOpponent(activePlayerId, game)) { if (!targetPlayer.hasOpponent(activePlayerId, game)) {
return false; return false;
} }
int countTargetPlayer = game.getBattlefield().countAll(FILTER, targetPlayer.getId(), game); int countTargetPlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, targetPlayer.getId(), game);
int countActivePlayer = game.getBattlefield().countAll(FILTER, activePlayerId, game); int countActivePlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, activePlayerId, game);
return countTargetPlayer > countActivePlayer; return countTargetPlayer > countActivePlayer;
} }

View file

@ -1,7 +1,6 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -17,46 +16,26 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class OathOfMages extends CardImpl { public final class OathOfMages extends CardImpl {
private final UUID originalId;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfMagesPredicate());
}
public OathOfMages(UUID ownerId, CardSetInfo setInfo) { public OathOfMages(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
// At the beginning of each player's upkeep, that player chooses target player who has more life than he or she does and is their opponent. The first player may have Oath of Mages deal 1 damage to the second player. // At the beginning of each player's upkeep, that player chooses target player who has more life than he or she does and is their opponent. The first player may have Oath of Mages deal 1 damage to the second player.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfMagesEffect(), TargetController.ANY, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfMagesEffect(), TargetController.ANY, false);
ability.addTarget(new TargetPlayer(1, 1, false, filter)); ability.setTargetAdjuster(OathOfMagesAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
originalId = ability.getOriginalId();
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
} }
public OathOfMages(final OathOfMages card) { public OathOfMages(final OathOfMages card) {
super(card); super(card);
this.originalId = card.originalId;
} }
@Override @Override
@ -65,6 +44,26 @@ public final class OathOfMages extends CardImpl {
} }
} }
enum OathOfMagesAdjuster implements TargetAdjuster {
instance;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfMagesPredicate());
}
@Override
public void adjustTargets(Ability ability, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
class OathOfMagesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> { class OathOfMagesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
@Override @Override

View file

@ -1,7 +1,6 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -17,47 +16,26 @@ import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class OathOfScholars extends CardImpl { public final class OathOfScholars extends CardImpl {
private final UUID originalId;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfScholarsPredicate());
}
public OathOfScholars(UUID ownerId, CardSetInfo setInfo) { public OathOfScholars(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// At the beginning of each player's upkeep, that player chooses target player who has more cards in hand than he or she does and is their opponent. The first player may discard their hand and draw three cards. // At the beginning of each player's upkeep, that player chooses target player who has more cards in hand than he or she does and is their opponent. The first player may discard their hand and draw three cards.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfScholarsEffect(), TargetController.ANY, false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfScholarsEffect(), TargetController.ANY, false);
ability.addTarget(new TargetPlayer(1, 1, false, filter)); ability.setTargetAdjuster(OathOfScholarsAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
originalId = ability.getOriginalId();
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
} }
public OathOfScholars(final OathOfScholars card) { public OathOfScholars(final OathOfScholars card) {
super(card); super(card);
this.originalId = card.originalId;
} }
@Override @Override
@ -66,6 +44,26 @@ public final class OathOfScholars extends CardImpl {
} }
} }
enum OathOfScholarsAdjuster implements TargetAdjuster {
instance;
private static final FilterPlayer filter = new FilterPlayer();
static {
filter.add(new OathOfScholarsPredicate());
}
@Override
public void adjustTargets(Ability ability, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer != null) {
ability.getTargets().clear();
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
target.setTargetController(activePlayer.getId());
ability.getTargets().add(target);
}
}
}
class OathOfScholarsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> { class OathOfScholarsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
@Override @Override

View file

@ -1,9 +1,7 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -13,12 +11,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class OpenIntoWonder extends CardImpl { public final class OpenIntoWonder extends CardImpl {
@ -30,28 +29,28 @@ public final class OpenIntoWonder extends CardImpl {
Effect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn); Effect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn);
effect.setText("X target creatures can't be blocked this turn"); effect.setText("X target creatures can't be blocked this turn");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_PERMANENT_CREATURE, false));
Ability abilityToGain = new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), false); Ability abilityToGain = new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), false);
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(abilityToGain, Duration.EndOfTurn, this.getSpellAbility().addEffect(new GainAbilityTargetEffect(abilityToGain, Duration.EndOfTurn,
"Until end of turn, those creatures gain \"Whenever this creature deals combat damage to a player, draw a card.\"")); "Until end of turn, those creatures gain \"Whenever this creature deals combat damage to a player, draw a card.\""));
this.getSpellAbility().setTargetAdjuster(OpenIntoWonderAdjuster.instance);
} }
public OpenIntoWonder(final OpenIntoWonder card) { public OpenIntoWonder(final OpenIntoWonder card) {
super(card); super(card);
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
ability.getTargets().clear();
int numberOfTargets = ability.getManaCostsToPay().getX();
numberOfTargets = Math.min(game.getBattlefield().count(StaticFilters.FILTER_PERMANENT_CREATURE, ability.getSourceId(), ability.getControllerId(), game), numberOfTargets);
ability.addTarget(new TargetCreaturePermanent(numberOfTargets));
}
}
@Override @Override
public OpenIntoWonder copy() { public OpenIntoWonder copy() {
return new OpenIntoWonder(this); return new OpenIntoWonder(this);
} }
} }
enum OpenIntoWonderAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
ability.addTarget(new TargetCreaturePermanent(ability.getManaCostsToPay().getX()));
}
}

View file

@ -1,7 +1,6 @@
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -22,10 +21,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class OpenSeason extends CardImpl { public final class OpenSeason extends CardImpl {
@ -37,7 +37,7 @@ public final class OpenSeason extends CardImpl {
Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()); Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance());
effect.setText("for each opponent, put a bounty counter on target creature that player controls"); effect.setText("for each opponent, put a bounty counter on target creature that player controls");
Ability ability = new EntersBattlefieldTriggeredAbility(effect); Ability ability = new EntersBattlefieldTriggeredAbility(effect);
ability.addTarget(new TargetCreaturePermanent()); ability.setTargetAdjuster(OpenSeasonAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
// Creatures your opponent control with bounty counters on them can't activate abilities // Creatures your opponent control with bounty counters on them can't activate abilities
@ -48,19 +48,6 @@ public final class OpenSeason extends CardImpl {
} }
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof EntersBattlefieldTriggeredAbility) {
ability.getTargets().clear();
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
ability.addTarget(new TargetPermanent(new FilterCreaturePermanent("creature from opponent " + opponent.getLogName())));
}
}
}
}
public OpenSeason(final OpenSeason card) { public OpenSeason(final OpenSeason card) {
super(card); super(card);
} }
@ -71,6 +58,21 @@ public final class OpenSeason extends CardImpl {
} }
} }
enum OpenSeasonAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
ability.addTarget(new TargetPermanent(new FilterCreaturePermanent("creature from opponent " + opponent.getLogName())));
}
}
}
}
class OpenSeasonRestrictionEffect extends RestrictionEffect { class OpenSeasonRestrictionEffect extends RestrictionEffect {
public OpenSeasonRestrictionEffect() { public OpenSeasonRestrictionEffect() {

View file

@ -3,7 +3,6 @@ package mage.cards.o;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.condition.common.KickedCondition; import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -18,17 +17,17 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class OrimsThunder extends CardImpl { public final class OrimsThunder extends CardImpl {
public OrimsThunder(UUID ownerId, CardSetInfo setInfo) { public OrimsThunder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Kicker {R} // Kicker {R}
this.addAbility(new KickerAbility("{R}")); this.addAbility(new KickerAbility("{R}"));
@ -39,16 +38,9 @@ public final class OrimsThunder extends CardImpl {
this.getSpellAbility().addEffect(new ConditionalOneShotEffect( this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new OrimsThunderEffect2(), new OrimsThunderEffect2(),
KickedCondition.instance, KickedCondition.instance,
"If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature")); "If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature")
} );
this.getSpellAbility().setTargetAdjuster(OrimsThunderAdjuster.instance);
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
if (KickedCondition.instance.apply(game, ability)) {
ability.addTarget(new TargetCreaturePermanent());
}
}
} }
public OrimsThunder(final OrimsThunder card) { public OrimsThunder(final OrimsThunder card) {
@ -61,6 +53,18 @@ public final class OrimsThunder extends CardImpl {
} }
} }
enum OrimsThunderAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
if (KickedCondition.instance.apply(game, ability)) {
ability.addTarget(new TargetCreaturePermanent());
}
}
}
class OrimsThunderEffect2 extends OneShotEffect { class OrimsThunderEffect2 extends OneShotEffect {
OrimsThunderEffect2() { OrimsThunderEffect2() {