* Cleaned up some unnecessary checks for FlashbackAbility due to the old Flashback implementation.

This commit is contained in:
LevelX2 2018-05-01 01:11:47 +02:00
parent c7f23a8ba4
commit a84dc233c3
14 changed files with 57 additions and 82 deletions

View file

@ -38,7 +38,6 @@ import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
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;
@ -63,7 +62,7 @@ public class AngelOfJubilation extends CardImpl {
} }
public AngelOfJubilation(UUID ownerId, CardSetInfo setInfo) { public AngelOfJubilation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}{W}");
this.subtype.add(SubType.ANGEL); this.subtype.add(SubType.ANGEL);
this.power = new MageInt(3); this.power = new MageInt(3);
@ -117,36 +116,36 @@ class AngelOfJubilationEffect extends ContinuousEffectImpl {
class AngelOfJubilationSacrificeFilterEffect extends CostModificationEffectImpl { class AngelOfJubilationSacrificeFilterEffect extends CostModificationEffectImpl {
public AngelOfJubilationSacrificeFilterEffect() { public AngelOfJubilationSacrificeFilterEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.SET_COST); super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.SET_COST);
staticText = "Players can't pay life or sacrifice creatures to cast spells or activate abilities"; staticText = "Players can't pay life or sacrifice creatures to cast spells or activate abilities";
} }
protected AngelOfJubilationSacrificeFilterEffect(AngelOfJubilationSacrificeFilterEffect effect) { protected AngelOfJubilationSacrificeFilterEffect(AngelOfJubilationSacrificeFilterEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public boolean apply(Game game, Ability source, Ability abilityToModify) { public boolean apply(Game game, Ability source, Ability abilityToModify) {
for (Cost cost : abilityToModify.getCosts()) { for (Cost cost : abilityToModify.getCosts()) {
if(cost instanceof SacrificeTargetCost) { if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
Filter filter = sacrificeCost.getTargets().get(0).getFilter(); Filter filter = sacrificeCost.getTargets().get(0).getFilter();
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
} }
} }
return true; return true;
} }
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED || return abilityToModify.getAbilityType() == AbilityType.ACTIVATED
abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility; || abilityToModify instanceof SpellAbility;
}
@Override
public AngelOfJubilationSacrificeFilterEffect copy() {
return new AngelOfJubilationSacrificeFilterEffect(this);
} }
@Override
public AngelOfJubilationSacrificeFilterEffect copy() {
return new AngelOfJubilationSacrificeFilterEffect(this);
}
} }

View file

@ -36,9 +36,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.ProtectionAbility; import mage.abilities.keyword.ProtectionAbility;
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.*;
@ -111,15 +109,11 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
if (abilityToModify.getControllerId().equals(source.getControllerId())) { if (abilityToModify.getControllerId().equals(source.getControllerId())) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId()); Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) { if (spell != null) {
return spell.isCreature(); return spell.isCreature();
} else {
// used at least for flashback ability because Flashback ability doesn't use stack or for getPlayables where spell is not cast yet
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && sourceCard.isCreature();
} }
} }
} }

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.SpellAbility; 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.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -82,7 +81,7 @@ class ArcaneMeleeCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card sourceCard = game.getCard((abilityToModify).getSourceId()); Card sourceCard = game.getCard((abilityToModify).getSourceId());
if (sourceCard != null && (sourceCard.isInstant() || sourceCard.isSorcery())) { if (sourceCard != null && (sourceCard.isInstant() || sourceCard.isSorcery())) {
return true; return true;

View file

@ -36,7 +36,6 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.AdjustingSourceCosts; import mage.abilities.costs.AdjustingSourceCosts;
import mage.abilities.effects.common.combat.CanBlockAdditionalCreatureEffect; import mage.abilities.effects.common.combat.CanBlockAdditionalCreatureEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
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;
@ -52,7 +51,7 @@ import mage.util.CardUtil;
public class AvatarOfHope extends CardImpl { public class AvatarOfHope extends CardImpl {
public AvatarOfHope(UUID ownerId, CardSetInfo setInfo) { public AvatarOfHope(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{W}{W}");
this.subtype.add(SubType.AVATAR); this.subtype.add(SubType.AVATAR);
this.power = new MageInt(4); this.power = new MageInt(4);
@ -93,7 +92,7 @@ class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSour
@Override @Override
public String getRule() { public String getRule() {
return "If you have 3 or less life, Avatar of Hope costs {6} less to cast"; return "If you have 3 or less life, {this} costs {6} less to cast";
} }
@Override @Override
@ -101,7 +100,7 @@ class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSour
if (ability.getAbilityType() == AbilityType.SPELL) { if (ability.getAbilityType() == AbilityType.SPELL) {
Player player = game.getPlayer(ability.getControllerId()); Player player = game.getPlayer(ability.getControllerId());
if (player != null && player.getLife() < 4) { if (player != null && player.getLife() < 4) {
CardUtil.adjustCost((SpellAbility)ability, 6); CardUtil.adjustCost((SpellAbility) ability, 6);
} }
} }
} }
@ -119,10 +118,10 @@ class AdjustingCostsEffect extends CostModificationEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source, Ability abilityToModify) { public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility)abilityToModify; SpellAbility spellAbility = (SpellAbility) abilityToModify;
Mana mana = spellAbility.getManaCostsToPay().getMana(); Mana mana = spellAbility.getManaCostsToPay().getMana();
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (mana.getGeneric() > 0 && player != null && player.getLife() < 4) { if (mana.getGeneric() > 0 && player != null && player.getLife() < 4) {
int newCount = mana.getGeneric() - 6; int newCount = mana.getGeneric() - 6;
if (newCount < 0) { if (newCount < 0) {
@ -137,7 +136,7 @@ class AdjustingCostsEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) if ((abilityToModify instanceof SpellAbility)
&& abilityToModify.getSourceId().equals(source.getSourceId())) { && abilityToModify.getSourceId().equals(source.getSourceId())) {
return true; return true;
} }

View file

@ -37,7 +37,6 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.NameACardEffect; import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -54,7 +53,7 @@ import mage.util.CardUtil;
public class CouncilOfTheAbsolute extends CardImpl { public class CouncilOfTheAbsolute extends CardImpl {
public CouncilOfTheAbsolute(UUID ownerId, CardSetInfo setInfo) { public CouncilOfTheAbsolute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{U}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR); this.subtype.add(SubType.ADVISOR);
@ -147,7 +146,7 @@ class CouncilOfTheAbsoluteCostReductionEffect extends CostModificationEffectImpl
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) if ((abilityToModify instanceof SpellAbility)
&& abilityToModify.getControllerId().equals(source.getControllerId())) { && abilityToModify.getControllerId().equals(source.getControllerId())) {
Card card = game.getCard(abilityToModify.getSourceId()); Card card = game.getCard(abilityToModify.getSourceId());
return card.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY)); return card.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY));

View file

@ -33,7 +33,6 @@ import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -46,7 +45,7 @@ import mage.game.Game;
public class DefenseGrid extends CardImpl { public class DefenseGrid extends CardImpl {
public DefenseGrid(UUID ownerId, CardSetInfo setInfo) { public DefenseGrid(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Each spell costs {3} more to cast except during its controller's turn. // Each spell costs {3} more to cast except during its controller's turn.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DefenseGridCostModificationEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DefenseGridCostModificationEffect()));
@ -65,7 +64,7 @@ public class DefenseGrid extends CardImpl {
class DefenseGridCostModificationEffect extends CostModificationEffectImpl { class DefenseGridCostModificationEffect extends CostModificationEffectImpl {
DefenseGridCostModificationEffect ( ) { DefenseGridCostModificationEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Each spell costs {3} more to cast except during its controller's turn"; staticText = "Each spell costs {3} more to cast except during its controller's turn";
} }
@ -83,8 +82,8 @@ class DefenseGridCostModificationEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
if(!abilityToModify.getControllerId().equals(game.getActivePlayerId())) { if (!abilityToModify.getControllerId().equals(game.getActivePlayerId())) {
return true; return true;
} }
} }
@ -96,4 +95,4 @@ class DefenseGridCostModificationEffect extends CostModificationEffectImpl {
return new DefenseGridCostModificationEffect(this); return new DefenseGridCostModificationEffect(this);
} }
} }

View file

@ -33,7 +33,6 @@ import mage.abilities.Ability;
import mage.abilities.SpellAbility; 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.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -48,7 +47,7 @@ import mage.util.CardUtil;
public class Glowrider extends CardImpl { public class Glowrider extends CardImpl {
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);
this.subtype.add(SubType.CLERIC); this.subtype.add(SubType.CLERIC);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -70,7 +69,7 @@ public class Glowrider extends CardImpl {
class GlowriderCostReductionEffect extends CostModificationEffectImpl { class GlowriderCostReductionEffect extends CostModificationEffectImpl {
GlowriderCostReductionEffect ( ) { GlowriderCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast"; staticText = "Noncreature spells cost {1} more to cast";
} }
@ -87,7 +86,7 @@ class GlowriderCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId()); Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) { if (card != null && !card.isCreature()) {
return true; return true;

View file

@ -33,7 +33,6 @@ import mage.abilities.Ability;
import mage.abilities.SpellAbility; 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.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -48,7 +47,7 @@ import mage.util.CardUtil;
public class LocketOfYesterdays extends CardImpl { public class LocketOfYesterdays extends CardImpl {
public LocketOfYesterdays(UUID ownerId, CardSetInfo setInfo) { public LocketOfYesterdays(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
// Spells you cast cost {1} less to cast for each card with the same name as that spell in your graveyard. // Spells you cast cost {1} less to cast for each card with the same name as that spell in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LocketOfYesterdaysCostReductionEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LocketOfYesterdaysCostReductionEffect()));
@ -80,7 +79,7 @@ class LocketOfYesterdaysCostReductionEffect extends CostModificationEffectImpl {
MageObject sourceObject = game.getObject(abilityToModify.getSourceId()); MageObject sourceObject = game.getObject(abilityToModify.getSourceId());
if (sourceObject != null) { if (sourceObject != null) {
int amount = 0; int amount = 0;
for (UUID cardId :game.getPlayer(source.getControllerId()).getGraveyard()) { for (UUID cardId : game.getPlayer(source.getControllerId()).getGraveyard()) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null && card.getName().equals(sourceObject.getName())) { if (card != null && card.getName().equals(sourceObject.getName())) {
amount++; amount++;
@ -97,9 +96,9 @@ class LocketOfYesterdaysCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getControllerId().equals(source.getControllerId()) && if (abilityToModify.getControllerId().equals(source.getControllerId())
(abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)) { && (abilityToModify instanceof SpellAbility)) {
return true; return true;
} }
return false; return false;
} }

View file

@ -34,7 +34,6 @@ import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -53,7 +52,7 @@ import mage.game.Game;
public class LodestoneGolem extends CardImpl { public class LodestoneGolem extends CardImpl {
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);
this.power = new MageInt(5); this.power = new MageInt(5);
@ -75,7 +74,7 @@ public class LodestoneGolem extends CardImpl {
class LodestoneGolemCostReductionEffect extends CostModificationEffectImpl { class LodestoneGolemCostReductionEffect extends CostModificationEffectImpl {
LodestoneGolemCostReductionEffect ( ) { LodestoneGolemCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Nonartifact spells cost {1} more to cast"; staticText = "Nonartifact spells cost {1} more to cast";
} }
@ -93,7 +92,7 @@ class LodestoneGolemCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId()); Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isArtifact()) { if (card != null && !card.isArtifact()) {
return true; return true;
@ -108,4 +107,3 @@ class LodestoneGolemCostReductionEffect extends CostModificationEffectImpl {
} }
} }

View file

@ -35,10 +35,8 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount; import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
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.*;
@ -147,15 +145,11 @@ class RakdosLordOfRiotsCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
if (abilityToModify.getControllerId().equals(source.getControllerId())) { if (abilityToModify.getControllerId().equals(source.getControllerId())) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId()); Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) { if (spell != null) {
return spell.isCreature(); return spell.isCreature();
} else {
// used at least for flashback ability because Flashback ability doesn't use stack or for getPlayables where spell is not cast yet
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && sourceCard.isCreature();
} }
} }
} }

View file

@ -35,7 +35,6 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -54,7 +53,7 @@ import mage.util.CardUtil;
public class SemblanceAnvil extends CardImpl { public class SemblanceAnvil extends CardImpl {
public SemblanceAnvil(UUID ownerId, CardSetInfo setInfo) { public SemblanceAnvil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Imprint - When Semblance Anvil enters the battlefield, you may exile a nonland card from your hand. // Imprint - When Semblance Anvil enters the battlefield, you may exile a nonland card from your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SemblanceAnvilEffect(), true)); this.addAbility(new EntersBattlefieldTriggeredAbility(new SemblanceAnvilEffect(), true));
@ -134,7 +133,7 @@ class SemblanceAnvilCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card sourceCard = game.getCard(abilityToModify.getSourceId()); Card sourceCard = game.getCard(abilityToModify.getSourceId());
if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId())) { if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId())) {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());

View file

@ -34,7 +34,6 @@ import mage.abilities.Mode;
import mage.abilities.SpellAbility; 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.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -90,7 +89,7 @@ class SpellwildOupheCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
for (UUID modeId : abilityToModify.getModes().getSelectedModes()) { for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
Mode mode = abilityToModify.getModes().get(modeId); Mode mode = abilityToModify.getModes().get(modeId);
for (Target target : mode.getTargets()) { for (Target target : mode.getTargets()) {

View file

@ -34,7 +34,6 @@ 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.CostModificationEffectImpl;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -49,7 +48,7 @@ import mage.util.CardUtil;
public class ThaliaGuardianOfThraben extends CardImpl { public class ThaliaGuardianOfThraben extends CardImpl {
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);
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
@ -76,7 +75,7 @@ public class ThaliaGuardianOfThraben extends CardImpl {
class ThaliaGuardianOfThrabenCostReductionEffect extends CostModificationEffectImpl { class ThaliaGuardianOfThrabenCostReductionEffect extends CostModificationEffectImpl {
ThaliaGuardianOfThrabenCostReductionEffect ( ) { ThaliaGuardianOfThrabenCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast"; staticText = "Noncreature spells cost {1} more to cast";
} }
@ -93,7 +92,7 @@ class ThaliaGuardianOfThrabenCostReductionEffect extends CostModificationEffectI
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId()); Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) { if (card != null && !card.isCreature()) {
return true; return true;

View file

@ -33,7 +33,6 @@ import mage.abilities.Ability;
import mage.abilities.SpellAbility; 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.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -54,14 +53,14 @@ import mage.util.CardUtil;
public class VrynWingmare extends CardImpl { public class VrynWingmare extends CardImpl {
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);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Flying // Flying
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 VrynWingmareCostReductionEffect()));
} }
@ -78,7 +77,7 @@ public class VrynWingmare extends CardImpl {
class VrynWingmareCostReductionEffect extends CostModificationEffectImpl { class VrynWingmareCostReductionEffect extends CostModificationEffectImpl {
VrynWingmareCostReductionEffect ( ) { VrynWingmareCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Noncreature spells cost {1} more to cast"; staticText = "Noncreature spells cost {1} more to cast";
} }
@ -95,7 +94,7 @@ class VrynWingmareCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify instanceof SpellAbility) {
Card card = game.getCard(abilityToModify.getSourceId()); Card card = game.getCard(abilityToModify.getSourceId());
if (card != null && !card.isCreature()) { if (card != null && !card.isCreature()) {
return true; return true;
@ -109,4 +108,4 @@ class VrynWingmareCostReductionEffect extends CostModificationEffectImpl {
return new VrynWingmareCostReductionEffect(this); return new VrynWingmareCostReductionEffect(this);
} }
} }