def _produce_abilities(record, level): abilities = AbilitiesPrototype() for ability_id in record.abilities: abilities.add(ability_id, level=1) abilities.randomized_mob_level_up( f.max_ability_points_number(level) - len(record.abilities)) return abilities
def create(cls, account): # pylint: disable=R0914 from the_tale.game.relations import GENDER, RACE from the_tale.game.actions.prototypes import ActionIdlenessPrototype from the_tale.game.logic_storage import LogicStorage start_place = places_storage.random_place() race = random.choice(RACE.records) gender = random.choice((GENDER.MASCULINE, GENDER.FEMININE)) current_turn_number = TimePrototype.get_current_turn_number() utg_name = names.generator.get_name(race, gender) hero = Hero.objects.create( created_at_turn=current_turn_number, saved_at_turn=current_turn_number, active_state_end_at=account.active_end_at, premium_state_end_at=account.premium_end_at, account=account._model, gender=gender, race=race, is_fast=account.is_fast, is_bot=account.is_bot, abilities=s11n.to_json(AbilitiesPrototype.create().serialize()), messages=s11n.to_json(messages.JournalContainer().serialize()), diary=s11n.to_json(messages.DiaryContainer().serialize()), settings_approved=False, next_spending=relations.ITEMS_OF_EXPENDITURE.BUYING_ARTIFACT, health=f.hp_on_lvl(1), energy=c.ANGEL_ENERGY_MAX, energy_bonus=heroes_settings.START_ENERGY_BONUS, pos_place=start_place._model, data=s11n.to_json({'name': utg_name.serialize()})) hero = cls(model=hero) HeroPreferencesPrototype.create( hero, energy_regeneration_type=hero.preferences.energy_regeneration_type, risk_level=relations.RISK_LEVEL.NORMAL, archetype=game_relations.ARCHETYPE.NEUTRAL, companion_dedication=relations.COMPANION_DEDICATION.NORMAL, companion_empathy=relations.COMPANION_EMPATHY.ORDINAL) return hero
def create(cls, account): # pylint: disable=R0914 from the_tale.game.relations import GENDER, RACE from the_tale.game.actions.prototypes import ActionIdlenessPrototype from the_tale.game.logic_storage import LogicStorage start_place = places_storage.random_place() race = random.choice(RACE.records) gender = random.choice((GENDER.MASCULINE, GENDER.FEMININE)) current_turn_number = TimePrototype.get_current_turn_number() utg_name = names.generator.get_name(race, gender) hero = Hero.objects.create(created_at_turn=current_turn_number, saved_at_turn=current_turn_number, active_state_end_at=account.active_end_at, premium_state_end_at=account.premium_end_at, account=account._model, gender=gender, race=race, is_fast=account.is_fast, is_bot=account.is_bot, abilities=s11n.to_json(AbilitiesPrototype.create().serialize()), messages=s11n.to_json(messages.JournalContainer().serialize()), diary=s11n.to_json(messages.DiaryContainer().serialize()), settings_approved=False, next_spending=relations.ITEMS_OF_EXPENDITURE.BUYING_ARTIFACT, health=f.hp_on_lvl(1), energy=c.ANGEL_ENERGY_MAX, energy_bonus=heroes_settings.START_ENERGY_BONUS, pos_place = start_place._model, data=s11n.to_json({'name': utg_name.serialize()})) hero = cls(model=hero) HeroPreferencesPrototype.create(hero, energy_regeneration_type=hero.preferences.energy_regeneration_type, risk_level=relations.RISK_LEVEL.NORMAL, archetype=game_relations.ARCHETYPE.NEUTRAL, companion_dedication=relations.COMPANION_DEDICATION.NORMAL, companion_empathy=relations.COMPANION_EMPATHY.ORDINAL) return hero
def _produce_abilities(record, level): abilities = AbilitiesPrototype() for ability_id in record.abilities: abilities.add(ability_id, level=1) abilities.randomized_mob_level_up(f.max_ability_points_number(level)-len(record.abilities)) return abilities