From 1ab6338c1d1f5b4827fef44dd2c923f02dd7d294 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Fri, 11 Nov 2022 23:34:39 +0100 Subject: [PATCH] War Room fix --- .../spellability/SpellAbilityRestriction.java | 8 ++++++++ .../spellability/SpellAbilityVariables.java | 18 +++++++++--------- forge-gui/res/cardsfolder/w/war_room.txt | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java index be3e6de7f0b..0ed423661a0 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java @@ -20,6 +20,7 @@ package forge.game.spellability; import java.util.List; import java.util.Map; +import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -544,6 +545,13 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { } } + if (this.getGameTypes().size() > 0) { + Predicate pgt = type -> game.getRules().hasAppliedVariant(type); + if (!Iterables.any(getGameTypes(), pgt)) { + return false; + } + } + return true; } diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java index 65eda28205b..f94a7b4871f 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java @@ -371,6 +371,15 @@ public class SpellAbilityVariables implements Cloneable { this.phases.addAll(phases); } + /** + * Gets the game types. + * + * @return the game types + */ + public final Set getGameTypes() { + return this.gameTypes; + } + /** *

* Setter for the field gameTypes. @@ -709,15 +718,6 @@ public class SpellAbilityVariables implements Cloneable { return this.firstCombatOnly = first; } - /** - * Gets the game types. - * - * @return the game types - */ - public final Set getGameTypes() { - return this.gameTypes; - } - /** * Gets the present defined. * diff --git a/forge-gui/res/cardsfolder/w/war_room.txt b/forge-gui/res/cardsfolder/w/war_room.txt index 5c5ac6922c6..27475a93479 100644 --- a/forge-gui/res/cardsfolder/w/war_room.txt +++ b/forge-gui/res/cardsfolder/w/war_room.txt @@ -2,7 +2,7 @@ Name:War Room ManaCost:no cost Types:Land A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}. -A:AB$ Draw | Cost$ 3 T PayLife | CostDesc$ {3}, {T}, Pay life equal to the number of colors in your commanders' color identity: | NumCards$ 1 | SpellDescription$ Draw a card. +A:AB$ Draw | Cost$ 3 T PayLife | ActivationGameTypes$ Commander,Brawl,TinyLeaders,Oathbreaker | CostDesc$ {3}, {T}, Pay life equal to the number of colors in your commanders' color identity: | NumCards$ 1 | SpellDescription$ Draw a card. SVar:X:Count$ColorsColorIdentity AI:RemoveDeck:NonCommander Oracle:{T}: Add {C}.\n{3}, {T}, Pay life equal to the number of colors in your commanders' color identity: Draw a card.