From 163d7b07fa96296a9dd60f464a88c2b5bd048b98 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 18 Jan 2021 08:00:03 -0500 Subject: [PATCH] [KHM] Implemented The Bloodsky Massacre --- .../src/mage/cards/t/TheBloodskyMassacre.java | 122 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../permanent/token/DemonBerserkerToken.java | 32 +++++ 3 files changed, 155 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TheBloodskyMassacre.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/DemonBerserkerToken.java diff --git a/Mage.Sets/src/mage/cards/t/TheBloodskyMassacre.java b/Mage.Sets/src/mage/cards/t/TheBloodskyMassacre.java new file mode 100644 index 00000000000..afda6613adb --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheBloodskyMassacre.java @@ -0,0 +1,122 @@ +package mage.cards.t; + +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.DemonBerserkerToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheBloodskyMassacre extends CardImpl { + + public TheBloodskyMassacre(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{R}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_III); + + // I — Create a 2/3 red Demon Berserker creature token with menace. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new CreateTokenEffect(new DemonBerserkerToken())); + + // II — Whenever a Berserker attacks this turn, you draw a card and you lose 1 life. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new CreateDelayedTriggeredAbilityEffect(new TheBloodskyMassacreAbility())); + + // III — Add {R} for each Berserker you control. Until end of turn, you don't lose this mana as steps or phases end. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new TheBloodskyMassacreEffect()); + + this.addAbility(sagaAbility); + } + + private TheBloodskyMassacre(final TheBloodskyMassacre card) { + super(card); + } + + @Override + public TheBloodskyMassacre copy() { + return new TheBloodskyMassacre(this); + } +} + +class TheBloodskyMassacreAbility extends DelayedTriggeredAbility { + + TheBloodskyMassacreAbility() { + super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false, false); + this.addEffect(new LoseLifeSourceControllerEffect(1)); + } + + private TheBloodskyMassacreAbility(final TheBloodskyMassacreAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent permanent = game.getPermanent(event.getSourceId()); + return permanent != null && permanent.hasSubtype(SubType.BERSERKER, game); + } + + @Override + public TheBloodskyMassacreAbility copy() { + return new TheBloodskyMassacreAbility(this); + } + + @Override + public String getRule() { + return "Whenever a Berserker attacks this turn, you draw a card and you lose 1 life."; + } +} + +class TheBloodskyMassacreEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.BERSERKER); + + TheBloodskyMassacreEffect() { + super(Outcome.Benefit); + staticText = "add {R} for each Berserker you control. Until end of turn, " + + "you don't lose this mana as steps or phases end"; + } + + private TheBloodskyMassacreEffect(final TheBloodskyMassacreEffect effect) { + super(effect); + } + + @Override + public TheBloodskyMassacreEffect copy() { + return new TheBloodskyMassacreEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int berserkers = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); + player.getManaPool().addMana(new Mana(ManaType.RED, berserkers), game, source, true); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 670f5ea94d3..cedc40e5dc6 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -264,6 +264,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Surtland Flinger", 377, Rarity.RARE, mage.cards.s.SurtlandFlinger.class)); cards.add(new SetCardInfo("Swamp", 396, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tergrid's Shadow", 113, Rarity.UNCOMMON, mage.cards.t.TergridsShadow.class)); + cards.add(new SetCardInfo("The Bloodsky Massacre", 207, Rarity.RARE, mage.cards.t.TheBloodskyMassacre.class)); cards.add(new SetCardInfo("The Trickster-God's Heist", 232, Rarity.UNCOMMON, mage.cards.t.TheTricksterGodsHeist.class)); cards.add(new SetCardInfo("The World Tree", 275, Rarity.RARE, mage.cards.t.TheWorldTree.class)); cards.add(new SetCardInfo("Thornmantle Striker", 387, Rarity.UNCOMMON, mage.cards.t.ThornmantleStriker.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/DemonBerserkerToken.java b/Mage/src/main/java/mage/game/permanent/token/DemonBerserkerToken.java new file mode 100644 index 00000000000..12dfc0d7300 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/DemonBerserkerToken.java @@ -0,0 +1,32 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.MenaceAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class DemonBerserkerToken extends TokenImpl { + + public DemonBerserkerToken() { + super("Demon", "2/3 red Demon Berserker creature token with menace"); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.DEMON); + subtype.add(SubType.BERSERKER); + power = new MageInt(2); + toughness = new MageInt(3); + addAbility(new MenaceAbility()); + } + + private DemonBerserkerToken(final DemonBerserkerToken token) { + super(token); + } + + @Override + public DemonBerserkerToken copy() { + return new DemonBerserkerToken(this); + } +}