From aaaed2637465db524102cfbea550b8405d488759 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 20 Apr 2022 21:48:58 -0400 Subject: [PATCH] [NCC] Implemented Bribe Taker --- Mage.Sets/src/mage/cards/b/BribeTaker.java | 116 ++++++++++++++++++ .../src/mage/sets/NewCapennaCommander.java | 1 + 2 files changed, 117 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BribeTaker.java diff --git a/Mage.Sets/src/mage/cards/b/BribeTaker.java b/Mage.Sets/src/mage/cards/b/BribeTaker.java new file mode 100644 index 00000000000..7538ac2afa5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BribeTaker.java @@ -0,0 +1,116 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class BribeTaker extends CardImpl { + + public BribeTaker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}"); + + this.subtype.add(SubType.RHINO); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // When Bribe Taker enters the battlefield, for each kind of counter on permanents you control, you may put your choice of a +1/+1 counter or a counter of that kind on Bribe Taker. + this.addAbility(new EntersBattlefieldTriggeredAbility(new BribeTakerEffect())); + } + + private BribeTaker(final BribeTaker card) { + super(card); + } + + @Override + public BribeTaker copy() { + return new BribeTaker(this); + } +} + +class BribeTakerEffect extends OneShotEffect { + + private static final String plusName = CounterType.P1P1.getName(); + + BribeTakerEffect() { + super(Outcome.Benefit); + staticText = "for each kind of counter on permanents you control, " + + "you may put your choice of a +1/+1 counter or a counter of that kind on {this}"; + } + + private BribeTakerEffect(final BribeTakerEffect effect) { + super(effect); + } + + @Override + public BribeTakerEffect copy() { + return new BribeTakerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (player == null || permanent == null) { + return false; + } + Set counterTypes = game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_CREATURE, + source.getControllerId(), source, game + ).stream() + .map(p -> p.getCounters(game)) + .map(HashMap::keySet) + .flatMap(Collection::stream) + .collect(Collectors.toSet()); + if (counterTypes.contains(plusName)) { + if (player.chooseUse(outcome, "Put a " + plusName + + " counter on " + permanent.getName() + '?', source, game)) { + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); + } + counterTypes.remove(plusName); + } + if (counterTypes.isEmpty()) { + return true; + } + for (String cType : counterTypes) { + if (!player.chooseUse( + outcome, "Put a " + cType + " counter or " + plusName + + " counter on " + permanent.getName() + '?', source, game + )) { + continue; + } + CounterType counterType = player.chooseUse( + outcome, "Choose " + cType + " counter or " + plusName + + " counter", null, cType, plusName, source, game + ) ? CounterType.findByName(cType) : CounterType.P1P1; + permanent.addCounters(counterType.createInstance(), source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index 494d561508e..e485a2dd244 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -59,6 +59,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Body Count", 34, Rarity.RARE, mage.cards.b.BodyCount.class)); cards.add(new SetCardInfo("Boros Charm", 332, Rarity.UNCOMMON, mage.cards.b.BorosCharm.class)); cards.add(new SetCardInfo("Boxing Ring", 91, Rarity.RARE, mage.cards.b.BoxingRing.class)); + cards.add(new SetCardInfo("Bribe Taker", 55, Rarity.RARE, mage.cards.b.BribeTaker.class)); cards.add(new SetCardInfo("Brokers Confluence", 68, Rarity.RARE, mage.cards.b.BrokersConfluence.class)); cards.add(new SetCardInfo("Caldaia Guardian", 56, Rarity.RARE, mage.cards.c.CaldaiaGuardian.class)); cards.add(new SetCardInfo("Call the Coppercoats", 195, Rarity.RARE, mage.cards.c.CallTheCoppercoats.class));