diff --git a/res/cardsfolder/a/ashling_the_extinguisher_avatar.txt b/res/cardsfolder/a/ashling_the_extinguisher_avatar.txt index 0dedcbf73d1..30262b918fe 100644 --- a/res/cardsfolder/a/ashling_the_extinguisher_avatar.txt +++ b/res/cardsfolder/a/ashling_the_extinguisher_avatar.txt @@ -2,7 +2,6 @@ Name:Ashling, the Extinguisher Avatar ManaCost:no cost Types:Vanguard HandLifeModifier:+1/-3 -A:AB$ DestroyAll | ActivationZone$ Command | Cost$ 5 | ValidCards$ Permanent.nonLand | PlayerTurn$ True | SubAbility$ DBRemoveAB | SpellDescription$ Destroy all nonland permanents. Activate this ability only once and only during your turn. -SVar:DBRemoveAB:DB$ Animate | RemoveAllAbilities$ True | Permanent$ True +A:AB$ DestroyAll | ActivationZone$ Command | Cost$ 5 | ValidCards$ Permanent.nonLand | PlayerTurn$ True | GameActivationLimit$ 1 | SpellDescription$ Destroy all nonland permanents. Activate this ability only once and only during your turn. SVar:Picture:http://www.cardforge.org/fpics/vgd-lq/ashling_the_extinguisher_avatar.jpg Oracle:Hand +1, life -3\n{5}: Destroy all nonland permanents. Activate this ability only once and only during your turn. \ No newline at end of file diff --git a/src/main/java/forge/card/ability/effects/RestartGameEffect.java b/src/main/java/forge/card/ability/effects/RestartGameEffect.java index 3cce15b538d..9d0a1a290e4 100644 --- a/src/main/java/forge/card/ability/effects/RestartGameEffect.java +++ b/src/main/java/forge/card/ability/effects/RestartGameEffect.java @@ -76,7 +76,8 @@ public class RestartGameEffect extends SpellAbilityEffect { player.setPoisonCounters(0, sa.getSourceCard()); player.setNumLandsPlayed(0); GameNew.putCardsOnBattlefield(player, psc.getCardsOnBattlefield(player)); - + GameNew.initVariantsZones(player, psc); + List newLibrary = playerLibraries.get(player); for (Card c : newLibrary) { action.moveToLibrary(c, 0); diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index 75a5d490485..b19c17128f4 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -219,6 +219,10 @@ public class SpellAbilityCondition extends SpellAbilityVariables { return false; } + if ((this.getGameActivationLimit() != -1) && (this.getNumberGameActivations() >= this.getGameActivationLimit())) { + return false; + } + if (this.getPhases().size() > 0) { boolean isPhase = false; final PhaseType currPhase = game.getPhaseHandler().getPhase(); diff --git a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java index af618c3f0a4..ed43bb3dd49 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java +++ b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java @@ -125,6 +125,10 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { this.setLimitToCheck(params.get("ActivationLimit")); } + if (params.containsKey("GameActivationLimit")) { + this.setGameLimitToCheck(params.get("GameActivationLimit")); + } + if (params.containsKey("ActivationNumberSacrifice")) { this.setActivationNumberSacrifice(Integer.parseInt(params.get("ActivationNumberSacrifice"))); } @@ -331,6 +335,16 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { } } + if (this.getGameLimitToCheck() != null) { + String limit = this.getGameLimitToCheck(); + int gameActivationLimit = AbilityUtils.calculateAmount(c, limit, sa); + this.setGameActivationLimit(gameActivationLimit); + + if ((this.getGameActivationLimit() != -1) && (this.getNumberGameActivations() >= this.getGameActivationLimit())) { + return false; + } + } + if (this.getCardsInHand() != -1) { if (activator.getCardsIn(ZoneType.Hand).size() != this.getCardsInHand()) { return false; diff --git a/src/main/java/forge/card/spellability/SpellAbilityVariables.java b/src/main/java/forge/card/spellability/SpellAbilityVariables.java index 19c5bdcfd19..186bf341422 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityVariables.java +++ b/src/main/java/forge/card/spellability/SpellAbilityVariables.java @@ -62,7 +62,9 @@ public class SpellAbilityVariables { this.opponentTurn = sav.isOpponentTurn(); this.playerTurn = sav.isPlayerTurn(); this.activationLimit = sav.getActivationLimit(); + this.gameActivationLimit = sav.getGameActivationLimit(); this.numberTurnActivations = sav.getNumberTurnActivations(); + this.numberGameActivations = sav.getNumberGameActivations(); this.activationNumberSacrifice = sav.getActivationNumberSacrifice(); this.cardsInHand = sav.getCardsInHand(); this.chosenColors = sav.getColorToCheck(); @@ -114,12 +116,21 @@ public class SpellAbilityVariables { /** The activation limit. */ private int activationLimit = -1; + /** The game activation limit. */ + private int gameActivationLimit = -1; + /** The limitToCheck to check. */ private String limitToCheck = null; + /** The gameLimitToCheck to check. */ + private String gameLimitToCheck = null; + /** The number turn activations. */ private int numberTurnActivations = 0; + /** The number game activations. */ + private int numberGameActivations = 0; + /** The activation number sacrifice. */ private int activationNumberSacrifice = -1; @@ -346,6 +357,18 @@ public class SpellAbilityVariables { this.activationLimit = limit; } + /** + *

+ * Setter for the field gameActivationLimit. + *

+ * + * @param limit + * a int. + */ + public final void setGameActivationLimit(final int limit) { + this.gameActivationLimit = limit; + } + /** *

* abilityActivated. @@ -353,6 +376,7 @@ public class SpellAbilityVariables { */ public final void abilityActivated() { this.numberTurnActivations++; + this.numberGameActivations++; } /** @@ -366,6 +390,17 @@ public class SpellAbilityVariables { return this.numberTurnActivations; } + /** + *

+ * Getter for the field numberTurnActivations. + *

+ * + * @return a int. + */ + public final int getNumberGameActivations() { + return this.numberGameActivations; + } + /** *

* resetTurnActivations. @@ -619,6 +654,15 @@ public class SpellAbilityVariables { return this.activationLimit; } + /** + * Gets the activation limit. + * + * @return the activationLimit + */ + public final int getGameActivationLimit() { + return this.gameActivationLimit; + } + /** *

* Setter for the field limitToCheck. @@ -631,6 +675,18 @@ public class SpellAbilityVariables { this.limitToCheck = limit; } + /** + *

+ * Setter for the field GamelimitToCheck. + *

+ * + * @param limit + * a {@link java.lang.String} object. + */ + public final void setGameLimitToCheck(final String limit) { + this.gameLimitToCheck = limit; + } + /** *

* Getter for the field limitToCheck. @@ -643,6 +699,18 @@ public class SpellAbilityVariables { return this.limitToCheck; } + /** + *

+ * Getter for the field getGameLimitToCheck. + *

+ * + * @return the getGameLimitToCheck + * a {@link java.lang.String} object. + */ + public final String getGameLimitToCheck() { + return this.gameLimitToCheck; + } + /** * Checks if is threshold. * diff --git a/src/main/java/forge/game/GameNew.java b/src/main/java/forge/game/GameNew.java index 5937bf80bda..269bcb8ba8f 100644 --- a/src/main/java/forge/game/GameNew.java +++ b/src/main/java/forge/game/GameNew.java @@ -63,7 +63,7 @@ public class GameNew { } } - private static void initVariantsZones(final Player player, final RegisteredPlayer psc) { + public static void initVariantsZones(final Player player, final RegisteredPlayer psc) { PlayerZone com = player.getZone(ZoneType.Command); // Mainly for avatar, but might find something else here