From a926b638e08b546caf62eebbbdecfff33b59a518 Mon Sep 17 00:00:00 2001 From: Austin McGowan Date: Thu, 9 Feb 2023 09:03:54 -0600 Subject: [PATCH] [J22] Implement Angelic Cub (#9853) --- Mage.Sets/src/mage/cards/a/AngelicCub.java | 90 ++++++++++++++++++++++ Mage.Sets/src/mage/sets/Jumpstart2022.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AngelicCub.java diff --git a/Mage.Sets/src/mage/cards/a/AngelicCub.java b/Mage.Sets/src/mage/cards/a/AngelicCub.java new file mode 100644 index 00000000000..460320f9aaa --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AngelicCub.java @@ -0,0 +1,90 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.SourceHasCounterCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.watchers.common.NumberOfTimesPermanentTargetedATurnWatcher; + +import java.util.UUID; + +/** + * @author AustinYQM + */ +public final class AngelicCub extends CardImpl { + + public AngelicCub(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.CAT); + this.subtype.add(SubType.ANGEL); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Angelic Cub becomes the target of a spell or ability for the first time each turn, put a +1/+1 counter on it. + this.addAbility(new AngelicCubAbility(), new NumberOfTimesPermanentTargetedATurnWatcher()); + // As long as Angelic Cub has three or more +1/+1 counters on it, it has flying. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), new SourceHasCounterCondition(CounterType.P1P1, 3), "As long as {this} has three or more +1/+1 counters on it, it has flying."))); + } + + private AngelicCub(final AngelicCub card) { + super(card); + } + + @Override + public AngelicCub copy() { + return new AngelicCub(this); + } +} + +class AngelicCubAbility extends TriggeredAbilityImpl { + + public AngelicCubAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false); + } + + public AngelicCubAbility(final mage.cards.a.AngelicCubAbility ability) { + super(ability); + } + + @Override + public mage.cards.a.AngelicCubAbility copy() { + return new mage.cards.a.AngelicCubAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TARGETED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getTargetId().equals(this.getSourceId())) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.isCreature(game)) { + NumberOfTimesPermanentTargetedATurnWatcher watcher = game.getState().getWatcher(NumberOfTimesPermanentTargetedATurnWatcher.class); + return watcher != null && watcher.notMoreThanOnceTargetedThisTurn(permanent, game); + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} becomes the target of a spell or ability for the first time each turn, put a +1/+1 counter on it."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Jumpstart2022.java b/Mage.Sets/src/mage/sets/Jumpstart2022.java index 789147075e3..5f8b41fb532 100644 --- a/Mage.Sets/src/mage/sets/Jumpstart2022.java +++ b/Mage.Sets/src/mage/sets/Jumpstart2022.java @@ -40,6 +40,7 @@ public final class Jumpstart2022 extends ExpansionSet { cards.add(new SetCardInfo("Ancient Craving", 376, Rarity.UNCOMMON, mage.cards.a.AncientCraving.class)); cards.add(new SetCardInfo("Ancient Stirrings", 628, Rarity.COMMON, mage.cards.a.AncientStirrings.class)); cards.add(new SetCardInfo("Angel of Flight Alabaster", 144, Rarity.RARE, mage.cards.a.AngelOfFlightAlabaster.class)); + cards.add(new SetCardInfo("Angelic Cub", 2, Rarity.UNCOMMON, mage.cards.a.AngelicCub.class)); cards.add(new SetCardInfo("Angelic Edict", 145, Rarity.COMMON, mage.cards.a.AngelicEdict.class)); cards.add(new SetCardInfo("Angelic Page", 146, Rarity.COMMON, mage.cards.a.AngelicPage.class)); cards.add(new SetCardInfo("Angelic Protector", 147, Rarity.UNCOMMON, mage.cards.a.AngelicProtector.class));