From 195c65d6b8cdda2b5db4644c1ff62a8cafe91799 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 11 Apr 2022 21:35:43 -0400 Subject: [PATCH] [SNC] Implemented Pyre-Sledge Arsonist --- .../src/mage/cards/p/PyreSledgeArsonist.java | 116 ++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 117 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PyreSledgeArsonist.java diff --git a/Mage.Sets/src/mage/cards/p/PyreSledgeArsonist.java b/Mage.Sets/src/mage/cards/p/PyreSledgeArsonist.java new file mode 100644 index 0000000000..0a5b2cb617 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PyreSledgeArsonist.java @@ -0,0 +1,116 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetAnyTarget; +import mage.util.CardUtil; +import mage.watchers.Watcher; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PyreSledgeArsonist extends CardImpl { + + private static final Hint hint = new ValueHint( + "Permanents you've sacrificed this turn", PyreSledgeArsonistValue.instance + ); + + public PyreSledgeArsonist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.VIASHINO); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {1}, {T}: Pyre-Sledge Arsonist deals X damage to any target, where X is the number of permanents you sacrificed this turn. + Ability ability = new SimpleActivatedAbility( + new DamageTargetEffect(PyreSledgeArsonistValue.instance), new GenericManaCost(1) + ); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetAnyTarget()); + this.addAbility(ability.addHint(hint)); + } + + private PyreSledgeArsonist(final PyreSledgeArsonist card) { + super(card); + } + + @Override + public PyreSledgeArsonist copy() { + return new PyreSledgeArsonist(this); + } +} + +enum PyreSledgeArsonistValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return PyreSledgeArsonistWatcher.getAmount(sourceAbility.getControllerId(), game); + } + + @Override + public PyreSledgeArsonistValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the number of permanents you sacrificed this turn"; + } + + @Override + public String toString() { + return "X"; + } +} + +class PyreSledgeArsonistWatcher extends Watcher { + + private final Map playerMap = new HashMap<>(); + + PyreSledgeArsonistWatcher() { + super(WatcherScope.GAME); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT) { + playerMap.compute(event.getPlayerId(), CardUtil::setOrIncrementValue); + } + } + + @Override + public void reset() { + super.reset(); + playerMap.clear(); + } + + static int getAmount(UUID playerId, Game game) { + return game + .getState() + .getWatcher(PyreSledgeArsonistWatcher.class) + .playerMap + .getOrDefault(playerId, 0); + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 95046bd74d..3f59c79b85 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -83,6 +83,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Professional Face-Breaker", 116, Rarity.RARE, mage.cards.p.ProfessionalFaceBreaker.class)); cards.add(new SetCardInfo("Psychic Pickpocket", 54, Rarity.UNCOMMON, mage.cards.p.PsychicPickpocket.class)); + cards.add(new SetCardInfo("Pyre-Sledge Arsonist", 118, Rarity.UNCOMMON, mage.cards.p.PyreSledgeArsonist.class)); cards.add(new SetCardInfo("Queza, Augur of Agonies", 212, Rarity.UNCOMMON, mage.cards.q.QuezaAugurOfAgonies.class)); cards.add(new SetCardInfo("Racers' Ring", 253, Rarity.COMMON, mage.cards.r.RacersRing.class)); cards.add(new SetCardInfo("Raffine's Informant", 26, Rarity.COMMON, mage.cards.r.RaffinesInformant.class));