From 18fe2edc8a7a4c577df67ca04578126b99d80d7c Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Tue, 14 Feb 2023 03:08:03 +0000 Subject: [PATCH] [ONC] Implement Phyresis Outbreak --- .../src/mage/cards/p/PhyresisOutbreak.java | 76 +++++++++++++++++++ .../sets/PhyrexiaAllWillBeOneCommander.java | 2 + 2 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PhyresisOutbreak.java diff --git a/Mage.Sets/src/mage/cards/p/PhyresisOutbreak.java b/Mage.Sets/src/mage/cards/p/PhyresisOutbreak.java new file mode 100644 index 0000000000..374c3c5d2a --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PhyresisOutbreak.java @@ -0,0 +1,76 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.counter.AddCountersPlayersEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class PhyresisOutbreak extends CardImpl { + + public PhyresisOutbreak(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}"); + + // Each opponent gets a poison counter. Then each creature your opponents control + // gets -1/-1 until end of turn for each poison counter its controller has. + this.getSpellAbility().addEffect(new AddCountersPlayersEffect( + CounterType.POISON.createInstance(), TargetController.OPPONENT + )); + this.getSpellAbility().addEffect(new PhyresisOutbreakEffect().concatBy("Then")); + } + + private PhyresisOutbreak(final PhyresisOutbreak card) { + super(card); + } + + @Override + public PhyresisOutbreak copy() { + return new PhyresisOutbreak(this); + } +} + +class PhyresisOutbreakEffect extends OneShotEffect { + + PhyresisOutbreakEffect() { + super(Outcome.UnboostCreature); + staticText = "each creature your opponents control gets -1/-1 until " + + "end of turn for each poison counter its controller has"; + } + + private PhyresisOutbreakEffect(final PhyresisOutbreakEffect effect) { + super(effect); + } + + @Override + public PhyresisOutbreakEffect copy() { + return new PhyresisOutbreakEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID opponentId : game.getOpponents(source.getControllerId(), true)) { + int totalPoison = game.getPlayer(opponentId).getCounters().getCount(CounterType.POISON); + BoostTargetEffect effect = new BoostTargetEffect(totalPoison * -1, totalPoison * -1, Duration.EndOfTurn); + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_A_CREATURE, opponentId, game)) { + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java index a91f8ea5a2..2d5e07f9b4 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java @@ -122,6 +122,8 @@ public final class PhyrexiaAllWillBeOneCommander extends ExpansionSet { cards.add(new SetCardInfo("Path of Ancestry", 161, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); cards.add(new SetCardInfo("Path to Exile", 84, Rarity.UNCOMMON, mage.cards.p.PathToExile.class)); cards.add(new SetCardInfo("Phantom General", 85, Rarity.UNCOMMON, mage.cards.p.PhantomGeneral.class)); + cards.add(new SetCardInfo("Phyresis Outbreak", 12, Rarity.RARE, mage.cards.p.PhyresisOutbreak.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Phyresis Outbreak", 50, Rarity.RARE, mage.cards.p.PhyresisOutbreak.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Phyrexian Rebirth", 86, Rarity.RARE, mage.cards.p.PhyrexianRebirth.class)); cards.add(new SetCardInfo("Phyrexian Swarmlord", 111, Rarity.RARE, mage.cards.p.PhyrexianSwarmlord.class)); cards.add(new SetCardInfo("Plague Myr", 139, Rarity.UNCOMMON, mage.cards.p.PlagueMyr.class));