mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[refactoring] Added SpellsCostReductionEffect and replaced existing effects
This commit is contained in:
parent
41c2e80d62
commit
ff85b56cad
13 changed files with 168 additions and 348 deletions
|
@ -33,20 +33,15 @@ import java.util.UUID;
|
|||
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,8 +50,11 @@ import mage.util.CardUtil;
|
|||
|
||||
public class LongForgottenGohei extends CardImpl<LongForgottenGohei> {
|
||||
|
||||
private final static FilterCreaturePermanent spiritFilter = new FilterCreaturePermanent("Spirits");
|
||||
private static final FilterCard arcaneFilter = new FilterCard("Arcane spells");
|
||||
private static final FilterCreaturePermanent spiritFilter = new FilterCreaturePermanent("Spirit creatures");
|
||||
|
||||
static {
|
||||
arcaneFilter.add(new SubtypePredicate("Arcane"));
|
||||
spiritFilter.add(new SubtypePredicate("Spirit"));
|
||||
}
|
||||
|
||||
|
@ -64,7 +62,7 @@ public class LongForgottenGohei extends CardImpl<LongForgottenGohei> {
|
|||
super(ownerId, 261, "Long-Forgotten Gohei", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
this.expansionSetCode = "CHK";
|
||||
// Arcane spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LongForgottenGoheiCostReductionEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(arcaneFilter, 1)));
|
||||
// Spirit creatures you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, spiritFilter, false)));
|
||||
}
|
||||
|
@ -77,41 +75,3 @@ public class LongForgottenGohei extends CardImpl<LongForgottenGohei> {
|
|||
return new LongForgottenGohei(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LongForgottenGoheiCostReductionEffect extends CostModificationEffectImpl<LongForgottenGoheiCostReductionEffect> {
|
||||
|
||||
LongForgottenGoheiCostReductionEffect ( ) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Arcane spells you cast cost {1} less to cast.";
|
||||
}
|
||||
|
||||
LongForgottenGoheiCostReductionEffect(LongForgottenGoheiCostReductionEffect 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 ) {
|
||||
Card sourceCard = game.getCard(((SpellAbility)abilityToModify).getSourceId());
|
||||
if ( sourceCard != null &&
|
||||
sourceCard.getSubtype().contains("Arcane") &&
|
||||
sourceCard.getOwnerId().equals(source.getControllerId()) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongForgottenGoheiCostReductionEffect copy() {
|
||||
return new LongForgottenGoheiCostReductionEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,21 +28,15 @@
|
|||
package mage.sets.innistrad;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -57,10 +51,10 @@ public class HeartlessSummoning extends CardImpl<HeartlessSummoning> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Creature spells you cast cost {2} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HeartlessSummoningCostReductionEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(new FilterCreatureCard("Creature spells"), 2)));
|
||||
|
||||
// Creatures you control get -1/-1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(-1, -1, Constants.Duration.WhileOnBattlefield)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(-1, -1, Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public HeartlessSummoning(final HeartlessSummoning card) {
|
||||
|
@ -72,39 +66,3 @@ public class HeartlessSummoning extends CardImpl<HeartlessSummoning> {
|
|||
return new HeartlessSummoning(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HeartlessSummoningCostReductionEffect extends CostModificationEffectImpl<HeartlessSummoningCostReductionEffect> {
|
||||
|
||||
HeartlessSummoningCostReductionEffect ( ) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Creature spells you cast cost {2} less to cast";
|
||||
}
|
||||
|
||||
HeartlessSummoningCostReductionEffect(HeartlessSummoningCostReductionEffect 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 ) {
|
||||
Card sourceCard = game.getCard(((SpellAbility)abilityToModify).getSourceId());
|
||||
if ( sourceCard != null && sourceCard.getCardType().contains(CardType.CREATURE) && sourceCard.getOwnerId().equals(source.getControllerId()) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeartlessSummoningCostReductionEffect copy() {
|
||||
return new HeartlessSummoningCostReductionEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,34 +70,6 @@ public class RooftopStorm extends CardImpl<RooftopStorm> {
|
|||
}
|
||||
}
|
||||
|
||||
//class RooftopStormAlternativeCost extends AlternativeCostImpl<RooftopStormAlternativeCost> {
|
||||
//
|
||||
// public RooftopStormAlternativeCost() {
|
||||
// super("You may pay {0} rather than pay the mana cost");
|
||||
// this.add(new GenericManaCost(0));
|
||||
// }
|
||||
//
|
||||
// public RooftopStormAlternativeCost(final RooftopStormAlternativeCost cost) {
|
||||
// super(cost);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RooftopStormAlternativeCost copy() {
|
||||
// return new RooftopStormAlternativeCost(this);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isAvailable(Game game, Ability source) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getText() {
|
||||
// return "You may pay {0} rather than pay the mana cost";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
class RooftopStormCostReductionEffect extends CostModificationEffectImpl<RooftopStormCostReductionEffect> {
|
||||
|
||||
private static final String effectText = "You may pay {0} rather than pay the mana cost for Zombie creature spells you cast";
|
||||
|
|
|
@ -30,22 +30,17 @@ package mage.sets.scourge;
|
|||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -53,10 +48,12 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class GoblinWarchief extends CardImpl<GoblinWarchief> {
|
||||
|
||||
private static final FilterCard filterSpells = new FilterCard("Goblin spells");
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Goblin"));
|
||||
filter.add(new SubtypePredicate("Goblin"));
|
||||
}
|
||||
|
||||
public GoblinWarchief(UUID ownerId) {
|
||||
|
@ -69,7 +66,7 @@ public class GoblinWarchief extends CardImpl<GoblinWarchief> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Goblin spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GoblinWarchiefEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filterSpells, 1)));
|
||||
// Goblin creatures you control have haste.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, filter, true)));
|
||||
}
|
||||
|
@ -83,38 +80,3 @@ public class GoblinWarchief extends CardImpl<GoblinWarchief> {
|
|||
return new GoblinWarchief(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GoblinWarchiefEffect extends CostModificationEffectImpl<GoblinWarchiefEffect> {
|
||||
|
||||
GoblinWarchiefEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Goblin spells you cast cost {1} less to cast";
|
||||
}
|
||||
|
||||
GoblinWarchiefEffect(GoblinWarchiefEffect 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) {
|
||||
Card sourceCard = game.getCard(((SpellAbility) abilityToModify).getSourceId());
|
||||
if (sourceCard != null && sourceCard.getSubtype().contains("Goblin") && sourceCard.getOwnerId().equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoblinWarchiefEffect copy() {
|
||||
return new GoblinWarchiefEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,19 +29,13 @@ package mage.sets.shardsofalara;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -60,7 +54,7 @@ public class EtheriumSculptor extends CardImpl<EtheriumSculptor> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Artifact spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EtheriumSculptorEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(new FilterArtifactCard("Artifact spells"), 1)));
|
||||
}
|
||||
|
||||
public EtheriumSculptor(final EtheriumSculptor card) {
|
||||
|
@ -72,38 +66,3 @@ public class EtheriumSculptor extends CardImpl<EtheriumSculptor> {
|
|||
return new EtheriumSculptor(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EtheriumSculptorEffect extends CostModificationEffectImpl<EtheriumSculptorEffect> {
|
||||
|
||||
EtheriumSculptorEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Artifact spells you cast cost {1} less to cast";
|
||||
}
|
||||
|
||||
EtheriumSculptorEffect(EtheriumSculptorEffect 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) {
|
||||
Card sourceCard = game.getCard(((SpellAbility) abilityToModify).getSourceId());
|
||||
if (sourceCard != null && sourceCard.getCardType().contains(CardType.ARTIFACT) && sourceCard.getOwnerId().equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtheriumSculptorEffect copy() {
|
||||
return new EtheriumSculptorEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,29 +27,34 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import mage.Constants;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.ColorCostReductionEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class EmeraldMedallion extends CardImpl<EmeraldMedallion> {
|
||||
|
||||
private static final String ruleText = "Green spells you cast cost {1} less to cast";
|
||||
private static final FilterCard filter = new FilterCard("Green spells");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
}
|
||||
|
||||
public EmeraldMedallion(UUID ownerId) {
|
||||
super(ownerId, 273, "Emerald Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// Green spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.GREEN, 1, ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, 1)));
|
||||
}
|
||||
|
||||
public EmeraldMedallion(final EmeraldMedallion card) {
|
||||
|
@ -61,4 +66,3 @@ public class EmeraldMedallion extends CardImpl<EmeraldMedallion> {
|
|||
return new EmeraldMedallion(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,29 +27,34 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import mage.Constants;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.ColorCostReductionEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class JetMedallion extends CardImpl<JetMedallion> {
|
||||
|
||||
private static final String ruleText = "Black spells you cast cost {1} less to cast";
|
||||
private static final FilterCard filter = new FilterCard("Black spells");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
public JetMedallion(UUID ownerId) {
|
||||
super(ownerId, 282, "Jet Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// Black spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.BLACK, 1, ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, 1)));
|
||||
}
|
||||
|
||||
public JetMedallion(final JetMedallion card) {
|
||||
|
|
|
@ -27,29 +27,34 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import mage.Constants;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.ColorCostReductionEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class PearlMedallion extends CardImpl<PearlMedallion> {
|
||||
|
||||
private static final String ruleText = "White spells you cast cost {1} less to cast";
|
||||
private static final FilterCard filter = new FilterCard("White spells");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
}
|
||||
|
||||
public PearlMedallion(UUID ownerId) {
|
||||
super(ownerId, 290, "Pearl Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// White spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.WHITE, 1, ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, 1)));
|
||||
}
|
||||
|
||||
public PearlMedallion(final PearlMedallion card) {
|
||||
|
|
|
@ -27,29 +27,34 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import mage.Constants;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.ColorCostReductionEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class RubyMedallion extends CardImpl<RubyMedallion> {
|
||||
|
||||
private static final String ruleText = "Red spells you cast cost {1} less to cast";
|
||||
private static final FilterCard filter = new FilterCard("Red spells");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
|
||||
public RubyMedallion(UUID ownerId) {
|
||||
super(ownerId, 295, "Ruby Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// Red spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.RED, 1, ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, 1)));
|
||||
}
|
||||
|
||||
public RubyMedallion(final RubyMedallion card) {
|
||||
|
|
|
@ -27,29 +27,34 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import mage.Constants;
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.ColorCostReductionEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class SapphireMedallion extends CardImpl<SapphireMedallion> {
|
||||
|
||||
private static final String ruleText = "Blue spells you cast cost {1} less to cast";
|
||||
private static final FilterCard filter = new FilterCard("Blue spells");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
|
||||
public SapphireMedallion(UUID ownerId) {
|
||||
super(ownerId, 296, "Sapphire Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// Blue spells you cast cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.BLUE, 1, ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, 1)));
|
||||
}
|
||||
|
||||
public SapphireMedallion(final SapphireMedallion card) {
|
||||
|
|
|
@ -30,23 +30,20 @@ package mage.sets.worldwake;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.ColorlessPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
|
@ -55,11 +52,13 @@ import mage.target.common.TargetCardInLibrary;
|
|||
*/
|
||||
public class EyeOfUgin extends CardImpl<EyeOfUgin> {
|
||||
|
||||
private static final FilterCreatureCard filter;
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard();
|
||||
private static final FilterCard filterSpells = new FilterCard("Colorless Eldrazi spells");
|
||||
|
||||
static {
|
||||
filter = new FilterCreatureCard();
|
||||
filter.add(new ColorlessPredicate());
|
||||
filterSpells.add(new ColorlessPredicate());
|
||||
filterSpells.add(new SubtypePredicate("Eldrazi"));
|
||||
}
|
||||
|
||||
public EyeOfUgin (UUID ownerId) {
|
||||
|
@ -69,7 +68,7 @@ public class EyeOfUgin extends CardImpl<EyeOfUgin> {
|
|||
this.subtype.add("Land");
|
||||
|
||||
// Colorless Eldrazi spells you cast cost {2} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EyeOfUginCostReductionEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filterSpells, 2)));
|
||||
// {7}, {tap}: Search your library for a colorless creature card, reveal it, and put it into your hand. Then shuffle your library.
|
||||
Ability searchAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true),
|
||||
|
@ -87,47 +86,3 @@ public class EyeOfUgin extends CardImpl<EyeOfUgin> {
|
|||
return new EyeOfUgin(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EyeOfUginCostReductionEffect extends CostModificationEffectImpl<EyeOfUginCostReductionEffect> {
|
||||
|
||||
private static final String effectText = "Colorless Eldrazi spells you cast cost {2} less to cast";
|
||||
|
||||
EyeOfUginCostReductionEffect ( ) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = effectText;
|
||||
}
|
||||
|
||||
EyeOfUginCostReductionEffect(EyeOfUginCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
SpellAbility spellAbility = (SpellAbility)abilityToModify;
|
||||
int previousCost = spellAbility.getManaCostsToPay().convertedManaCost();
|
||||
int adjustedCost = 0;
|
||||
if ( (previousCost - 2) > 0 ) {
|
||||
adjustedCost = previousCost - 2;
|
||||
}
|
||||
spellAbility.getManaCostsToPay().load("{" + adjustedCost + "}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if ( abilityToModify instanceof SpellAbility ) {
|
||||
Card sourceCard = game.getCard(((SpellAbility)abilityToModify).getSourceId());
|
||||
if ( sourceCard != null && sourceCard.hasSubtype("Eldrazi") && sourceCard.getOwnerId().equals(source.getControllerId()) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EyeOfUginCostReductionEffect copy() {
|
||||
return new EyeOfUginCostReductionEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class ColorCostReductionEffect extends CostModificationEffectImpl<ColorCostReductionEffect> {
|
||||
|
||||
private ObjectColor color;
|
||||
private int reduceCount;
|
||||
|
||||
public ColorCostReductionEffect(ObjectColor color, int reduceCount, String ruleText) {
|
||||
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit);
|
||||
staticText = ruleText;
|
||||
this.color = color;
|
||||
this.reduceCount = reduceCount;
|
||||
}
|
||||
|
||||
private ColorCostReductionEffect(ColorCostReductionEffect effect) {
|
||||
super(effect);
|
||||
this.color = effect.color;
|
||||
this.reduceCount = effect.reduceCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
SpellAbility spellAbility = (SpellAbility) abilityToModify;
|
||||
CardUtil.adjustCost(spellAbility, this.reduceCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if ( abilityToModify instanceof SpellAbility ) {
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
if ( sourceCard != null && sourceCard.getColor().contains(color) && sourceCard.getOwnerId().equals(source.getControllerId()) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorCostReductionEffect copy() {
|
||||
return new ColorCostReductionEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.CostModificationEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class SpellsCostReductionEffect extends CostModificationEffectImpl<SpellsCostReductionEffect> {
|
||||
|
||||
private FilterCard filter;
|
||||
private int amount;
|
||||
|
||||
public SpellsCostReductionEffect(FilterCard filter, int amount) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(filter.getMessage()).append(" you cast cost {").append(amount).append("} less to cast");
|
||||
this.staticText = sb.toString();
|
||||
}
|
||||
|
||||
protected SpellsCostReductionEffect(SpellsCostReductionEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
SpellAbility spellAbility = (SpellAbility) abilityToModify;
|
||||
CardUtil.adjustCost(spellAbility, this.amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.getControllerId().equals(source.getControllerId())) {
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null && this.filter.match(sourceCard, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpellsCostReductionEffect copy() {
|
||||
return new SpellsCostReductionEffect(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue