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

View file

@ -1,5 +1,7 @@
package mage.players; package mage.players;
import java.io.Serializable;
import java.util.*;
import mage.ConditionalMana; import mage.ConditionalMana;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -15,9 +17,6 @@ import mage.game.events.GameEvent.EventType;
import mage.game.events.ManaEvent; import mage.game.events.ManaEvent;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import java.io.Serializable;
import java.util.*;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -83,7 +82,8 @@ public class ManaPool implements Serializable {
* @param ability * @param ability
* @param filter * @param filter
* @param game * @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 * @param usedManaToPay the information about what mana was paid
* @return * @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()); GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
event.setData(mana.getOriginalId().toString()); event.setData(mana.getOriginalId().toString());
game.fireEvent(event); game.fireEvent(event);
usedManaToPay.increase(mana.getFirstAvailable()); usedManaToPay.increase(usableManaType);
mana.remove(usableManaType); mana.remove(usableManaType);
if (mana.count() == 0) { // so no items with count 0 stay in list if (mana.count() == 0) { // so no items with count 0 stay in list
manaItems.remove(mana); manaItems.remove(mana);