From 8556ee24c97d0698c2d5d81a1b5108f5258b1f70 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 19 May 2022 18:24:51 -0400 Subject: [PATCH] [CLB] Implemented Astarion, the Decadent --- .../src/mage/cards/a/AstarionTheDecadent.java | 120 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 121 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AstarionTheDecadent.java diff --git a/Mage.Sets/src/mage/cards/a/AstarionTheDecadent.java b/Mage.Sets/src/mage/cards/a/AstarionTheDecadent.java new file mode 100644 index 00000000000..268931f5204 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AstarionTheDecadent.java @@ -0,0 +1,120 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ControllerGotLifeCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.target.common.TargetOpponent; +import mage.watchers.common.PlayerGainedLifeWatcher; +import mage.watchers.common.PlayerLostLifeWatcher; + +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class AstarionTheDecadent extends CardImpl { + + public AstarionTheDecadent(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.VAMPIRE); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // At the beginning of your end step, choose one — + // • Feed — Target opponent loses life equal to the amount of life they lost this turn. + Ability ability = new BeginningOfEndStepTriggeredAbility( + new LoseLifeTargetEffect(AstarionTheDecadentValue.instance), TargetController.YOU, false + ); + ability.addTarget(new TargetOpponent()); + ability.withFirstModeFlavorWord("Feed"); + ability.addHint(ControllerGotLifeCount.getHint()); + + // • Friends — You gain life equal to the amount of life you gained this turn. + ability.addMode(new Mode(new GainLifeEffect(ControllerGotLifeCount.instance)).withFlavorWord("Friends")); + this.addAbility(ability.addHint(AstarionTheDecadentHint.instance), new PlayerGainedLifeWatcher()); + } + + private AstarionTheDecadent(final AstarionTheDecadent card) { + super(card); + } + + @Override + public AstarionTheDecadent copy() { + return new AstarionTheDecadent(this); + } +} + +enum AstarionTheDecadentValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game.getState() + .getWatcher(PlayerLostLifeWatcher.class) + .getLifeLost(effect.getTargetPointer().getFirst(game, sourceAbility)); + } + + @Override + public AstarionTheDecadentValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the amount of life they lost this turn"; + } + + @Override + public String toString() { + return "1"; + } +} + +enum AstarionTheDecadentHint implements Hint { + instance; + + @Override + public String getText(Game game, Ability ability) { + PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); + return "Life lost for each player: " + game + .getOpponents(ability.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(player -> player.getName() + " (" + watcher.getLifeLost(player.getId()) + ')') + .collect(Collectors.joining(", ")); + } + + @Override + public AstarionTheDecadentHint copy() { + return this; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 665d57c25c6..31a1633a01e 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -24,6 +24,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Aarakocra Sneak", 54, Rarity.COMMON, mage.cards.a.AarakocraSneak.class)); cards.add(new SetCardInfo("Ancient Brass Dragon", 111, Rarity.MYTHIC, mage.cards.a.AncientBrassDragon.class)); cards.add(new SetCardInfo("Arcane Signet", 298, Rarity.UNCOMMON, mage.cards.a.ArcaneSignet.class)); + cards.add(new SetCardInfo("Astarion, the Decadent", 265, Rarity.RARE, mage.cards.a.AstarionTheDecadent.class)); cards.add(new SetCardInfo("Astral Confrontation", 6, Rarity.COMMON, mage.cards.a.AstralConfrontation.class)); cards.add(new SetCardInfo("Baba Lysaga, Night Witch", 266, Rarity.RARE, mage.cards.b.BabaLysagaNightWitch.class)); cards.add(new SetCardInfo("Baldur's Gate", 345, Rarity.RARE, mage.cards.b.BaldursGate.class));