From 9055179f775f2cf74cb1895beee58a8c5ff8fd81 Mon Sep 17 00:00:00 2001 From: Grath <1895280+Grath@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:15:34 -0500 Subject: [PATCH] [PIP] Implement Yes Man, Personal Securitron --- .../cards/y/YesManPersonalSecuritron.java | 117 ++++++++++++++++++ Mage.Sets/src/mage/sets/Fallout.java | 1 + .../common/CreateTokenTargetEffect.java | 6 +- 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/y/YesManPersonalSecuritron.java diff --git a/Mage.Sets/src/mage/cards/y/YesManPersonalSecuritron.java b/Mage.Sets/src/mage/cards/y/YesManPersonalSecuritron.java new file mode 100644 index 00000000000..0db344a9708 --- /dev/null +++ b/Mage.Sets/src/mage/cards/y/YesManPersonalSecuritron.java @@ -0,0 +1,117 @@ +package mage.cards.y; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.condition.common.MyTurnCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersSourceCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.TargetPlayerGainControlSourceEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.hint.common.MyTurnHint; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SoldierToken; +import mage.target.common.TargetOpponent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author Grath + */ +public final class YesManPersonalSecuritron extends CardImpl { + + public YesManPersonalSecuritron(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.ROBOT); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {T}: Target opponent gains control of Yes Man, Personal Securitron. When they do, you draw two cards and put a quest counter on Yes Man. Activate only during your turn. + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, + new YesManPersonalSecuritronControlEffect(), new TapSourceCost(), MyTurnCondition.instance); + ability.addTarget(new TargetOpponent()); + ability.addHint(MyTurnHint.instance); + this.addAbility(ability); + + // Wild Card -- When Yes Man leaves the battlefield, its owner creates a tapped 1/1 white Soldier creature token for each quest counter on it. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new YesManPersonalSecuritronLeavesEffect(), false)); + } + + private YesManPersonalSecuritron(final YesManPersonalSecuritron card) { + super(card); + } + + @Override + public YesManPersonalSecuritron copy() { + return new YesManPersonalSecuritron(this); + } +} + +class YesManPersonalSecuritronControlEffect extends TargetPlayerGainControlSourceEffect { + YesManPersonalSecuritronControlEffect() { + super(); + this.staticText = "Target opponent gains control of {this}. When they do, you draw two cards and put a quest counter on Yes Man."; + } + + private YesManPersonalSecuritronControlEffect(final YesManPersonalSecuritronControlEffect effect) { + super(effect); + } + + @Override + public YesManPersonalSecuritronControlEffect copy() { + return new YesManPersonalSecuritronControlEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean controlChanged = super.apply(game, source); + if (!controlChanged) { + return false; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DrawCardSourceControllerEffect(2), false, "When they do, you draw two cards and put a quest counter on Yes Man."); + OneShotEffect counterEffect = new AddCountersTargetEffect(CounterType.QUEST.createInstance()); + counterEffect.setTargetPointer(new FixedTarget(source.getSourceId())); + ability.addEffect(counterEffect); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} + +class YesManPersonalSecuritronLeavesEffect extends CreateTokenTargetEffect { + YesManPersonalSecuritronLeavesEffect() { + super(new SoldierToken(), new CountersSourceCount(CounterType.QUEST), true); + this.staticText = "its owner creates a tapped 1/1 white Soldier creature token for each quest counter on it."; + } + + private YesManPersonalSecuritronLeavesEffect(final YesManPersonalSecuritronLeavesEffect effect) { + super(effect); + } + + @Override + public YesManPersonalSecuritronLeavesEffect copy() { + return new YesManPersonalSecuritronLeavesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent yesman = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (yesman == null) { + return false; + } + this.setTargetPointer(new FixedTarget(yesman.getOwnerId())); + return super.apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Fallout.java b/Mage.Sets/src/mage/sets/Fallout.java index d8c805944a4..e3b4309e94e 100644 --- a/Mage.Sets/src/mage/sets/Fallout.java +++ b/Mage.Sets/src/mage/sets/Fallout.java @@ -430,6 +430,7 @@ public final class Fallout extends ExpansionSet { cards.add(new SetCardInfo("Windbrisk Heights", 315, Rarity.RARE, mage.cards.w.WindbriskHeights.class)); cards.add(new SetCardInfo("Winding Constrictor", 223, Rarity.UNCOMMON, mage.cards.w.WindingConstrictor.class)); cards.add(new SetCardInfo("Woodland Cemetery", 316, Rarity.RARE, mage.cards.w.WoodlandCemetery.class)); + cards.add(new SetCardInfo("Yes Man, Personal Securitron", 29, Rarity.RARE, mage.cards.y.YesManPersonalSecuritron.class)); cards.add(new SetCardInfo("Young Deathclaws", 125, Rarity.UNCOMMON, mage.cards.y.YoungDeathclaws.class)); cards.removeIf(setCardInfo -> IkoriaLairOfBehemoths.mutateNames.contains(setCardInfo.getName())); // remove when mutate is implemented diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index a1d2b36e89a..0238ad8c2b3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -35,7 +35,11 @@ public class CreateTokenTargetEffect extends OneShotEffect { } public CreateTokenTargetEffect(Token token, DynamicValue amount) { - this(token, amount, false, false); + this(token, amount, false); + } + + public CreateTokenTargetEffect(Token token, DynamicValue amount, boolean tapped) { + this(token, amount, tapped, false); } public CreateTokenTargetEffect(Token token, DynamicValue amount, boolean tapped, boolean attacking) {