Repository: magefree/mage (2026-03-16T16:04:25Z)

Issue:
Mana generated by Jegantha can't pay for mana costs until all generic mana costs are paid
Mana generated by [[Jegantha, the Wellspring]] can't pay for mana costs until all generic mana costs are paid. For instance, if I had 2 mountains and a Jegantha on the field and I wanted to cast [[Honden of Infinite Rage]] with a mana cost of 2R, I would not be able to do so in xMage since I would first have to pay the 2 generic mana before using Jegantha, but the mountains would attempt to pay the red cost instead.

Tested with both tapping jegantha while paying the cost and floating the mana and paying from the pool.


Discussion:
**[Jegantha, the Wellspring](https://cards.scryfall.io/normal/front/1/d/1d52e527-3835-4350-8c01-0f2d5d623b9c.jpg?1600967546)** - [(Gatherer)](https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=479742) [(Scryfall)](https://scryfall.com/card/iko/222/jegantha-the-wellspring?utm_source=api) [(EDHREC)](https://edhrec.com/route/?cc=Jegantha%2C+the+Wellspring)
> {4}{R/G}
> Legendary Creature — Elemental Elk
> 5/5
> Companion — No card in your starting deck has more than one of the same mana symbol in its mana cost. (If this card is your chosen companion, you may put it into your hand from outside the game for {3} any time you could cast a sorcery.)
> {T}: Add {W}{U}{B}{R}{G}. This mana can't be spent to pay generic mana costs.

**[Honden of Infinite Rage](https://cards.scryfall.io/normal/front/1/7/174bcea4-4e9c-4de5-b001-6a9df2242e37.jpg?1580014564)** - [(Gatherer)](https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=413676) [(Scryfall)](https://scryfall.com/card/ema/134/honden-of-infinite-rage?utm_source=api) [(EDHREC)](https://edhrec.com/route/?cc=Honden+of+Infinite+Rage)
> {2}{R}
> Legendary Enchantment — Shrine
> At the beginning of your upkeep, Honden of Infinite Rage deals damage to any target equal to the number of Shrines you control.
(See #8844 for the history of the workaround.)



Patch:
diff --git a/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java b/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java
index ca321fb4f52d..44f753613230 100644
--- a/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java
+++ b/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java
@@ -6,6 +6,8 @@
 import mage.abilities.Ability;
 import mage.abilities.costs.Cost;
 import mage.abilities.costs.common.TapSourceCost;
+import mage.abilities.costs.mana.ManaCost;
+import mage.abilities.costs.mana.ManaCosts;
 import mage.abilities.keyword.CompanionAbility;
 import mage.abilities.keyword.CompanionCondition;
 import mage.abilities.mana.ConditionalColoredManaAbility;
@@ -106,7 +108,14 @@ class JeganthaManaCondition extends ManaCondition {
 
     @Override
     public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
-        // TODO find a better method.  this one forces the user to pay off the generic mana before continuing.
-        return source.getManaCostsToPay().getUnpaid().getMana().getGeneric() == 0;
+        if (costsToPay instanceof ManaCosts) {
+            // allowed to contribute towards any overall costs which contain colored costs
+            return ((ManaCosts)costsToPay).getMana().countColored() > 0;
+        }
+        if (costsToPay instanceof ManaCost) {
+            // not allowed to pay for specific cost components consisting of generic mana
+            return ((ManaCost)costsToPay).getUnpaid().getMana().getGeneric() == 0;
+        }
+        return false;
     }
 }


Test patch:
diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java
index 610cd05681ec..35af7e3fd338 100644
--- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java
+++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java
@@ -458,4 +458,50 @@ public void testConditionalManaDeduplication() {
         Assert.assertEquals("Incorrect number of mana", 5, manaOptions.size());
     }
 
+    // https://github.com/magefree/mage/issues/9796
+    @Test
+    public void testJeganthaYes() {
+        addCard(Zone.BATTLEFIELD, playerA, "Jegantha, the Wellspring");
+        addCard(Zone.HAND, playerA, "Lost Auramancers");
+        addCard(Zone.BATTLEFIELD, playerA, "Plains");
+        addCard(Zone.BATTLEFIELD, playerA, "Wastes", 2);
+
+        castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lost Auramancers");
+
+        setStrictChooseMode(true);
+        setStopAt(1, PhaseStep.END_TURN);
+        execute();
+
+        assertPermanentCount(playerA, "Lost Auramancers", 1);
+    }
+
+    @Test
+    public void testJeganthaYes2() {
+        addCard(Zone.BATTLEFIELD, playerA, "Jegantha, the Wellspring");
+        addCard(Zone.HAND, playerA, "Honden of Infinite Rage");
+        addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
+
+        castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Honden of Infinite Rage");
+
+        setStrictChooseMode(true);
+        setStopAt(1, PhaseStep.END_TURN);
+        execute();
+
+        assertPermanentCount(playerA, "Honden of Infinite Rage", 1);
+    }
+
+    @Test
+    public void testJeganthaNo() {
+        addCard(Zone.BATTLEFIELD, playerA, "Jegantha, the Wellspring");
+        addCard(Zone.HAND, playerA, "Lost Auramancers");
+        addCard(Zone.BATTLEFIELD, playerA, "Plains");
+
+        checkPlayableAbility("nope", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lost Auramancers", false);
+
+        setStrictChooseMode(true);
+        setStopAt(1, PhaseStep.END_TURN);
+        execute();
+
+        assertPermanentCount(playerA, "Lost Auramancers", 0);
+    }
 }