# Path: abilities/power_abilities.py
# class PowerAbilities(Enum):
#     Berserk = 0
#     Regeneration = 1
#     PowerAttack = 2
#     Parry = 3
#     Sneak = 4
#     Backstab = 5
# 
# Path: abilities/physical_abilities.py
# class PhysicalAbilities(Enum):
#     GRASP = 0
#     STAND = 1
#     SEE = 2
#     HEAR = 3
#     BITE = 4
#     PUNCH = 5
#     KICK = 6
#     EAT = 7
#     THINK = 8
#     MOVE = 9
#     LIVE = 10
#     BREATHE = 11
# 
# Path: components/level_tree.py
# class LevelTree(object):
#     NAME = "level_tree"
#     """
#     The goal of this Tree is to return advantages of a level recursively.
#     """
#     def __init__(self):
#         super().__init__()
#         self.stats_modifiers = {}
#         self.abilities_modifiers = {}
# 
#     def get_stat_modifiers(self, current_level):
#         final_modifiers = {}
#         ordered_modifiers = sorted(self.stats_modifiers.keys())
#         for level in ordered_modifiers:
#             if int(level) > int(current_level):
#                 continue
# 
#             for stat_modifier in self.stats_modifiers[level]:
#                 if stat_modifier in final_modifiers:
#                     final_modifiers[stat_modifier.uid] += stat_modifier.get_leveled_value(current_level, level)
#                 else:
#                     final_modifiers[stat_modifier.uid] = stat_modifier.get_leveled_value(current_level, level)
# 
#         return final_modifiers
# 
#     def get_ability_modifiers(self, current_level):
#         final_modifiers = {}
#         for level in sorted(self.abilities_modifiers.keys()):
#             if level > current_level:
#                 continue
#             for ability_modifier in self.abilities_modifiers[level]:
#                 if ability_modifier.uid in final_modifiers:
#                     final_modifiers[ability_modifier.uid] += ability_modifier.get_leveled_value(current_level, level)
#                 else:
#                     final_modifiers[ability_modifier.uid] = ability_modifier.get_leveled_value(current_level, level)
# 
#         return final_modifiers
# 
#     def add_stat_modifier(self, level, stat_modifier):
#         if level not in self.stats_modifiers:
#             self.stats_modifiers[level] = []
#         self.stats_modifiers[level].append(stat_modifier)
# 
#     def add_ability_modifier(self, level, ability_modifier):
#         if level not in self.abilities_modifiers:
#             self.abilities_modifiers[level] = []
#         self.abilities_modifiers[level].append(ability_modifier.power)
# 
# Path: stats/enums.py
# class StatsEnum(Enum):
#     Health = 'health'
#     Mana = 'mana'
#     Strength = 'strength'
#     Dexterity = 'dexterity'
#     Constitution = 'constitution'
#     Intelligence = 'intelligence'
#     Charisma = 'charisma'
#     Wisdom = 'wisdom'
#     Sharpness = 'sharpness'
#     Hardness = 'hardness'
#     Weight = 'weight'
#     Size = 'size'
#     Potency = 'potency'
#     MaxDamage = 'max_damage'
#     MinDamage = 'min_damage'
#     ArmorClass = 'armor_class'
# 
# Path: stats/stat.py
# class StatModifier(object):
#     def __init__(self, uid, value, level_progression=0):
#         self.uid = uid
#         self.value = value
#         self.level_progression = level_progression
# 
#     def __int__(self):
#         return
# 
#     def get_leveled_value(self, level, initial_level):
#         if self.level_progression > 0:
#             multiplier = (level - initial_level) / self.level_progression
#             return math.ceil(self.value * multiplier)
#         else:
#             return self.value


import unittest
from abilities.ability import Ability
from abilities.power_abilities import PowerAbilities
from abilities.physical_abilities import PhysicalAbilities
from components.level_tree import LevelTree
from stats.enums import StatsEnum
from stats.stat import StatModifier




class LevelTreeTestCase(unittest.TestCase):

    def test_stats_modifiers(self):
        test_tree = LevelTree()
        test_tree.stats_modifiers = {
            1: [StatModifier(StatsEnum.Health, 1, level_progression=1),
                StatModifier(StatsEnum.Charisma, -1, level_progression=2)],

# Path: abilities/power_abilities.py
# class PowerAbilities(Enum):
#     Berserk = 0
#     Regeneration = 1
#     PowerAttack = 2
#     Parry = 3
#     Sneak = 4
#     Backstab = 5
# 
# Path: abilities/physical_abilities.py
# class PhysicalAbilities(Enum):
#     GRASP = 0
#     STAND = 1
#     SEE = 2
#     HEAR = 3
#     BITE = 4
#     PUNCH = 5
#     KICK = 6
#     EAT = 7
#     THINK = 8
#     MOVE = 9
#     LIVE = 10
#     BREATHE = 11
# 
# Path: components/level_tree.py
# class LevelTree(object):
#     NAME = "level_tree"
#     """
#     The goal of this Tree is to return advantages of a level recursively.
#     """
#     def __init__(self):
#         super().__init__()
#         self.stats_modifiers = {}
#         self.abilities_modifiers = {}
# 
#     def get_stat_modifiers(self, current_level):
#         final_modifiers = {}
#         ordered_modifiers = sorted(self.stats_modifiers.keys())
#         for level in ordered_modifiers:
#             if int(level) > int(current_level):
#                 continue
# 
#             for stat_modifier in self.stats_modifiers[level]:
#                 if stat_modifier in final_modifiers:
#                     final_modifiers[stat_modifier.uid] += stat_modifier.get_leveled_value(current_level, level)
#                 else:
#                     final_modifiers[stat_modifier.uid] = stat_modifier.get_leveled_value(current_level, level)
# 
#         return final_modifiers
# 
#     def get_ability_modifiers(self, current_level):
#         final_modifiers = {}
#         for level in sorted(self.abilities_modifiers.keys()):
#             if level > current_level:
#                 continue
#             for ability_modifier in self.abilities_modifiers[level]:
#                 if ability_modifier.uid in final_modifiers:
#                     final_modifiers[ability_modifier.uid] += ability_modifier.get_leveled_value(current_level, level)
#                 else:
#                     final_modifiers[ability_modifier.uid] = ability_modifier.get_leveled_value(current_level, level)
# 
#         return final_modifiers
# 
#     def add_stat_modifier(self, level, stat_modifier):
#         if level not in self.stats_modifiers:
#             self.stats_modifiers[level] = []
#         self.stats_modifiers[level].append(stat_modifier)
# 
#     def add_ability_modifier(self, level, ability_modifier):
#         if level not in self.abilities_modifiers:
#             self.abilities_modifiers[level] = []
#         self.abilities_modifiers[level].append(ability_modifier.power)
# 
# Path: stats/enums.py
# class StatsEnum(Enum):
#     Health = 'health'
#     Mana = 'mana'
#     Strength = 'strength'
#     Dexterity = 'dexterity'
#     Constitution = 'constitution'
#     Intelligence = 'intelligence'
#     Charisma = 'charisma'
#     Wisdom = 'wisdom'
#     Sharpness = 'sharpness'
#     Hardness = 'hardness'
#     Weight = 'weight'
#     Size = 'size'
#     Potency = 'potency'
#     MaxDamage = 'max_damage'
#     MinDamage = 'min_damage'
#     ArmorClass = 'armor_class'
# 
# Path: stats/stat.py
# class StatModifier(object):
#     def __init__(self, uid, value, level_progression=0):
#         self.uid = uid
#         self.value = value
#         self.level_progression = level_progression
# 
#     def __int__(self):
#         return
# 
#     def get_leveled_value(self, level, initial_level):
#         if self.level_progression > 0:
#             multiplier = (level - initial_level) / self.level_progression
#             return math.ceil(self.value * multiplier)
#         else:
#             return self.value


# Path: tests/components/test_level_tree.py
import unittest
from abilities.ability import Ability
from abilities.power_abilities import PowerAbilities
from abilities.physical_abilities import PhysicalAbilities
from components.level_tree import LevelTree
from stats.enums import StatsEnum
from stats.stat import StatModifier





class LevelTreeTestCase(unittest.TestCase):

    def test_stats_modifiers(self):
        test_tree = LevelTree()
        test_tree.stats_modifiers = {
            1: [StatModifier(StatsEnum.Health, 1, level_progression=1),
                StatModifier(StatsEnum.Charisma, -1, level_progression=2)],

            2: [StatModifier(StatsEnum.Dexterity, 1)]