diff --git a/Mage.Sets/src/mage/cards/l/LightOfPromise.java b/Mage.Sets/src/mage/cards/l/LightOfPromise.java new file mode 100644 index 00000000000..622f7ee7ea1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LightOfPromise.java @@ -0,0 +1,84 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.common.GainLifeControllerTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LightOfPromise extends CardImpl { + + public LightOfPromise(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature has "Whenever you gain life, put that many +1/+1 counters on this creature." + this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect( + new GainLifeControllerTriggeredAbility( + new LightOfPromiseEffect(), false, true + ), AttachmentType.AURA + ))); + } + + private LightOfPromise(final LightOfPromise card) { + super(card); + } + + @Override + public LightOfPromise copy() { + return new LightOfPromise(this); + } +} + +class LightOfPromiseEffect extends OneShotEffect { + + LightOfPromiseEffect() { + super(Outcome.Benefit); + staticText = "put that many +1/+1 counters on this creature"; + } + + private LightOfPromiseEffect(final LightOfPromiseEffect effect) { + super(effect); + } + + @Override + public LightOfPromiseEffect copy() { + return new LightOfPromiseEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent == null) { + return false; + } + int gainedLife = (int) this.getValue("gainedLife"); + return permanent.addCounters(CounterType.P1P1.createInstance(gainedLife), source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2021.java b/Mage.Sets/src/mage/sets/CoreSet2021.java index 1fe118f4305..e8345dcebc6 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2021.java +++ b/Mage.Sets/src/mage/sets/CoreSet2021.java @@ -101,6 +101,7 @@ public final class CoreSet2021 extends ExpansionSet { cards.add(new SetCardInfo("Kaervek, the Spiteful", 106, Rarity.RARE, mage.cards.k.KaervekTheSpiteful.class)); cards.add(new SetCardInfo("Keral Keep Disciples", 334, Rarity.UNCOMMON, mage.cards.k.KeralKeepDisciples.class)); cards.add(new SetCardInfo("Library Larcenist", 55, Rarity.COMMON, mage.cards.l.LibraryLarcenist.class)); + cards.add(new SetCardInfo("Light of Promise", 25, Rarity.UNCOMMON, mage.cards.l.LightOfPromise.class)); cards.add(new SetCardInfo("Liliana's Devotee", 109, Rarity.UNCOMMON, mage.cards.l.LilianasDevotee.class)); cards.add(new SetCardInfo("Liliana's Scorn", 329, Rarity.RARE, mage.cards.l.LilianasScorn.class)); cards.add(new SetCardInfo("Liliana's Scrounger", 330, Rarity.UNCOMMON, mage.cards.l.LilianasScrounger.class));