<commit_before>"""
These "weapons" are attacks, not weapons per se.
They are bound to a creature.

"""
from .melee import MeleeAttack

def equip_club(creature, ability_name: str = 'str'):
    return MeleeAttack(creature=creature,
                       name='club',
                       attack_roll=AttackRoll(name='club',
                                              ability_die=creature[ability_name],
                                              damage_dice=Dice(4, 0),
                                              modifier=0)
                       )<commit_msg>:beetle: added more to armory for issue #14<commit_after>"""
These "weapons" are attacks, not weapons per se.
They are bound to a creature.

The idea is that beyond the standard weapons more exotic ones can be added.
Finess is a quality that springs to mind.

TODO the standard weapons will be loaded from a JSON or a CSV file.
 for now, they are hardcoded here temporarily.

"""
from .action import Action
from .melee import MeleeAttack
from ..dice import AttackRoll, Dice
from .enums import AttackType
from typing import *
__all__ = ['equip_standard_weapon', 'weapons']

# todo make into json/csv
weapons = {'club': 4,
           'greatclub': 8,
           'dagger': 4,
           'shortsword': 6,
           'longsword': 8, 'bastardsword': 10, 'greatsword': 12,
           'rapier': 8, 'scimitar': 6, 'sickle': 4,
           'handaxe': 6, 'battleaxe': 8, 'waraxe': 10, 'greataxe': 12,
           'javelin': 6, 'spear': 6, 'flail': 8, 'glaive': 10, 'halberd': 10, 'lance': 12, 'pike': 10,
           'trident': 6,
           'war pick': 8,
           'lighthammer': 4, 'mace': 6, 'warhammer': 8,
           'quaterstaff': 6, 'morningstar': 8, 'punch': 1,
           'whip': 4}

# todo make into a class method once all set up
def equip_standard_weapon(creature,
                          weapon_name: str,
                          modifier:int=0) -> Action:
    """
    This creates the attack but does not add it to creature.actions
    """
    # ## determine if weapon is known
    if weapon_name not in weapon_name:
        raise ValueError(f'{weapon_name} does not appear in the list of weapons known. {list(weapons.keys())}')
    # ## get info
    # todo change:
    weapon_data = weapons[weapon_name]  # int now, Dict later!
    ability_name = 'str'
    damage = weapon_data
    print(damage)
    damage_dice = Dice(damage, 0)
    attack_roll = AttackRoll(name=weapon_name,
                             ability_die=creature[ability_name],
                             damage_dice=damage_dice,
                             modifier=modifier
                             )
    # ## determine weapon type
    # todo for now, everything is a melee weapon.
    attack_type = AttackType.melee
    if attack_type == AttackType.melee:
        SpecificAttack = MeleeAttack
    else:
        raise NotImplementedError('Ranged etc. attacks are made yet.')
    return SpecificAttack(creature=creature,
                          name=weapon_name,
                          attack_roll=attack_roll
                            )

{'fraction_non_alphanumeric': 0.09857789269553975, 'fraction_numerical': 0.014544279250161603, 'mean_word_length': 1.9674017257909875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4124726', 'n_tokens_mistral': 957, 'n_tokens_neox': 892, 'n_words': 288}