Example #1
0
def handler_battle_skill_scope(ac):
    map = ac.battle.map
    if ac.type == SkillType.Counter:
        ui.echo()
        ui.echo("%s发动反击!" % ac.subject.name)
        ui.echo()
        ui.read("(回车继续)")
    if ac.battle.current != ac.subject or not ac.battle.controllable():
        ui.echo()
        ui.echo("%s使出" % ac.subject.name + ui.rank(ac.skill.belongs, txt="【%s】" % ac.skill.belongs.name) + \
                "中的一式" + ui.rank(ac.skill, txt="【%s】" % ac.skill.name))
        ui.echo()
        if ac.type != SkillType.Counter and ac.battle.current != ac.subject:
            ui.read("(回车继续)")
        ui.map(map,
               entities=battle_person_handler(ac.snapshot),
               coordinates=[{
                   "positions": ac.scope,
                   "color": "yellow"
               }],
               show_trace=False)
        #ui.echo()
        #ui.echo("%s使出" % ac.subject.name + ui.rank(ac.skill.belongs, txt="【%s】" % ac.skill.belongs.name) + \
        #        "中的一式" + ui.rank(ac.skill, txt="【%s】" % ac.skill.name))
        ui.echo()
        ui.read("(回车继续)")
Example #2
0
def handler_battle_skill(ac):
    map = ac.battle.map
    if len(ac.objects) == 0:
        ui.echo()
        ui.echo("攻击范围内无目标!")
        ui.read()
    elif ac.critical:
        if not ui.blankline():
            ui.echo()
        criticaltxt = ac.subject.criticaltxt
        if criticaltxt is None:
            criticaltxt = "接我这招!"
        ui.echo(
            ui.colored("%s:%s" % (ac.subject.name, criticaltxt),
                       color="yellow",
                       attrs=["bold"]))
        ui.read()
    for obj in ac.anti_list:
        if not ui.blankline():
            ui.echo()
        antitxt = "可惜,这一招已经被我看破了!"
        ui.echo(
            ui.colored("%s:%s" % (obj.name, antitxt),
                       color="yellow",
                       attrs=["bold"]))
        ui.read()
    ui.echo()
    ui.map(map, entities=battle_person_handler(ac.snapshot, show_events=True))
    ui.echo()
    ui.read("(回车继续)")
Example #3
0
def handler_battle_finish_turn(ac):
    map = ac.battle.map
    if not ui.blankline():
        ui.echo()
    ui.map(map, entities=battle_person_handler(ac.snapshot, show_events=True))
    ui.echo()
    ui.read("(回车继续)")
Example #4
0
def handler_world_scenario_change_ensure(ctx):
    target = ctx.team.scenario.transport_locs[ctx.team.location]
    target = Map.one(target).name
    map = ctx.team.scenario
    ui.map(map, entities=team_info(map), show_trace=True)
    ui.echo()
    ret = ui.sure("当前地块可通往%s,是否前往?" % target)
    return ret
Example #5
0
def handler_battle_item(ac):
    map = ac.battle.map
    if len(ac.objects) == 0:
        ui.echo()
        ui.echo("使用范围内无目标!")
    ui.echo()
    ui.map(map, entities=battle_person_handler(ac.snapshot, show_events=True))
    ui.echo()
    ui.read("(回车继续)")
Example #6
0
def handler_world_clash(ctx):
    map = ctx.map
    ui.echo()
    ui.map(map, entities=team_info(ctx.map), show_trace=True)
    ui.echo()
    ui.warn("移动过程中发生路径冲突,移动已中断!")
    ui.echo()
    ui.read("(回车继续)")
    ui.menu(world_menu(ctx.subject), title="请选择你的行动方针:", columns=5, width=15)
Example #7
0
def handler_world_player(ctx):
    map = ctx.map
    ui.cleanmenu()
    recenter(ctx.subject)
    if not ui.blankline():
        ui.echo()
    ui.echo("当前回合:%s" % context.timestamp)
    ui.echo()
    ui.map(map, entities=team_info(ctx.map), show_trace=True)
    ui.menu(world_menu(ctx.subject), title="请选择你的行动方针:", columns=5, width=15)
Example #8
0
def handler_battle_player(ac):
    map = ac.battle.map
    if ac.back:
        ui.echo()
        ui.map(map, entities=battle_person_handler(ac.snapshot))
    ui.cleanmenu()
    ui.menu(battle_menu(),
            title="请选择%s的行动方针:" % ac.battle.current.name,
            columns=2,
            width=15)
Example #9
0
def handler_battle_new_turn(ac):
    map = ac.battle.map
    map.window_center(ac.snapshot[ac.battle.current.id]["location"])
    if not ui.blankline():
        ui.echo()
    ui.map(map, entities=battle_person_handler(ac.snapshot, show_events=True))
    ui.echo()
    ui.echo("轮到%s行动。" % ac.battle.current.name)
    ui.echo()
    ui.read("(回车继续)")
Example #10
0
def handler_battle_control(ctrl):
    map = ctrl.battle.map
    if not ui.blankline():
        ui.echo()
    ui.map(map, entities=battle_person_handler(ctrl.snapshot))
    ui.cleanmenu()
    ui.menu(battle_menu(ctrl),
            title="请选择%s的行动方针:" % ctrl.battle.current.name,
            macros=ctrl.macs,
            columns=2,
            width=15)
Example #11
0
def handler_battle_move(ac):
    map = ac.battle.map
    map.window_center(ac.snapshot[ac.battle.current.id]["location"])
    if not ac.motivated or (not ac.battle.controllable() and len(ac.path) > 1):
        ui.echo()
        ui.map(map,
               entities=battle_person_handler(ac.snapshot, show_events=True))
        ui.echo()
        ui.echo("%s移动至%s。" % (ac.subject.name, ac.target))
        ui.echo()
        ui.read("(回车继续)")
Example #12
0
def handler_battle_start(ac):
    map = ac.battle.map
    if not ui.blankline():
        ui.echo()
    ui.warn("战斗开始!")
    ui.echo()
    ui.read("(回车继续)")
    ui.echo()
    ui.map(map, entities=battle_person_handler(ac.snapshot))
    ui.echo()
    ui.read("(回车继续)")
Example #13
0
def handler_map_camera_control(ctrl):
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入镜头需要移动至的坐标(x与y用空格分隔):",
                  handler=lambda x: validate_position(x, ctrl.map))
    ctrl.input(ret)
Example #14
0
def handler_map_erase_control(ctrl):
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入需要添加地形的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input(ret)
Example #15
0
def handler_world_build_position(ctx):
    map = ctx.map
    ui.echo()
    ui.map(map,
           entities=team_info(ctx.map),
           coordinates=ctx.positions,
           coordinate_color="green",
           show_trace=False)
    ui.echo()
    rt = ui.read("请输入你想要建设的格子(绿色表示可建设范围,坐标用空格分隔,输入#back可返回):",
                 handler=lambda x: validate_position(x, ctx.positions, True))
    return rt
Example #16
0
def handler_battle_scope_control(ctrl):
    map = ctrl.battle.map
    ui.echo()
    ui.map(map,
           entities=battle_person_handler(ctrl.snapshot),
           coordinates=[{
               "positions": ctrl.scope,
               "color": "yellow"
           }],
           show_trace=False)
    ui.echo()
    rt = ui.sure("黄色为作用范围,是否确认")
    ctrl.input(rt)
Example #17
0
def handler_map_person_control(ctrl):
    ui.echo()
    person = ui.read("请输入需要添加人物的模板号:")
    ui.echo()
    if not person.startswith("PERSON"):
        return None
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    loc = ui.read("请输入需要添加地形的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input((person, loc))
Example #18
0
def handler_battle_item_scope(ac):
    map = ac.battle.map
    if ac.battle.current != ac.subject or not ac.battle.controllable():
        ui.echo()
        ui.map(map,
               entities=battle_person_handler(ac.snapshot),
               coordinates=[{
                   "positions": ac.scope,
                   "color": "yellow"
               }],
               show_trace=False)
        ui.echo()
        fstr = "%s使用了物品" % ac.subject.name
        ui.echo(fstr + ui.colored(ui.rank(ac.item, txt="【%s】" % ac.item.name)))
        ui.echo()
        ui.read("(回车继续)")
Example #19
0
def handler_map_element_control(ctrl):
    if not ui.blankline():
        ui.echo()
    ret = ui.read("输入你想要设置的实体名称:")
    ctrl.elename(ret)
    ui.menu(element_menu(ctrl), goback=True, backmethod=ctrl.close)
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入需要添加元素的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input(ret)
Example #20
0
def handler_map_editor_control(ctrl):
    if not ui.blankline():
        ui.echo()
    if ctrl.show_coordinates:
        ui.map(map=ctrl.map,
               coordinates=[{
                   "positions": ctrl.map.all(),
                   "real": ctrl.real_coordinates
               }],
               entities=entity_info(ctrl.map))
    else:
        ui.map(map=ctrl.map, entities=entity_info(ctrl.map))
    if ctrl.real_coordinates:
        ctrl.real_coordinates = False
        ctrl.show_coordinates = False
    ui.echo()
    ret = ui.menu(editor_menu(ctrl), title="请选择你要进行的操作:", columns=2, width=15)
    return ret
Example #21
0
def handler_world_give_position(ctx):
    map = ctx.map
    ui.echo()
    ui.map(map,
           entities=team_info(ctx.map),
           coordinates=ctx.positions,
           coordinate_color="green",
           show_trace=False)
    ui.echo()
    while True:
        rt = ui.read(
            "请输入你想要赠予的对象坐标(绿色表示可赠予范围,坐标用空格分隔,输入#back可返回):",
            handler=lambda x: validate_position(x, ctx.positions, True))
        if rt is not None and rt not in map.loc_entity:
            ui.warn("该坐标下无可赠予对象!")
        else:
            break
        ui.echo()
    return rt
Example #22
0
def handler_map_terran_control(ctrl):
    ui.menu(terran_menu(ctrl),
            keylist=[chr(i) for i in range(ord('a'),
                                           ord('a') + 26)],
            columns=6,
            width=15,
            pagesize=26,
            goback=True,
            backmethod=ctrl.close)
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入需要添加地形的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input(ret)
Example #23
0
def handler_battle_pos_select_control(ctrl):
    map = ctrl.battle.map
    ui.echo()
    ui.map(map,
           entities=battle_person_handler(ctrl.snapshot),
           coordinates=[{
               "positions": ctrl.positions,
               "color": "green"
           }],
           show_trace=False)
    ui.echo()
    rt = ui.read("%s(绿色表示可移动格子,坐标用空格分隔,输入#back可返回):" % ctrl.text,
                 handler=ctrl.validator)
    ui.echo()
    if ctrl.ensure:
        surert = ui.sure(ctrl.ensure_text)
        if not surert:
            rt = None
    ctrl.select(rt)
Example #24
0
def handler_scenario_control(ctrl):
    scenario = ctrl.scenario
    ui.cleanmenu()
    recenter(ctrl.team)
    if not ui.blankline():
        ui.echo()
    ui.echo("当前回合:%s" % context.timestamp)
    ui.echo()
    ui.map(scenario,
           entities=team_info(ctrl),
           coordinates=[{
               "positions": context.guide,
               "color": "yellow"
           }],
           show_trace=True)
    ui.menu(world_menu(ctrl),
            title="请选择你的行动方针:",
            macros=ctrl.macs,
            columns=4,
            width=15)
Example #25
0
def handler_pos_select_control(ctrl):
    map = ctrl.scenario
    ui.echo()
    ui.map(map,
           entities=team_info(ctrl),
           coordinates=[{
               "positions": ctrl.positions
           }, {
               "positions": context.guide,
               "color": "yellow"
           }],
           show_trace=False)
    ui.echo()
    rt = ui.read("%s(绿色表示可用格子,坐标用空格分隔,输入#back可返回):" % ctrl.text,
                 handler=ctrl.validator)
    ui.echo()
    if ctrl.ensure:
        surert = ui.sure(ctrl.ensure_text)
        if not surert:
            rt = None
    ctrl.select(rt)
Example #26
0
def handler_battle_map_control(ctrl):
    map = ctrl.battle.map
    if not ui.blankline():
        ui.echo()
    ui.map(map, entities=battle_person_handler(ctrl.snapshot))
Example #27
0
def handler_rest_control(ctrl):
    ui.echo()
    ui.map(ctrl.team.scenario, entities=team_info(ctrl), show_trace=True)
    ui.echo()
    ret = ui.sure("你已经休息过了一段时间,是否继续休息?")
    ctrl.input(ret)
Example #28
0
def handler_world_rest(ctx):
    ui.echo()
    ui.map(ctx.map, entities=team_info(ctx.map), show_trace=True)
    ui.echo()
    ret = ui.sure("你已经休息过了一段时间,是否继续休息?")
    return ret
Example #29
0
def handler_world_map(ctrl):
    ui.echo()
    ui.map(ctrl.map, entities=team_info(ctrl), show_trace=ctrl.show_trace)
    ui.echo()
    ui.read("(回车继续)")
    ui.echo()
Example #30
0
def handler_scenario_change_control(ctrl):
    map = ctrl.team.scenario
    ui.map(map, entities=team_info(ctrl), show_trace=True)
    ui.echo()
    ret = ui.sure(ctrl.text)
    ctrl.input(ret)