From 8eb5e5d59059f412caf202913ac94114995d21ad Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 14 Apr 2022 19:42:04 -0400 Subject: [PATCH] [SNC] Implemented Freelance Muscle --- .../src/mage/cards/f/FreelanceMuscle.java | 89 +++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FreelanceMuscle.java diff --git a/Mage.Sets/src/mage/cards/f/FreelanceMuscle.java b/Mage.Sets/src/mage/cards/f/FreelanceMuscle.java new file mode 100644 index 0000000000..3873f10494 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FreelanceMuscle.java @@ -0,0 +1,89 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksOrBlocksTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FreelanceMuscle extends CardImpl { + + private static final Hint hint = new ValueHint( + "Greatest power and/or toughness among other creatures you control", FreelanceMuscleValue.instance + ); + + public FreelanceMuscle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); + + this.subtype.add(SubType.RHINO); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever Freelance Muscle attacks or blocks, it gets +X/+X until end of turn, where X is the greatest power and/or toughness among other creatures you control. + this.addAbility(new AttacksOrBlocksTriggeredAbility(new BoostSourceEffect( + FreelanceMuscleValue.instance, FreelanceMuscleValue.instance, + Duration.EndOfTurn, true, "it" + ), false).addHint(hint)); + } + + private FreelanceMuscle(final FreelanceMuscle card) { + super(card); + } + + @Override + public FreelanceMuscle copy() { + return new FreelanceMuscle(this); + } +} + +enum FreelanceMuscleValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, + sourceAbility.getControllerId(), sourceAbility, game + ) + .stream() + .mapToInt(permanent -> Math.max( + permanent.getPower().getValue(), + permanent.getToughness().getValue() + )) + .max() + .orElse(0); + } + + @Override + public FreelanceMuscleValue copy() { + return this; + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "the greatest power and/or toughness among other creatures you control"; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 481c756c17..21cafc3851 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -79,6 +79,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Fleetfoot Dancer", 188, Rarity.RARE, mage.cards.f.FleetfootDancer.class)); cards.add(new SetCardInfo("Forest", 270, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forge Boss", 189, Rarity.UNCOMMON, mage.cards.f.ForgeBoss.class)); + cards.add(new SetCardInfo("Freelance Muscle", 147, Rarity.UNCOMMON, mage.cards.f.FreelanceMuscle.class)); cards.add(new SetCardInfo("Gala Greeters", 148, Rarity.RARE, mage.cards.g.GalaGreeters.class)); cards.add(new SetCardInfo("Getaway Car", 237, Rarity.RARE, mage.cards.g.GetawayCar.class)); cards.add(new SetCardInfo("Graveyard Shift", 81, Rarity.UNCOMMON, mage.cards.g.GraveyardShift.class));