From 39191a4bd84ea645260711b17b979b2d76682b6a Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Tue, 13 Sep 2022 15:19:47 -0500 Subject: [PATCH] [DMU] Implemented Garna, Bloodfist of Keld (#9480) --- .../mage/cards/g/GarnaBloodfistOfKeld.java | 81 +++++++++++++++++++ Mage.Sets/src/mage/sets/DominariaUnited.java | 1 + 2 files changed, 82 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GarnaBloodfistOfKeld.java diff --git a/Mage.Sets/src/mage/cards/g/GarnaBloodfistOfKeld.java b/Mage.Sets/src/mage/cards/g/GarnaBloodfistOfKeld.java new file mode 100644 index 0000000000..0d14a0b69a --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GarnaBloodfistOfKeld.java @@ -0,0 +1,81 @@ +package mage.cards.g; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.Effects; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author weirddan455 + */ +public final class GarnaBloodfistOfKeld extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control"); + + static { + filter.add(AnotherPredicate.instance); + } + + public GarnaBloodfistOfKeld(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.BERSERKER); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Whenever another creature you control dies, draw a card if it was attacking. Otherwise, Garna, Bloodfist of Keld deals 1 damage to each opponent. + this.addAbility(new DiesCreatureTriggeredAbility( + new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(1), + new DamagePlayersEffect(1, TargetController.OPPONENT), + GarnaBloodfistOfKeldCondition.instance, + "draw a card if it was attacking. Otherwise, {this} deals 1 damage to each opponent" + ), + false, + filter + )); + } + + private GarnaBloodfistOfKeld(final GarnaBloodfistOfKeld card) { + super(card); + } + + @Override + public GarnaBloodfistOfKeld copy() { + return new GarnaBloodfistOfKeld(this); + } +} + +enum GarnaBloodfistOfKeldCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Effects effects = source.getEffects(); + if (!effects.isEmpty()) { + Object value = effects.get(0).getValue("creatureDied"); + if (value instanceof Permanent) { + return ((Permanent) value).isAttacking(); + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnited.java b/Mage.Sets/src/mage/sets/DominariaUnited.java index 34c81c07f3..15d84ae818 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnited.java +++ b/Mage.Sets/src/mage/sets/DominariaUnited.java @@ -111,6 +111,7 @@ public final class DominariaUnited extends ExpansionSet { cards.add(new SetCardInfo("Frostfist Strider", 51, Rarity.UNCOMMON, mage.cards.f.FrostfistStrider.class)); cards.add(new SetCardInfo("Furious Bellow", 126, Rarity.COMMON, mage.cards.f.FuriousBellow.class)); cards.add(new SetCardInfo("Gaea's Might", 164, Rarity.COMMON, mage.cards.g.GaeasMight.class)); + cards.add(new SetCardInfo("Garna, Bloodfist of Keld", 200, Rarity.UNCOMMON, mage.cards.g.GarnaBloodfistOfKeld.class)); cards.add(new SetCardInfo("Geothermal Bog", 247, Rarity.COMMON, mage.cards.g.GeothermalBog.class)); cards.add(new SetCardInfo("Ghitu Amplifier", 127, Rarity.COMMON, mage.cards.g.GhituAmplifier.class)); cards.add(new SetCardInfo("Gibbering Barricade", 95, Rarity.COMMON, mage.cards.g.GibberingBarricade.class));