diff --git a/Mage.Sets/src/mage/cards/k/KaitoBaneOfNightmares.java b/Mage.Sets/src/mage/cards/k/KaitoBaneOfNightmares.java index f947283d7f0..f7d515aa699 100644 --- a/Mage.Sets/src/mage/cards/k/KaitoBaneOfNightmares.java +++ b/Mage.Sets/src/mage/cards/k/KaitoBaneOfNightmares.java @@ -19,7 +19,10 @@ import mage.abilities.keyword.HexproofAbility; import mage.abilities.keyword.NinjutsuAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.counters.CounterType; import mage.game.Game; import mage.game.command.emblems.KaitoBaneOfNightmaresEmblem; @@ -31,7 +34,6 @@ import mage.watchers.common.PlayerLostLifeWatcher; import java.util.UUID; /** - * * @author jackd149 */ public final class KaitoBaneOfNightmares extends CardImpl { @@ -62,7 +64,7 @@ public final class KaitoBaneOfNightmares extends CardImpl { // 0: Surveil 2. Then draw a card for each opponent who lost life this turn. Ability ability = new LoyaltyAbility(new SurveilEffect(2), 0); ability.addEffect(new DrawCardSourceControllerEffect(KaitoBaneOfNightmaresCount.instance)); - this.addAbility(ability, new PlayerLostLifeWatcher()); + this.addAbility(ability); // -2: Tap target creature. Put two stun counters on it. Ability minusTwoAbility = new LoyaltyAbility(new TapTargetEffect(), -2); @@ -87,10 +89,10 @@ enum KaitoBaneOfNightmaresCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - if (!MyTurnCondition.instance.apply(game, source)){ + if (!MyTurnCondition.instance.apply(game, source)) { return false; } - + Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { diff --git a/Mage.Sets/src/mage/cards/p/PapalymoTotolymo.java b/Mage.Sets/src/mage/cards/p/PapalymoTotolymo.java new file mode 100644 index 00000000000..c707d7a82cc --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PapalymoTotolymo.java @@ -0,0 +1,120 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.CanBeSacrificedPredicate; +import mage.filter.predicate.permanent.GreatestPowerControlledPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.watchers.common.PlayerLostLifeWatcher; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PapalymoTotolymo extends CardImpl { + + public PapalymoTotolymo(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.DWARF); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Whenever you cast a noncreature spell, Papalymo Totolymo deals 1 damage to each opponent and you gain 1 life. + Ability ability = new SpellCastControllerTriggeredAbility( + new DamagePlayersEffect(1, TargetController.OPPONENT), + StaticFilters.FILTER_SPELL_A_NON_CREATURE, false + ); + ability.addEffect(new GainLifeEffect(1).concatBy("and")); + this.addAbility(ability); + + // {4}, {T}, Sacrifice Papalymo Totolymo: Each opponent who lost life this turn sacrifices a creature with the greatest power among creatures they control. + ability = new SimpleActivatedAbility(new PapalymoTotolymoEffect(), new GenericManaCost(4)); + ability.addCost(new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + private PapalymoTotolymo(final PapalymoTotolymo card) { + super(card); + } + + @Override + public PapalymoTotolymo copy() { + return new PapalymoTotolymo(this); + } +} + +class PapalymoTotolymoEffect extends OneShotEffect { + + private static final FilterPermanent filter + = new FilterControlledCreaturePermanent("a creature you control with the greatest power"); + + static { + filter.add(GreatestPowerControlledPredicate.instance); + filter.add(CanBeSacrificedPredicate.instance); + } + + PapalymoTotolymoEffect() { + super(Outcome.Benefit); + staticText = "each opponent who lost life this turn sacrifices a creature " + + "with the greatest power among creatures they control"; + } + + private PapalymoTotolymoEffect(final PapalymoTotolymoEffect effect) { + super(effect); + } + + @Override + public PapalymoTotolymoEffect copy() { + return new PapalymoTotolymoEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List permanents = new ArrayList<>(); + PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + if (watcher.getLifeLost(opponentId) < 1) { + continue; + } + Player opponent = game.getPlayer(opponentId); + if (opponent == null || !game.getBattlefield().contains(filter, opponentId, source, game, 1)) { + continue; + } + TargetPermanent target = new TargetPermanent(filter); + target.withNotTarget(true); + target.withChooseHint("to sacrifice"); + opponent.choose(outcome, target, source, game); + permanents.add(game.getPermanent(target.getFirstTarget())); + } + permanents.removeIf(Objects::isNull); + for (Permanent permanent : permanents) { + permanent.sacrifice(source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index bc64161d818..bf225cb5c2e 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -232,6 +232,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Observed Stasis", 40, Rarity.RARE, mage.cards.o.ObservedStasis.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Overflowing Basin", 410, Rarity.RARE, mage.cards.o.OverflowingBasin.class)); cards.add(new SetCardInfo("Palace Jailer", 247, Rarity.UNCOMMON, mage.cards.p.PalaceJailer.class)); + cards.add(new SetCardInfo("Papalymo Totolymo", 180, Rarity.RARE, mage.cards.p.PapalymoTotolymo.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Papalymo Totolymo", 90, Rarity.RARE, mage.cards.p.PapalymoTotolymo.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Path of Ancestry", 411, Rarity.COMMON, mage.cards.p.PathOfAncestry.class)); cards.add(new SetCardInfo("Path of Discovery", 312, Rarity.RARE, mage.cards.p.PathOfDiscovery.class)); cards.add(new SetCardInfo("Path to Exile", 248, Rarity.UNCOMMON, mage.cards.p.PathToExile.class));