forked from External/mage
GUI, game: improved priority pass on non-empty mana pool (no more confirm dialogs on active "don't lose unspent mana" and other effects, close #11717)
This commit is contained in:
parent
fbd5cca14a
commit
75d241d541
2 changed files with 32 additions and 9 deletions
|
|
@ -38,9 +38,10 @@ public class ManaPool implements Serializable {
|
|||
private boolean forcedToPay; // for Word of Command
|
||||
private final List<ManaPoolItem> poolBookmark = new ArrayList<>(); // mana pool bookmark for rollback purposes
|
||||
|
||||
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
|
||||
private boolean manaBecomesBlack = false;
|
||||
private boolean manaBecomesColorless = false;
|
||||
// empty mana pool effects
|
||||
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>(); // keep some colors
|
||||
private boolean manaBecomesBlack = false; // replace all pool by black
|
||||
private boolean manaBecomesColorless = false; // replace all pool by colorless
|
||||
|
||||
private static final class ConditionalManaInfo {
|
||||
private final ManaType manaType;
|
||||
|
|
@ -147,10 +148,10 @@ public class ManaPool implements Serializable {
|
|||
if (ability.getSourceId().equals(mana.getSourceId())
|
||||
|| !(mana.getSourceObject() instanceof Spell)
|
||||
|| ((Spell) mana.getSourceObject())
|
||||
.getAbilities(game)
|
||||
.stream()
|
||||
.flatMap(a -> a.getAllEffects().stream())
|
||||
.anyMatch(ManaEffect.class::isInstance)) {
|
||||
.getAbilities(game)
|
||||
.stream()
|
||||
.flatMap(a -> a.getAllEffects().stream())
|
||||
.anyMatch(ManaEffect.class::isInstance)) {
|
||||
continue; // if any of the above cases, not an alt mana payment ability, thus excluded by filter
|
||||
}
|
||||
}
|
||||
|
|
@ -253,6 +254,28 @@ public class ManaPool implements Serializable {
|
|||
manaItems.clear();
|
||||
}
|
||||
|
||||
public boolean canLostManaOnEmpty() {
|
||||
for (ManaPoolItem item : manaItems) {
|
||||
for (ManaType manaType : ManaType.values()) {
|
||||
if (item.get(manaType) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (doNotEmptyManaTypes.contains(manaType)) {
|
||||
continue;
|
||||
}
|
||||
if (manaBecomesBlack) {
|
||||
continue;
|
||||
}
|
||||
if (manaBecomesColorless) {
|
||||
continue;
|
||||
}
|
||||
// found real mana to empty
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int emptyPool(Game game) {
|
||||
int total = 0;
|
||||
Iterator<ManaPoolItem> it = manaItems.iterator();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue