diff --git a/Mage.Sets/src/mage/cards/b/BlasphemousAct.java b/Mage.Sets/src/mage/cards/b/BlasphemousAct.java index f17a9d0f42..36a123e7b6 100644 --- a/Mage.Sets/src/mage/cards/b/BlasphemousAct.java +++ b/Mage.Sets/src/mage/cards/b/BlasphemousAct.java @@ -5,8 +5,13 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; @@ -21,13 +26,17 @@ import mage.util.CardUtil; */ public final class BlasphemousAct extends CardImpl { + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE); + private static final Hint hint = new ValueHint("Creatures on the battlefield", xValue); + public BlasphemousAct(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{8}{R}"); // Blasphemous Act costs {1} less to cast for each creature on the battlefield. - Ability ability = new SimpleStaticAbility(Zone.ALL, new BlasphemousCostReductionEffect()); - ability.setRuleAtTheTop(true); - this.addAbility(ability); + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SpellCostReductionSourceEffect(xValue).setText("this spell costs {1} less to cast for each creature on the battlefield") + ).addHint(hint).setRuleAtTheTop(true)); // Blasphemous Act deals 13 damage to each creature. this.getSpellAbility().addEffect(new DamageAllEffect(13, new FilterCreaturePermanent())); @@ -42,39 +51,3 @@ public final class BlasphemousAct extends CardImpl { return new BlasphemousAct(this); } } - -class BlasphemousCostReductionEffect extends CostModificationEffectImpl { - - BlasphemousCostReductionEffect() { - super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST); - staticText = "this spell costs {1} less to cast for each creature on the battlefield"; - } - - BlasphemousCostReductionEffect(BlasphemousCostReductionEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source, Ability abilityToModify) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { return false; } - - int reductionAmount = game.getBattlefield().count(StaticFilters.FILTER_PERMANENT_CREATURE, source.getSourceId(), source, game); - CardUtil.reduceCost(abilityToModify, reductionAmount); - - return true; - } - - @Override - public boolean applies(Ability abilityToModify, Ability source, Game game) { - if ((abilityToModify instanceof SpellAbility) && abilityToModify.getSourceId().equals(source.getSourceId())) { - return game.getCard(abilityToModify.getSourceId()) != null; - } - return false; - } - - @Override - public BlasphemousCostReductionEffect copy() { - return new BlasphemousCostReductionEffect(this); - } -}