# Path: MTG/cardtype.py
# class SuperType(Enum):
# class CardType(Enum):
# class LandType(Enum):
#     BASIC = 0
#     LEGENDARY = 1
#     SNOW = 2
#     WORLD = 3
#     ARTIFACT = 0
#     CREATURE = 1
#     ENCHANTMENT = 2
#     INSTANT = 3
#     LAND = 4
#     PLANESWALKER = 5
#     SORCERY = 6
#     TRIBAL = 7
#     PLAINS = 0
#     ISLAND = 1
#     SWAMP = 2
#     MOUNTAIN = 3
#     FOREST = 4
# 
# Path: MTG/static_abilities.py
# class StaticAbilities(Enum):
# 
# Path: MTG/utils.py
# def get_card_from_user_input(player, string):
# def choose_targets(source):
# def parse_targets(criterias):
# def parse_ability_costs(cost):


import pdb
import time
import math
from collections import defaultdict, namedtuple
from sortedcontainers import SortedListWithKey
from MTG import cardtype
from MTG import static_abilities
from MTG import utils

        return [c(self, t) for c, t in 
                zip(self.target_criterias, self.targets_chosen)]

    def has_valid_target(self):
        if self.target_criterias is None:
            return True

        # for each target criteria, check if at least one TARGETABLE OBJECT
        # somewhere satisfies this criteria (i.e. is targetable)
        for crit in self.target_criterias:
            has_valid_target = False
            for _zone in ['battlefield', 'stack',
                          'graveyard', 'exile']:
                has_valid_target = self.game.apply_to_zone(lambda _: True, _zone, lambda card: crit(self, card))
                if has_valid_target:
                    break

            # see if it can target players
            if not has_valid_target:
                has_valid_target = self.game.apply_to_players(lambda p: crit(self, p))

            if not has_valid_target:
                print(f"{self}: No valid targets.")
                return False

        return True


    def choose_targets(self):

# Path: MTG/cardtype.py
# class SuperType(Enum):
# class CardType(Enum):
# class LandType(Enum):
#     BASIC = 0
#     LEGENDARY = 1
#     SNOW = 2
#     WORLD = 3
#     ARTIFACT = 0
#     CREATURE = 1
#     ENCHANTMENT = 2
#     INSTANT = 3
#     LAND = 4
#     PLANESWALKER = 5
#     SORCERY = 6
#     TRIBAL = 7
#     PLAINS = 0
#     ISLAND = 1
#     SWAMP = 2
#     MOUNTAIN = 3
#     FOREST = 4
# 
# Path: MTG/static_abilities.py
# class StaticAbilities(Enum):
# 
# Path: MTG/utils.py
# def get_card_from_user_input(player, string):
# def choose_targets(source):
# def parse_targets(criterias):
# def parse_ability_costs(cost):


# Path: MTG/gameobject.py
import pdb
import time
import math
from collections import defaultdict, namedtuple
from sortedcontainers import SortedListWithKey
from MTG import cardtype
from MTG import static_abilities
from MTG import utils


        return [c(self, t) for c, t in 
                zip(self.target_criterias, self.targets_chosen)]

    def has_valid_target(self):
        if self.target_criterias is None:
            return True

        # for each target criteria, check if at least one TARGETABLE OBJECT
        # somewhere satisfies this criteria (i.e. is targetable)
        for crit in self.target_criterias:
            has_valid_target = False
            for _zone in ['battlefield', 'stack',
                          'graveyard', 'exile']:
                has_valid_target = self.game.apply_to_zone(lambda _: True, _zone, lambda card: crit(self, card))
                if has_valid_target:
                    break

            # see if it can target players
            if not has_valid_target:
                has_valid_target = self.game.apply_to_players(lambda p: crit(self, p))

            if not has_valid_target:
                print(f"{self}: No valid targets.")
                return False

        return True


    def choose_targets(self):

        targets_chosen = utils.choose_targets(self)