mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
CardPlayOption: add MayPlayWithFlash
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -2277,9 +2277,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user