mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Improved payment handling of conditional monohybrid colored mana.
This commit is contained in:
parent
54b757cb46
commit
4c2d8cd8f8
3 changed files with 20 additions and 8 deletions
|
|
@ -37,6 +37,7 @@ import mage.abilities.costs.VariableCost;
|
|||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.Filter;
|
||||
import mage.game.Game;
|
||||
|
|
@ -293,16 +294,16 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
}
|
||||
|
||||
// Mono Hybrid mana costs
|
||||
// First try only to pay colored mana with the pool
|
||||
// First try only to pay colored mana or conditional colored mana with the pool
|
||||
for (ManaCost cost : this) {
|
||||
if (!cost.isPaid() && cost instanceof MonoHybridManaCost) {
|
||||
if (((cost.containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
|
||||
if (((cost.containsColor(ColoredManaSymbol.W)) && (pool.getWhite() > 0 || pool.ConditionalManaHasManaType(ManaType.WHITE)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.B)) && (pool.getBlack() > 0 || pool.ConditionalManaHasManaType(ManaType.BLACK)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.R)) && (pool.getRed() > 0 || pool.ConditionalManaHasManaType(ManaType.RED)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.G)) && (pool.getGreen() > 0 || pool.ConditionalManaHasManaType(ManaType.GREEN)))
|
||||
|| ((cost.containsColor(ColoredManaSymbol.U)) && (pool.getBlue() > 0) || pool.ConditionalManaHasManaType(ManaType.BLUE))) {
|
||||
cost.assignPayment(game, ability, pool, costToPay);
|
||||
if (pool.isEmpty()) {
|
||||
if (pool.isEmpty() && pool.getConditionalMana().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,6 +414,17 @@ public class ManaPool implements Serializable {
|
|||
return conditionalMana;
|
||||
}
|
||||
|
||||
public boolean ConditionalManaHasManaType(ManaType manaType) {
|
||||
for (ManaPoolItem item : manaItems) {
|
||||
if (item.isConditional()) {
|
||||
if (item.getConditionalMana().get(manaType) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int count() {
|
||||
int x = 0;
|
||||
for (ManaPoolItem item : manaItems) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue