# Path: combat/enums.py
# class DamageType(Enum):
#     Blunt = 0
#     Slash = 1
#     Pierce = 2
# 
# 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: managers/echo.py
# class EchoService(object):
# class MessageVariables(Enum):
#     def __init__(self, console, game_context):
#     def combat_context_echo(self, message, attacker=None, defender=None,
#                             attacker_weapon=None, defender_weapon=None, defender_bodypart=None):
# def his_her_it(target, **kwargs):
# def him_her_it(target, **kwargs):
# def he_her_it(target, **kwargs):
# def name_or_you(target, **kwargs):
# 
# Path: util/check_roller.py
# def d20_check_roll(difficulty_class, modifiers=0, advantage=None):
# def roll_damage(dice_stacks, modifiers, critical=False):
# 
# Path: util/dice.py
# class DiceStack(object):
#     __slots__ = ['amount', 'dice']
# 
#     def __init__(self, amount, dice):
#         self.amount = amount
#         self.dice = dice
# 
# class Dice(object):
#     __slots__ = ['sides']
# 
#     def __init__(self, sides):
#         self.sides = sides


import abc
from combat.enums import DamageType
from stats.enums import StatsEnum
from managers import echo
from util import check_roller
from util.dice import DiceStack, Dice
from . import enums
        self.required_item_melee_damage_type = required_item_melee_damage_type

    def make_attack(self, attacker, defender, **kwargs):
        attacker_weapon = self.get_used_weapon(attacker)
        return super().make_attack(attacker, defender, attacker_weapon=attacker_weapon)

    def get_hit_bonus(self, attacker, **kwargs):
        # TODO Weapon could have bonuses to hit
        return super().get_hit_bonus(attacker, **kwargs)

    def get_damage_bonus(self, attacker, **kwargs):
        # TODO Weapon could have bonuses to damage
        return super().get_damage_bonus(attacker, **kwargs)

    def get_damage_dice(self, **kwargs):
        attacker_weapon = kwargs.get("attacker_weapon")
        return attacker_weapon.weapon.damage_dice

    def get_used_weapon(self, attacker):
        for wielded_item in attacker.equipment.get_wielded_items():
            weapon = wielded_item.get_component('weapon')
            if weapon.melee_damage_type == self.required_item_melee_damage_type:
                return wielded_item

    def get_damage_type(self, **kwargs):
        item = kwargs.get("attacker_weapon")
        if item.weapon:
            return item.weapon.melee_damage_type
        else:
            # TODO This indicates an improvised weapon. We'll need to get a better way to handle this.

# Path: combat/enums.py
# class DamageType(Enum):
#     Blunt = 0
#     Slash = 1
#     Pierce = 2
# 
# 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: managers/echo.py
# class EchoService(object):
# class MessageVariables(Enum):
#     def __init__(self, console, game_context):
#     def combat_context_echo(self, message, attacker=None, defender=None,
#                             attacker_weapon=None, defender_weapon=None, defender_bodypart=None):
# def his_her_it(target, **kwargs):
# def him_her_it(target, **kwargs):
# def he_her_it(target, **kwargs):
# def name_or_you(target, **kwargs):
# 
# Path: util/check_roller.py
# def d20_check_roll(difficulty_class, modifiers=0, advantage=None):
# def roll_damage(dice_stacks, modifiers, critical=False):
# 
# Path: util/dice.py
# class DiceStack(object):
#     __slots__ = ['amount', 'dice']
# 
#     def __init__(self, amount, dice):
#         self.amount = amount
#         self.dice = dice
# 
# class Dice(object):
#     __slots__ = ['sides']
# 
#     def __init__(self, sides):
#         self.sides = sides


# Path: combat/attack.py
import abc
from combat.enums import DamageType
from stats.enums import StatsEnum
from managers import echo
from util import check_roller
from util.dice import DiceStack, Dice
from . import enums

        self.required_item_melee_damage_type = required_item_melee_damage_type

    def make_attack(self, attacker, defender, **kwargs):
        attacker_weapon = self.get_used_weapon(attacker)
        return super().make_attack(attacker, defender, attacker_weapon=attacker_weapon)

    def get_hit_bonus(self, attacker, **kwargs):
        # TODO Weapon could have bonuses to hit
        return super().get_hit_bonus(attacker, **kwargs)

    def get_damage_bonus(self, attacker, **kwargs):
        # TODO Weapon could have bonuses to damage
        return super().get_damage_bonus(attacker, **kwargs)

    def get_damage_dice(self, **kwargs):
        attacker_weapon = kwargs.get("attacker_weapon")
        return attacker_weapon.weapon.damage_dice

    def get_used_weapon(self, attacker):
        for wielded_item in attacker.equipment.get_wielded_items():
            weapon = wielded_item.get_component('weapon')
            if weapon.melee_damage_type == self.required_item_melee_damage_type:
                return wielded_item

    def get_damage_type(self, **kwargs):
        item = kwargs.get("attacker_weapon")
        if item.weapon:
            return item.weapon.melee_damage_type
        else:
            # TODO This indicates an improvised weapon. We'll need to get a better way to handle this.

            return DamageType.Blunt