From 4995dc29584cdf08c6ec525ebccac2fa8d84cac4 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Fri, 15 Apr 2022 10:14:43 -0500 Subject: [PATCH] [SNC] Implemented Reservoir Kraken --- .../src/mage/cards/r/ReservoirKraken.java | 111 ++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/ReservoirKraken.java diff --git a/Mage.Sets/src/mage/cards/r/ReservoirKraken.java b/Mage.Sets/src/mage/cards/r/ReservoirKraken.java new file mode 100644 index 00000000000..f5d64e50531 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ReservoirKraken.java @@ -0,0 +1,111 @@ +package mage.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.condition.common.SourceTappedCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.FishToken; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author weirddan455 + */ +public final class ReservoirKraken extends CardImpl { + + public ReservoirKraken(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + + this.subtype.add(SubType.KRAKEN); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Ward {2} + this.addAbility(new WardAbility(new ManaCostsImpl<>("{2}"))); + + // At the beginning of each combat, if Reservoir Kraken is untapped, any opponent may tap an untapped creature they control. If they do, tap Reservoir Kraken and create a 1/1 blue Fish creature token with "This creature can't be blocked." + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfCombatTriggeredAbility(new ReservoirKrakenEffect(), TargetController.ANY, false), + SourceTappedCondition.UNTAPPED, + "At the beginning of each combat, if {this} is untapped, any opponent may tap an untapped creature they control. If they do, tap {this} and create a 1/1 blue Fish creature token with \"This creature can't be blocked.\"" + )); + } + + private ReservoirKraken(final ReservoirKraken card) { + super(card); + } + + @Override + public ReservoirKraken copy() { + return new ReservoirKraken(this); + } +} + +class ReservoirKrakenEffect extends OneShotEffect { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); + + static { + filter.add(TappedPredicate.UNTAPPED); + } + + public ReservoirKrakenEffect() { + super(Outcome.Tap); + this.staticText = "any opponent may tap an untapped creature they control. If they do, tap {this} and create a 1/1 blue Fish creature token with \"This creature can't be blocked.\""; + } + + private ReservoirKrakenEffect(final ReservoirKrakenEffect effect) { + super(effect); + } + + @Override + public ReservoirKrakenEffect copy() { + return new ReservoirKrakenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean opponentTapped = false; + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, true); + if (target.canChoose(opponentId, source, game) && opponent.chooseUse(Outcome.AIDontUseIt, "Tap an untapped creature you control?", source, game)) { + opponent.chooseTarget(Outcome.Tap, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null && permanent.tap(source, game)) { + opponentTapped = true; + } + } + } + } + if (opponentTapped) { + Permanent kraken = source.getSourcePermanentIfItStillExists(game); + if (kraken != null) { + kraken.tap(source, game); + } + new FishToken().putOntoBattlefield(1, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index a7afa910dd3..5a1b160c269 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -152,6 +152,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Raffine's Tower", 254, Rarity.RARE, mage.cards.r.RaffinesTower.class)); cards.add(new SetCardInfo("Raffine, Scheming Seer", 213, Rarity.MYTHIC, mage.cards.r.RaffineSchemingSeer.class)); cards.add(new SetCardInfo("Refuse to Yield", 27, Rarity.UNCOMMON, mage.cards.r.RefuseToYield.class)); + cards.add(new SetCardInfo("Reservoir Kraken", 56, Rarity.RARE, mage.cards.r.ReservoirKraken.class)); cards.add(new SetCardInfo("Revel Ruiner", 91, Rarity.COMMON, mage.cards.r.RevelRuiner.class)); cards.add(new SetCardInfo("Riveteers Charm", 217, Rarity.UNCOMMON, mage.cards.r.RiveteersCharm.class)); cards.add(new SetCardInfo("Riveteers Initiate", 120, Rarity.COMMON, mage.cards.r.RiveteersInitiate.class));