import random

from procgen.aspects import Aspect
from procgen.species.aspects.aspect_categories import AspectCategory
from procgen.species.aspects.attribute_aspects import get_attribute_pair


def get_traits():
    n = random.randrange(1, 3)
    random.shuffle(traits)
    selected = traits[:1]
    major, minor = get_attribute_pair()
    selected.append(major)
    selected.append(minor)
    return selected

covering_traits = [
    Aspect(description='dense plates', categories={AspectCategory.COVERING}, naming=['plated', 'armored']),
    Aspect(description='spines', categories={AspectCategory.COVERING}, naming=['thorny', 'spined', 'spiney', 'quilled']),
    Aspect(description='insulating fur', categories={AspectCategory.COVERING}, naming=['hairy', 'furry', 'shaggy']),
    Aspect(description='blubberous', categories={AspectCategory.COVERING}),
    Aspect(description='reflective scales', categories={AspectCategory.COVERING}),
    Aspect(description='adaptive camouflage', categories={AspectCategory.COVERING}),
]

natural_weapon_traits = [
    Aspect(description='sharp claws', categories={AspectCategory.NATURAL_WEAPON}),
    Aspect(description='sharp fangs', categories={AspectCategory.NATURAL_WEAPON}),
    Aspect(description='stinging spines', categories={AspectCategory.NATURAL_WEAPON}),
    Aspect(description='stinger', categories={AspectCategory.NATURAL_WEAPON}, naming=['stinging']),
]

spell_like_abilities = [
    Aspect(description='firebreathing'),
    Aspect(description='frostbreathing'),
    Aspect(description='invisibility'),
    Aspect(description='teleport'),
    Aspect(description='lightning'),
    Aspect(description='telepathic'),
    Aspect(description='telekinetic'),
    Aspect(description='confusing spores'),
    Aspect(description='toxic spores'),
]

arboreal_trait = Aspect(description='arboreal', categories={AspectCategory.HABITAT}, naming=['climbing'])

habitats = [
    Aspect(description='aquatic', categories={AspectCategory.HABITAT}),
    Aspect(description='amphibious', categories={AspectCategory.HABITAT}),
    Aspect(description='subterranean', categories={AspectCategory.HABITAT}, naming=['burrowing', 'cavern']),
    arboreal_trait
]

traits = [
    Aspect(description='long life', categories={AspectCategory.LIFESPAN}, naming=['elder']),
    Aspect(description='short life', categories={AspectCategory.LIFESPAN}, naming=['fleeting']),
    Aspect(description='nomadic', categories={AspectCategory.NOMADISM}, naming=['wandering']),
    Aspect(description='sedentary', categories={AspectCategory.NOMADISM}),
    Aspect(description='glowing', naming=['glowing']),
    Aspect(description='night vision'),
    Aspect(description='keen smell'),
    Aspect(description='keen hearing'),
    Aspect(description='keen taste'),
    Aspect(description='giant', categories={AspectCategory.SIZE}),
    Aspect(description='small', categories={AspectCategory.SIZE}),
    Aspect(description='elongated', categories={AspectCategory.SIZE}),
    Aspect(description='horrifying'),
    Aspect(description='needs less water'),
    Aspect(description='carnivorous', categories={AspectCategory.DIET}),
    Aspect(description='herbivorous', categories={AspectCategory.DIET}),
    Aspect(description='scavenger', categories={AspectCategory.DIET}),
] + habitats + natural_weapon_traits + covering_traits + spell_like_abilities

