From 89e025ce9d7aa93da92a220245690e9be9640109 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Mon, 30 Jul 2012 22:36:36 +0400 Subject: [PATCH] Fixed Omniscience --- .../src/mage/sets/magic2013/Omniscience.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2013/Omniscience.java b/Mage.Sets/src/mage/sets/magic2013/Omniscience.java index 0206e7412d..597d4880d0 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Omniscience.java +++ b/Mage.Sets/src/mage/sets/magic2013/Omniscience.java @@ -35,6 +35,8 @@ import mage.abilities.effects.CostModificationEffectImpl; import mage.cards.Card; import mage.cards.CardImpl; import mage.game.Game; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; import mage.players.Player; import java.util.UUID; @@ -87,12 +89,18 @@ class OmniscienceEffect extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { Card sourceCard = game.getCard(abilityToModify.getSourceId()); - if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId()) - && !sourceCard.getCardType().contains(CardType.LAND)) { - Player player = game.getPlayer(source.getControllerId()); - String message = "Cast " + sourceCard.getName() + " without paying its mana costs?"; - if (player != null && player.chooseUse(outcome, message, game)) { - return true; + StackObject stackObject = game.getStack().getStackObject(abilityToModify.getSourceId()); + if (stackObject != null && stackObject instanceof Spell) { + Zone zone = ((Spell)stackObject).getFromZone(); + if (zone != null && zone.equals(Zone.HAND)) { + if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId()) + && !sourceCard.getCardType().contains(CardType.LAND)) { + Player player = game.getPlayer(source.getControllerId()); + String message = "Cast " + sourceCard.getName() + " without paying its mana costs?"; + if (player != null && player.chooseUse(outcome, message, game)) { + return true; + } + } } } }