* Fixed available mana calculation for Cryptic Trilobite and Titans' Nest. Added some improvements for available mana calculation of conditional mana.

This commit is contained in:
LevelX2 2020-08-16 01:16:52 +02:00
parent 3d989b24ac
commit 768f1bec4f
100 changed files with 507 additions and 144 deletions

View file

@ -3121,6 +3121,9 @@ public abstract class PlayerImpl implements Player, Serializable {
MageObjectReference permittingObject = game.getContinuousEffects().asThough(ability.getSourceId(),
AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game);
for (Mana mana : abilityOptions) {
if (mana.count() == 0) {
return true;
}
for (Mana avail : availableMana) {
// TODO: SPEND_OTHER_MANA effects with getAsThoughManaType can change mana type to pay,
// but that code processing it as any color, need to test and fix another use cases
@ -3131,6 +3134,9 @@ public abstract class PlayerImpl implements Player, Serializable {
if (permittingObject != null && mana.count() <= avail.count()) {
return true;
}
if (avail instanceof ConditionalMana && !((ConditionalMana) avail).apply(ability, game, getId(), ability.getManaCosts())) {
continue;
}
if (mana.enough(avail)) { // here we need to check if spend mana as though allow to pay the mana cost
return true;
}
@ -4620,4 +4626,10 @@ public abstract class PlayerImpl implements Player, Serializable {
public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) {
return card.getSpellAbility();
}
@Override
public String toString() {
return getName() + " " + super.toString();
}
}