[BNG] Fix Astral Cornucopia not producing enough mana. Closes #9392.

This commit is contained in:
Alex Vasile 2022-08-24 20:10:00 -04:00
parent ac13be90cf
commit dca1b5e110
2 changed files with 46 additions and 1 deletions

View file

@ -107,6 +107,6 @@ class AstralCornucopiaManaEffect extends ManaEffect {
} }
ManaType chosenType = ManaType.findByName(choice.getChoice()); ManaType chosenType = ManaType.findByName(choice.getChoice());
return chosenType == null ? null : new Mana(chosenType); return chosenType == null ? null : new Mana(chosenType, counters);
} }
} }

View file

@ -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);
}
}