def init_character(character_id: int, character_tem: game_type.NpcTem): """ 按id生成角色属性 Keyword arguments: character_id -- 角色id character_tem -- 角色生成模板数据 """ now_character = game_type.Character() now_character.name = character_tem.Name now_character.sex = character_tem.Sex if character_tem.MotherTongue != "": now_character.mother_tongue = character_tem.MotherTongue if character_tem.Age != "": now_character.age = attr_calculation.get_age(character_tem.Age) if character_tem.Weight != "": now_character.weigt_tem = character_tem.Weight if character_tem.SexExperienceTem != "": if character_tem.SexExperienceTem != "Rand": now_character.sex_experience_tem = character_tem.SexExperienceTem else: now_character.sex_experience_tem = get_rand_npc_sex_experience_tem( now_character.age, now_character.sex) if character_tem.BodyFat: now_character.bodyfat_tem = character_tem.BodyFat else: now_character.bodyfat_tem = now_character.weigt_tem if character_tem.Chest: now_character.chest_tem = character_tem.Chest character.init_attr(now_character) cache_contorl.character_data[character_id] = now_character
def creator_character_panel(): """ 创建角色面板 """ cache.character_data[0] = game_type.Character() character_handle.init_character_list() while 1: if input_name_panel(): character.init_attr(0) game_start() if confirm_character_attr_panel(): break cache.now_panel_id = constant.Panel.GET_UP
def attribute_generation_branch_func(): """ 询问玩家是否需要详细设置属性流程 输入0:进入询问玩家年龄段流程 输入1:进入属性最终确认流程(使用基础模板生成玩家属性) 输入2:返回请求输入性别流程 """ flow_return = creator_character_panel.attribute_generation_branch_panel() if flow_return == 0: py_cmd.clr_cmd() detailed_setting_func_1() elif flow_return == 1: py_cmd.clr_cmd() character.init_attr(cache_contorl.character_data[0]) cache_contorl.now_flow_id = "acknowledgment_attribute" elif flow_return == 2: py_cmd.clr_cmd() input_sex_confirm_func()
def enter_character_nature_func(): """ 请求玩家确认性格流程 """ character.init_attr(cache_contorl.character_data[0]) while 1: py_cmd.clr_cmd() creator_character_panel.enter_character_nature_head() input_s = see_nature_panel.see_character_nature_change_panel(0) input_s += creator_character_panel.enter_character_nature_end() yrn = game_init.askfor_all(input_s) if yrn in cache_contorl.character_data[0].nature: if cache_contorl.character_data[0].nature[yrn] < 50: cache_contorl.character_data[0].nature[yrn] = random.uniform( 50, 100) else: cache_contorl.character_data[0].nature[yrn] = random.uniform( 0, 50) elif int(yrn) == 0: character.init_attr(cache_contorl.character_data[0]) cache_contorl.now_flow_id = "acknowledgment_attribute" break elif int(yrn) == 1: cache_contorl.character_data[0].nature = nature.get_random_nature()