From 255d436148a8d2d80774d15d8bc998c6000f5f08 Mon Sep 17 00:00:00 2001 From: Nathaniel Brandes Date: Wed, 29 Apr 2015 01:57:55 -0700 Subject: [PATCH] Omniscience now only allows you to play cards from your hand without paying their mana costs. --- .../src/mage/sets/magic2013/Omniscience.java | 20 +++++++++++++++---- .../common/SourceIsSpellCondition.java | 1 - 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2013/Omniscience.java b/Mage.Sets/src/mage/sets/magic2013/Omniscience.java index 1689e90960..c922ecd62e 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Omniscience.java +++ b/Mage.Sets/src/mage/sets/magic2013/Omniscience.java @@ -28,8 +28,11 @@ package mage.sets.magic2013; import java.util.UUID; + import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.CompoundCondition; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.SourceIsSpellCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.effects.ContinuousEffectImpl; @@ -43,6 +46,7 @@ import mage.constants.SubLayer; import mage.constants.Zone; import mage.filter.common.FilterNonlandCard; import mage.game.Game; +import mage.game.stack.Spell; import mage.players.Player; /** @@ -73,9 +77,6 @@ public class Omniscience extends CardImpl { class OmniscienceCastingEffect extends ContinuousEffectImpl { - static AlternativeCostSourceAbility alternativeCastingCostAbility = new AlternativeCostSourceAbility( - null, SourceIsSpellCondition.getInstance(), null, new FilterNonlandCard(), true); - public OmniscienceCastingEffect() { super(Duration.WhileOnBattlefield, Outcome.Detriment); staticText = "You may cast nonland cards from your hand without paying their mana costs"; @@ -94,7 +95,8 @@ class OmniscienceCastingEffect extends ContinuousEffectImpl { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - controller.getAlternativeSourceCosts().add(alternativeCastingCostAbility); + controller.getAlternativeSourceCosts().add(new AlternativeCostSourceAbility( + null, new CompoundCondition(SourceIsSpellCondition.getInstance(), new SpellIsBeingCastFromHandCondition()), null, new FilterNonlandCard(), true)); return true; } return false; @@ -110,3 +112,13 @@ class OmniscienceCastingEffect extends ContinuousEffectImpl { return layer == Layer.RulesEffects; } } + +class SpellIsBeingCastFromHandCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = (Spell) game.getObject(source.getSourceId()); + return spell != null && spell.getFromZone() == Zone.HAND; + } + +} diff --git a/Mage/src/mage/abilities/condition/common/SourceIsSpellCondition.java b/Mage/src/mage/abilities/condition/common/SourceIsSpellCondition.java index 94a27fa180..7e36ecb3c6 100644 --- a/Mage/src/mage/abilities/condition/common/SourceIsSpellCondition.java +++ b/Mage/src/mage/abilities/condition/common/SourceIsSpellCondition.java @@ -27,7 +27,6 @@ */ package mage.abilities.condition.common; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.condition.Condition;