mirror of
https://github.com/correl/mage.git
synced 2025-04-06 01:04:10 -09:00
* Fixed that colorless mana could be paid with colored mana.
This commit is contained in:
parent
d0f38ffa53
commit
dd6484dba5
4 changed files with 14 additions and 4 deletions
Mage/src/main/java/mage/abilities/costs/mana
|
@ -68,7 +68,7 @@ public class GenericManaCost extends ManaCostImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costsToPay) {
|
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costsToPay) {
|
||||||
this.assignColorless(ability, game, pool, mana, costsToPay);
|
this.assignGeneric(ability, game, pool, mana, costsToPay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -151,7 +151,17 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean assignColorless(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) {
|
protected void assignColorless(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) {
|
||||||
|
int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay);
|
||||||
|
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
|
||||||
|
if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) {
|
||||||
|
this.payment.increaseColorless();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean assignGeneric(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) {
|
||||||
int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay);
|
int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay);
|
||||||
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
|
while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) {
|
||||||
if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) {
|
if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class MonoHybridManaCost extends ManaCostImpl {
|
||||||
@Override
|
@Override
|
||||||
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) {
|
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) {
|
||||||
if (!assignColored(ability, game, pool, mana, costToPay)) {
|
if (!assignColored(ability, game, pool, mana, costToPay)) {
|
||||||
assignColorless(ability, game, pool, mana2, costToPay);
|
assignGeneric(ability, game, pool, mana2, costToPay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SnowManaCost extends ManaCostImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) {
|
public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) {
|
||||||
this.assignColorless(ability, game, pool, 1, costToPay);
|
this.assignGeneric(ability, game, pool, 1, costToPay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue