Esempio n. 1
0
def create_character(race, kit, model, action_factory, rng):
    """
    Creates a new character with given race and kit
    """
    global race_stats
    global kit_stats
    global __logger

    if race_stats == None:
        initialise_stat_tables()

    temp_race = race_stats[race]
    temp_kit = kit_stats[kit]

    new_character = Character(model,
                              action_factory,
                              EffectsCollection(),
                              rng)
    new_character.body = temp_race['body'] + temp_kit['body']
    new_character.finesse = temp_race['finesse'] + temp_kit['finesse']
    new_character.mind = temp_race['mind'] + temp_kit['mind']
    new_character.hit_points = temp_race['hp'] + temp_kit['hp']
    new_character.max_hp = new_character.hit_points
    new_character.speed = temp_race['speed'] + temp_kit['speed']
    new_character.size = 'medium'
    new_character.attack = 3

    new_character.feats.append(WeaponProficiency('simple'))
    new_character.icon = herculeum.config.tiles.HUMAN_FIGHTER

    return new_character
Esempio n. 2
0
    def generate_creature(self, name):
        """
        Generate creature

        :param name: name of the creature to generate
        :type name: string
        """
        config = self.__get_creature_config(name)

        new_creature = Character(self.model,
                                 self.action_factory,
                                 EffectsCollection(),
                                 self.rng)

        new_creature.name = config.name
        new_creature.body = config.body
        new_creature.finesse = config.finesse
        new_creature.mind = config.mind
        new_creature.hit_points = config.hp
        new_creature.speed = config.speed
        new_creature.icon = config.icons #TODO: pick random
        new_creature.attack = config.attack

        for spec in config.effect_handles:
            new_handle = EffectHandle(trigger = spec.trigger,
                                       effect = spec.effect,
                                       parameters = spec.parameters,
                                       charges = spec.charges)

            new_creature.add_effect_handle(new_handle)

        if not config.ai == None:
            new_creature.artificial_intelligence = config.ai(new_creature)

        return new_creature