mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
updated cost adjusters A through F
This commit is contained in:
parent
c9ca0e8916
commit
537391a772
7 changed files with 149 additions and 160 deletions
|
@ -1,26 +1,26 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class AbandonHope extends CardImpl {
|
||||
|
@ -29,7 +29,7 @@ public final class AbandonHope extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{1}{B}");
|
||||
|
||||
// As an additional cost to cast Abandon Hope, discard X cards.
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL, new AbandonHopeRuleEffect());
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL, new InfoEffect("As an additional cost to cast this spell, discard X cards"));
|
||||
ability.setRuleAtTheTop(true);
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -37,44 +37,27 @@ public final class AbandonHope extends CardImpl {
|
|||
ManacostVariableValue manaX = new ManacostVariableValue();
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(manaX, TargetController.ANY));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().setCostAdjuster(AbandonHopeAdjuster.instance);
|
||||
}
|
||||
|
||||
public AbandonHope(final AbandonHope card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, new FilterCard("cards"))));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbandonHope copy() {
|
||||
return new AbandonHope(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AbandonHopeRuleEffect extends OneShotEffect {
|
||||
|
||||
public AbandonHopeRuleEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "As an additional cost to cast this spell, discard X cards";
|
||||
}
|
||||
|
||||
public AbandonHopeRuleEffect(final AbandonHopeRuleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
enum AbandonHopeAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public AbandonHopeRuleEffect copy() {
|
||||
return new AbandonHopeRuleEffect(this);
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new DiscardTargetCost(new TargetCardInHand(xValue, xValue, StaticFilters.FILTER_CARD_CARDS)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -21,8 +22,9 @@ import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class CallerOfTheHunt extends CardImpl {
|
||||
|
@ -34,14 +36,24 @@ public final class CallerOfTheHunt extends CardImpl {
|
|||
|
||||
// As an additional cost to cast Caller of the Hunt, choose a creature type.
|
||||
// Caller of the Hunt's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CallerOfTheHuntAdditionalCostEffect()));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("as an additional cost to cast this spell, choose a creature type. \r"
|
||||
+ "{this}'s power and toughness are each equal to the number of creatures of the chosen type on the battlefield")));
|
||||
this.getSpellAbility().setCostAdjuster(CallerOfTheHuntAdjuster.instance);
|
||||
}
|
||||
|
||||
public CallerOfTheHunt(final CallerOfTheHunt card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHunt copy() {
|
||||
return new CallerOfTheHunt(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CallerOfTheHuntAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
MageObject mageObject = game.getObject(ability.getSourceId());
|
||||
|
@ -56,34 +68,6 @@ public final class CallerOfTheHunt extends CardImpl {
|
|||
game.addEffect(effectToughness, ability);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHunt copy() {
|
||||
return new CallerOfTheHunt(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CallerOfTheHuntAdditionalCostEffect extends OneShotEffect {
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "as an additional cost to cast this spell, choose a creature type. \r"
|
||||
+ "{this}'s power and toughness are each equal to the number of creatures of the chosen type on the battlefield";
|
||||
}
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect(final CallerOfTheHuntAdditionalCostEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHuntAdditionalCostEffect copy() {
|
||||
return new CallerOfTheHuntAdditionalCostEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but that other version is not compatible with this card
|
||||
|
@ -116,5 +100,4 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
|
|||
public ChooseCreatureTypeEffect copy() {
|
||||
return new ChooseCreatureTypeEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
@ -22,23 +21,19 @@ import mage.target.common.TargetCardInHand;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DraconicRoar extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public DraconicRoar(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// As an additional cost to cast Draconic Roar, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
this.getSpellAbility().setCostAdjuster(DraconicRoarAdjuster.instance);
|
||||
|
||||
// Draconic Roar deals 3 damage to target creature. If you revealed a Dragon card or controlled a Dragon as you cast Draconic Roar, Draconic Roar deals 3 damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
|
||||
|
@ -47,18 +42,6 @@ public final class DraconicRoar extends CardImpl {
|
|||
this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DraconicRoar(final DraconicRoar card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -69,6 +52,25 @@ public final class DraconicRoar extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DraconicRoarAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DraconicRoarEffect extends OneShotEffect {
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffect;
|
||||
|
@ -25,24 +25,20 @@ import mage.game.stack.Spell;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class DragonlordsPrerogative extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public DragonlordsPrerogative(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}{U}");
|
||||
|
||||
// As an additional cost to cast Dragonlord's Prerogative, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
|
||||
this.getSpellAbility().setCostAdjuster(DragonlordsPrerogativeAdjuster.instance);
|
||||
|
||||
// If you revealed a Dragon card or controlled a Dragon as you cast Dragonlord's Prerogative, Dragonlord's Prerogative can't be countered.
|
||||
Condition condition = new DragonlordsPrerogativeCondition();
|
||||
ContinuousRuleModifyingEffect cantBeCountered = new CantBeCounteredSourceEffect();
|
||||
|
@ -50,22 +46,12 @@ public final class DragonlordsPrerogative extends CardImpl {
|
|||
conditionalCantBeCountered.setText("<br/>If you revealed a Dragon card or controlled a Dragon as you cast {this}, this spell can't be countered");
|
||||
Ability ability = new SimpleStaticAbility(Zone.STACK, conditionalCantBeCountered);
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
// Draw four cards.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(4));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DragonlordsPrerogative(final DragonlordsPrerogative card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -76,6 +62,25 @@ public final class DragonlordsPrerogative extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum DragonlordsPrerogativeAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DragonlordsPrerogativeCondition implements Condition {
|
||||
|
||||
private final static FilterControlledPermanent filter = new FilterControlledPermanent("Dragon");
|
||||
|
@ -89,7 +94,7 @@ class DragonlordsPrerogativeCondition implements Condition {
|
|||
boolean applies = false;
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null && spell.getSpellAbility() != null) {
|
||||
for(Cost cost: spell.getSpellAbility().getCosts()) {
|
||||
for (Cost cost : spell.getSpellAbility().getCosts()) {
|
||||
if (cost instanceof RevealTargetFromHandCost) {
|
||||
applies = !cost.getTargets().isEmpty();
|
||||
break;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -25,8 +25,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class EliteArcanist extends CardImpl {
|
||||
|
@ -45,6 +46,7 @@ public final class EliteArcanist extends CardImpl {
|
|||
// {X}, {T}: Copy the exiled card. You may cast the copy without paying its mana cost. X is the converted mana cost of the exiled card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EliteArcanistCopyEffect(), new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.setCostAdjuster(EliteArcanistAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -52,29 +54,35 @@ public final class EliteArcanist extends CardImpl {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) {
|
||||
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
|
||||
if (imprintedInstant != null) {
|
||||
int cmc = imprintedInstant.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
ability.getManaCostsToPay().clear();
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(cmc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EliteArcanist copy() {
|
||||
return new EliteArcanist(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EliteArcanistAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent == null
|
||||
|| sourcePermanent.getImprinted() == null
|
||||
|| sourcePermanent.getImprinted().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
|
||||
if (imprintedInstant == null) {
|
||||
return;
|
||||
}
|
||||
int cmc = imprintedInstant.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
ability.getManaCostsToPay().clear();
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(cmc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class EliteArcanistImprintEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("instant card from your hand");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -14,8 +14,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class Fireball extends CardImpl {
|
||||
|
@ -27,14 +28,7 @@ public final class Fireball extends CardImpl {
|
|||
// Fireball costs 1 more to cast for each target beyond the first.
|
||||
this.getSpellAbility().addTarget(new FireballTargetCreatureOrPlayer(0, Integer.MAX_VALUE));
|
||||
this.getSpellAbility().addEffect(new FireballEffect());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().isEmpty() ? 0 : ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 1) {
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1));
|
||||
}
|
||||
this.getSpellAbility().setCostAdjuster(FireballAdjuster.instance);
|
||||
}
|
||||
|
||||
public Fireball(final Fireball card) {
|
||||
|
@ -47,6 +41,18 @@ public final class Fireball extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FireballAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int numTargets = ability.getTargets().isEmpty() ? 0 : ability.getTargets().get(0).getTargets().size();
|
||||
if (numTargets > 1) {
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FireballEffect extends OneShotEffect {
|
||||
|
||||
public FireballEffect() {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
@ -22,23 +21,19 @@ import mage.target.TargetPlayer;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class FoulTongueInvocation extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
public FoulTongueInvocation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// As an additional cost to cast Foul-Tongue Invocation, you may reveal a Dragon card from your hand.
|
||||
this.getSpellAbility().addEffect(new InfoEffect("as an additional cost to cast this spell, you may reveal a Dragon card from your hand"));
|
||||
this.getSpellAbility().setCostAdjuster(FoulTongueInvocationAdjuster.instance);
|
||||
|
||||
// Target player sacrifices a creature. If you revealed a Dragon card or controlled a Dragon as you cast Foul-Tongue Invocation, you gain 4 life.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
|
@ -47,18 +42,6 @@ public final class FoulTongueInvocation extends CardImpl {
|
|||
this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FoulTongueInvocation(final FoulTongueInvocation card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -69,6 +52,25 @@ public final class FoulTongueInvocation extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FoulTongueInvocationAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
private static final FilterCard filter = new FilterCard("a Dragon card from your hand (you don't have to)");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.DRAGON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filter, game) > 0) {
|
||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FoulTongueInvocationEffect extends OneShotEffect {
|
||||
|
||||
public FoulTongueInvocationEffect() {
|
||||
|
|
Loading…
Reference in a new issue