- Converted the replacement ability of Lich to script.

This commit is contained in:
Sloth
2012-01-08 15:37:26 +00:00
parent e933b27958
commit 7229e183c5
2 changed files with 12 additions and 15 deletions

View File

@@ -1,8 +1,11 @@
Name:Lich Name:Lich
ManaCost:B B B B ManaCost:B B B B
Types:Enchantment Types:Enchantment
Text:As CARDNAME enters the battlefield, you lose life equal to your life total.\r\nYou don't lose the game for having 0 or less life.\r\nIf you would gain life, draw that many cards instead.\r\nWhenever you're dealt damage, sacrifice that many nontoken permanents. If you can't, you lose the game.\r\nWhen CARDNAME is put into a graveyard from the battlefield, you lose the game. Text:As CARDNAME enters the battlefield, you lose life equal to your life total.\r\nYou don't lose the game for having 0 or less life.\r\nWhenever you're dealt damage, sacrifice that many nontoken permanents. If you can't, you lose the game.\r\nWhen CARDNAME is put into a graveyard from the battlefield, you lose the game.
K:You don't lose the game for having 0 or less life. K:You don't lose the game for having 0 or less life.
R:Event$ GainLife | ValidPlayer$ You | ReplaceWith$ Draw | Description$ If you would gain life, draw that many cards instead.
SVar:Draw:AB$Draw | Cost$ 0 | Defined$ You | NumCards$ X
SVar:X:ReplaceCount$LifeGained
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/lich.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/lich.jpg

View File

@@ -312,21 +312,15 @@ public abstract class Player extends GameEntity {
int lifeGain = toGain; int lifeGain = toGain;
if (lifeGain > 0) { if (lifeGain > 0) {
if (AllZoneUtil.isCardInPlay("Lich", this)) { this.addLife(lifeGain);
// draw cards instead of gain life newLifeSet = true;
this.drawCards(lifeGain); this.updateObservers();
newLifeSet = false;
} else {
this.addLife(lifeGain);
newLifeSet = true;
this.updateObservers();
// Run triggers // Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Player", this); runParams.put("Player", this);
runParams.put("LifeAmount", lifeGain); runParams.put("LifeAmount", lifeGain);
AllZone.getTriggerHandler().runTrigger("LifeGained", runParams); AllZone.getTriggerHandler().runTrigger("LifeGained", runParams);
}
} else { } else {
System.out.println("Player - trying to gain negative or 0 life"); System.out.println("Player - trying to gain negative or 0 life");
} }