diff --git a/src/main/java/forge/card/spellability/Spell.java b/src/main/java/forge/card/spellability/Spell.java index 1d88c4489d3..d260e50dfde 100644 --- a/src/main/java/forge/card/spellability/Spell.java +++ b/src/main/java/forge/card/spellability/Spell.java @@ -100,7 +100,8 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable if (!(card.isInstant() || PhaseHandler.canCastSorcery(activator) || card.hasKeyword("Flash") || this.getRestrictions().isInstantSpeed() - || activator.hasKeyword("You may cast nonland cards as though they had flash."))) { + || activator.hasKeyword("You may cast nonland cards as though they had flash.") + || card.hasStartOfKeyword("You may cast CARDNAME as though it had flash."))) { return false; } diff --git a/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java b/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java index c698e5d0448..3bddea95aae 100644 --- a/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java +++ b/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java @@ -25,6 +25,7 @@ import forge.Card; import forge.card.cost.Cost; import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbilityStackInstance; +import forge.game.phase.PhaseHandler; import forge.game.player.Player; /** @@ -164,6 +165,21 @@ public class TriggerSpellAbilityCast extends Trigger { } } + if (this.getMapParams().containsKey("SpellSpeed")) { + if (this.getHostCard().hasKeyword("You may cast CARDNAME as though it had flash. If you cast it any time " + + "a sorcery couldn't have been cast, the controller of the permanent it becomes sacrifices it " + + "at the beginning of the next cleanup step.") + && (this.getHostCard().hasKeyword("Flash") || this.getHostCard().hasKeyword("HIDDEN Flash") + || this.getHostCard().getController().hasKeyword("You may cast nonland cards as though they had flash."))) { + // for these cards the trigger must only fire if using their own ability to cast at instant speed + return false; + } + else if (this.getMapParams().get("SpellSpeed").equals("NotSorcerySpeed") + && PhaseHandler.couldCastSorcery(this.getHostCard().getController(), spellAbility)) { + return false; + } + } + return true; } diff --git a/src/main/java/forge/game/phase/PhaseHandler.java b/src/main/java/forge/game/phase/PhaseHandler.java index 5c9e95d0cbe..e2b4f748076 100644 --- a/src/main/java/forge/game/phase/PhaseHandler.java +++ b/src/main/java/forge/game/phase/PhaseHandler.java @@ -30,6 +30,7 @@ import forge.CardList; import forge.CardListFilter; import forge.GameActionUtil; import forge.Singletons; +import forge.card.spellability.SpellAbility; import forge.card.trigger.TriggerType; import forge.game.player.Player; import forge.game.zone.ZoneType; @@ -981,6 +982,31 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { return now.isPlayerTurn(player) && now.getPhase().isMain() && AllZone.getStack().size() == 0; } + /** + *

+ * couldCastSorcery. + * for conditions the stack must only have the sa being checked + *

+ * + * @param player + * a {@link forge.game.player.Player} object. + * @param sa + * a {@link forge.game.player.SpellAbility} object. + * @return a boolean . + */ + public static boolean couldCastSorcery(final Player player, final SpellAbility sa) { + PhaseHandler now = Singletons.getModel().getGameState().getPhaseHandler(); + final Card source = sa.getRootSpellAbility().getSourceCard(); + if (AllZone.getStack().size() != 0) { + for (final Card card : AllZoneUtil.getCardsIn(ZoneType.Stack)) { + if (card != source) { + return false; + } + } + } + return now.isPlayerTurn(player) && now.getPhase().isMain(); + } + /**