mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Omniscience now only allows you to play cards from your hand without
paying their mana costs.
This commit is contained in:
parent
66499bd58f
commit
255d436148
2 changed files with 16 additions and 5 deletions
|
@ -28,8 +28,11 @@
|
||||||
package mage.sets.magic2013;
|
package mage.sets.magic2013;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.condition.CompoundCondition;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.condition.common.SourceIsSpellCondition;
|
import mage.abilities.condition.common.SourceIsSpellCondition;
|
||||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -43,6 +46,7 @@ import mage.constants.SubLayer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,9 +77,6 @@ public class Omniscience extends CardImpl {
|
||||||
|
|
||||||
class OmniscienceCastingEffect extends ContinuousEffectImpl {
|
class OmniscienceCastingEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
static AlternativeCostSourceAbility alternativeCastingCostAbility = new AlternativeCostSourceAbility(
|
|
||||||
null, SourceIsSpellCondition.getInstance(), null, new FilterNonlandCard(), true);
|
|
||||||
|
|
||||||
public OmniscienceCastingEffect() {
|
public OmniscienceCastingEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||||
staticText = "You may cast nonland cards from your hand without paying their mana costs";
|
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) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -110,3 +112,13 @@ class OmniscienceCastingEffect extends ContinuousEffectImpl {
|
||||||
return layer == Layer.RulesEffects;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.condition.common;
|
package mage.abilities.condition.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
|
|
Loading…
Reference in a new issue