mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Added the restrictions part of the code for "Can be played as though it has flash. If you do sac at next cleanup."
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* couldCastSorcery.
|
||||
* for conditions the stack must only have the sa being checked
|
||||
* </p>
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user