forked from External/mage
* Fixed a problem of available mana generation caused by order of usage of mana sourced with costs (example Coal Golem and then Dromar's Attendant - related to #6698).
This commit is contained in:
parent
8e929d4e9d
commit
06968ad921
4 changed files with 127 additions and 48 deletions
|
|
@ -2936,9 +2936,19 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
for (Abilities<ActivatedManaAbilityImpl> manaAbilities : sourceWithoutManaCosts) {
|
||||
availableMana.addMana(manaAbilities, game);
|
||||
}
|
||||
for (Abilities<ActivatedManaAbilityImpl> manaAbilities : sourceWithCosts) {
|
||||
availableMana.removeDuplicated();
|
||||
availableMana.addManaWithCost(manaAbilities, game);
|
||||
|
||||
boolean anAbilityWasUsed = true;
|
||||
while (anAbilityWasUsed && !sourceWithCosts.isEmpty()) {
|
||||
anAbilityWasUsed = false;
|
||||
for (Iterator<Abilities<ActivatedManaAbilityImpl>> iterator = sourceWithCosts.iterator(); iterator.hasNext();) {
|
||||
Abilities<ActivatedManaAbilityImpl> manaAbilities = iterator.next();
|
||||
boolean used = availableMana.addManaWithCost(manaAbilities, game);
|
||||
if (used) {
|
||||
iterator.remove();
|
||||
availableMana.removeDuplicated();
|
||||
anAbilityWasUsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove duplicated variants (see ManaOptionsTest for info - when that rises)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue