From ed3305cf5933662b57501a6073c6d575dbbbfe49 Mon Sep 17 00:00:00 2001 From: Muz Date: Sat, 10 Jan 2026 16:14:14 -0600 Subject: [PATCH] [ECL] Implement Selfless Safewright (#14227) * Update gen-card.pl to take all command line args as a space-seperated card name to remove need for quoting or escaping * [ECL] Implement Selfless Safewright --- .../src/mage/cards/s/SelflessSafewright.java | 115 ++++++++++++++++++ Mage.Sets/src/mage/sets/LorwynEclipsed.java | 4 + Utils/gen-card.pl | 2 +- 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/s/SelflessSafewright.java diff --git a/Mage.Sets/src/mage/cards/s/SelflessSafewright.java b/Mage.Sets/src/mage/cards/s/SelflessSafewright.java new file mode 100644 index 00000000000..24f651fe182 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SelflessSafewright.java @@ -0,0 +1,115 @@ +package mage.cards.s; + +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import mage.MageInt; +import mage.MageObject; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTargets; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.ConvokeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.Choice; +import mage.choices.ChoiceCreatureType; +import mage.constants.CardType; +import mage.constants.Outcome; + +/** + * + * @author muz + */ +public final class SelflessSafewright extends CardImpl { + + public SelflessSafewright(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); + + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Convoke + this.addAbility(new ConvokeAbility()); + + // When this creature enters, choose a creature type. Other permanents you control of that type gain hexproof and indestructible until end of turn. + this.addAbility(new AsEntersBattlefieldAbility(new SelflessSafewrightEffect())); + } + + private SelflessSafewright(final SelflessSafewright card) { + super(card); + } + + @Override + public SelflessSafewright copy() { + return new SelflessSafewright(this); + } +} + +class SelflessSafewrightEffect extends OneShotEffect { + + SelflessSafewrightEffect() { + super(Outcome.Benefit); + staticText = "choose a creature type. Other permanents you control of that type gain hexproof and indestructible until end of turn"; + } + + private SelflessSafewrightEffect(final SelflessSafewrightEffect effect) { + super(effect); + } + + @Override + public SelflessSafewrightEffect copy() { + return new SelflessSafewrightEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Choice choice = new ChoiceCreatureType(game, source); + controller.choose(outcome, choice, game); + SubType subType = SubType.byDescription(choice.getChoiceKey()); + if (subType == null) { + return false; + } + game.informPlayers(controller.getLogName() + " chooses " + subType); + List permanents = game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_OTHER_CONTROLLED_PERMANENTS, + source.getControllerId(), source, game + ).stream() + .filter(permanent -> permanent.hasSubtype(subType, game)) + .collect(Collectors.toList()); + if (permanents.isEmpty()) { + return false; + } + + game.addEffect(new GainAbilityTargetEffect( + HexproofAbility.getInstance() + ).setTargetPointer(new FixedTargets(permanents, game)), source); + + game.addEffect(new GainAbilityTargetEffect( + IndestructibleAbility.getInstance() + ).setTargetPointer(new FixedTargets(permanents, game)), source); + + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsed.java b/Mage.Sets/src/mage/sets/LorwynEclipsed.java index 385a00b2dd6..21d124427a9 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsed.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsed.java @@ -270,6 +270,10 @@ public final class LorwynEclipsed extends ExpansionSet { cards.add(new SetCardInfo("Scuzzback Scrounger", 320, Rarity.RARE, mage.cards.s.ScuzzbackScrounger.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sear", 154, Rarity.UNCOMMON, mage.cards.s.Sear.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sear", 405, Rarity.UNCOMMON, mage.cards.s.Sear.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Selfless Safewright", 193, Rarity.RARE, mage.cards.s.SelflessSafewright.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Selfless Safewright", 367, Rarity.RARE, mage.cards.s.SelflessSafewright.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Selfless Safewright", 391, Rarity.MYTHIC, mage.cards.s.SelflessSafewright.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Selfless Safewright", 401, Rarity.MYTHIC, mage.cards.s.SelflessSafewright.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Shimmercreep", 120, Rarity.UNCOMMON, mage.cards.s.Shimmercreep.class)); cards.add(new SetCardInfo("Shinestriker", 68, Rarity.UNCOMMON, mage.cards.s.Shinestriker.class)); cards.add(new SetCardInfo("Shore Lurker", 34, Rarity.COMMON, mage.cards.s.ShoreLurker.class)); diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index 7dfe18852cc..4d5a504dcf6 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -90,7 +90,7 @@ $raritiesConversion{'Special'} = 'SPECIAL'; $raritiesConversion{'Bonus'} = 'BONUS'; # Get card name -my $cardName = $ARGV[0]; +my $cardName = join ' ', @ARGV; if (!$cardName) { print 'Enter a card name: '; $cardName = ;