mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Convert Lich to Script
This commit is contained in:
@@ -1,11 +1,21 @@
|
|||||||
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\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.
|
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.
|
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:Draw:AB$Draw | Cost$ 0 | Defined$ You | NumCards$ X | References$ X
|
||||||
SVar:X:ReplaceCount$LifeGained
|
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: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
|
||||||
|
|||||||
@@ -769,32 +769,6 @@ public final class GameActionUtil {
|
|||||||
return;
|
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);
|
c.getDamageHistory().registerDamage(player);
|
||||||
|
|
||||||
// Play the Life Loss sound
|
// Play the Life Loss sound
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import com.google.common.collect.Iterables;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
|
|
||||||
import forge.CardLists;
|
import forge.CardLists;
|
||||||
import forge.Command;
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.spellability.Ability;
|
import forge.card.spellability.Ability;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.game.GameLossReason;
|
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
@@ -122,58 +120,5 @@ class CardFactoryEnchantments {
|
|||||||
nightSoil.setAfterPayMana(soilTarget);
|
nightSoil.setAfterPayMana(soilTarget);
|
||||||
card.addSpellAbility(nightSoil);
|
card.addSpellAbility(nightSoil);
|
||||||
} // *************** END ************ END **************************
|
} // *************** 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 **************************
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user