diff --git a/forge-game/src/main/java/forge/game/CardTraitBase.java b/forge-game/src/main/java/forge/game/CardTraitBase.java index fb81b6d130c..ddc5424e96d 100644 --- a/forge-game/src/main/java/forge/game/CardTraitBase.java +++ b/forge-game/src/main/java/forge/game/CardTraitBase.java @@ -176,6 +176,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView { final Game game = hostController.getGame(); if ("True".equalsIgnoreCase(params.get("Metalcraft")) && !hostController.hasMetalcraft()) return false; + if ("True".equalsIgnoreCase(params.get("Delirium")) && !hostController.hasDelirium()) return false; if ("True".equalsIgnoreCase(params.get("Threshold")) && !hostController.hasThreshold()) return false; if ("True".equalsIgnoreCase(params.get("Hellbent")) && !hostController.hasHellbent()) return false; if ("True".equalsIgnoreCase(params.get("Bloodthirst")) && !hostController.hasBloodthirst()) return false; diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index b1a45bc1788..2c4e524437b 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -1290,6 +1290,9 @@ public class CardFactoryUtil { if (sq[0].contains("Metalcraft")) { return doXMath(Integer.parseInt(sq[cc.hasMetalcraft() ? 1 : 2]), m, c); } + if (sq[0].contains("Delirium")) { + return doXMath(Integer.parseInt(sq[cc.hasDelirium() ? 1 : 2]), m, c); + } if (sq[0].contains("FatefulHour")) { return doXMath(Integer.parseInt(sq[cc.getLife() <= 5 ? 1 : 2]), m, c); } diff --git a/forge-game/src/main/java/forge/game/player/Player.java b/forge-game/src/main/java/forge/game/player/Player.java index e0c6e9d2fab..b6e1adfa705 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -1834,6 +1834,10 @@ public class Player extends GameEntity implements Comparable { return getZone(ZoneType.Hand).isEmpty(); } + public final boolean hasDelirium() { + return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4; + } + public final boolean hasLandfall() { final CardCollectionView list = getZone(ZoneType.Battlefield).getCardsAddedThisTurn(null); return Iterables.any(list, CardPredicates.Presets.LANDS); diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java index 84eae6a79b1..53cd20daf20 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java @@ -84,6 +84,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables { if (value.equals("Metalcraft")) { this.setMetalcraft(true); } + if (value.equals("Delirium")) { + this.setDelirium(true); + } if (value.equals("Hellbent")) { this.setHellbent(true); } @@ -221,6 +224,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables { if (this.isHellbent() && !activator.hasHellbent()) return false; if (this.isThreshold() && !activator.hasThreshold()) return false; if (this.isMetalcraft() && !activator.hasMetalcraft()) return false; + if (this.isDelirium() && !activator.hasDelirium()) return false; if (this.kicked && !sa.isKicked()) return false; if (this.kicked1 && !sa.isOptionalCostPaid(OptionalCost.Kicker1)) return false; 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 114dd8c2ee7..685a9dc10e8 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java @@ -77,6 +77,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { if (value.equals("Metalcraft")) { this.setMetalcraft(true); } + if (value.equals("Delirium")) { + this.setDelirium(true); + } if (value.equals("Hellbent")) { this.setHellbent(true); } @@ -332,6 +335,11 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { return false; } } + if (this.isDelirium()) { + if (!activator.hasDelirium()) { + return false; + } + } if (this.isSurge()) { if (!activator.hasSurge()) { return false; 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 6e2c1dd8db5..ea1d92acc7d 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java @@ -71,7 +71,8 @@ public class SpellAbilityVariables { this.chosenColors = sav.getColorToCheck(); this.threshold = sav.isThreshold(); this.surge = sav.isSurge(); - this.metalcraft = sav.isThreshold(); + this.metalcraft = sav.isMetalcraft(); + this.delirium = sav.isDelirium(); this.hellbent = sav.isHellbent(); this.allTargetsLegal = sav.isAllTargetsLegal(); this.shareAllColors = sav.getShareAllColors(); @@ -145,13 +146,10 @@ public class SpellAbilityVariables { /** The n cards in hand. */ private int cardsInHand = -1; - /** The threshold. */ + // Conditional States for Cards private boolean threshold = false; - - /** The metalcraft. */ private boolean metalcraft = false; - - /** The hellbent. */ + private boolean delirium = false; private boolean hellbent = false; /** The surge. */ @@ -453,42 +451,18 @@ public class SpellAbilityVariables { this.setCardsInHand(cards); } - // specific named conditions - /** - *

- * Setter for the field hellbent. - *

- * - * @param bHellbent - * a boolean. - */ + public final void setHellbent(final boolean bHellbent) { this.hellbent = bHellbent; } - /** - *

- * Setter for the field threshold. - *

- * - * @param bThreshold - * a boolean. - */ public final void setThreshold(final boolean bThreshold) { this.threshold = bThreshold; } - /** - *

- * Setter for the field metalcraft. - *

- * - * @param bMetalcraft - * a boolean. - */ - public final void setMetalcraft(final boolean bMetalcraft) { - this.metalcraft = bMetalcraft; - } + public final void setMetalcraft(final boolean bMetalcraft) { this.metalcraft = bMetalcraft; } + + public void setDelirium(boolean delirium) { this.delirium = delirium; } /** *

@@ -699,32 +673,13 @@ public class SpellAbilityVariables { return this.gameLimitToCheck; } - /** - * Checks if is threshold. - * - * @return the threshold - */ - public final boolean isThreshold() { - return this.threshold; - } + public final boolean isThreshold() { return this.threshold; } - /** - * Checks if is metalcraft. - * - * @return the metalcraft - */ - public final boolean isMetalcraft() { - return this.metalcraft; - } + public final boolean isMetalcraft() { return this.metalcraft; } - /** - * Checks if is hellbent. - * - * @return the hellbent - */ - public final boolean isHellbent() { - return this.hellbent; - } + public final boolean isDelirium() { return this.delirium; } + + public final boolean isHellbent() { return this.hellbent; } /** * Checks if is surge. @@ -1004,9 +959,6 @@ public class SpellAbilityVariables { return enchantedControllerOnly; } - /** - * @param opponentOnly the opponentOnly to set - */ public void setEnchantedControllerOnly(boolean enchantedControllerOnly) { this.enchantedControllerOnly = enchantedControllerOnly; } diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java index 9f0a2fc6a3a..06c2e088856 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java @@ -465,6 +465,7 @@ public class StaticAbility extends CardTraitBase { if (condition.equals("Threshold") && !controller.hasThreshold()) return false; if (condition.equals("Hellbent") && !controller.hasHellbent()) return false; if (condition.equals("Metalcraft") && !controller.hasMetalcraft()) return false; + if (condition.equals("Delirium") && !controller.hasDelirium()) return false; if (condition.equals("PlayerTurn")) { if (!controller.getGame().getPhaseHandler().isPlayerTurn(controller)) {