From dca1b5e110aadead6b668293449481d0222dd9f3 Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Wed, 24 Aug 2022 20:10:00 -0400 Subject: [PATCH] [BNG] Fix Astral Cornucopia not producing enough mana. Closes #9392. --- .../src/mage/cards/a/AstralCornucopia.java | 2 +- .../single/bng/AstralCornucopiaTest.java | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/bng/AstralCornucopiaTest.java diff --git a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java index cac362f10d..9560fa3421 100644 --- a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java +++ b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java @@ -107,6 +107,6 @@ class AstralCornucopiaManaEffect extends ManaEffect { } ManaType chosenType = ManaType.findByName(choice.getChoice()); - return chosenType == null ? null : new Mana(chosenType); + return chosenType == null ? null : new Mana(chosenType, counters); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/bng/AstralCornucopiaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/bng/AstralCornucopiaTest.java new file mode 100644 index 0000000000..1146801cd0 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/bng/AstralCornucopiaTest.java @@ -0,0 +1,45 @@ +package org.mage.test.cards.single.bng; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * {@link mage.cards.a.AstralCornucopia Astral Cornucopia} + * Artifact + * {X}{X}{X} + * Astral Cornucopia enters the battlefield with X charge counters on it. + * {T}: Choose a color. Add one mana of that color for each charge counter on Astral Cornucopia. + */ +public class AstralCornucopiaTest extends CardTestPlayerBase { + + private static final String astralCornucopia = "Astral Cornucopia"; + + /** + * Reported bug: https://github.com/magefree/mage/issues/9392 + * + * Astral Cornucopia taps for 1 mana regardless of how many charge counters it has on it. + */ + @Test + public void testCorrectManaAmount() { + // Artifact {2} + String arcaneSignet = "Arcane Signet"; + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 6); + addCard(Zone.HAND, playerA, astralCornucopia); + addCard(Zone.HAND, playerA, arcaneSignet); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, astralCornucopia, true); + setChoice(playerA, "X=2"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, arcaneSignet); + + execute(); + + assertPermanentCount(playerA, astralCornucopia,1 ); + assertCounterCount(playerA, astralCornucopia, CounterType.CHARGE, 2); + assertPermanentCount(playerA, arcaneSignet, 1); + } +}