* Mana increase effects - fixed that some infinite mana combos gives 0 mana on too much permanents/effects (example: Nyxbloom Ancient);

This commit is contained in:
Oleg Agafonov 2021-02-02 19:05:42 +04:00
parent cda79866ad
commit 2393485320
10 changed files with 165 additions and 103 deletions

View file

@ -16,6 +16,7 @@ import mage.game.events.GameEvent.EventType;
import mage.game.events.ManaEvent;
import mage.game.events.ManaPaidEvent;
import mage.game.stack.Spell;
import mage.util.CardUtil;
import java.io.Serializable;
import java.util.*;
@ -387,7 +388,7 @@ public class ManaPool implements Serializable {
private void removeConditional(ConditionalManaInfo manaInfo, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) {
for (ConditionalMana mana : getConditionalMana()) {
if (mana.get(manaInfo.manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
mana.set(manaInfo.manaType, mana.get(manaInfo.manaType) - 1);
mana.set(manaInfo.manaType, CardUtil.subtractWithOverflowCheck(mana.get(manaInfo.manaType), 1));
usedManaToPay.increase(manaInfo.manaType, manaInfo.sourceObject.isSnow());
GameEvent event = new ManaPaidEvent(ability, mana.getManaProducerId(), mana.getFlag(), mana.getManaProducerOriginalId());
game.fireEvent(event);