# Path: MTG/abilities.py
# class Ability(gameobject.GameObject):
# class ActivatedAbility(Ability):
# class TriggeredAbility(Ability):
#     def __init__(self, card, effect, target_criterias=None,
#                  prompts=None):
#     def __str__(self):
#     def __repr__(self):
#     def resolve(self):
#     def __init__(self, card, cost, effect, target_criterias=None, prompts=None, is_mana_ability=False):
#     def can_activate(self):
#     def __init__(self, card, effect, requirements, target_criterias=None,
#                  prompts=None, intervening_if=None):
#     def condition_satisfied(self):
#     def put_on_stack(self):
# 
# Path: MTG/triggers.py
# class triggerConditions(Enum):
# 
# Path: MTG/mana.py
# class Mana(Enum):
# class ManaPool():
#     WHITE = 0
#     BLUE = 1
#     BLACK = 2
#     RED = 3
#     GREEN = 4
#     COLORLESS = 5
#     GENERIC = 6
# def str_to_mana_dict(manacost):
# def chr_to_mana(c):
#     def __init__(self, controller=None):
#     def add(self, mana, amount=1):
#     def add_str(self, mana_str):
#     def pay(self, manacost):
#     def is_empty(self):
#     def determine_costs(self, manacost):
#     def canPay(self, manacost, convoke=False):
#     def clear(self):
#     def __repr__(self):
# 
# 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/permanent.py
# class Status():
# class Effect():
# class Permanent(gameobject.GameObject):
# class Aura(Permanent):
#     def __init__(self):
#     def __repr__(self):
#     def __str__(self):
#     def reset(self):
#     def __init__(self, value, timestamp, apply_target=None, source=None, expiration=math.inf, is_active=True,
#                  toggle_func=lambda eff: False):
#     def __init__(self, characteristics, controller, owner=None, original_card=None,
#                  status=None, modifications=[]):
#     def __repr__(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def activate_ability(self, num=0):
#     def add_effect(self, name, value, source=None, expiration=math.inf,
#                    is_active=True, toggle_func=lambda eff: True):
#     def get_effect(self, name):
#     def check_effect_expiration(self):
#     def tap(self):
#     def untap(self):
#     def freeze(self):
#     def power(self):
#     def toughness(self):
#     def add_counter(self, counter="+1/+1", num=1):
#     def num_counters(self, counter):
#     def _calculate_pt(self):
#     def is_summoning_sick(self):
#     def can_attack(self):
#     def can_block(self, attackers=None):
#     def attacks(self, player):
#     def blocks(self, creature):
#     def in_combat(self):
#     def exits_combat(self):
#     def take_damage(self, source, dmg, is_combat=False):
#     def deals_damage(self, target, dmg, is_combat=False):
#     def trigger(self, condition, source=None, amount=1):
#     def change_zone(self, target_zone, from_top=0, shuffle=True,
#                     status_mod=None, modi_func=None):
#     def dies(self):
#     def destroy(self):
#     def sacrifice(self):
#     def exile(self):
#     def bounce(self):
#     def flicker(self):
#     def __init__(self, enchant_target, characteristics, controller, owner=None, original_card=None):
#     def enchant(self, target):
#     def disenchant(self):
#     def add_ability(self, ability):
#     def add_pt(self, PT):
# def make_permanent(card, status_mod=None, modi_func=None):
# def make_aura(card, enchant_target):


import sys
import pickle
import math
import re
from collections import namedtuple
from MTG.parsedcards import *
from MTG.exceptions import *
from MTG import abilities
from MTG import triggers
from MTG import mana
from MTG import utils
from MTG import permanent

    # add aura enchant effects
    card = card_from_name(cardname, get_instance=False)
    card.continuous_effects = effects

def add_trigger(cardname, condition, effect, requirements=None,
                target_criterias=None, target_prompts=None, intervening_if=None):
    """
    Each effect is a function of the form
        lambda self: do_something

    It will be passed into the stack as
        play.Play(lambda: effect(self))

    where self is the source of the trigger (the permanent)
    """
    if not name_to_id(cardname):
        return
    card = card_from_name(cardname, get_instance=False)

    if not requirements:
        requirements = lambda self: True

    # make it a variable specific to card rather than a card.Card class var
    # normally, trigger_listeners is defined in card.Card,
    # and our parsed card classes just inherit that
    if card.triggers == {}:
        card.triggers = {}

    if condition not in card.triggers:

# Path: MTG/abilities.py
# class Ability(gameobject.GameObject):
# class ActivatedAbility(Ability):
# class TriggeredAbility(Ability):
#     def __init__(self, card, effect, target_criterias=None,
#                  prompts=None):
#     def __str__(self):
#     def __repr__(self):
#     def resolve(self):
#     def __init__(self, card, cost, effect, target_criterias=None, prompts=None, is_mana_ability=False):
#     def can_activate(self):
#     def __init__(self, card, effect, requirements, target_criterias=None,
#                  prompts=None, intervening_if=None):
#     def condition_satisfied(self):
#     def put_on_stack(self):
# 
# Path: MTG/triggers.py
# class triggerConditions(Enum):
# 
# Path: MTG/mana.py
# class Mana(Enum):
# class ManaPool():
#     WHITE = 0
#     BLUE = 1
#     BLACK = 2
#     RED = 3
#     GREEN = 4
#     COLORLESS = 5
#     GENERIC = 6
# def str_to_mana_dict(manacost):
# def chr_to_mana(c):
#     def __init__(self, controller=None):
#     def add(self, mana, amount=1):
#     def add_str(self, mana_str):
#     def pay(self, manacost):
#     def is_empty(self):
#     def determine_costs(self, manacost):
#     def canPay(self, manacost, convoke=False):
#     def clear(self):
#     def __repr__(self):
# 
# 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/permanent.py
# class Status():
# class Effect():
# class Permanent(gameobject.GameObject):
# class Aura(Permanent):
#     def __init__(self):
#     def __repr__(self):
#     def __str__(self):
#     def reset(self):
#     def __init__(self, value, timestamp, apply_target=None, source=None, expiration=math.inf, is_active=True,
#                  toggle_func=lambda eff: False):
#     def __init__(self, characteristics, controller, owner=None, original_card=None,
#                  status=None, modifications=[]):
#     def __repr__(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def activate_ability(self, num=0):
#     def add_effect(self, name, value, source=None, expiration=math.inf,
#                    is_active=True, toggle_func=lambda eff: True):
#     def get_effect(self, name):
#     def check_effect_expiration(self):
#     def tap(self):
#     def untap(self):
#     def freeze(self):
#     def power(self):
#     def toughness(self):
#     def add_counter(self, counter="+1/+1", num=1):
#     def num_counters(self, counter):
#     def _calculate_pt(self):
#     def is_summoning_sick(self):
#     def can_attack(self):
#     def can_block(self, attackers=None):
#     def attacks(self, player):
#     def blocks(self, creature):
#     def in_combat(self):
#     def exits_combat(self):
#     def take_damage(self, source, dmg, is_combat=False):
#     def deals_damage(self, target, dmg, is_combat=False):
#     def trigger(self, condition, source=None, amount=1):
#     def change_zone(self, target_zone, from_top=0, shuffle=True,
#                     status_mod=None, modi_func=None):
#     def dies(self):
#     def destroy(self):
#     def sacrifice(self):
#     def exile(self):
#     def bounce(self):
#     def flicker(self):
#     def __init__(self, enchant_target, characteristics, controller, owner=None, original_card=None):
#     def enchant(self, target):
#     def disenchant(self):
#     def add_ability(self, ability):
#     def add_pt(self, PT):
# def make_permanent(card, status_mod=None, modi_func=None):
# def make_aura(card, enchant_target):


# Path: MTG/cards.py
import sys
import pickle
import math
import re
from collections import namedtuple
from MTG.parsedcards import *
from MTG.exceptions import *
from MTG import abilities
from MTG import triggers
from MTG import mana
from MTG import utils
from MTG import permanent


    # add aura enchant effects
    card = card_from_name(cardname, get_instance=False)
    card.continuous_effects = effects

def add_trigger(cardname, condition, effect, requirements=None,
                target_criterias=None, target_prompts=None, intervening_if=None):
    """
    Each effect is a function of the form
        lambda self: do_something

    It will be passed into the stack as
        play.Play(lambda: effect(self))

    where self is the source of the trigger (the permanent)
    """
    if not name_to_id(cardname):
        return
    card = card_from_name(cardname, get_instance=False)

    if not requirements:
        requirements = lambda self: True

    # make it a variable specific to card rather than a card.Card class var
    # normally, trigger_listeners is defined in card.Card,
    # and our parsed card classes just inherit that
    if card.triggers == {}:
        card.triggers = {}

    if condition not in card.triggers:

        card.triggers[condition] = []