From d33f233db28b7253cbab10940952294056005fca Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 15 Jul 2021 08:27:26 -0400 Subject: [PATCH] [AFR] Implemented Warlock Class --- Mage.Sets/src/mage/cards/w/WarlockClass.java | 109 ++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + 2 files changed, 110 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WarlockClass.java diff --git a/Mage.Sets/src/mage/cards/w/WarlockClass.java b/Mage.Sets/src/mage/cards/w/WarlockClass.java new file mode 100644 index 00000000000..ae4bda5dc88 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WarlockClass.java @@ -0,0 +1,109 @@ +package mage.cards.w; + +import mage.abilities.Ability; +import mage.abilities.common.BecomesClassLevelTriggeredAbility; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.condition.common.MorbidCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.abilities.hint.common.MorbidHint; +import mage.abilities.keyword.ClassLevelAbility; +import mage.abilities.keyword.ClassReminderAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.MorbidWatcher; +import mage.watchers.common.PlayerLostLifeWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WarlockClass extends CardImpl { + + public WarlockClass(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}"); + + this.subtype.add(SubType.CLASS); + + // (Gain the next level as a sorcery to add its ability.) + this.addAbility(new ClassReminderAbility()); + + // At the beginning of your end step, if a creature died this turn, each opponent loses 1 life. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfEndStepTriggeredAbility( + new LoseLifeOpponentsEffect(2), TargetController.YOU, false + ), MorbidCondition.instance, "At the beginning of your end step, " + + "if a creature died this turn, each opponent loses 1 life." + ).addHint(MorbidHint.instance), new MorbidWatcher()); + + // {1}{B}: Level 2 + this.addAbility(new ClassLevelAbility(2, "{1}{B}")); + + // When this Class becomes level 2, look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard. + this.addAbility(new BecomesClassLevelTriggeredAbility(new LookLibraryAndPickControllerEffect( + StaticValue.get(1), false, StaticValue.get(1), StaticFilters.FILTER_CARD, + Zone.GRAVEYARD, false, false, false, Zone.HAND, false + ), 2)); + + // {6}{B}: Level 3 + this.addAbility(new ClassLevelAbility(3, "{6}{B}")); + + // At the beginning of your end step, each opponent loses life equal to the life they lost this turn. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new WarlockClassEffect(), TargetController.YOU, false + )); + } + + private WarlockClass(final WarlockClass card) { + super(card); + } + + @Override + public WarlockClass copy() { + return new WarlockClass(this); + } +} + +class WarlockClassEffect extends OneShotEffect { + + WarlockClassEffect() { + super(Outcome.Benefit); + staticText = "At the beginning of your end step, each opponent loses life equal to the life they lost this turn."; + } + + private WarlockClassEffect(final WarlockClassEffect effect) { + super(effect); + } + + @Override + public WarlockClassEffect copy() { + return new WarlockClassEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); + if (watcher == null) { + return false; + } + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(playerId); + if (opponent == null) { + continue; + } + int lifeLost = watcher.getLifeLost(playerId); + if (lifeLost > 0) { + opponent.loseLife(lifeLost, game, source, false); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 0a26afa905b..2d2cc4d0e25 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -244,6 +244,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Volo, Guide to Monsters", 238, Rarity.RARE, mage.cards.v.VoloGuideToMonsters.class)); cards.add(new SetCardInfo("Vorpal Sword", 124, Rarity.RARE, mage.cards.v.VorpalSword.class)); cards.add(new SetCardInfo("Wandering Troubadour", 210, Rarity.UNCOMMON, mage.cards.w.WanderingTroubadour.class)); + cards.add(new SetCardInfo("Warlock Class", 125, Rarity.UNCOMMON, mage.cards.w.WarlockClass.class)); cards.add(new SetCardInfo("Werewolf Pack Leader", 211, Rarity.RARE, mage.cards.w.WerewolfPackLeader.class)); cards.add(new SetCardInfo("Westgate Regent", 126, Rarity.RARE, mage.cards.w.WestgateRegent.class)); cards.add(new SetCardInfo("White Dragon", 41, Rarity.UNCOMMON, mage.cards.w.WhiteDragon.class));