From 28ad759dc664c229954ded136802d2912ab22d60 Mon Sep 17 00:00:00 2001
From: Evan Kranzler <theelk801@gmail.com>
Date: Sat, 22 Oct 2022 18:20:39 -0400
Subject: [PATCH] [CLB] Implemented Raggadragga, Goreguts Boss

---
 .../mage/cards/r/RaggadraggaGoregutsBoss.java | 99 +++++++++++++++++++
 .../CommanderLegendsBattleForBaldursGate.java |  1 +
 2 files changed, 100 insertions(+)
 create mode 100644 Mage.Sets/src/mage/cards/r/RaggadraggaGoregutsBoss.java

diff --git a/Mage.Sets/src/mage/cards/r/RaggadraggaGoregutsBoss.java b/Mage.Sets/src/mage/cards/r/RaggadraggaGoregutsBoss.java
new file mode 100644
index 0000000000..aab8476957
--- /dev/null
+++ b/Mage.Sets/src/mage/cards/r/RaggadraggaGoregutsBoss.java
@@ -0,0 +1,99 @@
+package mage.cards.r;
+
+import mage.MageInt;
+import mage.abilities.Ability;
+import mage.abilities.common.AttacksAllTriggeredAbility;
+import mage.abilities.common.SimpleStaticAbility;
+import mage.abilities.common.SpellCastControllerTriggeredAbility;
+import mage.abilities.effects.common.UntapTargetEffect;
+import mage.abilities.effects.common.continuous.BoostAllEffect;
+import mage.abilities.effects.common.continuous.BoostTargetEffect;
+import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
+import mage.abilities.keyword.TrampleAbility;
+import mage.abilities.mana.ManaAbility;
+import mage.cards.CardImpl;
+import mage.cards.CardSetInfo;
+import mage.constants.*;
+import mage.filter.FilterSpell;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.predicate.Predicate;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.game.stack.StackObject;
+import mage.watchers.common.ManaPaidSourceWatcher;
+
+import java.util.UUID;
+
+/**
+ * @author TheElk801
+ */
+public final class RaggadraggaGoregutsBoss extends CardImpl {
+
+    private static final FilterCreaturePermanent filter
+            = new FilterCreaturePermanent("creature you control with a mana ability");
+    private static final FilterSpell filter2 = new FilterSpell();
+
+    static {
+        filter.add(TargetController.YOU.getOwnerPredicate());
+        filter.add(RaggadraggaGoregutsBossCreaturePredicate.instance);
+        filter2.add(RaggadraggaGoregutsBossSpellPredicate.instance);
+    }
+
+    public RaggadraggaGoregutsBoss(UUID ownerId, CardSetInfo setInfo) {
+        super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}");
+
+        this.addSuperType(SuperType.LEGENDARY);
+        this.subtype.add(SubType.HUMAN);
+        this.subtype.add(SubType.BOAR);
+        this.power = new MageInt(4);
+        this.toughness = new MageInt(4);
+
+        // Each creature you control with a mana ability gets +2/+2.
+        this.addAbility(new SimpleStaticAbility(new BoostAllEffect(
+                2, 2, Duration.WhileOnBattlefield, filter, false
+        )));
+
+        // Whenever a creature you control with a mana ability attacks, untap it.
+        this.addAbility(new AttacksAllTriggeredAbility(
+                new UntapTargetEffect("untap it"), false, filter,
+                SetTargetPointer.PERMANENT, false
+        ));
+
+        // Whenever you cast a spell, if at least seven mana was spent to cast it, untap target creature. It gets +7/+7 and gains trample until end of turn.
+        Ability ability = new SpellCastControllerTriggeredAbility(
+                new UntapTargetEffect(), filter2, false
+        ).setTriggerPhrase("Whenever you cast a spell, if at least seven mana was spent to cast it, ");
+        ability.addEffect(new BoostTargetEffect(7, 7).setText("It gets +7/+7"));
+        ability.addEffect(new GainAbilityTargetEffect(
+                TrampleAbility.getInstance(), Duration.EndOfTurn
+        ).setText("and gains trample until end of turn"));
+        this.addAbility(ability);
+    }
+
+    private RaggadraggaGoregutsBoss(final RaggadraggaGoregutsBoss card) {
+        super(card);
+    }
+
+    @Override
+    public RaggadraggaGoregutsBoss copy() {
+        return new RaggadraggaGoregutsBoss(this);
+    }
+}
+
+enum RaggadraggaGoregutsBossCreaturePredicate implements Predicate<Permanent> {
+    instance;
+
+    @Override
+    public boolean apply(Permanent input, Game game) {
+        return input.getAbilities(game).stream().anyMatch(ManaAbility.class::isInstance);
+    }
+}
+
+enum RaggadraggaGoregutsBossSpellPredicate implements Predicate<StackObject> {
+    instance;
+
+    @Override
+    public boolean apply(StackObject input, Game game) {
+        return ManaPaidSourceWatcher.getTotalPaid(input.getId(), game) >= 7;
+    }
+}
diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java
index 0456171985..e56f20cb35 100644
--- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java
+++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java
@@ -468,6 +468,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
         cards.add(new SetCardInfo("Pull from Tomorrow", 731, Rarity.RARE, mage.cards.p.PullFromTomorrow.class));
         cards.add(new SetCardInfo("Puppeteer Clique", 769, Rarity.RARE, mage.cards.p.PuppeteerClique.class));
         cards.add(new SetCardInfo("Pursued Whale", 732, Rarity.RARE, mage.cards.p.PursuedWhale.class));
+        cards.add(new SetCardInfo("Raggadragga, Goreguts Boss", 291, Rarity.RARE, mage.cards.r.RaggadraggaGoregutsBoss.class));
         cards.add(new SetCardInfo("Raging Ravine", 910, Rarity.RARE, mage.cards.r.RagingRavine.class));
         cards.add(new SetCardInfo("Raised by Giants", 250, Rarity.RARE, mage.cards.r.RaisedByGiants.class));
         cards.add(new SetCardInfo("Raphael, Fiendish Savior", 292, Rarity.RARE, mage.cards.r.RaphaelFiendishSavior.class));