mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
MayFlashSac: rework using MayPlayNotSorcerySpeed
This commit is contained in:
@@ -35,7 +35,7 @@ public class PermanentAi extends SpellAbilityAi {
|
||||
|
||||
final Card card = sa.getHostCard();
|
||||
|
||||
if (card.hasStartOfKeyword("You may cast CARDNAME as though it had flash. If") && !ai.couldCastSorcery(sa)) {
|
||||
if (card.hasKeyword("MayFlashSac") && !ai.couldCastSorcery(sa)) {
|
||||
// AiPlayDecision.AnotherTime
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,10 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
for (CardPlayOption o : source.mayPlay(activator)) {
|
||||
// do not appear if it can be cast with SorcerySpeed
|
||||
if (o.getAbility().hasParam("MayPlayNotSorcerySpeed") && activator.couldCastSorcery(sa)) {
|
||||
continue;
|
||||
}
|
||||
// non basic are only allowed if PayManaCost is yes
|
||||
if (!sa.isBasicSpell() && o.getPayManaCost() == PayManaCost.NO) {
|
||||
continue;
|
||||
@@ -418,6 +422,19 @@ public final class GameActionUtil {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else if (keyword.startsWith("MayFlashCost")) {
|
||||
final String[] k = keyword.split(":");
|
||||
for (int i = 0; i < abilities.size(); i++) {
|
||||
final SpellAbility newSA = abilities.get(i).copy();
|
||||
newSA.setBasicSpell(false);
|
||||
newSA.setPayCosts(new Cost(k[1], false).add(newSA.getPayCosts()));
|
||||
newSA.setDescription(newSA.getDescription() + " (as though it had flash)");
|
||||
newSA.getRestrictions().setInstantSpeed(true);
|
||||
if (newSA.canPlay()) {
|
||||
abilities.add(i, newSA);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else if (keyword.startsWith("Kicker")) {
|
||||
String[] sCosts = TextUtil.split(keyword.substring(6), ':');
|
||||
boolean generic = "Generic".equals(sCosts[sCosts.length - 1]);
|
||||
|
||||
@@ -3032,7 +3032,7 @@ public class CardFactoryUtil {
|
||||
inst.addTrigger(parsedUpkeepTrig);
|
||||
inst.addTrigger(parsedSacTrigger);
|
||||
} else if (keyword.equals("MayFlashSac")) {
|
||||
String strTrig = "Mode$ SpellCast | ValidCard$ Card.Self | Static$ True | Secondary$ True | SpellSpeed$ NotSorcerySpeed"
|
||||
String strTrig = "Mode$ SpellCast | ValidCard$ Card.Self | ValidSA$ Spell.MayPlaySource | Static$ True | Secondary$ True "
|
||||
+ " | TriggerDescription$ 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.";
|
||||
|
||||
@@ -4286,8 +4286,8 @@ public class CardFactoryUtil {
|
||||
effect = "Mode$ CantBlockBy | ValidAttacker$ Creature.Self | ValidBlocker$ " + k[1]
|
||||
+ " | Description$ CARDNAME can't be blocked " + getTextForKwCantBeBlockedByType(keyword);
|
||||
} else if (keyword.equals("MayFlashSac")) {
|
||||
effect = "Mode$ Continuous | EffectZone$ All | Affected$ Card.Self | Secondary$ True"
|
||||
+ " | MayPlay$ True | MayPlayWithFlash$ True | MayPlayText$ Sacrifice at the next cleanup step"
|
||||
effect = "Mode$ Continuous | EffectZone$ All | Affected$ Card.Self | Secondary$ True | MayPlay$ True"
|
||||
+ " | MayPlayNotSorcerySpeed$ True | MayPlayWithFlash$ True | MayPlayText$ Sacrifice at the next cleanup step"
|
||||
+ " | AffectedZone$ Exile,Graveyard,Hand,Library,Stack | Description$ " + inst.getReminderText();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,9 +127,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
||||
game.getAction().checkStaticAbilities(false);
|
||||
}
|
||||
|
||||
if (!(isInstant || activator.canCastSorcery() || flash
|
||||
|| getRestrictions().isInstantSpeed()
|
||||
|| card.hasStartOfKeyword("You may cast CARDNAME as though it had flash.")
|
||||
if (!(isInstant || activator.canCastSorcery() || flash || getRestrictions().isInstantSpeed()
|
||||
|| this.hasSVar("IsCastFromPlayEffect")
|
||||
|| (card.isFaceDown() && !card.getLastKnownZone().is(ZoneType.Battlefield) && card.getState(CardStateName.Original).getType().isInstant()))) {
|
||||
return false;
|
||||
|
||||
@@ -124,6 +124,11 @@ public class TriggerSpellAbilityCast extends Trigger {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasParam("ValidSA")) {
|
||||
if (!matchesValid(spellAbility, getParam("ValidSA").split(","), getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("TargetsValid")) {
|
||||
SpellAbility sa = spellAbility;
|
||||
@@ -205,21 +210,6 @@ public class TriggerSpellAbilityCast extends Trigger {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("SpellSpeed")) {
|
||||
if (getParam("SpellSpeed").equals("NotSorcerySpeed")) {
|
||||
if (getHostCard().getController().couldCastSorcery(spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO do we need check if it could have been cast with normal Flash?
|
||||
|
||||
StaticAbility sta = spellAbility.getMayPlay();
|
||||
if (sta == null || !getHostCard().equals(sta.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("SharesNameWithActivatorsZone")) {
|
||||
String zones = getParam("SharesNameWithActivatorsZone");
|
||||
if (si == null) {
|
||||
|
||||
Reference in New Issue
Block a user