Omniscience now only allows you to play cards from your hand without

paying their mana costs.
This commit is contained in:
Nathaniel Brandes 2015-04-29 01:57:55 -07:00
parent 66499bd58f
commit 255d436148
2 changed files with 16 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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;