- Convert Lich to Script

This commit is contained in:
Sol
2012-11-28 03:13:06 +00:00
parent e974f13b0f
commit 751134b40c
3 changed files with 11 additions and 82 deletions

View File

@@ -1,11 +1,21 @@
Name:Lich
ManaCost:B B B B
Types:Enchantment
Text:As CARDNAME enters the battlefield, you lose life equal to your life total.\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:no text
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Static$ True | Execute$ TrigLoseLife | TriggerDescription$ As CARDNAME enters the battlefield, you lose life equal to your life total.
SVar:TrigLoseLife:DB$LoseLife | Cost$ 0 | LifeAmount$ LifeTotal
SVar:LifeTotal:Count$YourLifeTotal
S:Mode$ Continuous | Affected$ You | AddKeyword$ You don't lose the game for having 0 or less life. | Description$ You don't lose the game for having 0 or less life.
R:Event$ GainLife | ActiveZones$ Battlefield | 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 | References$ X
SVar:X:ReplaceCount$LifeGained
T:Mode$ DamageDone | 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 | References$ PermanentsToSac | 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 | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME is put into a graveyard from the battlefield, you lose the game.
SVar:TrigLose:DB$ LosesGame | Defined$ You
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/lich.jpg

View File

@@ -769,32 +769,6 @@ public final class GameActionUtil {
return;
}
final List<Card> playerLiches = player.getCardsIn(ZoneType.Battlefield, "Lich");
for (final Card lich : playerLiches) {
final SpellAbility ability = new Ability(lich, "0") {
@Override
public void resolve() {
for (int i = 0; i < damage; i++) {
List<Card> nonTokens = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), Presets.NON_TOKEN);
if (nonTokens.size() == 0) {
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
} else {
player.sacrificePermanent("Select a permanent to sacrifice", nonTokens);
}
}
}
};
final StringBuilder sb = new StringBuilder();
sb.append(lich.getName()).append(" - ").append(lich.getController());
sb.append(" sacrifices ").append(damage).append(" nontoken permanents.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
c.getDamageHistory().registerDamage(player);
// Play the Life Loss sound

View File

@@ -7,12 +7,10 @@ import com.google.common.collect.Iterables;
import forge.Card;
import forge.CardLists;
import forge.Command;
import forge.Singletons;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.control.input.Input;
import forge.game.GameLossReason;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
@@ -122,58 +120,5 @@ class CardFactoryEnchantments {
nightSoil.setAfterPayMana(soilTarget);
card.addSpellAbility(nightSoil);
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Lich")) {
final SpellAbility loseAllLife = new Ability(card, "0") {
@Override
public void resolve() {
final int life = card.getController().getLife();
card.getController().loseLife(life);
}
};
final Command intoPlay = new Command() {
private static final long serialVersionUID = 1337794055075168785L;
@Override
public void execute() {
final StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" - ").append(card.getController());
sb.append(" loses life equal to his or her life total.");
loseAllLife.setStackDescription(sb.toString());
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(loseAllLife);
}
};
final SpellAbility loseGame = new Ability(card, "0") {
@Override
public void resolve() {
card.getController().loseConditionMet(GameLossReason.SpellEffect, card.getName());
}
};
final Command toGrave = new Command() {
private static final long serialVersionUID = 5863295714122376047L;
@Override
public void execute() {
final StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" - ").append(card.getController());
sb.append("loses the game.");
loseGame.setStackDescription(sb.toString());
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(loseGame);
}
};
card.addComesIntoPlayCommand(intoPlay);
card.addDestroyCommand(toGrave);
} // *************** END ************ END **************************
}
}