From 827ef33729cffd23fd2722c31fcdbb050383a509 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 25 Apr 2025 14:24:58 -0400 Subject: [PATCH] [CLU] Implement Herald of Ilharg --- .../src/mage/cards/h/HeraldOfIlharg.java | 95 +++++++++++++++++++ .../src/mage/sets/RavnicaClueEdition.java | 2 +- 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/h/HeraldOfIlharg.java diff --git a/Mage.Sets/src/mage/cards/h/HeraldOfIlharg.java b/Mage.Sets/src/mage/cards/h/HeraldOfIlharg.java new file mode 100644 index 00000000000..5fc87cc06be --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeraldOfIlharg.java @@ -0,0 +1,95 @@ +package mage.cards.h; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.counters.Counters; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HeraldOfIlharg extends CardImpl { + + public HeraldOfIlharg(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}"); + + this.subtype.add(SubType.BOAR); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever you cast a creature spell, put two +1/+1 counters on Herald of Ilharg. If that spell has mana value 5 or greater, Herald of Ilharg deals damage equal to the number of counters on it to each opponent. + Ability ability = new SpellCastControllerTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), + StaticFilters.FILTER_SPELL_A_CREATURE, false + ); + ability.addEffect(new HeraldOfIlhargEffect()); + this.addAbility(ability); + } + + private HeraldOfIlharg(final HeraldOfIlharg card) { + super(card); + } + + @Override + public HeraldOfIlharg copy() { + return new HeraldOfIlharg(this); + } +} + +class HeraldOfIlhargEffect extends OneShotEffect { + + HeraldOfIlhargEffect() { + super(Outcome.Benefit); + staticText = "If that spell has mana value 5 or greater, " + + "{this} deals damage equal to the number of counters on it to each opponent"; + } + + private HeraldOfIlhargEffect(final HeraldOfIlhargEffect effect) { + super(effect); + } + + @Override + public HeraldOfIlhargEffect copy() { + return new HeraldOfIlhargEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int count = Optional + .ofNullable(source.getSourcePermanentOrLKI(game)) + .map(permanent -> permanent.getCounters(game)) + .map(Counters::getTotalCount) + .orElse(0); + Spell spell = (Spell) getValue("spellCast"); + if (count < 1 || spell == null || spell.getManaValue() < 5) { + return false; + } + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.damage(count, source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaClueEdition.java b/Mage.Sets/src/mage/sets/RavnicaClueEdition.java index 653ccdeb060..9b71bfb42a0 100644 --- a/Mage.Sets/src/mage/sets/RavnicaClueEdition.java +++ b/Mage.Sets/src/mage/sets/RavnicaClueEdition.java @@ -129,7 +129,7 @@ public final class RavnicaClueEdition extends ExpansionSet { cards.add(new SetCardInfo("Havoc Jester", 138, Rarity.UNCOMMON, mage.cards.h.HavocJester.class)); cards.add(new SetCardInfo("Headliner Scarlett", 4, Rarity.RARE, mage.cards.h.HeadlinerScarlett.class)); cards.add(new SetCardInfo("Helium Squirter", 87, Rarity.COMMON, mage.cards.h.HeliumSquirter.class)); - //cards.add(new SetCardInfo("Herald of Ilharg", 34, Rarity.RARE, mage.cards.h.HeraldOfIlharg.class)); + cards.add(new SetCardInfo("Herald of Ilharg", 34, Rarity.RARE, mage.cards.h.HeraldOfIlharg.class)); cards.add(new SetCardInfo("Hydroid Krasis", 195, Rarity.MYTHIC, mage.cards.h.HydroidKrasis.class)); cards.add(new SetCardInfo("Hypersonic Dragon", 196, Rarity.RARE, mage.cards.h.HypersonicDragon.class)); cards.add(new SetCardInfo("Incriminating Impetus", 35, Rarity.UNCOMMON, mage.cards.i.IncriminatingImpetus.class));