diff --git a/forge-game/src/main/java/forge/game/CardTraitBase.java b/forge-game/src/main/java/forge/game/CardTraitBase.java index 729dbb3cb6c..16f01b88387 100644 --- a/forge-game/src/main/java/forge/game/CardTraitBase.java +++ b/forge-game/src/main/java/forge/game/CardTraitBase.java @@ -208,6 +208,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView { if ("True".equalsIgnoreCase(params.get("Hellbent")) && !hostController.hasHellbent()) return false; if ("True".equalsIgnoreCase(params.get("Bloodthirst")) && !hostController.hasBloodthirst()) return false; if ("True".equalsIgnoreCase(params.get("FatefulHour")) && hostController.getLife() > 5) return false; + if ("True".equalsIgnoreCase(params.get("Revolt")) && !hostController.hasRevolt()) return false; if (params.containsKey("Presence")) { if (hostCard.getCastFrom() == null || hostCard.getCastSA() == null) diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index f513842cf89..3427930e589 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -166,7 +166,11 @@ public class GameAction { if (fromBattlefield && c.getSVar("EndOfTurnLeavePlay").equals("Dash")) { c.removeSVar("EndOfTurnLeavePlay"); } - + + if (fromBattlefield && !toBattlefield) { + c.getController().setRevolt(true); + } + // Don't copy Tokens, copy only cards leaving the battlefield // and returning to hand (to recreate their spell ability information) if (suppress || (!fromBattlefield && !toHand)) { 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 dacc7bab499..20c92c72550 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -1099,7 +1099,9 @@ public class CardFactoryUtil { if (sq[0].contains("FatefulHour")) { return doXMath(Integer.parseInt(sq[cc.getLife() <= 5 ? 1 : 2]), m, c); } - + if (sq[0].contains("Revolt")) { + return doXMath(Integer.parseInt(sq[cc.hasRevolt() ? 1 : 2]), m, c); + } if (sq[0].contains("Landfall")) { return doXMath(Integer.parseInt(sq[cc.hasLandfall() ? 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 639ef90c0b7..3ff1b8c1c19 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -107,6 +107,8 @@ public class Player extends GameEntity implements Comparable { private int numDiscardedThisTurn = 0; private int numCardsInHandStartedThisTurnWith = 0; + private boolean revolt = false; + private CardCollection sacrificedThisTurn = new CardCollection(); private Map countersAddedtoPermThisTurn = Maps.newEnumMap(CounterType.class); @@ -1898,8 +1900,7 @@ public class Player extends GameEntity implements Comparable { } public final boolean hasMetalcraft() { - final CardCollectionView list = CardLists.filter(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); - return list.size() >= 3; + return CardLists.count(getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS) >= 3; } public final boolean hasThreshold() { @@ -1910,6 +1911,14 @@ public class Player extends GameEntity implements Comparable { return getZone(ZoneType.Hand).isEmpty(); } + public final boolean hasRevolt() { + return revolt; + } + + public final void setRevolt(final boolean val) { + revolt = val; + } + public final boolean hasDelirium() { return CardFactoryUtil.getCardTypesFromList(getCardsIn(ZoneType.Graveyard)) >= 4; } @@ -1953,7 +1962,7 @@ public class Player extends GameEntity implements Comparable { prowl.add(type); } public final void resetProwl() { - prowl = new ArrayList(); + prowl.clear(); } public final void setLibrarySearched(final int l) { @@ -2588,6 +2597,7 @@ public class Player extends GameEntity implements Comparable { resetCounterToPermThisTurn(); clearAssignedDamage(); resetAttackersDeclaredThisTurn(); + setRevolt(false); } public boolean canCastSorcery() { 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 c4c9804b309..f7628af4587 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java @@ -91,6 +91,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables { if (value.equals("Hellbent")) { this.setHellbent(true); } + if (value.equals("Revolt")) { + this.setRevolt(true); + } if (value.equals("Kicked")) { this.kicked = true; } @@ -228,6 +231,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables { if (this.isThreshold() && !activator.hasThreshold()) return false; if (this.isMetalcraft() && !activator.hasMetalcraft()) return false; if (this.isDelirium() && !activator.hasDelirium()) return false; + if (this.isRevolt() && !activator.hasRevolt()) 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/SpellAbilityVariables.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java index d802ef429f0..f612d039d0f 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java @@ -153,6 +153,7 @@ public class SpellAbilityVariables implements Cloneable { private boolean metalcraft = false; private boolean delirium = false; private boolean hellbent = false; + private boolean revolt = false; /** The surge. */ private boolean surge = false; @@ -469,6 +470,7 @@ public class SpellAbilityVariables implements Cloneable { public void setDelirium(boolean delirium) { this.delirium = delirium; } + public void setRevolt(final boolean bRevolt) { revolt = bRevolt; } /** *

* Setter for the field surge. @@ -684,6 +686,8 @@ public class SpellAbilityVariables implements Cloneable { public final boolean isDelirium() { return this.delirium; } public final boolean isHellbent() { return this.hellbent; } + + public final boolean isRevolt() { return this.revolt; } /** * Checks if is surge.