From 05d5eeb94176470955bd739ab48b138a7179d34a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 25 Apr 2021 14:51:45 -0400 Subject: [PATCH] [MRD] fixed Hum of the Radix applying to non-artifact spells (fixes #7775) --- Mage.Sets/src/mage/cards/h/HumOfTheRadix.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HumOfTheRadix.java b/Mage.Sets/src/mage/cards/h/HumOfTheRadix.java index b26d4fa4ea..c603c516cb 100644 --- a/Mage.Sets/src/mage/cards/h/HumOfTheRadix.java +++ b/Mage.Sets/src/mage/cards/h/HumOfTheRadix.java @@ -4,15 +4,18 @@ import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.filter.common.FilterArtifactPermanent; +import mage.constants.CardType; +import mage.constants.CostModificationType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.filter.StaticFilters; import mage.game.Game; import mage.util.CardUtil; import java.util.UUID; -import mage.cards.Card; /** * @author Pete Rossi @@ -23,8 +26,7 @@ public final class HumOfTheRadix extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); // Each artifact spell costs {1} more to cast for each artifact its controller controls. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HumOfTheRadixCostIncreaseEffect())); - + this.addAbility(new SimpleStaticAbility(new HumOfTheRadixCostIncreaseEffect())); } private HumOfTheRadix(final HumOfTheRadix card) { @@ -50,20 +52,20 @@ class HumOfTheRadixCostIncreaseEffect extends CostModificationEffectImpl { @Override public boolean apply(Game game, Ability source, Ability abilityToModify) { - int additionalCost = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), abilityToModify.getControllerId(), game).size(); - CardUtil.increaseCost(abilityToModify, additionalCost); + CardUtil.increaseCost(abilityToModify, game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, + abilityToModify.getControllerId(), source.getSourceId(), game + ).size()); return true; } @Override public boolean applies(Ability abilityToModify, Ability source, Game game) { - if (abilityToModify instanceof SpellAbility) { - Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game); - if (spellCard != null) { - return !spellCard.isArtifact(); - } + if (!(abilityToModify instanceof SpellAbility)) { + return false; } - return false; + Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game); + return spellCard != null && spellCard.isArtifact(); } @Override