Name:Shadowbane
ManaCost:1 W
Types:Instant
A:SP$ ChooseSource | Choices$ Card,Emblem | AILogic$ NeedsPrevention | SubAbility$ DBEffect | StackDescription$ SpellDescription | SpellDescription$ The next time a source of your choice would deal damage to you and/or creatures you control this turn, prevent that damage. If damage from a black source is prevented this way, you gain that much life.
SVar:DBEffect:DB$ Effect | ReplacementEffects$ RepDmg | SubAbility$ DBCleanup | ConditionDefined$ ChosenCard | ConditionPresent$ Card,Emblem | ConditionCompare$ GE1
SVar:RepDmg:Event$ DamageDone | ValidTarget$ You,Creature.YouCtrl | ValidSource$ Card.ChosenCardStrict,Emblem.ChosenCard | ReplaceWith$ GainLifeYou | PreventionEffect$ True | Description$ The next time a source of your choice would deal damage to you and/or creatures you control this turn, prevent that damage. If damage from a black source is prevented this way, you gain that much life.
SVar:GainLifeYou:DB$ GainLife | Defined$ You | LifeAmount$ X | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1 | SubAbility$ ExileEffect
SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True
SVar:X:ReplaceCount$DamageAmount
SVar:Y:ReplacedSource$Valid Card.BlackSource
DeckHas:Ability$LifeGain
Oracle:The next time a source of your choice would deal damage to you and/or creatures you control this turn, prevent that damage. If damage from a black source is prevented this way, you gain that much life.
