Search in sources :

Example 21 with ActivatedAbility

use of mage.abilities.ActivatedAbility in project mage by magefree.

the class MCTSPlayer method getPlayableOptions.

public List<Ability> getPlayableOptions(Game game) {
    List<Ability> all = new ArrayList<>();
    List<ActivatedAbility> playables = getPlayableAbilities(game);
    for (ActivatedAbility ability : playables) {
        List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
        if (options.isEmpty()) {
            if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
                simulateVariableCosts(ability, all, game);
            } else {
                all.add(ability);
            }
        } else {
            for (Ability option : options) {
                if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
                    simulateVariableCosts(option, all, game);
                } else {
                    all.add(option);
                }
            }
        }
    }
    return all;
}
Also used : SpellAbility(mage.abilities.SpellAbility) PassAbility(mage.abilities.common.PassAbility) ActivatedAbility(mage.abilities.ActivatedAbility) Ability(mage.abilities.Ability) ArrayList(java.util.ArrayList) ActivatedAbility(mage.abilities.ActivatedAbility)

Aggregations

ActivatedAbility (mage.abilities.ActivatedAbility)21 Ability (mage.abilities.Ability)17 PassAbility (mage.abilities.common.PassAbility)11 Permanent (mage.game.permanent.Permanent)8 StackAbility (mage.game.stack.StackAbility)8 SpellAbility (mage.abilities.SpellAbility)7 Card (mage.cards.Card)7 Player (mage.players.Player)7 ArrayList (java.util.ArrayList)4 TriggeredAbility (mage.abilities.TriggeredAbility)4 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)4 Game (mage.game.Game)4 UUID (java.util.UUID)3 File (java.io.File)2 java.util (java.util)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 MageObject (mage.MageObject)2 PlayLandAbility (mage.abilities.PlayLandAbility)2 StaticAbility (mage.abilities.StaticAbility)2