From a9662ce63f414bd1d27df5e84210421f0813221f Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:45:54 +0200 Subject: [PATCH] implement [MH3] Kozilek, the Broken Reality --- .../mage/cards/k/KozilekTheBrokenReality.java | 115 ++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons3.java | 1 + 2 files changed, 116 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KozilekTheBrokenReality.java diff --git a/Mage.Sets/src/mage/cards/k/KozilekTheBrokenReality.java b/Mage.Sets/src/mage/cards/k/KozilekTheBrokenReality.java new file mode 100644 index 00000000000..aacfabe3a04 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KozilekTheBrokenReality.java @@ -0,0 +1,115 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.keyword.ManifestEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorlessPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class KozilekTheBrokenReality extends CardImpl { + + private static final FilterCreaturePermanent filter = + new FilterCreaturePermanent("colorless creatures"); + + static { + filter.add(ColorlessPredicate.instance); + } + + public KozilekTheBrokenReality(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{9}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.ELDRAZI); + this.power = new MageInt(9); + this.toughness = new MageInt(9); + + // When you cast this spell, up to two target players each manifest two cards from their hands. For each card manifested this way, you draw a card. + Ability ability = new CastSourceTriggeredAbility(new KozilekTheBrokenRealityEffect()); + ability.addTarget(new TargetPlayer(0, 2, false)); + this.addAbility(ability); + + // Other colorless creatures you control get +3/+2. + this.addAbility(new SimpleStaticAbility( + new BoostControlledEffect(3, 2, Duration.WhileOnBattlefield, filter, true) + )); + } + + private KozilekTheBrokenReality(final KozilekTheBrokenReality card) { + super(card); + } + + @Override + public KozilekTheBrokenReality copy() { + return new KozilekTheBrokenReality(this); + } +} + +class KozilekTheBrokenRealityEffect extends OneShotEffect { + + KozilekTheBrokenRealityEffect() { + super(Outcome.Neutral); + staticText = "up to two target players each manifest two cards from their hands. For each card manifested this way, you draw a card"; + } + + private KozilekTheBrokenRealityEffect(final KozilekTheBrokenRealityEffect effect) { + super(effect); + } + + @Override + public KozilekTheBrokenRealityEffect copy() { + return new KozilekTheBrokenRealityEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + + boolean result = false; + int toDraw = 0; + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + if (!getTargetPointer().getTargets(game, source).contains(playerId)) { + continue; + } + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + int amount = Math.min(2, player.getHand().size()); + if (amount <= 0) { + continue; + } + TargetCardInHand target = new TargetCardInHand(amount, StaticFilters.FILTER_CARD).withChooseHint("to manifest"); + target.choose(Outcome.Discard, playerId, source.getId(), source, game); + Cards toManifest = new CardsImpl(target.getTargets()); + toDraw += ManifestEffect.doManifestCards(game, source, player, toManifest.getCards(game)).size(); + result = true; + } + if (toDraw > 0) { + controller.drawCards(toDraw, source, game); + } + return result; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index 3d5f04f5dc0..1155d9689d9 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -163,6 +163,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Kappa Cannoneer", 270, Rarity.RARE, mage.cards.k.KappaCannoneer.class)); cards.add(new SetCardInfo("Kozilek's Command", 11, Rarity.RARE, mage.cards.k.KozileksCommand.class)); cards.add(new SetCardInfo("Kozilek's Unsealing", 65, Rarity.UNCOMMON, mage.cards.k.KozileksUnsealing.class)); + cards.add(new SetCardInfo("Kozilek, the Broken Reality", 10, Rarity.MYTHIC, mage.cards.k.KozilekTheBrokenReality.class)); cards.add(new SetCardInfo("Kudo, King Among Bears", 192, Rarity.RARE, mage.cards.k.KudoKingAmongBears.class)); cards.add(new SetCardInfo("Laelia, the Blade Reforged", 281, Rarity.RARE, mage.cards.l.LaeliaTheBladeReforged.class)); cards.add(new SetCardInfo("Legion Leadership", 255, Rarity.UNCOMMON, mage.cards.l.LegionLeadership.class));