Cost increasing effects - refactor, removed redundant custom effects (related to #6684 and #6698);

This commit is contained in:
Oleg Agafonov 2020-06-29 15:39:58 +04:00
parent 4bdd8910a8
commit 90965802d0
28 changed files with 363 additions and 655 deletions

View file

@ -1,22 +1,22 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class AlabasterLeech extends CardImpl { public final class AlabasterLeech extends CardImpl {
@ -28,14 +28,14 @@ public final class AlabasterLeech extends CardImpl {
} }
public AlabasterLeech(UUID ownerId, CardSetInfo setInfo) { public AlabasterLeech(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.LEECH); this.subtype.add(SubType.LEECH);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// White spells you cast cost {W} more to cast. // White spells you cast cost {W} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{W}")))); new SpellsCostIncreasingAllEffect(new ManaCostsImpl("{W}"), filter, TargetController.YOU)));
} }
public AlabasterLeech(final AlabasterLeech card) { public AlabasterLeech(final AlabasterLeech card) {

View file

@ -1,25 +1,21 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class AndraditeLeech extends CardImpl { public final class AndraditeLeech extends CardImpl {
@ -31,17 +27,17 @@ public final class AndraditeLeech extends CardImpl {
} }
public AndraditeLeech(UUID ownerId, CardSetInfo setInfo) { public AndraditeLeech(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.LEECH); this.subtype.add(SubType.LEECH);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Black spells you cast cost {B} more to cast. // Black spells you cast cost {B} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{B}")))); new SpellsCostIncreasingAllEffect(new ManaCostsImpl("{B}"), filter, TargetController.YOU)));
// {B}: Andradite Leech gets +1/+1 until end of turn. // {B}: Andradite Leech gets +1/+1 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{B}"))); new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{B}")));
} }
public AndraditeLeech(final AndraditeLeech card) { public AndraditeLeech(final AndraditeLeech card) {

View file

@ -1,35 +1,42 @@
package mage.cards.a; package mage.cards.a;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.filter.predicate.Predicates;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class AuraOfSilence extends CardImpl { public final class AuraOfSilence extends CardImpl {
private static final FilterCard filter = new FilterCard("Artifact and enchantment spells");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.ENCHANTMENT.getPredicate()));
}
public AuraOfSilence(UUID ownerId, CardSetInfo setInfo) { public AuraOfSilence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
// Artifact and enchantment spells your opponents cast cost {2} more to cast. // Artifact and enchantment spells your opponents cast cost {2} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AuraOfSilenceCostModificationEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(2, filter, TargetController.OPPONENT)));
// Sacrifice Aura of Silence: Destroy target artifact or enchantment. // Sacrifice Aura of Silence: Destroy target artifact or enchantment.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new SacrificeSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT)); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
@ -44,41 +51,4 @@ public final class AuraOfSilence extends CardImpl {
public AuraOfSilence copy() { public AuraOfSilence copy() {
return new AuraOfSilence(this); return new AuraOfSilence(this);
} }
}
class AuraOfSilenceCostModificationEffect extends CostModificationEffectImpl {
AuraOfSilenceCostModificationEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Artifact and enchantment spells your opponents cast cost {2} more to cast";
}
AuraOfSilenceCostModificationEffect(AuraOfSilenceCostModificationEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, -2);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && (card.isArtifact() || card.isEnchantment())) {
return true;
}
}
}
return false;
}
@Override
public AuraOfSilenceCostModificationEffect copy() {
return new AuraOfSilenceCostModificationEffect(this);
}
} }

View file

@ -1,33 +1,34 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class Chill extends CardImpl { public final class Chill extends CardImpl {
private static final FilterCard filter = new FilterCard("Red spells"); private static final FilterCard filter = new FilterCard("Red spells");
static { static {
filter.add(new ColorPredicate(ObjectColor.RED)); filter.add(new ColorPredicate(ObjectColor.RED));
} }
public Chill(UUID ownerId, CardSetInfo setInfo) { public Chill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// Red spells cost {2} more to cast. // Red spells cost {2} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(filter, 2))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(2, filter, TargetController.ANY)));
} }
public Chill(final Chill card) { public Chill(final Chill card) {

View file

@ -1,19 +1,15 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration; import mage.filter.FilterCard;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
@ -21,8 +17,9 @@ import mage.game.events.ManaEvent;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.CastSpellLastTurnWatcher; import mage.watchers.common.CastSpellLastTurnWatcher;
import java.util.UUID;
/** /**
*
* @author L_J * @author L_J
*/ */
public final class DampingSphere extends CardImpl { public final class DampingSphere extends CardImpl {
@ -90,10 +87,10 @@ class DampingSphereReplacementEffect extends ReplacementEffectImpl {
} }
} }
class DampingSphereIncreasementAllEffect extends SpellsCostIncreasementAllEffect { class DampingSphereIncreasementAllEffect extends SpellsCostIncreasingAllEffect {
DampingSphereIncreasementAllEffect() { DampingSphereIncreasementAllEffect() {
super(0); super(1, new FilterCard(), TargetController.ANY);
this.staticText = "Each spell a player casts costs {1} more to cast for each other spell that player has cast this turn"; this.staticText = "Each spell a player casts costs {1} more to cast for each other spell that player has cast this turn";
} }

View file

@ -1,41 +1,41 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class Derelor extends CardImpl { public final class Derelor extends CardImpl {
private static final FilterCard filter = new FilterCard("Black spells"); private static final FilterCard filter = new FilterCard("Black spells");
static { static {
filter.add(new ColorPredicate(ObjectColor.BLACK)); filter.add(new ColorPredicate(ObjectColor.BLACK));
} }
public Derelor(UUID ownerId, CardSetInfo setInfo) { public Derelor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.THRULL); this.subtype.add(SubType.THRULL);
this.power = new MageInt(4); this.power = new MageInt(4);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Black spells you cast cost {B} more to cast. // Black spells you cast cost {B} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl<>("{B}")))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(new ManaCostsImpl<>("{B}"), filter, TargetController.YOU)));
} }
public Derelor(final Derelor card) { public Derelor(final Derelor card) {

View file

@ -2,30 +2,35 @@ package mage.cards.d;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.SpellAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.PreventDamageByTargetEffect; import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.abilities.effects.common.PreventDamageToTargetEffect; import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.filter.predicate.Predicates;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
import mage.abilities.mana.ManaAbility;
import mage.game.stack.Spell;
/** /**
* @author TheElk801 * @author TheElk801
*/ */
public final class DovinHandOfControl extends CardImpl { public final class DovinHandOfControl extends CardImpl {
private static final FilterCard filter = new FilterCard("Artifact, instant, and sorcery spells");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.INSTANT.getPredicate(),
CardType.SORCERY.getPredicate()));
}
public DovinHandOfControl(UUID ownerId, CardSetInfo setInfo) { public DovinHandOfControl(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W/U}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W/U}");
@ -34,7 +39,7 @@ public final class DovinHandOfControl extends CardImpl {
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// Artifact, instant, and sorcery spells your opponents cast cost {1} more to cast. // Artifact, instant, and sorcery spells your opponents cast cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(new DovinHandOfControlEffect())); this.addAbility(new SimpleStaticAbility(new SpellsCostIncreasingAllEffect(1, filter, TargetController.OPPONENT)));
// -1: Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls. // -1: Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.
Ability ability = new LoyaltyAbility(new PreventDamageToTargetEffect( Ability ability = new LoyaltyAbility(new PreventDamageToTargetEffect(
@ -55,40 +60,4 @@ public final class DovinHandOfControl extends CardImpl {
public DovinHandOfControl copy() { public DovinHandOfControl copy() {
return new DovinHandOfControl(this); return new DovinHandOfControl(this);
} }
} }
class DovinHandOfControlEffect extends CostModificationEffectImpl {
DovinHandOfControlEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Artifact, instant, and sorcery spells your opponents cast cost {1} more to cast";
}
private DovinHandOfControlEffect(DovinHandOfControlEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, -1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
Card card = game.getCard(abilityToModify.getSourceId());
if (!(abilityToModify instanceof SpellAbility)) {
return false;
}
return card != null
&& (card.isInstantOrSorcery()
|| card.isArtifact())
&& game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId());
}
@Override
public DovinHandOfControlEffect copy() {
return new DovinHandOfControlEffect(this);
}
}

View file

@ -1,29 +1,29 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*
*/ */
public final class FerozsBan extends CardImpl { public final class FerozsBan extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard("Creature spells");
public FerozsBan(UUID ownerId, CardSetInfo setInfo) { public FerozsBan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
// Creature spells cost {2} more to cast. // Creature spells cost {2} more to cast.
Effect effect = new SpellsCostIncreasementAllEffect(StaticFilters.FILTER_CARD_CREATURE, 2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(2, filter, TargetController.ANY)));
effect.setText("Creature spells cost {2} more to cast.");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
} }
public FerozsBan(final FerozsBan card) { public FerozsBan(final FerozsBan card) {

View file

@ -1,24 +1,23 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import java.util.UUID;
/** /**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/ */
public final class GeistFueledScarecrow extends CardImpl { public final class GeistFueledScarecrow extends CardImpl {
private static final FilterCard filter = new FilterCard("Creature spells"); private static final FilterCard filter = new FilterCard("Creature spells");
static { static {
@ -26,14 +25,14 @@ public final class GeistFueledScarecrow extends CardImpl {
} }
public GeistFueledScarecrow(UUID ownerId, CardSetInfo setInfo) { public GeistFueledScarecrow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.subtype.add(SubType.SCARECROW); this.subtype.add(SubType.SCARECROW);
this.power = new MageInt(4); this.power = new MageInt(4);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Creature spells you cast cost {1} more to cast. // Creature spells you cast cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{1}")))); new SpellsCostIncreasingAllEffect(1, filter, TargetController.YOU)));
} }
public GeistFueledScarecrow(final GeistFueledScarecrow card) { public GeistFueledScarecrow(final GeistFueledScarecrow card) {

View file

@ -1,13 +1,11 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -16,23 +14,25 @@ import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game; import mage.game.Game;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID;
/** /**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/ */
public final class Gloom extends CardImpl { public final class Gloom extends CardImpl {
private static final FilterCard filter = new FilterCard("White spells"); private static final FilterCard filter = new FilterCard("White spells");
static { static {
filter.add(new ColorPredicate(ObjectColor.WHITE)); filter.add(new ColorPredicate(ObjectColor.WHITE));
} }
public Gloom(UUID ownerId, CardSetInfo setInfo) { public Gloom(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
// White spells cost {3} more to cast. // White spells cost {3} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(filter, 3))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(3, filter, TargetController.ANY)));
// Activated abilities of white enchantments cost {3} more to activate. // Activated abilities of white enchantments cost {3} more to activate.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GloomCostIncreaseEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GloomCostIncreaseEffect()));
} }
@ -63,12 +63,12 @@ class GloomCostIncreaseEffect extends CostModificationEffectImpl {
CardUtil.increaseCost(abilityToModify, 3); CardUtil.increaseCost(abilityToModify, 3);
return true; return true;
} }
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
boolean isWhiteEnchantment = false; boolean isWhiteEnchantment = false;
boolean isActivated = abilityToModify.getAbilityType() == AbilityType.ACTIVATED; boolean isActivated = abilityToModify.getAbilityType() == AbilityType.ACTIVATED;
if (isActivated) { if (isActivated) {
MageObject permanent = game.getPermanent(abilityToModify.getSourceId()); MageObject permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null) { if (permanent != null) {
isWhiteEnchantment = permanent.isEnchantment() && permanent.getColor(game).isWhite(); isWhiteEnchantment = permanent.isEnchantment() && permanent.getColor(game).isWhite();

View file

@ -1,25 +1,30 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.game.Game; import mage.constants.SubType;
import mage.util.CardUtil; import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class Glowrider extends CardImpl { public final class Glowrider extends CardImpl {
private static final FilterCard filter = new FilterCard("Noncreature spells");
static {
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
}
public Glowrider(UUID ownerId, CardSetInfo setInfo) { public Glowrider(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
@ -28,7 +33,7 @@ public final class Glowrider extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Noncreature spells cost {1} more to cast. // Noncreature spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GlowriderCostReductionEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
public Glowrider(final Glowrider card) { public Glowrider(final Glowrider card) {
@ -40,38 +45,3 @@ public final class Glowrider extends CardImpl {
return new Glowrider(this); return new Glowrider(this);
} }
} }
class GlowriderCostReductionEffect extends CostModificationEffectImpl {
GlowriderCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast";
}
GlowriderCostReductionEffect(GlowriderCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.increaseCost(abilityToModify, 1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) {
return true;
}
}
return false;
}
@Override
public GlowriderCostReductionEffect copy() {
return new GlowriderCostReductionEffect(this);
}
}

View file

@ -1,16 +1,15 @@
package mage.cards.g; package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.LoseLifeOpponentsEffect; import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.game.Game; import mage.constants.SuperType;
import mage.util.CardUtil; import mage.constants.TargetController;
import mage.filter.FilterCard;
import java.util.UUID; import java.util.UUID;
@ -25,7 +24,7 @@ public final class GodPharaohsStatue extends CardImpl {
this.addSuperType(SuperType.LEGENDARY); this.addSuperType(SuperType.LEGENDARY);
// Spells your opponents cast cost {2} more to cast. // Spells your opponents cast cost {2} more to cast.
this.addAbility(new SimpleStaticAbility(new GodPharaohsStatueEffect())); this.addAbility(new SimpleStaticAbility(new SpellsCostIncreasingAllEffect(2, new FilterCard("Spells"), TargetController.OPPONENT)));
// At the beginning of your end step, each opponent loses 1 life. // At the beginning of your end step, each opponent loses 1 life.
this.addAbility(new BeginningOfEndStepTriggeredAbility( this.addAbility(new BeginningOfEndStepTriggeredAbility(
@ -42,40 +41,3 @@ public final class GodPharaohsStatue extends CardImpl {
return new GodPharaohsStatue(this); return new GodPharaohsStatue(this);
} }
} }
class GodPharaohsStatueEffect extends CostModificationEffectImpl {
private static final String effectText = "Spells your opponents cast cost {2} more to cast";
GodPharaohsStatueEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = effectText;
}
private GodPharaohsStatueEffect(GodPharaohsStatueEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, -2);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
return true;
}
}
return false;
}
@Override
public GodPharaohsStatueEffect copy() {
return new GodPharaohsStatueEffect(this);
}
}

View file

@ -2,18 +2,14 @@ package mage.cards.g;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
@ -46,7 +42,7 @@ public final class GrandArbiterAugustinIV extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filterBlue, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filterBlue, 1)));
// Spells your opponents cast cost {1} more to cast. // Spells your opponents cast cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GrandArbiterAugustinIVCostIncreaseEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, new FilterCard("Spells"), TargetController.OPPONENT)));
} }
public GrandArbiterAugustinIV(final GrandArbiterAugustinIV card) { public GrandArbiterAugustinIV(final GrandArbiterAugustinIV card) {
@ -58,40 +54,3 @@ public final class GrandArbiterAugustinIV extends CardImpl {
return new GrandArbiterAugustinIV(this); return new GrandArbiterAugustinIV(this);
} }
} }
class GrandArbiterAugustinIVCostIncreaseEffect extends CostModificationEffectImpl {
private static final String effectText = "Spells your opponents cast cost {1} more to cast";
GrandArbiterAugustinIVCostIncreaseEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = effectText;
}
GrandArbiterAugustinIVCostIncreaseEffect(GrandArbiterAugustinIVCostIncreaseEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, -1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
return true;
}
}
return false;
}
@Override
public GrandArbiterAugustinIVCostIncreaseEffect copy() {
return new GrandArbiterAugustinIVCostIncreaseEffect(this);
}
}

View file

@ -1,35 +1,36 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class HighSeas extends CardImpl { public final class HighSeas extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("Red creature spells and green creature spells"); private static final FilterCreatureCard filter = new FilterCreatureCard("Red creature spells and green creature spells");
static { static {
filter.add(Predicates.or(new ColorPredicate(ObjectColor.RED), filter.add(Predicates.or(new ColorPredicate(ObjectColor.RED),
(new ColorPredicate(ObjectColor.GREEN)))); (new ColorPredicate(ObjectColor.GREEN))));
} }
public HighSeas(UUID ownerId, CardSetInfo setInfo) { public HighSeas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// Red creature spells and green creature spells cost {1} more to cast. // Red creature spells and green creature spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(filter, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
public HighSeas(final HighSeas card) { public HighSeas(final HighSeas card) {

View file

@ -1,35 +1,32 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterEnchantmentCard; import mage.filter.common.FilterEnchantmentCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class IriniSengir extends CardImpl { public final class IriniSengir extends CardImpl {
private static final FilterEnchantmentCard filter = new FilterEnchantmentCard("Green enchantment spells and white enchantment spells"); private static final FilterEnchantmentCard filter = new FilterEnchantmentCard("Green enchantment spells and white enchantment spells");
static { static {
filter.add(Predicates.or(new ColorPredicate(ObjectColor.GREEN), filter.add(Predicates.or(new ColorPredicate(ObjectColor.GREEN),
(new ColorPredicate(ObjectColor.WHITE)))); (new ColorPredicate(ObjectColor.WHITE))));
} }
public IriniSengir(UUID ownerId, CardSetInfo setInfo) { public IriniSengir(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VAMPIRE); this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.DWARF); this.subtype.add(SubType.DWARF);
@ -37,7 +34,9 @@ public final class IriniSengir extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Green enchantment spells and white enchantment spells cost {2} more to cast. // Green enchantment spells and white enchantment spells cost {2} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(filter, 2))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasingAllEffect(2, filter, TargetController.ANY))
);
} }
public IriniSengir(final IriniSengir card) { public IriniSengir(final IriniSengir card) {

View file

@ -1,22 +1,22 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class JadeLeech extends CardImpl { public final class JadeLeech extends CardImpl {
@ -28,14 +28,14 @@ public final class JadeLeech extends CardImpl {
} }
public JadeLeech(UUID ownerId, CardSetInfo setInfo) { public JadeLeech(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.subtype.add(SubType.LEECH); this.subtype.add(SubType.LEECH);
this.power = new MageInt(5); this.power = new MageInt(5);
this.toughness = new MageInt(5); this.toughness = new MageInt(5);
// Green spells you cast cost {G} more to cast. // Green spells you cast cost {G} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{G}")))); new SpellsCostIncreasingAllEffect(new ManaCostsImpl("{G}"), filter, TargetController.YOU)));
} }
public JadeLeech(final JadeLeech card) { public JadeLeech(final JadeLeech card) {

View file

@ -1,30 +1,30 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.CostModificationType; import mage.constants.TargetController;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class LodestoneGolem extends CardImpl { public final class LodestoneGolem extends CardImpl {
private static final FilterCard filter = new FilterCard("Nonartifact spells");
static {
filter.add(Predicates.not(CardType.ARTIFACT.getPredicate()));
}
public LodestoneGolem(UUID ownerId, CardSetInfo setInfo) { public LodestoneGolem(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.subtype.add(SubType.GOLEM); this.subtype.add(SubType.GOLEM);
@ -33,7 +33,7 @@ public final class LodestoneGolem extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Nonartifact spells cost {1} more to cast. // Nonartifact spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LodestoneGolemCostReductionEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
public LodestoneGolem(final LodestoneGolem card) { public LodestoneGolem(final LodestoneGolem card) {
@ -45,39 +45,3 @@ public final class LodestoneGolem extends CardImpl {
return new LodestoneGolem(this); return new LodestoneGolem(this);
} }
} }
class LodestoneGolemCostReductionEffect extends CostModificationEffectImpl {
LodestoneGolemCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Nonartifact spells cost {1} more to cast";
}
LodestoneGolemCostReductionEffect(LodestoneGolemCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
spellAbility.getManaCostsToPay().add(new GenericManaCost(1));
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isArtifact()) {
return true;
}
}
return false;
}
@Override
public LodestoneGolemCostReductionEffect copy() {
return new LodestoneGolemCostReductionEffect(this);
}
}

View file

@ -1,23 +1,23 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class RubyLeech extends CardImpl { public final class RubyLeech extends CardImpl {
@ -29,7 +29,7 @@ public final class RubyLeech extends CardImpl {
} }
public RubyLeech(UUID ownerId, CardSetInfo setInfo) { public RubyLeech(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.LEECH); this.subtype.add(SubType.LEECH);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
@ -38,7 +38,7 @@ public final class RubyLeech extends CardImpl {
this.addAbility(FirstStrikeAbility.getInstance()); this.addAbility(FirstStrikeAbility.getInstance());
// Red spells you cast cost {R} more to cast. // Red spells you cast cost {R} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{R}")))); new SpellsCostIncreasingAllEffect(new ManaCostsImpl("{R}"), filter, TargetController.YOU)));
} }
public RubyLeech(final RubyLeech card) { public RubyLeech(final RubyLeech card) {

View file

@ -1,23 +1,23 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostIncreasementControllerEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class SapphireLeech extends CardImpl { public final class SapphireLeech extends CardImpl {
@ -29,7 +29,7 @@ public final class SapphireLeech extends CardImpl {
} }
public SapphireLeech(UUID ownerId, CardSetInfo setInfo) { public SapphireLeech(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.LEECH); this.subtype.add(SubType.LEECH);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
@ -38,7 +38,7 @@ public final class SapphireLeech extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Blue spells you cast cost {U} more to cast. // Blue spells you cast cost {U} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("{U}")))); new SpellsCostIncreasingAllEffect(new ManaCostsImpl("{U}"), filter, TargetController.YOU)));
} }
public SapphireLeech(final SapphireLeech card) { public SapphireLeech(final SapphireLeech card) {

View file

@ -1,25 +1,28 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class SphereOfResistance extends CardImpl { public final class SphereOfResistance extends CardImpl {
public SphereOfResistance(UUID ownerId, CardSetInfo setInfo) { public SphereOfResistance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Spells cost {1} more to cast. // Spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new SpellsCostIncreasingAllEffect(1, new FilterCard("Spells"), TargetController.ANY))
);
} }
public SphereOfResistance(final SphereOfResistance card) { public SphereOfResistance(final SphereOfResistance card) {

View file

@ -1,35 +1,34 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class Squeeze extends CardImpl { public final class Squeeze extends CardImpl {
private static final FilterCard filter = new FilterCard("Sorcery spells"); private static final FilterCard filter = new FilterCard("Sorcery spells");
static { static {
filter.add(CardType.SORCERY.getPredicate()); filter.add(CardType.SORCERY.getPredicate());
} }
public Squeeze(UUID ownerId, CardSetInfo setInfo) { public Squeeze(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Sorcery spells cost {3} more to cast. // Sorcery spells cost {3} more to cast.
Effect effect = new SpellsCostIncreasementAllEffect(filter, 3); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
effect.setText("Sorcery spells cost {3} more to cast"); new SpellsCostIncreasingAllEffect(3, filter, TargetController.ANY))
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); );
} }
public Squeeze(final Squeeze card) { public Squeeze(final Squeeze card) {

View file

@ -1,26 +1,28 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.game.Game; import mage.filter.FilterCard;
import mage.util.CardUtil; import mage.filter.predicate.Predicates;
import java.util.UUID;
/** /**
*
* @author BetaSteward * @author BetaSteward
*/ */
public final class ThaliaGuardianOfThraben extends CardImpl { public final class ThaliaGuardianOfThraben extends CardImpl {
private static final FilterCard filter = new FilterCard("Noncreature spells");
static {
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
}
public ThaliaGuardianOfThraben(UUID ownerId, CardSetInfo setInfo) { public ThaliaGuardianOfThraben(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
@ -33,7 +35,7 @@ public final class ThaliaGuardianOfThraben extends CardImpl {
this.addAbility(FirstStrikeAbility.getInstance()); this.addAbility(FirstStrikeAbility.getInstance());
// Noncreature spells cost {1} more to cast. // Noncreature spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThaliaGuardianOfThrabenCostReductionEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
@ -45,39 +47,4 @@ public final class ThaliaGuardianOfThraben extends CardImpl {
public ThaliaGuardianOfThraben copy() { public ThaliaGuardianOfThraben copy() {
return new ThaliaGuardianOfThraben(this); return new ThaliaGuardianOfThraben(this);
} }
} }
class ThaliaGuardianOfThrabenCostReductionEffect extends CostModificationEffectImpl {
ThaliaGuardianOfThrabenCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast";
}
ThaliaGuardianOfThrabenCostReductionEffect(ThaliaGuardianOfThrabenCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.increaseCost(abilityToModify, 1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) {
return true;
}
}
return false;
}
@Override
public ThaliaGuardianOfThrabenCostReductionEffect copy() {
return new ThaliaGuardianOfThrabenCostReductionEffect(this);
}
}

View file

@ -1,31 +1,33 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class ThornOfAmethyst extends CardImpl { public final class ThornOfAmethyst extends CardImpl {
private static final FilterCard filter = new FilterCard("Noncreature spells"); private static final FilterCard filter = new FilterCard("Noncreature spells");
static { static {
filter.add(Predicates.not(CardType.CREATURE.getPredicate())); filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
} }
public ThornOfAmethyst(UUID ownerId, CardSetInfo setInfo) { public ThornOfAmethyst(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Noncreature spells cost {1} more to cast. // Noncreature spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementAllEffect(filter, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
public ThornOfAmethyst(final ThornOfAmethyst card) { public ThornOfAmethyst(final ThornOfAmethyst card) {

View file

@ -1,31 +1,31 @@
package mage.cards.v; package mage.cards.v;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.CostModificationType; import mage.constants.TargetController;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.filter.FilterCard;
import mage.util.CardUtil; import mage.filter.predicate.Predicates;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class VrynWingmare extends CardImpl { public final class VrynWingmare extends CardImpl {
private static final FilterCard filter = new FilterCard("Noncreature spells");
static {
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
}
public VrynWingmare(UUID ownerId, CardSetInfo setInfo) { public VrynWingmare(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.PEGASUS); this.subtype.add(SubType.PEGASUS);
@ -36,7 +36,7 @@ public final class VrynWingmare extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Noncreature spells cost {1} more to cast. // Noncreature spells cost {1} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VrynWingmareCostReductionEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasingAllEffect(1, filter, TargetController.ANY)));
} }
public VrynWingmare(final VrynWingmare card) { public VrynWingmare(final VrynWingmare card) {
@ -48,38 +48,3 @@ public final class VrynWingmare extends CardImpl {
return new VrynWingmare(this); return new VrynWingmare(this);
} }
} }
class VrynWingmareCostReductionEffect extends CostModificationEffectImpl {
VrynWingmareCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast";
}
VrynWingmareCostReductionEffect(VrynWingmareCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.increaseCost(abilityToModify, 1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) {
return true;
}
}
return false;
}
@Override
public VrynWingmareCostReductionEffect copy() {
return new VrynWingmareCostReductionEffect(this);
}
}

View file

@ -5,10 +5,12 @@ import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.condition.common.NotMyTurnCondition; import mage.abilities.condition.common.NotMyTurnCondition;
import mage.abilities.decorator.ConditionalCostModificationEffect; import mage.abilities.decorator.ConditionalCostModificationEffect;
import mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect; import mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect;
import mage.abilities.effects.common.cost.SpellsCostIncreasementAllEffect; import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.EquipAbility;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -113,7 +115,7 @@ public class ConditionalCostModificationTest extends CardTestPlayerBase {
new ConditionalCostModificationEffect( new ConditionalCostModificationEffect(
new AbilitiesCostReductionControllerEffect(EquipAbility.class, "equip"), new AbilitiesCostReductionControllerEffect(EquipAbility.class, "equip"),
NotMyTurnCondition.instance, NotMyTurnCondition.instance,
new SpellsCostIncreasementAllEffect(1), new SpellsCostIncreasingAllEffect(1, new FilterCard(), TargetController.ANY),
"" ""
) )
)); ));

View file

@ -1,66 +0,0 @@
package mage.abilities.effects.common.cost;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.cards.Card;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.util.CardUtil;
/**
*
* @author Plopman
*/
public class SpellsCostIncreasementAllEffect extends CostModificationEffectImpl {
private FilterCard filter;
private int amount;
public SpellsCostIncreasementAllEffect(int amount) {
this(new FilterCard("Spells"), amount);
}
public SpellsCostIncreasementAllEffect(FilterCard filter, int amount) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
this.filter = filter;
this.amount = amount;
this.staticText = new StringBuilder(filter.getMessage()).append(" cost {").append(amount).append("} more to cast").toString();
}
protected SpellsCostIncreasementAllEffect(SpellsCostIncreasementAllEffect effect) {
super(effect);
this.filter = effect.filter;
this.amount = effect.amount;
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.increaseCost(abilityToModify, this.amount);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
return this.filter.match(spell, game);
} else {
// used at least for flashback ability because Flashback ability doesn't use stack
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && this.filter.match(sourceCard, game);
}
}
return false;
}
@Override
public SpellsCostIncreasementAllEffect copy() {
return new SpellsCostIncreasementAllEffect(this);
}
}

View file

@ -1,90 +0,0 @@
package mage.abilities.effects.common.cost;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.cards.Card;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.util.CardUtil;
/**
*
* @author Quercitron
*/
public class SpellsCostIncreasementControllerEffect extends CostModificationEffectImpl {
private final FilterCard filter;
private final int amount;
private ManaCosts<ManaCost> manaCostsToIncrease = null;
public SpellsCostIncreasementControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST);
this.filter = filter;
this.amount = 0;
this.manaCostsToIncrease = manaCostsToReduce;
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage()).append(" you cast cost ");
for (String manaSymbol : manaCostsToReduce.getSymbols()) {
sb.append(manaSymbol);
}
sb.append(" more to cast");
this.staticText = sb.toString();
}
public SpellsCostIncreasementControllerEffect(FilterCard filter, int amount) {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST);
this.filter = filter;
this.amount = amount;
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage()).append(" you cast cost {").append(amount).append("} more to cast");
this.staticText = sb.toString();
}
protected SpellsCostIncreasementControllerEffect(SpellsCostIncreasementControllerEffect effect) {
super(effect);
this.filter = effect.filter;
this.amount = effect.amount;
this.manaCostsToIncrease = effect.manaCostsToIncrease;
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
if (manaCostsToIncrease != null) {
CardUtil.increaseCost((SpellAbility) abilityToModify, manaCostsToIncrease);
} else {
CardUtil.increaseCost(abilityToModify, this.amount);
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
if (abilityToModify.isControlledBy(source.getControllerId())) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
return this.filter.match(spell, game);
} else {
// used at least for flashback ability because Flashback ability doesn't use stack
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && this.filter.match(sourceCard, game);
}
}
}
return false;
}
@Override
public SpellsCostIncreasementControllerEffect copy() {
return new SpellsCostIncreasementControllerEffect(this);
}
}

View file

@ -0,0 +1,139 @@
package mage.abilities.effects.common.cost;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.cards.Card;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author JayDi85
*/
public class SpellsCostIncreasingAllEffect extends CostModificationEffectImpl {
private final FilterCard filter;
private final TargetController targetController;
private final int increaseGenericCost;
private ManaCosts<ManaCost> increaseManaCosts;
public SpellsCostIncreasingAllEffect(int increaseGenericCost, FilterCard filter, TargetController targetController) {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST);
this.filter = filter;
this.targetController = targetController;
this.increaseGenericCost = increaseGenericCost;
this.increaseManaCosts = null;
setText();
}
public SpellsCostIncreasingAllEffect(ManaCosts<ManaCost> increaseManaCosts, FilterCard filter, TargetController targetController) {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST);
this.filter = filter;
this.targetController = targetController;
this.increaseGenericCost = 0;
this.increaseManaCosts = increaseManaCosts;
setText();
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage());
switch (this.targetController) {
case YOU:
sb.append(" you cast");
break;
case OPPONENT:
sb.append(" your opponents cast");
break;
case ANY:
break;
default:
throw new IllegalArgumentException("Unsupported TargetController " + this.targetController);
}
sb.append(" cost ");
if (this.increaseManaCosts != null) {
for (String manaSymbol : this.increaseManaCosts.getSymbols()) {
sb.append(manaSymbol);
}
} else {
sb.append("{").append(increaseGenericCost).append("}");
}
sb.append(" more to cast");
this.staticText = sb.toString();
}
protected SpellsCostIncreasingAllEffect(SpellsCostIncreasingAllEffect effect) {
super(effect);
this.filter = effect.filter;
this.targetController = effect.targetController;
this.increaseGenericCost = effect.increaseGenericCost;
this.increaseManaCosts = effect.increaseManaCosts;
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
if (increaseManaCosts != null) {
CardUtil.increaseCost((SpellAbility) abilityToModify, increaseManaCosts);
} else {
CardUtil.increaseCost(abilityToModify, this.increaseGenericCost);
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
Player abilityController = game.getPlayer(abilityToModify.getControllerId());
Player sourceController = game.getPlayer(source.getControllerId());
if (abilityController == null || sourceController == null) {
return false;
}
switch (this.targetController) {
case YOU:
if (!sourceController.getId().equals(abilityController.getId())) {
return false;
}
break;
case OPPONENT:
if (!sourceController.hasOpponent(abilityController.getId(), game)) {
return false;
}
break;
case ANY:
break;
default:
throw new IllegalArgumentException("Unsupported TargetController " + this.targetController);
}
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
// real cast with put on stack
return this.filter.match(spell, game);
} else {
// get playable and other staff without put on stack
// used at least for flashback ability because Flashback ability doesn't use stack
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && this.filter.match(sourceCard, game);
}
}
return false;
}
@Override
public SpellsCostIncreasingAllEffect copy() {
return new SpellsCostIncreasingAllEffect(this);
}
}