From e36a2819f58f62484bb0a6faf23c774d153f0639 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 15 Sep 2015 08:27:58 +0200 Subject: [PATCH] * Soldevi Machinist - Fixed that the mana ability worked for artifact spells instead of activated abilities of artifacts. --- .../masterseditioniv/SoldeviMachinist.java | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java index f9680a67e5..6af888069a 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java @@ -30,13 +30,19 @@ package mage.sets.masterseditioniv; import java.util.UUID; import mage.ConditionalMana; import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.mana.ConditionalColorlessManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ArtifactCastConditionalMana; +import mage.abilities.mana.conditional.ManaCondition; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Rarity; +import mage.game.Game; /** * @@ -71,11 +77,39 @@ class SoldeviMachinistManaBuilder extends ConditionalManaBuilder { @Override public ConditionalMana build(Object... options) { - return new ArtifactCastConditionalMana(this.mana); + return new ArtifactAbilityConditionalMana(this.mana); } @Override public String getRule() { - return "Spend this mana only to cast artifact spells"; + return "Spend this mana only to activate abilities of artifacts"; + } +} + +class ArtifactAbilityConditionalMana extends ConditionalMana { + + public ArtifactAbilityConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to activate abilities of artifacts"; + addCondition(new ArtifactAbilityManaCondition()); + } +} + +class ArtifactAbilityManaCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + if (source != null && source.getAbilityType().equals(AbilityType.ACTIVATED)) { + MageObject object = game.getObject(source.getSourceId()); + if (object != null && object.getCardType().contains(CardType.ARTIFACT)) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source, UUID originalId) { + return apply(game, source); } }