From ace3a8be86e28d618bec55d568bb821bcf534992 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 7 Jul 2021 17:26:29 -0400 Subject: [PATCH] [AFR] Implemented Minsc, Beloved Ranger --- .../src/mage/cards/m/MinscBelovedRanger.java | 80 +++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + .../effects/common/CreateTokenEffect.java | 1 + .../src/main/java/mage/constants/SubType.java | 1 + .../mage/game/permanent/token/BooToken.java | 34 ++++++++ 5 files changed, 117 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MinscBelovedRanger.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/BooToken.java diff --git a/Mage.Sets/src/mage/cards/m/MinscBelovedRanger.java b/Mage.Sets/src/mage/cards/m/MinscBelovedRanger.java new file mode 100644 index 0000000000..c42a8f9eed --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MinscBelovedRanger.java @@ -0,0 +1,80 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.token.BooToken; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MinscBelovedRanger extends CardImpl { + + public MinscBelovedRanger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.RANGER); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Minsc, Beloved Ranger enters the battlefield, create Boo, a legendary 1/1 red Hamster creature token with trample and haste. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new BooToken()))); + + // {X}: Until end of turn, target creature you control has base power and toughness X/X and becomes a Giant in addition to its other types. Activate only a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + new MinscBelovedRangerEffect(), new ManaCostsImpl<>("{X}") + ); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + private MinscBelovedRanger(final MinscBelovedRanger card) { + super(card); + } + + @Override + public MinscBelovedRanger copy() { + return new MinscBelovedRanger(this); + } +} + +class MinscBelovedRangerEffect extends OneShotEffect { + + MinscBelovedRangerEffect() { + super(Outcome.Benefit); + staticText = "until end of turn, target creature you control has base power " + + "and toughness X/X and becomes a Giant in addition to its other types"; + } + + private MinscBelovedRangerEffect(final MinscBelovedRangerEffect effect) { + super(effect); + } + + @Override + public MinscBelovedRangerEffect copy() { + return new MinscBelovedRangerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = source.getManaCostsToPay().getX(); + game.addEffect(new SetPowerToughnessTargetEffect(xValue, xValue, Duration.EndOfTurn), source); + game.addEffect(new AddCardSubTypeTargetEffect(SubType.GIANT, Duration.EndOfTurn), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 27facebd69..9d49f9c762 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -144,6 +144,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Meteor Swarm", 155, Rarity.RARE, mage.cards.m.MeteorSwarm.class)); cards.add(new SetCardInfo("Mimic", 249, Rarity.COMMON, mage.cards.m.Mimic.class)); cards.add(new SetCardInfo("Minion of the Mighty", 156, Rarity.RARE, mage.cards.m.MinionOfTheMighty.class)); + cards.add(new SetCardInfo("Minsc, Beloved Ranger", 227, Rarity.MYTHIC, mage.cards.m.MinscBelovedRanger.class)); cards.add(new SetCardInfo("Monk of the Open Hand", 25, Rarity.UNCOMMON, mage.cards.m.MonkOfTheOpenHand.class)); cards.add(new SetCardInfo("Moon-Blessed Cleric", 26, Rarity.UNCOMMON, mage.cards.m.MoonBlessedCleric.class)); cards.add(new SetCardInfo("Mordenkainen's Polymorph", 65, Rarity.COMMON, mage.cards.m.MordenkainensPolymorph.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 08fb6d71a4..5eab8fc988 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -114,6 +114,7 @@ public class CreateTokenEffect extends OneShotEffect { private void setText() { if (token.getDescription().contains(", a legendary")) { staticText = "create " + token.getDescription(); + return; } StringBuilder sb = new StringBuilder("create "); if (amount.toString().equals("1")) { diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index dc9b179558..b15e6cbda3 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -173,6 +173,7 @@ public enum SubType { // H HAG("Hag", SubTypeSet.CreatureType), HALFLING("Halfling", SubTypeSet.CreatureType), + HAMSTER("Hamster", SubTypeSet.CreatureType), HARPY("Harpy", SubTypeSet.CreatureType), HELLION("Hellion", SubTypeSet.CreatureType), HIPPO("Hippo", SubTypeSet.CreatureType), diff --git a/Mage/src/main/java/mage/game/permanent/token/BooToken.java b/Mage/src/main/java/mage/game/permanent/token/BooToken.java new file mode 100644 index 0000000000..0868853921 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/BooToken.java @@ -0,0 +1,34 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; + +/** + * @author TheElk801 + */ +public final class BooToken extends TokenImpl { + + public BooToken() { + super("Boo", "Boo, a legendary 1/1 red Hamster creature token with trample and haste"); + supertype.add(SuperType.LEGENDARY); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.HAMSTER); + power = new MageInt(1); + toughness = new MageInt(1); + addAbility(TrampleAbility.getInstance()); + addAbility(HasteAbility.getInstance()); + } + + private BooToken(final BooToken token) { + super(token); + } + + public BooToken copy() { + return new BooToken(this); + } +}