* 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,6 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ColorsOfManaSpentToCastCount;
@ -19,8 +20,6 @@ import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import org.apache.log4j.Logger;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -68,7 +67,8 @@ class BringToLightEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int numberColors = ColorsOfManaSpentToCastCount.getInstance().calculate(game, source, this);
FilterCard filter = new FilterCard();
FilterCard filter = new FilterCard("a creature, instant, or sorcery card with converted mana "
+ "cost less than or equal to " + numberColors);
filter.add(Predicates.or(CardType.CREATURE.getPredicate(),
CardType.INSTANT.getPredicate(), CardType.SORCERY.getPredicate()));
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, numberColors + 1));

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