Name:Lich
ManaCost:B B B B
Types:Enchantment
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ LoseLife | ReplacementResult$ Updated | Description$ As CARDNAME enters, you lose life equal to your life total.
SVar:LoseLife:DB$ LoseLife | LifeAmount$ LifeTotal
SVar:LifeTotal:Count$YourLifeTotal
R:Event$ GameLoss | ActiveZones$ Battlefield | ValidPlayer$ You | ValidLoseReason$ LifeReachedZero | Layer$ CantHappen | Description$ You don't lose the game for having 0 or less life.
R:Event$ GainLife | ActiveZones$ Battlefield | ValidPlayer$ You | AILogic$ LichDraw | ReplaceWith$ Draw | Description$ If you would gain life, draw that many cards instead.
SVar:Draw:DB$ Draw | Defined$ You | NumCards$ X
SVar:X:ReplaceCount$LifeGained
T:Mode$ DamageDoneOnce | ValidTarget$ You | TriggerZones$ Battlefield | Execute$ TrigLoseOrSac | TriggerDescription$ Whenever you're dealt damage, sacrifice that many nontoken permanents. If you can't, you lose the game.
SVar:TrigLoseOrSac:DB$ LosesGame | Defined$ You | ConditionCheckSVar$ PermanentsToSac | ConditionSVarCompare$ GTY | SubAbility$ DBSacrificePerm
SVar:DBSacrificePerm:DB$ Sacrifice | Amount$ PermanentsToSac | SacValid$ Permanent.nonToken | ConditionCheckSVar$ PermanentsToSac | ConditionSVarCompare$ LEY
SVar:PermanentsToSac:TriggerCount$DamageAmount
SVar:Y:Count$Valid Permanent.nonToken+YouCtrl
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigLose | TriggerDescription$ When CARDNAME is put into a graveyard from the battlefield, you lose the game.
SVar:TrigLose:DB$ LosesGame | Defined$ You
AI:RemoveDeck:Random
SVar:NonStackingEffect:True
Oracle:As Lich enters, you lose life equal to your life total.\nYou don't lose the game for having 0 or less life.\nIf you would gain life, draw that many cards instead.\nWhenever you're dealt damage, sacrifice that many nontoken permanents. If you can't, you lose the game.\nWhen Lich is put into a graveyard from the battlefield, you lose the game.
