* AI: improved support of "as though mana" abilities (now computer can choose correct mana ability to pay, example: Draugr Necromancer);

* Dev: added card's LKI support of multi part cards (mdf/split/adventure);
* Dev: improved support of adding/removing counters from mdf cards;
* Draugr Necromancer - fixed support of mdf/split/adventure cards (#7620);
This commit is contained in:
Oleg Agafonov 2021-02-27 20:14:12 +04:00
parent adc945748b
commit dda69cd009
12 changed files with 227 additions and 65 deletions

View file

@ -18,6 +18,7 @@ import mage.cards.ModalDoubleFacesCard;
import mage.cards.SplitCard;
import mage.choices.Choice;
import mage.constants.ColoredManaSymbol;
import mage.constants.ManaType;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.players.Player;
@ -699,6 +700,23 @@ public final class ManaUtil {
} else {
return 0;
}
}
/**
* Find all used mana types in mana cost (wubrg + colorless)
*
* @return
*/
public static List<ManaType> getManaTypesInCost(ManaCost cost) {
List<ManaType> res = new ArrayList<>();
for (Mana mana : cost.getManaOptions()) {
if (mana.getWhite() > 0) res.add(ManaType.WHITE);
if (mana.getBlue() > 0) res.add(ManaType.BLUE);
if (mana.getBlack() > 0) res.add(ManaType.BLACK);
if (mana.getRed() > 0) res.add(ManaType.RED);
if (mana.getGreen() > 0) res.add(ManaType.GREEN);
if (mana.getColorless() > 0 || mana.getGeneric() > 0 || mana.getAny() > 0) res.add(ManaType.COLORLESS);
}
return res;
}
}