diff --git a/forge-game/src/main/java/forge/game/GameActionUtil.java b/forge-game/src/main/java/forge/game/GameActionUtil.java index a67752333d9..fcd7db7f302 100644 --- a/forge-game/src/main/java/forge/game/GameActionUtil.java +++ b/forge-game/src/main/java/forge/game/GameActionUtil.java @@ -192,11 +192,14 @@ public final class GameActionUtil { final SpellAbility newSA = sa.copy(); final SpellAbilityRestriction sar = new SpellAbilityRestriction(); sar.setVariables(sa.getRestrictions()); + if (playOption.isWithFlash()) { + sar.setInstantSpeed(true); + } sar.setZone(null); newSA.setRestrictions(sar); newSA.setBasicSpell(false); newSA.setPayCosts(newSA.getPayCosts().copyWithNoMana()); - newSA.setDescription(sa.getDescription() + " (without paying its mana cost)"); + newSA.setDescription(sa.getDescription() + playOption.toString()); alternatives.add(newSA); } } @@ -227,17 +230,6 @@ public final class GameActionUtil { newSA.setDescription(sa.getDescription() + " (without paying its mana cost)"); alternatives.add(newSA); } - if (sa.isSpell() && keyword.startsWith("May be played without paying its mana cost and as though it has flash")) { - final SpellAbility newSA = sa.copy(); - SpellAbilityRestriction sar = new SpellAbilityRestriction(); - sar.setVariables(sa.getRestrictions()); - sar.setInstantSpeed(true); - newSA.setRestrictions(sar); - newSA.setBasicSpell(false); - newSA.setPayCosts(newSA.getPayCosts().copyWithNoMana()); - newSA.setDescription(sa.getDescription() + " (without paying its mana cost and as though it has flash)"); - alternatives.add(newSA); - } if (sa.isSpell() && keyword.startsWith("Alternative Cost")) { final SpellAbility newSA = sa.copy(); newSA.setBasicSpell(false); diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index b4bd7ba6ec8..c6f4d8e5521 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -2277,9 +2277,9 @@ public class Card extends GameEntity implements Comparable { public final CardPlayOption mayPlay(final Player player) { return mayPlay.get(player); } - public final void setMayPlay(final Player player, final boolean withoutManaCost, final boolean ignoreColor) { + public final void setMayPlay(final Player player, final boolean withoutManaCost, final boolean ignoreColor, final boolean withFlash) { final CardPlayOption option = this.mayPlay.get(player); - this.mayPlay.put(player, option == null ? new CardPlayOption(withoutManaCost, ignoreColor) : option.add(withoutManaCost, ignoreColor)); + this.mayPlay.put(player, option == null ? new CardPlayOption(withoutManaCost, ignoreColor, withFlash) : option.add(withoutManaCost, ignoreColor, withFlash)); } public final void removeMayPlay(final Player player) { this.mayPlay.remove(player); diff --git a/forge-game/src/main/java/forge/game/card/CardPlayOption.java b/forge-game/src/main/java/forge/game/card/CardPlayOption.java index ba0a715a89e..59fb8432a5a 100644 --- a/forge-game/src/main/java/forge/game/card/CardPlayOption.java +++ b/forge-game/src/main/java/forge/game/card/CardPlayOption.java @@ -21,17 +21,19 @@ public final class CardPlayOption { private final PayManaCost payManaCost; private final boolean ignoreManaCostColor; + private final boolean withFlash; - public CardPlayOption(final boolean withoutManaCost, final boolean ignoreManaCostColor) { - this(withoutManaCost ? PayManaCost.NO : PayManaCost.YES, ignoreManaCostColor); + public CardPlayOption(final boolean withoutManaCost, final boolean ignoreManaCostColor, final boolean withFlash) { + this(withoutManaCost ? PayManaCost.NO : PayManaCost.YES, ignoreManaCostColor, withFlash); } - private CardPlayOption(final PayManaCost payManaCost, final boolean ignoreManaCostColor) { + private CardPlayOption(final PayManaCost payManaCost, final boolean ignoreManaCostColor, final boolean withFlash) { this.payManaCost = payManaCost; this.ignoreManaCostColor = ignoreManaCostColor; + this.withFlash = withFlash; } - public CardPlayOption add(final boolean payManaCost, final boolean ignoreManaCostColor) { - return new CardPlayOption(this.payManaCost.add(payManaCost), isIgnoreManaCostColor() || ignoreManaCostColor); + public CardPlayOption add(final boolean payManaCost, final boolean ignoreManaCostColor, final boolean withFlash) { + return new CardPlayOption(this.payManaCost.add(payManaCost), isIgnoreManaCostColor() || ignoreManaCostColor, isWithFlash() || withFlash); } public PayManaCost getPayManaCost() { @@ -41,6 +43,10 @@ public final class CardPlayOption { public boolean isIgnoreManaCostColor() { return ignoreManaCostColor; } + + public boolean isWithFlash() { + return withFlash; + } @Override public String toString() { @@ -57,7 +63,11 @@ public final class CardPlayOption { return " (with or without paying its mana cost)"; } case NO: - return " (without paying its mana cost)"; + if (isWithFlash()) { + return " (without paying its mana cost and as though it has flash)"; + } else { + return " (without paying its mana cost)"; + } } return StringUtils.EMPTY; } diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java index 490786f640b..5b800025431 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java @@ -29,9 +29,7 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import forge.GameCommand; -import forge.card.ColorSet; import forge.card.MagicColor; -import forge.card.mana.ManaCostShard; import forge.game.Game; import forge.game.GlobalRuleChange; import forge.game.StaticEffect; @@ -140,7 +138,7 @@ public final class StaticAbilityContinuous { boolean removeSubTypes = false; boolean removeCreatureTypes = false; boolean controllerMayLookAt = false; - boolean controllerMayPlay = false, mayPlayWithoutManaCost = false, mayPlayIgnoreColor = false; + boolean controllerMayPlay = false, mayPlayWithoutManaCost = false, mayPlayIgnoreColor = false, mayPlayWithFlash = false; //Global rules changes if (layer == StaticAbilityLayer.RULES && params.containsKey("GlobalRule")) { @@ -376,6 +374,9 @@ public final class StaticAbilityContinuous { } else if (params.containsKey("MayPlayIgnoreColor")) { mayPlayIgnoreColor = true; } + if (params.containsKey("MayPlayWithFlash")) { + mayPlayWithFlash = true; + } } if (params.containsKey("IgnoreEffectCost")) { @@ -611,7 +612,7 @@ public final class StaticAbilityContinuous { affectedCard.setMayLookAt(controller, true); } if (controllerMayPlay) { - affectedCard.setMayPlay(controller, mayPlayWithoutManaCost, mayPlayIgnoreColor); + affectedCard.setMayPlay(controller, mayPlayWithoutManaCost, mayPlayIgnoreColor, mayPlayWithFlash); } affectedCard.updateStateForView();