def main_play(): global tgroup, tworld, tscene game.clr_cmd() game.pline() string = game.align('剧情进度:', 14) + lib.value_bar(tworld.当前进度, tworld.data['剧情容量']) string += game.align('下一剧情:' + tscene.名称, 30, 'right') game.pl(string) for p in tgroup.所有人物: prefix = p.姓名 + '|体力:' prefix = game.align(prefix, 14) game.pl(prefix + lib.value_bar(p.当前体力, p.体力上限)) string = '----------------------------------' + '设置剧情 ' + ': ' + tscene.名称 + ' --------------------------------' game.pl(string, style='title') game.call_event('设置剧情_' + tscene.名称, arg=(tscene.data, )) string = '---------------------------------------------------------------------------------------' game.pl(string, style='title') def begin_scene(): global tscene game.call_event('进行剧情_' + tworld.当前剧情['名称'], arg=(tgroup, tworld, tscene)) tworld.下一剧情() if tworld.当前进度 <= tworld.data['剧情容量']: tscene = Target_scene(tworld.当前剧情) main_play() if tworld.当前进度 <= tworld.data['剧情容量']: game.pcmd('[100] 开始剧情', 100, begin_scene) else: game.p('[100] 开始剧情', style='grey') game.pl() game.pcmd('[999] 结束试炼', 999, main_func)
def main_func(): # 新界面准备 game.clr_cmd() game.pline() # 画图 draw_map() def create_func(direction_name): def func(): global direction direction = direction_name next_step() return func # 状态显示 game.pline('--') game.pl('分数:') # 绘制命令按钮 game.pline('--') game.pcmd('[1] 左 ', 1, create_func('zuo')) game.pcmd('[2] 上 ', 2, create_func('shang')) game.pcmd('[3] 右 ', 3, create_func('you')) game.pl() game.p(' ') game.pcmd('[4] 下 ', 4, create_func('xia')) game.pl('\n') game.pcmd('[5] 存储游戏 ', 5, lib.save_func, arg=main_func) game.pcmd('[6] 读取游戏 ', 6, lib.load_func, arg=(main_func, main_func))
def create_group(): tpl = {} game.p('请输入队伍名称:', style='notice') name = game.askfor_str() tpl['队伍名称'] = name tpl['ID'] = lib.get_id() tpl['队伍队员'] = [] for i in range(0, 6): tpl['队伍队员'].append({}) game.data['队伍列表'].append(tpl) group_manager()
def play_config(): game.clr_cmd() game.pline() display_traget() game.pline('--') game.pcmd('[001] 改变试炼队伍', 1, change_target_group) game.p(' ') game.pcmd('[002] 改变试炼世界', 2, change_target_world) game.pl() game.pcmd('[099] 退出管理', 99, main_func) game.askfor_order()
def main_func(): game.clr_cmd() game.pl() game.pline() game.pl('主神名称:' + game.data['主神名称']) import script.play_cfg script.play_cfg.display_traget() game.pline('--') import script.play game.pcmd('[101] 开始试炼', 101, script.play.init_play) game.p(' ') import script.play_cfg game.pcmd('[102] 试炼设置', 102, script.play_cfg.play_config) game.pl() import script.people game.pcmd('[103] 人物管理', 103, script.people.people_manager) game.p(' ') import script.group game.pcmd('[104] 队伍管理', 104, script.group.group_manager) game.p(' ') import script.world game.pcmd('[105] 世界管理', 105, script.world.world_manager) game.pl() game.pcmd('[111] 保存游戏', 111, lib.save_func, arg=(main_func, )) game.p(' ') game.pcmd('[112] 读取游戏', 112, lib.load_func, arg=(main_func, main_func))
def group_control(g): import script.people game.clr_cmd() game.pline() string = '----------------------------------' + '队伍配置' + '---------------------------------------------' game.pl(string, style='title') string = '队伍名称: ' + g['队伍名称'] game.pl(string) for i in range(0, 6): def add_people_here(people, i=i): clean_people(people) add_people_to_group(g, people, i) group_control(g) def cancel_people_here(i=i): g['队伍队员'][i] = {} group_control(g) num_cmd = (i + 1) * 10 game.pcmd('[0' + str(i + 1) + '1]设置', num_cmd + 1, script.people.dispaly_people_list, arg=add_people_here) game.p(' ') game.pcmd('[0' + str(i + 1) + '2]清空', num_cmd + 2, cancel_people_here) string = ' 队员 ' + str(i + 1) + ': ' if g['队伍队员'][i] == {}: string += '无' else: string += g['队伍队员'][i]['姓名'] game.p(string + '\n') string = '---------------------------------------------------------------------------------------' game.pl(string, style='title') def add_people(people): clean_people(people) add_people_to_group(g, people) group_control(g) game.pcmd('[001] 添加队员', 1, script.people.dispaly_people_list, arg=add_people) game.pl() game.pcmd('[099] 返回列表', 99, group_manager) game.askfor_order()
def draw_map(): map_size = game.data['map']['map_size'] snake_list = game.data['snake_list'] mapdata = game.data['mapdata'] for y in range(0, map_size): for x in range(0, map_size): pos = (x, y) if pos in snake_list: game.p('❖', style='special') continue if mapdata[pos] == 1: game.p('❁') continue if mapdata[pos] == 0: game.p('﹒') continue game.pl()
def 设置剧情_赤手蠢贼(tpl): game.p('难度设置:') def set(x): tpl['难度']=x lib.list_nums([1,3,5,7,9],set , tpl['难度'])
def test(): import math game.p(math.exp(3)) return