From 09334d20434579b64a0547588008563d44ebdaf4 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sat, 3 Apr 2021 13:10:09 -0400 Subject: [PATCH] support for OrActivationCardsInHand param --- .../game/spellability/SpellAbilityRestriction.java | 10 +++++++++- .../forge/game/spellability/SpellAbilityVariables.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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 5c8f0973aee..4dbc7d44a8d 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java @@ -141,6 +141,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { if (params.containsKey("ActivationCardsInHand")) { this.setActivateCardsInHand(Integer.parseInt(params.get("ActivationCardsInHand"))); } + if (params.containsKey("OrActivationCardsInHand")) { + this.setActivateCardsInHand2(Integer.parseInt(params.get("OrActivationCardsInHand"))); + } if (params.containsKey("ActivationChosenColor")) { this.setColorToCheck(params.get("ActivationChosenColor")); @@ -356,7 +359,12 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { } if (getCardsInHand() != -1) { - if (activator.getCardsIn(ZoneType.Hand).size() != getCardsInHand()) { + int h = activator.getCardsIn(ZoneType.Hand).size(); + if (getCardsInHand2() != -1) { + if (h != getCardsInHand() && h != getCardsInHand2()) { + return false; + } + } else if (h != getCardsInHand()) { 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 0856cc4bb9d..2711b33d95d 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java @@ -134,6 +134,7 @@ public class SpellAbilityVariables implements Cloneable { /** The n cards in hand. */ private int cardsInHand = -1; + private int cardsInHand2 = -1; // Conditional States for Cards private boolean threshold = false; @@ -384,6 +385,9 @@ public class SpellAbilityVariables implements Cloneable { public final void setActivateCardsInHand(final int cards) { this.setCardsInHand(cards); } + public final void setActivateCardsInHand2(final int cards) { + this.setCardsInHand2(cards); + } public final void setHellbent(final boolean bHellbent) { @@ -830,6 +834,9 @@ public class SpellAbilityVariables implements Cloneable { public final int getCardsInHand() { return this.cardsInHand; } + public final int getCardsInHand2() { + return this.cardsInHand2; + } /** * Sets the cards in hand. @@ -840,6 +847,9 @@ public class SpellAbilityVariables implements Cloneable { public final void setCardsInHand(final int cardsInHand0) { this.cardsInHand = cardsInHand0; } + public final void setCardsInHand2(final int cardsInHand0) { + this.cardsInHand2 = cardsInHand0; + } /** * Gets the checks if is present.