From fe95ad2e11593aa86ed72ba0f2d16723aeb68d9b Mon Sep 17 00:00:00 2001 From: Alumi Date: Sat, 8 May 2021 13:57:03 +0000 Subject: [PATCH] Refactor Damage Prevention - Step 2 --- .../src/main/java/forge/ai/AiController.java | 20 +-- .../java/forge/ai/PlayerControllerAi.java | 4 +- .../ability/effects/ReplaceDamageEffect.java | 2 +- .../src/main/java/forge/game/card/Card.java | 6 - .../java/forge/game/card/CardFactoryUtil.java | 30 +++-- .../main/java/forge/game/player/Player.java | 7 - .../forge/game/player/PlayerController.java | 2 +- .../game/replacement/ReplacementHandler.java | 3 +- .../game/staticability/StaticAbility.java | 35 ----- .../StaticAbilityPreventDamage.java | 120 ------------------ .../util/PlayerControllerForTests.java | 2 +- forge-gui/res/cardsfolder/b/barbed_wire.txt | 9 +- .../cardsfolder/b/battletide_alchemist.txt | 4 +- .../res/cardsfolder/c/cover_of_winter.txt | 6 +- forge-gui/res/cardsfolder/d/dark_sphere.txt | 9 +- .../res/cardsfolder/d/daunting_defender.txt | 4 +- .../cardsfolder/d/djeru_with_eyes_open.txt | 4 +- forge-gui/res/cardsfolder/e/errant_minion.txt | 4 +- .../g/gisela_blade_of_goldnight.txt | 5 +- .../res/cardsfolder/g/guardian_seraph.txt | 4 +- .../cardsfolder/h/hedron_field_purists.txt | 7 +- .../cardsfolder/n/nothing_can_stop_me_now.txt | 4 +- .../res/cardsfolder/o/orbs_of_warding.txt | 4 +- .../res/cardsfolder/p/plated_pegasus.txt | 4 +- forge-gui/res/cardsfolder/p/power_leak.txt | 4 +- .../cardsfolder/p/protection_of_the_hekma.txt | 4 +- ..._the_worthy_valkmira_protectors_shield.txt | 3 +- .../cardsfolder/s/shield_of_the_avatar.txt | 4 +- .../res/cardsfolder/s/shield_of_the_realm.txt | 3 +- .../res/cardsfolder/s/sphere_of_duty.txt | 4 +- .../res/cardsfolder/s/sphere_of_grace.txt | 4 +- forge-gui/res/cardsfolder/s/sphere_of_law.txt | 4 +- .../res/cardsfolder/s/sphere_of_purity.txt | 4 +- .../res/cardsfolder/s/sphere_of_reason.txt | 4 +- .../res/cardsfolder/s/sphere_of_truth.txt | 4 +- .../cardsfolder/s/spirit_of_resistance.txt | 4 +- forge-gui/res/cardsfolder/t/thunderstaff.txt | 4 +- .../res/cardsfolder/t/torrent_of_lava.txt | 11 +- forge-gui/res/cardsfolder/u/urzas_armor.txt | 4 +- .../forge/player/PlayerControllerHuman.java | 2 +- 40 files changed, 104 insertions(+), 262 deletions(-) delete mode 100644 forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index 75a20ff5627..ae259ad7246 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -1307,15 +1307,6 @@ public class AiController { } public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) { - if (logic.equalsIgnoreCase("ProtectFriendly")) { - final Player controller = hostCard.getController(); - if (affected instanceof Player) { - return !((Player) affected).isOpponentOf(controller); - } - if (affected instanceof Card) { - return !((Card) affected).getController().isOpponentOf(controller); - } - } return true; } @@ -1759,12 +1750,21 @@ public class AiController { * @param sa the sa * @return true, if successful */ - public final boolean aiShouldRun(final ReplacementEffect effect, final SpellAbility sa) { + public final boolean aiShouldRun(final ReplacementEffect effect, final SpellAbility sa, GameEntity affected) { Card hostCard = effect.getHostCard(); if (hostCard.hasAlternateState()) { hostCard = game.getCardState(hostCard); } + if (effect.hasParam("AILogic") && effect.getParam("AILogic").equalsIgnoreCase("ProtectFriendly")) { + final Player controller = hostCard.getController(); + if (affected instanceof Player) { + return !((Player) affected).isOpponentOf(controller); + } + if (affected instanceof Card) { + return !((Card) affected).getController().isOpponentOf(controller); + } + } if (effect.hasParam("AICheckSVar")) { System.out.println("aiShouldRun?" + sa); final String svarToCheck = effect.getParam("AICheckSVar"); diff --git a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java index 826e4202c97..9d1cfdc97a0 100644 --- a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java +++ b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java @@ -568,8 +568,8 @@ public class PlayerControllerAi extends PlayerController { } @Override - public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question) { - return brains.aiShouldRun(replacementEffect, effectSA); + public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question) { + return brains.aiShouldRun(replacementEffect, effectSA, affected); } @Override diff --git a/forge-game/src/main/java/forge/game/ability/effects/ReplaceDamageEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ReplaceDamageEffect.java index a1e2fa1d76e..1619901305c 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ReplaceDamageEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ReplaceDamageEffect.java @@ -48,7 +48,7 @@ public class ReplaceDamageEffect extends SpellAbilityEffect { if (card.getType().hasStringType("Effect") && prevent <= 0) { game.getAction().exile(card, null); - } else if (!StringUtils.isNumeric(varValue)) { + } else if (!StringUtils.isNumeric(varValue) && card.getSVar(varValue).startsWith("Number$")) { card.setSVar(varValue, "Number$" + prevent); } // Set PreventedDamage SVar for PreventionSubAbility diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 38911562cf2..18a2a974032 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -5222,12 +5222,6 @@ public class Card extends GameEntity implements Comparable, IHasSVars { return 0; } - // Prevent Damage static abilities - for (final Card ca : getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { - for (final StaticAbility stAb : ca.getStaticAbilities()) { - restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage, isCombat, isTest); - } - } return restDamage > 0 ? restDamage : 0; } 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 c2f66da4d5d..36a6e7d845f 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -3422,7 +3422,24 @@ public class CardFactoryUtil { Card host = card.getCard(); String keyword = inst.getOriginal(); - if (keyword.equals("Aftermath") && card.getStateName().equals(CardStateName.RightSplit)) { + if (keyword.startsWith("Absorb")) { + final String[] k = keyword.split(":"); + final String n = k[1]; + + StringBuilder sb = new StringBuilder(); + sb.append("Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Card.Self"); + sb.append(" | PreventionEffect$ True | Secondary$ True | Description$ Absorb ").append(n); + sb.append(" (").append(inst.getReminderText()).append(")"); + String repeffstr = sb.toString(); + + String abString = "DB$ ReplaceDamage | Amount$ " + n; + SpellAbility replaceDamage = AbilityFactory.getAbility(abString, card); + replaceDamage.setIntrinsic(intrinsic); + + ReplacementEffect re = ReplacementHandler.parseReplacement(repeffstr, host, intrinsic, card); + re.setOverridingAbility(replaceDamage); + inst.addReplacement(re); + } else if (keyword.equals("Aftermath") && card.getStateName().equals(CardStateName.RightSplit)) { StringBuilder sb = new StringBuilder(); sb.append("Event$ Moved | ValidCard$ Card.Self | Origin$ Stack | ExcludeDestination$ Exile "); sb.append("| ValidStackSa$ Spell.Aftermath | Description$ Aftermath"); @@ -4748,16 +4765,7 @@ public class CardFactoryUtil { String effect = null; Map svars = Maps.newHashMap(); - if (keyword.startsWith("Absorb")) { - final String[] k = keyword.split(":"); - final String n = k[1]; - - StringBuilder sb = new StringBuilder(); - sb.append("Mode$ PreventDamage | Target$ Card.Self | Amount$ "); - sb.append(n).append("| Secondary$ True | Description$ Absorb ").append(n); - sb.append(" (").append(inst.getReminderText()).append(")"); - effect = sb.toString(); - } else if (keyword.startsWith("Affinity")) { + if (keyword.startsWith("Affinity")) { final String[] k = keyword.split(":"); final String t = k[1]; 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 fe041141a72..a838ab70dbe 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -729,13 +729,6 @@ public class Player extends GameEntity implements Comparable { int restDamage = damage; - // Prevent Damage static abilities - for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { - for (final StaticAbility stAb : ca.getStaticAbilities()) { - restDamage = stAb.applyAbility("PreventDamage", source, this, restDamage, isCombat, isTest); - } - } - if (restDamage > 0) { return restDamage; } diff --git a/forge-game/src/main/java/forge/game/player/PlayerController.java b/forge-game/src/main/java/forge/game/player/PlayerController.java index dd110de1f9d..5bd6a56eb29 100644 --- a/forge-game/src/main/java/forge/game/player/PlayerController.java +++ b/forge-game/src/main/java/forge/game/player/PlayerController.java @@ -180,7 +180,7 @@ public abstract class PlayerController { } public abstract Object vote(SpellAbility sa, String prompt, List options, ListMultimap votes, Player forPlayer); - public abstract boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question); + public abstract boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question); public abstract CardCollectionView getCardsToMulligan(Player firstPlayer); public abstract boolean mulliganKeepHand(Player player, int cardsToReturn); diff --git a/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java b/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java index 2a18dbf3c8c..e850041632f 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java @@ -342,7 +342,8 @@ public class ReplacementHandler { final String question = replacementEffect instanceof ReplaceDiscard ? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), runParams.get(AbilityKey.Card).toString(), effectDesc) : Localizer.getInstance().getMessage("lblApplyReplacementEffectOfCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), effectDesc); - boolean confirmed = optDecider.getController().confirmReplacementEffect(replacementEffect, effectSA, question); + GameEntity affected = (GameEntity) runParams.get(AbilityKey.Affected); + boolean confirmed = optDecider.getController().confirmReplacementEffect(replacementEffect, effectSA, affected, question); if (!confirmed) { return ReplacementResult.NotReplaced; } 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 16e43f05de7..53faa617d36 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java @@ -287,41 +287,6 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone return getParam("Mode").equals("Continuous") && layers.contains(layer) && !isSuppressed() && checkConditions() && (previousRun || getHostCard().getStaticAbilities().contains(this)); } - // apply the ability if it has the right mode - /** - * Apply ability. - * - * @param mode - * the mode - * @param source - * the source - * @param target - * the target - * @param in - * the in - * @param isCombat - * the b - * @return the int - */ - public final int applyAbility(final String mode, final Card source, final GameEntity target, final int in, - final boolean isCombat, final boolean isTest) { - - // don't apply the ability if it hasn't got the right mode - if (!getParam("Mode").equals(mode)) { - return in; - } - - if (this.isSuppressed() || !this.checkConditions()) { - return in; - } - - if (mode.equals("PreventDamage")) { - return StaticAbilityPreventDamage.applyPreventDamageAbility(this, source, target, in, isCombat, isTest); - } - - return in; - } - /** * Apply ability. * diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java deleted file mode 100644 index 2e44081dc16..00000000000 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2011 Forge Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package forge.game.staticability; - -import java.util.Map; - -import forge.game.GameEntity; -import forge.game.card.Card; -import forge.game.card.CardFactoryUtil; - -/** - * The Class StaticAbility_PreventDamage. - */ -public class StaticAbilityPreventDamage { - - /** - * TODO Write javadoc for this method. - * - * @param stAb - * a StaticAbility - * @param source - * the source - * @param target - * the target - * @param damage - * the damage - * @param isCombat - * the is combat - * @return the int - */ - public static int applyPreventDamageAbility(final StaticAbility stAb, final Card source, final GameEntity target, - final int damage, final boolean isCombat, final boolean isTest) { - final Map params = stAb.getMapParams(); - final Card hostCard = stAb.getHostCard(); - int restDamage = damage; - - if (params.containsKey("Source") && !stAb.matchesValid(source, params.get("Source").split(","))) { - return restDamage; - } - - if (params.containsKey("Target") && !stAb.matchesValid(target, params.get("Target").split(","))) { - return restDamage; - } - - if (params.containsKey("CombatDamage") && params.get("CombatDamage").equals("True") && !isCombat) { - return restDamage; - } - - if (params.containsKey("CombatDamage") && params.get("CombatDamage").equals("False") && isCombat) { - return restDamage; - } - - if (params.containsKey("MaxDamage") && (Integer.parseInt(params.get("MaxDamage")) < damage)) { - return restDamage; - } - - if (params.containsKey("SourceSharesColorWithTarget")) { - if (!(target instanceof Card) || source.equals(target)) { - return restDamage; - } - Card targetCard = (Card) target; - if (!source.sharesColorWith(targetCard)) { - return restDamage; - } - } - - if (params.containsKey("Optional")) { //Assume if param is present it should be optional - if (!isTest) { - final String logic = params.containsKey("AILogic") ? params.get("AILogic") : ""; - final String message = "Apply the effect of " + hostCard + "? (Affected: " + target + ")"; - boolean confirmed = hostCard.getController().getController().confirmStaticApplication(hostCard, target, logic, message); - - if (!confirmed) { - return restDamage; - } - } else { //test - if (!hostCard.getController().equals(target)) { - return restDamage; - } - } - } - - // no amount means all - if (!params.containsKey("Amount") || params.get("Amount").equals("All")) { - return 0; - } - - if (params.get("Amount").matches("[0-9][0-9]?")) { - restDamage = restDamage - Integer.parseInt(params.get("Amount")); - } else if (params.get("Amount").matches("HalfUp")) { - restDamage = restDamage - (int) (Math.ceil(restDamage / 2.0)); - } else if (params.get("Amount").matches("HalfDown")) { - restDamage = restDamage - (int) (Math.floor(restDamage / 2.0)); - } else { - restDamage = restDamage - CardFactoryUtil.xCount(hostCard, hostCard.getSVar(params.get("Amount"))); - } - - if (restDamage < 0) { - return 0; - } - - return restDamage; - } - -} diff --git a/forge-gui-desktop/src/test/java/forge/gamesimulationtests/util/PlayerControllerForTests.java b/forge-gui-desktop/src/test/java/forge/gamesimulationtests/util/PlayerControllerForTests.java index ed0bbea56cd..ab95d3e297f 100644 --- a/forge-gui-desktop/src/test/java/forge/gamesimulationtests/util/PlayerControllerForTests.java +++ b/forge-gui-desktop/src/test/java/forge/gamesimulationtests/util/PlayerControllerForTests.java @@ -310,7 +310,7 @@ public class PlayerControllerForTests extends PlayerController { } @Override - public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question) { + public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question) { return true; } diff --git a/forge-gui/res/cardsfolder/b/barbed_wire.txt b/forge-gui/res/cardsfolder/b/barbed_wire.txt index 3d33cead9fb..6f796397b79 100644 --- a/forge-gui/res/cardsfolder/b/barbed_wire.txt +++ b/forge-gui/res/cardsfolder/b/barbed_wire.txt @@ -3,10 +3,9 @@ ManaCost:3 Types:Artifact T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ At the beginning of each player's upkeep, CARDNAME deals 1 damage to that player. SVar:TrigDamage:DB$ DealDamage | Defined$ TriggeredPlayer | NumDmg$ 1 -A:AB$ Effect | Cost$ 2 | ImprintCards$ Self | Triggers$ OutOfSight | StaticAbilities$ STPrevent | SpellDescription$ Prevent the next 1 damage that would be dealt by CARDNAME this turn. | StackDescription$ SpellDescription -SVar:STPrevent:Mode$ PreventDamage | EffectZone$ Command | Amount$ 1 | Source$ Card.IsImprinted | Description$ Prevent the next 1 damage that would be dealt by CARDNAME this turn. -SVar:OutOfSight:Mode$ ChangesZone | TriggerZones$ Command | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.IsImprinted | Execute$ ExileSelf | Static$ True -SVar:ExileSelf:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile +A:AB$ Effect | Cost$ 2 | RememberObjects$ Self | ReplacementEffects$ DBPrevent | ForgetOnMoved$ Battlefield | SpellDescription$ Prevent the next 1 damage that would be dealt by CARDNAME this turn. | StackDescription$ SpellDescription +SVar:DBPrevent:Event$ DamageDone | ActiveZones$ Command | ValidSource$ Card.IsRemembered | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ Prevent the next 1 damage that would be dealt by EFFECTSOURCE this turn. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ ShieldAmount +SVar:ShieldAmount:Number$1 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/barbed_wire.jpg Oracle:At the beginning of each player's upkeep, Barbed Wire deals 1 damage to that player.\n{2}: Prevent the next 1 damage that would be dealt by Barbed Wire this turn. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/b/battletide_alchemist.txt b/forge-gui/res/cardsfolder/b/battletide_alchemist.txt index b6b13ba6383..d590a6b6e31 100644 --- a/forge-gui/res/cardsfolder/b/battletide_alchemist.txt +++ b/forge-gui/res/cardsfolder/b/battletide_alchemist.txt @@ -2,7 +2,7 @@ Name:Battletide Alchemist ManaCost:3 W W Types:Creature Kithkin Cleric PT:3/4 -S:Mode$ PreventDamage | Target$ Player | Amount$ AlchemicX | Optional$ True | AILogic$ ProtectFriendly | Description$ If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Player | ReplaceWith$ DBReplace | PreventionEffect$ True | Optional$ True | OptionalDecider$ You | AILogic$ ProtectFriendly | Description$ If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ AlchemicX SVar:AlchemicX:Count$Valid Cleric.YouCtrl -SVar:Picture:http://www.wizards.com/global/images/magic/general/battletide_alchemist.jpg Oracle:If a source would deal damage to a player, you may prevent X of that damage, where X is the number of Clerics you control. diff --git a/forge-gui/res/cardsfolder/c/cover_of_winter.txt b/forge-gui/res/cardsfolder/c/cover_of_winter.txt index ec4afab7142..4e80c2d938d 100644 --- a/forge-gui/res/cardsfolder/c/cover_of_winter.txt +++ b/forge-gui/res/cardsfolder/c/cover_of_winter.txt @@ -2,8 +2,8 @@ Name:Cover of Winter ManaCost:2 W Types:Snow Enchantment K:Cumulative upkeep:S -S:Mode$ PreventDamage | Target$ You,Creature.YouCtrl | Source$ Creature | CombatDamage$ True | Amount$ X | Description$ If a creature would deal combat damage to you and/or one or more creatures you control, prevent X of that damage, where X is the number of age counters on CARDNAME. -A:AB$ PutCounter | Cost$ S | CounterType$ AGE | CounterNum$ 1 | SpellDescription$ Put a age counter on CARDNAME. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You,Creature.YouCtrl | ValidSource$ Creature | IsCombat$ True | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a creature would deal combat damage to you and/or one or more creatures you control, prevent X of that damage, where X is the number of age counters on CARDNAME. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ X +A:AB$ PutCounter | Cost$ S | CounterType$ AGE | CounterNum$ 1 | SpellDescription$ Put an age counter on CARDNAME. SVar:X:Count$CardCounters.AGE -SVar:Picture:http://www.wizards.com/global/images/magic/general/cover_of_winter.jpg Oracle:Cumulative upkeep {S} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it. {S} can be paid with one mana from a snow source.)\nIf a creature would deal combat damage to you and/or one or more creatures you control, prevent X of that damage, where X is the number of age counters on Cover of Winter.\n{S}: Put an age counter on Cover of Winter. diff --git a/forge-gui/res/cardsfolder/d/dark_sphere.txt b/forge-gui/res/cardsfolder/d/dark_sphere.txt index a726fab6935..8f6d6e0d4f2 100644 --- a/forge-gui/res/cardsfolder/d/dark_sphere.txt +++ b/forge-gui/res/cardsfolder/d/dark_sphere.txt @@ -2,9 +2,8 @@ Name:Dark Sphere ManaCost:0 Types:Artifact A:AB$ ChooseSource | Cost$ T Sac<1/CARDNAME> | Choices$ Card | RememberChosen$ True | AILogic$ NeedsPrevention | SubAbility$ DBEffect | SpellDescription$ The next time a source of your choice would deal damage to you this turn, prevent half that damage, rounded down. -SVar:DBEffect:DB$ Effect | Triggers$ DamageDealt | StaticAbilities$ StaticPrevent | RememberObjects$ Remembered -SVar:StaticPrevent:Mode$ PreventDamage | Source$ Card.IsRemembered | Target$ You | Amount$ HalfDown | EffectZone$ Command | Description$ The next time a source of your choice would deal damage to you this turn, prevent half that damage, rounded down. -SVar:DamageDealt:Mode$ DamageDone | ValidSource$ Card.IsRemembered | ValidTarget$ You | Execute$ ExileEffect | Static$ True -SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile -SVar:Picture:http://www.wizards.com/global/images/magic/general/dark_sphere.jpg +SVar:DBEffect:DB$ Effect | RememberObjects$ Remembered | ReplacementEffects$ DBPrevent | ForgetOnMoved$ Battlefield +SVar:DBPrevent:Event$ DamageDone | ActiveZones$ Command | ValidSource$ Card.IsRemembered | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ The next time a source of your choice would deal damage to you this turn, prevent half that damage, rounded down. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ ShieldAmount +SVar:ShieldAmount:ReplaceCount$DamageAmount/HalfDown Oracle:{T}, Sacrifice Dark Sphere: The next time a source of your choice would deal damage to you this turn, prevent half that damage, rounded down. diff --git a/forge-gui/res/cardsfolder/d/daunting_defender.txt b/forge-gui/res/cardsfolder/d/daunting_defender.txt index 75d16e14362..c9bc6ebda52 100644 --- a/forge-gui/res/cardsfolder/d/daunting_defender.txt +++ b/forge-gui/res/cardsfolder/d/daunting_defender.txt @@ -1,7 +1,7 @@ Name:Daunting Defender ManaCost:4 W Types:Creature Human Cleric -S:Mode$ PreventDamage | Target$ Creature.Cleric+YouCtrl | Amount$ 1 | Description$ If a source would deal damage to a Cleric creature you control, prevent 1 of that damage. PT:3/3 -SVar:Picture:http://www.wizards.com/global/images/magic/general/daunting_defender.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Creature.Cleric+YouCtrl | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to a Cleric creature you control, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:If a source would deal damage to a Cleric creature you control, prevent 1 of that damage. diff --git a/forge-gui/res/cardsfolder/d/djeru_with_eyes_open.txt b/forge-gui/res/cardsfolder/d/djeru_with_eyes_open.txt index 6e436c6e0d0..48944c189da 100644 --- a/forge-gui/res/cardsfolder/d/djeru_with_eyes_open.txt +++ b/forge-gui/res/cardsfolder/d/djeru_with_eyes_open.txt @@ -5,6 +5,6 @@ PT:4/3 K:Vigilance T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.Self | Execute$ TrigChange | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a planeswalker card, reveal it, put it into your hand, then shuffle. SVar:TrigChange:DB$ChangeZone | Origin$ Library | Destination$ Hand | ChangeType$ Planeswalker | ChangeNum$ 1 | ShuffleNonMandatory$ True -S:Mode$ PreventDamage | Target$ Planeswalker.YouCtrl | Amount$ 1 | Description$ If a source would deal damage to a planeswalker you control, prevent 1 of that damage. -SVar:Picture:http://www.wizards.com/global/images/magic/general/djeru_with_eyes_open.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Planeswalker.YouCtrl | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to a planeswalker you control, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:Vigilance\nWhen Djeru, With Eyes Open enters the battlefield, you may search your library for a planeswalker card, reveal it, put it into your hand, then shuffle.\nIf a source would deal damage to a planeswalker you control, prevent 1 of that damage. diff --git a/forge-gui/res/cardsfolder/e/errant_minion.txt b/forge-gui/res/cardsfolder/e/errant_minion.txt index f15d034c6bd..690ea3cd362 100644 --- a/forge-gui/res/cardsfolder/e/errant_minion.txt +++ b/forge-gui/res/cardsfolder/e/errant_minion.txt @@ -4,12 +4,12 @@ Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 2 U | ValidTgts$ Creature | AILogic$ Curse T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedController | Execute$ DBPay | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of the upkeep of enchanted creature's controller, that player may pay any amount of mana. CARDNAME deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. -S:Mode$ PreventDamage | Target$ EnchantedController | Source$ Card.Self | Amount$ PaidAmount | Secondary$ True +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.Self | ReplaceWith$ DBReplace | PreventionEffect$ True | Secondary$ True +SVar:DBReplace:DB$ ReplaceDamage | Amount$ PaidAmount SVar:DBPay:DB$ ChooseNumber | Defined$ EnchantedController | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ PowerLeakMaxMana.2 | SubAbility$ DBStore SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ X | UnlessCost$ X | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg SVar:DBDmg:DB$ DealDamage | Defined$ EnchantedController | NumDmg$ 2 | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ PaidAmount | Type$ Number | Expression$ 0 SVar:X:Count$ChosenNumber SVar:PaidAmount:Number$0 -SVar:Picture:http://www.wizards.com/global/images/magic/general/power_leak.jpg Oracle:Enchant creature\nAt the beginning of the upkeep of enchanted creature's controller, that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. diff --git a/forge-gui/res/cardsfolder/g/gisela_blade_of_goldnight.txt b/forge-gui/res/cardsfolder/g/gisela_blade_of_goldnight.txt index a2be0e1d295..d33d8bf4311 100644 --- a/forge-gui/res/cardsfolder/g/gisela_blade_of_goldnight.txt +++ b/forge-gui/res/cardsfolder/g/gisela_blade_of_goldnight.txt @@ -7,7 +7,8 @@ K:First Strike R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card,Emblem | ValidTarget$ Opponent,Permanent.OppCtrl | ReplaceWith$ DmgTwice | Description$ If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead. SVar:DmgTwice:DB$ ReplaceEffect | VarName$ DamageAmount | VarValue$ X SVar:X:ReplaceCount$DamageAmount/Twice -S:Mode$ PreventDamage | Target$ You,Permanent.YouCtrl | Amount$ HalfUp | Description$ If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You,Permanent.YouCtrl | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ ShieldAmount +SVar:ShieldAmount:ReplaceCount$DamageAmount/HalfUp SVar:PlayMain1:TRUE -SVar:Picture:http://www.wizards.com/global/images/magic/general/gisela_blade_of_goldnight.jpg Oracle:Flying, first strike\nIf a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead.\nIf a source would deal damage to you or a permanent you control, prevent half that damage, rounded up. diff --git a/forge-gui/res/cardsfolder/g/guardian_seraph.txt b/forge-gui/res/cardsfolder/g/guardian_seraph.txt index 0e2a71faa4c..4340de456c5 100644 --- a/forge-gui/res/cardsfolder/g/guardian_seraph.txt +++ b/forge-gui/res/cardsfolder/g/guardian_seraph.txt @@ -3,6 +3,6 @@ ManaCost:2 W W Types:Creature Angel PT:3/4 K:Flying -S:Mode$ PreventDamage | Target$ You | Source$ Card.OppCtrl | Amount$ 1 | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. -SVar:Picture:http://www.wizards.com/global/images/magic/general/guardian_seraph.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.OppCtrl,Emblem.OppCtrl | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:Flying\nIf a source an opponent controls would deal damage to you, prevent 1 of that damage. diff --git a/forge-gui/res/cardsfolder/h/hedron_field_purists.txt b/forge-gui/res/cardsfolder/h/hedron_field_purists.txt index ee01371e7f6..8aae72ec6ea 100644 --- a/forge-gui/res/cardsfolder/h/hedron_field_purists.txt +++ b/forge-gui/res/cardsfolder/h/hedron_field_purists.txt @@ -6,9 +6,10 @@ K:Level up:2 W SVar:maxLevel:5 S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 1 | SetToughness$ 4 | CheckSVar$ X | SVarCompare$ EQ1 | Description$ LEVEL 1-4 1/4 If a source would deal damage to you or a creature you control prevent 1 of that damage. S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 2 | SetToughness$ 5 | CheckSVar$ Y | SVarCompare$ EQ1 | Description$ LEVEL 5+ 2/5 If a source would deal damage to you or a creature you control prevent 2 of that damage. -S:Mode$ PreventDamage | Target$ You,Creature.YouCtrl | Amount$ 1 | CheckSVar$ X | SVarCompare$ EQ1 -S:Mode$ PreventDamage | Target$ You,Creature.YouCtrl | Amount$ 2 | CheckSVar$ Y | SVarCompare$ EQ1 +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You,Creature.YouCtrl | ReplaceWith$ DBReplace1 | PreventionEffect$ True | CheckSVar$ X | SVarCompare$ EQ1 +SVar:DBReplace1:DB$ ReplaceDamage | Amount$ 1 +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You,Creature.YouCtrl | ReplaceWith$ DBReplace2 | PreventionEffect$ True | CheckSVar$ Y | SVarCompare$ EQ1 +SVar:DBReplace2:DB$ ReplaceDamage | Amount$ 2 SVar:X:Count$Valid Card.Self+counters_GE1_LEVEL+counters_LT5_LEVEL SVar:Y:Count$Valid Card.Self+counters_GE5_LEVEL -SVar:Picture:http://www.wizards.com/global/images/magic/general/hedron_field_purists.jpg Oracle:Level up {2}{W} ({2}{W}: Put a level counter on this. Level up only as a sorcery.)\nLEVEL 1-4\n1/4\nIf a source would deal damage to you or a creature you control, prevent 1 of that damage.\nLEVEL 5+\n2/5\nIf a source would deal damage to you or a creature you control, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/n/nothing_can_stop_me_now.txt b/forge-gui/res/cardsfolder/n/nothing_can_stop_me_now.txt index 6a16399dad8..b8e0046aa6d 100644 --- a/forge-gui/res/cardsfolder/n/nothing_can_stop_me_now.txt +++ b/forge-gui/res/cardsfolder/n/nothing_can_stop_me_now.txt @@ -2,9 +2,9 @@ Name:Nothing Can Stop Me Now ManaCost:no cost Types:Ongoing Scheme Text:(An ongoing scheme remains face up until it's abandoned.) -S:Mode$ PreventDamage | EffectZone$ Command | Target$ You | Source$ Card.OppCtrl | Amount$ 1 | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. +R:Event$ DamageDone | ActiveZones$ Command | ValidSource$ Card.OppCtrl,Emblem.OppCtrl | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 T:Mode$ Phase | Phase$ End of Turn | CheckSVar$ X | SVarCompare$ GE5 | TriggerZones$ Command | Execute$ Abandon | TriggerDescription$ At the beginning of each end step, if you've been dealt 5 or more damage this turn, abandon this scheme. SVar:Abandon:AB$ Abandon | Cost$ 0 SVar:X:Count$YourDamageThisTurn -SVar:Picture:https://downloads.cardforge.org/images/cards/ARC/Nothing Can Stop Me Now.full.jpg Oracle:(An ongoing scheme remains face up until it's abandoned.)\nIf a source an opponent controls would deal damage to you, prevent 1 of that damage.\nAt the beginning of each end step, if you've been dealt 5 or more damage this turn, abandon this scheme. diff --git a/forge-gui/res/cardsfolder/o/orbs_of_warding.txt b/forge-gui/res/cardsfolder/o/orbs_of_warding.txt index 84a45e8acdf..8dfcf5c7499 100644 --- a/forge-gui/res/cardsfolder/o/orbs_of_warding.txt +++ b/forge-gui/res/cardsfolder/o/orbs_of_warding.txt @@ -2,6 +2,6 @@ Name:Orbs of Warding ManaCost:5 Types:Artifact S:Mode$ Continuous | Affected$ You | AddKeyword$ Hexproof | Description$ You have hexproof. (You can't be the target of spells or abilities your opponents control.) -S:Mode$ PreventDamage | Target$ You | Source$ Creature.inZoneBattlefield | Amount$ 1 | Description$ If a creature would deal damage to you, prevent 1 of that damage. -SVar:Picture:http://www.wizards.com/global/images/magic/general/orbs_of_warding.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Creature.inZoneBattlefield | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a creature would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:You have hexproof. (You can't be the target of spells or abilities your opponents control.)\nIf a creature would deal damage to you, prevent 1 of that damage. diff --git a/forge-gui/res/cardsfolder/p/plated_pegasus.txt b/forge-gui/res/cardsfolder/p/plated_pegasus.txt index 9929068ed00..7fc148732cf 100644 --- a/forge-gui/res/cardsfolder/p/plated_pegasus.txt +++ b/forge-gui/res/cardsfolder/p/plated_pegasus.txt @@ -4,6 +4,6 @@ Types:Creature Pegasus PT:1/2 K:Flash K:Flying -S:Mode$ PreventDamage | Target$ Permanent,Player | Source$ Spell | Amount$ 1 | Description$ If a spell would deal damage to a permanent or player, prevent 1 damage that spell would deal to that permanent or player. -SVar:Picture:http://www.wizards.com/global/images/magic/general/plated_pegasus.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Spell | ValidTarget$ Permanent,Player | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a spell would deal damage to a permanent or player, prevent 1 damage that spell would deal to that permanent or player. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:Flash (You may cast this spell any time you could cast an instant.)\nFlying\nIf a spell would deal damage to a permanent or player, prevent 1 damage that spell would deal to that permanent or player. diff --git a/forge-gui/res/cardsfolder/p/power_leak.txt b/forge-gui/res/cardsfolder/p/power_leak.txt index 5a741c8c2f4..046cd4e6203 100644 --- a/forge-gui/res/cardsfolder/p/power_leak.txt +++ b/forge-gui/res/cardsfolder/p/power_leak.txt @@ -4,12 +4,12 @@ Types:Enchantment Aura K:Enchant enchantment A:SP$ Attach | Cost$ 1 U | ValidTgts$ Enchantment | AILogic$ Curse T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ EnchantedController | Execute$ DBPay | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. CARDNAME deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. -S:Mode$ PreventDamage | Target$ EnchantedController | Source$ Card.Self | Amount$ PaidAmount | Secondary$ True +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.Self | ReplaceWith$ DBReplace | PreventionEffect$ True | Secondary$ True +SVar:DBReplace:DB$ ReplaceDamage | Amount$ PaidAmount SVar:DBPay:DB$ ChooseNumber | Defined$ EnchantedController | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ PowerLeakMaxMana.2 | SubAbility$ DBStore SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ X | UnlessCost$ X | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg SVar:DBDmg:DB$ DealDamage | Defined$ EnchantedController | NumDmg$ 2 | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ PaidAmount | Type$ Number | Expression$ 0 SVar:X:Count$ChosenNumber SVar:PaidAmount:Number$0 -SVar:Picture:http://www.wizards.com/global/images/magic/general/power_leak.jpg Oracle:Enchant enchantment\nAt the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. Power Leak deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. diff --git a/forge-gui/res/cardsfolder/p/protection_of_the_hekma.txt b/forge-gui/res/cardsfolder/p/protection_of_the_hekma.txt index bf63586bb1a..7cf5d53f363 100644 --- a/forge-gui/res/cardsfolder/p/protection_of_the_hekma.txt +++ b/forge-gui/res/cardsfolder/p/protection_of_the_hekma.txt @@ -1,6 +1,6 @@ Name:Protection of the Hekma ManaCost:4 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.OppCtrl | Amount$ 1 | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. -SVar:Picture:http://www.wizards.com/global/images/magic/general/protection_of_the_hekma.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.OppCtrl,Emblem.OppCtrl | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source an opponent controls would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:If a source an opponent controls would deal damage to you, prevent 1 of that damage. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/r/reidane_god_of_the_worthy_valkmira_protectors_shield.txt b/forge-gui/res/cardsfolder/r/reidane_god_of_the_worthy_valkmira_protectors_shield.txt index 0f1c8c3a9b8..1ab4396a1c5 100644 --- a/forge-gui/res/cardsfolder/r/reidane_god_of_the_worthy_valkmira_protectors_shield.txt +++ b/forge-gui/res/cardsfolder/r/reidane_god_of_the_worthy_valkmira_protectors_shield.txt @@ -15,7 +15,8 @@ ALTERNATE Name:Valkmira, Protector's Shield ManaCost:3 W Types:Legendary Artifact -S:Mode$ PreventDamage | Target$ You,Permanent.YouCtrl | ValidSource$ Card.OppCtrl | Amount$ 1 | Description$ If a source an opponent controls would deal damage to you or a permanent you control, prevent 1 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.OppCtrl,Emblem.OppCtrl | ValidTarget$ You,Permanent.YouCtrl | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source an opponent controls would deal damage to you or a permanent you control, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 T:Mode$ BecomesTarget | ValidSource$ Card.OppCtrl | ValidTarget$ You,Permanent.YouCtrl+Other | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever you or another permanent you control becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {1}. SVar:TrigCounter:DB$ Counter | Defined$ TriggeredSourceSA | UnlessCost$ 1 | UnlessPayer$ TriggeredSourceSAController Oracle:If a source an opponent controls would deal damage to you or a permanent you control, prevent 1 of that damage.\nWhenever you or another permanent you control becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {1}. diff --git a/forge-gui/res/cardsfolder/s/shield_of_the_avatar.txt b/forge-gui/res/cardsfolder/s/shield_of_the_avatar.txt index bbe2435e15d..f38f6ab614d 100644 --- a/forge-gui/res/cardsfolder/s/shield_of_the_avatar.txt +++ b/forge-gui/res/cardsfolder/s/shield_of_the_avatar.txt @@ -2,8 +2,8 @@ Name:Shield of the Avatar ManaCost:1 Types:Artifact Equipment K:Equip:2 -S:Mode$ PreventDamage | Target$ Creature.EquippedBy | Amount$ X | Description$ If a source would deal damage to equipped creature, prevent X of that damage, where X is the number of creatures you control. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Creature.EquippedBy | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to equipped creature, prevent X of that damage, where X is the number of creatures you control. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ X SVar:X:Count$Valid Creature.YouCtrl SVar:BuffedBy:Creature -SVar:Picture:http://www.wizards.com/global/images/magic/general/shield_of_the_avatar.jpg Oracle:If a source would deal damage to equipped creature, prevent X of that damage, where X is the number of creatures you control.\nEquip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/s/shield_of_the_realm.txt b/forge-gui/res/cardsfolder/s/shield_of_the_realm.txt index 453c51c4dbe..6d47a4f0101 100644 --- a/forge-gui/res/cardsfolder/s/shield_of_the_realm.txt +++ b/forge-gui/res/cardsfolder/s/shield_of_the_realm.txt @@ -2,5 +2,6 @@ Name:Shield of the Realm ManaCost:2 Types:Artifact Equipment K:Equip:1 -S:Mode$ PreventDamage | Target$ Creature.EquippedBy | Amount$ 2 | Description$ If a source would deal damage to equipped creature, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ Creature.EquippedBy | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to equipped creature, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 Oracle:If a source would deal damage to equipped creature, prevent 2 of that damage.\nEquip {1} diff --git a/forge-gui/res/cardsfolder/s/sphere_of_duty.txt b/forge-gui/res/cardsfolder/s/sphere_of_duty.txt index ec1754c3651..443a52c6c3c 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_duty.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_duty.txt @@ -1,7 +1,7 @@ Name:Sphere of Duty ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.GreenSource | Amount$ 2 | Description$ If a green source would deal damage to you, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.GreenSource | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a green source would deal damage to you, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_duty.jpg Oracle:If a green source would deal damage to you, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/s/sphere_of_grace.txt b/forge-gui/res/cardsfolder/s/sphere_of_grace.txt index d8e72c522fd..5739ec2297d 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_grace.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_grace.txt @@ -1,7 +1,7 @@ Name:Sphere of Grace ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.BlackSource | Amount$ 2 | Description$ If a black source would deal damage to you, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.BlackSource | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a black source would deal damage to you, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_grace.jpg Oracle:If a black source would deal damage to you, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/s/sphere_of_law.txt b/forge-gui/res/cardsfolder/s/sphere_of_law.txt index d52cd7e380b..126fdff4143 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_law.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_law.txt @@ -1,7 +1,7 @@ Name:Sphere of Law ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.RedSource | Amount$ 2 | Description$ If a red source would deal damage to you, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.RedSource | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a red source would deal damage to you, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_law.jpg Oracle:If a red source would deal damage to you, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/s/sphere_of_purity.txt b/forge-gui/res/cardsfolder/s/sphere_of_purity.txt index 8f4e434af94..b5fe28befbf 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_purity.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_purity.txt @@ -1,7 +1,7 @@ Name:Sphere of Purity ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Artifact | Amount$ 1 | Description$ If an artifact source would deal damage to you, prevent 1 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Artifact | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If an artifact would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_purity.jpg Oracle:If an artifact would deal damage to you, prevent 1 of that damage. diff --git a/forge-gui/res/cardsfolder/s/sphere_of_reason.txt b/forge-gui/res/cardsfolder/s/sphere_of_reason.txt index 06348adbe40..cebc3c02f0e 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_reason.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_reason.txt @@ -1,7 +1,7 @@ Name:Sphere of Reason ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.BlueSource | Amount$ 2 | Description$ If a blue source would deal damage to you, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.BlueSource | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a blue source would deal damage to you, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_reason.jpg Oracle:If a blue source would deal damage to you, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/s/sphere_of_truth.txt b/forge-gui/res/cardsfolder/s/sphere_of_truth.txt index 658a76d6fab..ce476b768b2 100644 --- a/forge-gui/res/cardsfolder/s/sphere_of_truth.txt +++ b/forge-gui/res/cardsfolder/s/sphere_of_truth.txt @@ -1,7 +1,7 @@ Name:Sphere of Truth ManaCost:3 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Source$ Card.WhiteSource | Amount$ 2 | Description$ If a white source would deal damage to you, prevent 2 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.WhiteSource | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a white source would deal damage to you, prevent 2 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 2 AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/sphere_of_truth.jpg Oracle:If a white source would deal damage to you, prevent 2 of that damage. diff --git a/forge-gui/res/cardsfolder/s/spirit_of_resistance.txt b/forge-gui/res/cardsfolder/s/spirit_of_resistance.txt index a9fddb9bec2..06d76384647 100644 --- a/forge-gui/res/cardsfolder/s/spirit_of_resistance.txt +++ b/forge-gui/res/cardsfolder/s/spirit_of_resistance.txt @@ -1,8 +1,8 @@ Name:Spirit of Resistance ManaCost:2 W Types:Enchantment -S:Mode$ PreventDamage | Target$ You | Condition$ PermanentOfEachColor | Description$ As long as you control a permanent of each color, prevent all damage that would be dealt to you. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You | Prevent$ True | CheckSVar$ X | SVarCompare$ EQ5 | Description$ As long as you control a permanent of each color, prevent all damage that would be dealt to you. +SVar:X:Count$ColorsCtrl Permanent SVar:NonStackingEffect:True AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/spirit_of_resistance.jpg Oracle:As long as you control a permanent of each color, prevent all damage that would be dealt to you. diff --git a/forge-gui/res/cardsfolder/t/thunderstaff.txt b/forge-gui/res/cardsfolder/t/thunderstaff.txt index b8f5e397f9c..832b29ae8cc 100644 --- a/forge-gui/res/cardsfolder/t/thunderstaff.txt +++ b/forge-gui/res/cardsfolder/t/thunderstaff.txt @@ -1,8 +1,8 @@ Name:Thunderstaff ManaCost:3 Types:Artifact -S:Mode$ PreventDamage | Target$ You | Source$ Creature | CombatDamage$ True | Amount$ 1 | CheckSVar$ X | SVarCompare$ EQ1 | Description$ As long as CARDNAME is untapped, if a creature would deal combat damage to you, prevent 1 of that damage. +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Creature | ValidTarget$ You | IsCombat$ True | ReplaceWith$ DBReplace | PreventionEffect$ True | CheckSVar$ X | SVarCompare$ EQ1 | Description$ As long as CARDNAME is untapped, if a creature would deal combat damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 A:AB$ PumpAll | Cost$ 2 T | ValidCards$ Creature.attacking | NumAtt$ +1 | SpellDescription$ Attacking creatures get +1/+0 until end of turn. SVar:X:Count$Valid Card.Self+untapped -SVar:Picture:http://www.wizards.com/global/images/magic/general/thunderstaff.jpg Oracle:As long as Thunderstaff is untapped, if a creature would deal combat damage to you, prevent 1 of that damage.\n{2}, {T}: Attacking creatures get +1/+0 until end of turn. diff --git a/forge-gui/res/cardsfolder/t/torrent_of_lava.txt b/forge-gui/res/cardsfolder/t/torrent_of_lava.txt index 08207482c4d..49db4cbbad6 100644 --- a/forge-gui/res/cardsfolder/t/torrent_of_lava.txt +++ b/forge-gui/res/cardsfolder/t/torrent_of_lava.txt @@ -3,9 +3,8 @@ ManaCost:X R R Types:Sorcery A:SP$ DamageAll | Cost$ X R R | ValidCards$ Creature.withoutFlying | NumDmg$ X | SpellDescription$ CARDNAME deals X damage to each creature without flying. | StackDescription$ SpellDescription SVar:X:Count$xPaid -S:Mode$ Continuous | Affected$ Creature | AddAbility$ DbPrevent | AddSVar$ TOLOutOfSight & TOLSTPrevent & TOLExileSelf | EffectZone$ Stack | Description$ As long as Torrent of Lava is on the stack, each creature has "{T}: Prevent the next 1 damage that would be dealt to this creature by CARDNAME this turn." -SVar:DbPrevent:AB$ Effect | Cost$ T | RememberObjects$ OriginalHost | ImprintCards$ Self | Triggers$ TOLOutOfSight | StaticAbilities$ TOLSTPrevent | SpellDescription$ Prevent the next 1 damage that would be dealt to this creature by Torrent of Lava this turn. | StackDescription$ SpellDescription -SVar:TOLSTPrevent:Mode$ PreventDamage | EffectZone$ Command | Amount$ 1 | Target$ Card.IsImprinted | Source$ Card.IsRemembered | Description$ Prevent the next 1 damage that would be dealt to this creature by remembered Card this turn. -SVar:TOLOutOfSight:Mode$ ChangesZone | TriggerZones$ Command | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.IsImprinted | Execute$ TOLExileSelf | Static$ True -SVar:TOLExileSelf:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile -Oracle:Torrent of Lava deals X damage to each creature without flying.\nAs long as Torrent of Lava is on the stack, each creature has "{T}: Prevent the next 1 damage that would be dealt to this creature by Torrent of Lava this turn." \ No newline at end of file +S:Mode$ Continuous | Affected$ Creature | AddAbility$ TOPrevent | AddSVar$ DBPrevent & DBReplace | EffectZone$ Stack | Description$ As long as Torrent of Lava is on the stack, each creature has "{T}: Prevent the next 1 damage that would be dealt to this creature by CARDNAME this turn." +SVar:TOPrevent:AB$ Effect | Cost$ T | RememberObjects$ Self | ImprintCards$ OriginalHost | ReplacementEffects$ DBPrevent | ForgetOnMoved$ Battlefield | SpellDescription$ Prevent the next 1 damage that would be dealt to this creature by Torrent of Lava this turn. | StackDescription$ SpellDescription +SVar:DBPrevent:Event$ DamageDone | ActiveZones$ Command | ValidSource$ Card.IsImprinted | ValidTarget$ Card.IsRemembered | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ Prevent the next 1 damage that would be dealt to this creature by Torrent of Lava this turn. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 +Oracle:Torrent of Lava deals X damage to each creature without flying.\nAs long as Torrent of Lava is on the stack, each creature has "{T}: Prevent the next 1 damage that would be dealt to this creature by Torrent of Lava this turn." diff --git a/forge-gui/res/cardsfolder/u/urzas_armor.txt b/forge-gui/res/cardsfolder/u/urzas_armor.txt index 346638d0e0f..63814ef093c 100644 --- a/forge-gui/res/cardsfolder/u/urzas_armor.txt +++ b/forge-gui/res/cardsfolder/u/urzas_armor.txt @@ -1,6 +1,6 @@ Name:Urza's Armor ManaCost:6 Types:Artifact -S:Mode$ PreventDamage | Target$ You | Source$ Card | Amount$ 1 | Description$ If a source would deal damage to you, prevent 1 of that damage. -SVar:Picture:http://www.wizards.com/global/images/magic/general/urzas_armor.jpg +R:Event$ DamageDone | ActiveZones$ Battlefield | ValidTarget$ You | ReplaceWith$ DBReplace | PreventionEffect$ True | Description$ If a source would deal damage to you, prevent 1 of that damage. +SVar:DBReplace:DB$ ReplaceDamage | Amount$ 1 Oracle:If a source would deal damage to you, prevent 1 of that damage. diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index 86ee5e8373c..abc379ee81f 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -1345,7 +1345,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont */ @Override public boolean confirmReplacementEffect(final ReplacementEffect replacementEffect, final SpellAbility effectSA, - final String question) { + GameEntity affected, final String question) { final InputConfirm inp = new InputConfirm(this, question, effectSA); inp.showAndWait(); return inp.getResult();