* Fixed a problem how the color of mana paid from mana pool was recognized that could made problems to count the number of different colors used to pay a spell with convergence (e.g. if the mana was created with Cascading Cataracts) fixes #3816.

This commit is contained in:
LevelX2 2020-07-13 00:10:09 +02:00
parent a77471f58f
commit 1cdb715d92
2 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,7 @@
package mage.players;
import java.io.Serializable;
import java.util.*;
import mage.ConditionalMana;
import mage.Mana;
import mage.abilities.Ability;
@ -15,9 +17,6 @@ import mage.game.events.GameEvent.EventType;
import mage.game.events.ManaEvent;
import mage.game.stack.Spell;
import java.io.Serializable;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -83,7 +82,8 @@ public class ManaPool implements Serializable {
* @param ability
* @param filter
* @param game
* @param costToPay complete costs to pay (needed to check conditional mana)
* @param costToPay complete costs to pay (needed to check conditional
* mana)
* @param usedManaToPay the information about what mana was paid
* @return
*/
@ -144,7 +144,7 @@ public class ManaPool implements Serializable {
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
event.setData(mana.getOriginalId().toString());
game.fireEvent(event);
usedManaToPay.increase(mana.getFirstAvailable());
usedManaToPay.increase(usableManaType);
mana.remove(usableManaType);
if (mana.count() == 0) { // so no items with count 0 stay in list
manaItems.remove(mana);
@ -301,7 +301,7 @@ public class ManaPool implements Serializable {
if (mana instanceof ConditionalMana) {
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game),
((ConditionalMana) mana).getManaProducerOriginalId() != null
? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
if (emptyOnTurnsEnd) {
item.setDuration(Duration.EndOfTurn);
}