diff --git a/.gitattributes b/.gitattributes index 9c67c34a0d2..d647032ae41 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9226,6 +9226,7 @@ res/cardsfolder/s/sabretooth_tiger.txt svneol=native#text/plain res/cardsfolder/s/sacellum_archers.txt svneol=native#text/plain res/cardsfolder/s/sacellum_godspeaker.txt -text res/cardsfolder/s/sachi_daughter_of_seshiro.txt svneol=native#text/plain +res/cardsfolder/s/sacred_boon.txt -text res/cardsfolder/s/sacred_foundry.txt svneol=native#text/plain res/cardsfolder/s/sacred_guide.txt -text res/cardsfolder/s/sacred_knight.txt svneol=native#text/plain @@ -9388,6 +9389,7 @@ res/cardsfolder/s/scarecrone.txt svneol=native#text/plain res/cardsfolder/s/scarecrow.txt -text res/cardsfolder/s/scarland_thrinax.txt svneol=native#text/plain res/cardsfolder/s/scarred_vinebreeder.txt svneol=native#text/plain +res/cardsfolder/s/scars_of_the_veteran.txt -text res/cardsfolder/s/scarscale_ritual.txt svneol=native#text/plain res/cardsfolder/s/scarwood_bandits.txt svneol=native#text/plain res/cardsfolder/s/scarwood_goblins.txt svneol=native#text/plain diff --git a/res/cardsfolder/s/sacred_boon.txt b/res/cardsfolder/s/sacred_boon.txt new file mode 100644 index 00000000000..c98a6260078 --- /dev/null +++ b/res/cardsfolder/s/sacred_boon.txt @@ -0,0 +1,11 @@ +Name:Sacred Boon +ManaCost:1 W +Types:Instant +A:SP$ PreventDamage | Cost$ 1 W | ValidTgts$ Creature | Amount$ 3 | PreventionSubAbility$ BoonEffect | ShieldEffectTarget$ Targeted | TgtPrompt$ Select target creature | SpellDescription$ Prevent the next 3 damage that would be dealt to target creature this turn. At the beginning of the next end step, put a +0/+1 counter on that creature for each 1 damage prevented this way. +SVar:BoonEffect:AB$ Effect | Cost$ 0 | RememberObjects$ ShieldEffectTarget | Triggers$ DelTrig,OutOfSight | SVars$ DelayedBoon,ExileEffect | SpellDescription$ At the beginning of the next end step, put a +0/+1 counter on the targeted creature for each 1 damage prevented this way. +SVar:DelTrig:Mode$ Phase | Phase$ End of Turn | Execute$ DelayedBoon | TriggerDescription$ Put a +0/+1 counter on the targeted creature for each 1 damage prevented this way. +SVar:DelayedBoon:AB$ PutCounter | Cost$ 0 | Defined$ Remembered | CounterType$ P0P1 | CounterNum$ PreventedDamage | SubAbility$ ExileEffect +SVar:OutOfSight:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Creature.IsRemembered | Execute$ ExileEffect | Static$ True +SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile | Static$ True +SVar:Picture:http://www.wizards.com/global/images/magic/general/sacred_boon.jpg +Oracle:Prevent the next 3 damage that would be dealt to target creature this turn. At the beginning of the next end step, put a +0/+1 counter on that creature for each 1 damage prevented this way. diff --git a/res/cardsfolder/s/scars_of_the_veteran.txt b/res/cardsfolder/s/scars_of_the_veteran.txt new file mode 100644 index 00000000000..7c49891cb21 --- /dev/null +++ b/res/cardsfolder/s/scars_of_the_veteran.txt @@ -0,0 +1,13 @@ +Name:Scars of the Veteran +ManaCost:4 W +Types:Instant +SVar:AltCost:Cost$ ExileFromHand<1/Card.White> | Description$ You may exile a white card from your hand rather than pay CARDNAME's mana cost. +A:SP$ PreventDamage | Cost$ 4 W | ValidTgts$ Creature,Player | Amount$ 7 | PreventionSubAbility$ ScarEffect | ShieldEffectTarget$ Targeted | TgtPrompt$ Select target creature or player | SpellDescription$ Prevent the next 7 damage that would be dealt to target creature or player this turn. At the beginning of the next end step, put a +0/+1 counter on that creature for each 1 damage prevented this way. +SVar:ScarEffect:AB$ Effect | Cost$ 0 | RememberObjects$ ShieldEffectTarget | Triggers$ DelTrig,OutOfSight,NoCreatTgt | SVars$ DelayedScars,ExileEffect | SpellDescription$ At the beginning of the next end step, put a +0/+1 counter on the targeted creature for each 1 damage prevented this way. +SVar:DelTrig:Mode$ Phase | Phase$ End of Turn | Execute$ DelayedScars | TriggerDescription$ Put a +0/+1 counter on the targeted creature for each 1 damage prevented this way. +SVar:DelayedScars:AB$ PutCounter | Cost$ 0 | Defined$ Remembered | CounterType$ P0P1 | CounterNum$ PreventedDamage | SubAbility$ ExileEffect +SVar:OutOfSight:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Creature.IsRemembered | Execute$ ExileEffect | Static$ True +SVar:NoCreatTgt:Mode$ Always | IsPresent$ Creature.IsRemembered | PresentCompare$ EQ0 | Execute$ ExileEffect | Static$ True +SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile | Static$ True +SVar:Picture:http://www.wizards.com/global/images/magic/general/scars_of_the_veteran.jpg +Oracle:You may exile a white card from your hand rather than pay Scars of the Veteran's mana cost.\nPrevent the next 7 damage that would be dealt to target creature or player this turn. At the beginning of the next end step, put a +0/+1 counter on that creature for each 1 damage prevented this way. diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 48596c37af3..53204d4aa0b 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -7386,15 +7386,23 @@ public class Card extends GameEntity implements Comparable { System.err.println(shieldSource + " - Targeting for prevention shield's effect should be done with initial spell"); } - if (restDamage >= shieldAmount) { - this.getController().getController().playSpellAbilityNoStack(this.getController(), shieldSA); - this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); - restDamage = restDamage - shieldAmount; - } else { - this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); - this.getController().getController().playSpellAbilityNoStack(this.getController(), shieldSA); - restDamage = 0; + boolean apiIsEffect = (shieldSA.getApi() == ApiType.Effect); + List cardsInCommand = null; + if (apiIsEffect) { + cardsInCommand = this.getGame().getCardsIn(ZoneType.Command); } + + this.getController().getController().playSpellAbilityNoStack(this.getController(), shieldSA); + if (apiIsEffect) { + List newCardsInCommand = this.getGame().getCardsIn(ZoneType.Command); + newCardsInCommand.removeAll(cardsInCommand); + if (newCardsInCommand != null && !newCardsInCommand.isEmpty()) { + newCardsInCommand.get(0).setSVar("PreventedDamage", "Number$" + Integer.toString(dmgToBePrevented)); + } + } + this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); + restDamage = restDamage - dmgToBePrevented; + if (DEBUGShieldsWithEffects) { System.out.println("Remaining shields: " + (shieldMap.containsKey(shieldSource) ? shieldMap.get(shieldSource).get("ShieldAmount") : "all shields used")); diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index 4e108da14e9..c0da7539fa4 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -44,6 +44,7 @@ import forge.Singletons; import forge.card.MagicColor; import forge.card.ability.AbilityFactory; import forge.card.ability.AbilityUtils; +import forge.card.ability.ApiType; import forge.card.mana.ManaCost; import forge.card.mana.ManaPool; import forge.card.replacement.ReplacementResult; @@ -932,15 +933,21 @@ public class Player extends GameEntity implements Comparable { System.err.println(shieldSource + " - Targeting for prevention shield's effect should be done with initial spell"); } - if (restDamage >= shieldAmount) { - this.getController().playSpellAbilityNoStack(this, shieldSA); - this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); - restDamage = restDamage - shieldAmount; - } else { - this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); - this.getController().playSpellAbilityNoStack(this, shieldSA); - restDamage = 0; + boolean apiIsEffect = (shieldSA.getApi() == ApiType.Effect); + List cardsInCommand = null; + if (apiIsEffect) { + cardsInCommand = this.getGame().getCardsIn(ZoneType.Command); } + + this.getController().playSpellAbilityNoStack(this, shieldSA); + if (apiIsEffect) { + List newCardsInCommand = this.getGame().getCardsIn(ZoneType.Command); + newCardsInCommand.removeAll(cardsInCommand); + newCardsInCommand.get(0).setSVar("PreventedDamage", "Number$" + Integer.toString(dmgToBePrevented)); + } + this.subtractPreventNextDamageWithEffect(shieldSource, restDamage); + restDamage = restDamage - dmgToBePrevented; + if (DEBUGShieldsWithEffects) { System.out.println("Remaining shields: " + (shieldMap.containsKey(shieldSource) ? shieldMap.get(shieldSource).get("ShieldAmount") : "all shields used"));