Esempio n. 1
0
def skill_equipped(p):
    ret = []
    if p.studying is not None:
        ret.append("【当前修炼】%s:%s(进度:%s/%s)" % (ui.rank(
            p.studying.belongs), ui.rank(p.studying), p.exp, p.studying.exp))
    else:
        ret.append(ui.colored("【当前修炼】无", color="grey", attrs=["bold"]))
    ret.append("")
    if p.running is not None:
        ret.append("【运行心法】%s" % ui.rank(p.running))
        isk_str = ui.inner_skill(p.running, p)
        for isk in isk_str:
            ret.append("            %s" % isk)
    else:
        ret.append(ui.colored("【运行心法】无", color="grey", attrs=["bold"]))
    ret.append("")
    str_list = [
        "一",
        "二",
        "三",
        "四",
        "五",
        "六",
        "七",
        "八",
        "九",
    ]
    asc_idx = 0
    for sk in p.skills_equipped:
        if sk is None:
            ret.append(
                ui.colored("【技能%s】无" % str_list[asc_idx],
                           color="grey",
                           attrs=["bold"]))
        else:
            comments = [ui.skill(sk)]
            for effe in sk.effects:
                comments.append(ui.effect(effe))
            ret.append("【技能%s】%s:%s" %
                       (str_list[asc_idx], ui.rank(sk.belongs), ui.rank(sk)))
            for c in comments:
                ret.append("          %s" % c)
        asc_idx += 1
    ret.append("")
    if p.skill_counter is not None:
        ret.append(
            "【辅助技能】%s:%s" %
            (ui.rank(p.skill_counter.belongs), ui.rank(p.skill_counter)))
        comments = [ui.skill(p.skill_counter)]
        for effe in p.skill_counter.effects:
            comments.append(ui.effect(effe))
        for c in comments:
            ret.append("            %s" % c)
    else:
        ret.append(ui.colored("【辅助技能】无", color="grey", attrs=["bold"]))
    return ret
Esempio n. 2
0
def handler_superskill_control(ctrl):
    if not ui.blankline():
        ui.echo()
    ui.superskill(ctrl.superskill)
    ui.echo()
    for idx, nd in enumerate(ctrl.superskill.nodes):
        comments = [nd.description]
        for nt in nd.tags:
            if nt.startswith("SKILL_"):
                sk = Skill.one(nt)
                if "Neigong" not in sk.style:
                    comments.append("%s" % ui.skill(sk))
                    for effe in sk.effects:
                        comments.append(ui.effect(effe))
                else:
                    for effe in sk.effects:
                        comments.append(ui.effect(effe.exertion))
        ui.echo(ui.colored("【%s】- " % (idx + 1) + nd.name, attrs=["bold"]))
        for c in comments:
            ui.echo("       " + c)
    ret = ui.menu([],
                  title=ctrl.title,
                  shownone=False,
                  goback=True,
                  backmethod=ctrl.close)
    return ret
Esempio n. 3
0
def skill_menu(person):
    smenu = []
    for sk in person.skills:
        sk_str = "%s:%s" % (ui.rank(sk.belongs), ui.rank(sk))
        comments = [ui.skill(sk)]
        for effe in sk.effects:
            comments.append(ui.effect(effe))
        smenu.append(ui.menuitem(sk_str, comments=comments, value=sk))
    return smenu
Esempio n. 4
0
def skill_menu(ctrl):
    smenu = []
    skills = ctrl.skills
    for sk, errormsg in skills:
        comments = [ui.skill(sk)]
        for effe in sk.effects:
            comments.append(ui.effect(effe))
        if errormsg is None:
            sk_str = "%s:%s" % (ui.rank(sk.belongs), ui.rank(sk))
            smenu.append(
                ui.menuitem(sk_str,
                            comments=comments,
                            value=sk,
                            goto=ctrl.select))
        else:
            sk_str = "%s:%s(%s)" % (sk.belongs.name, sk.name, errormsg)
            smenu.append(ui.menuitem(sk_str, validator=lambda x: False))
    return smenu
Esempio n. 5
0
def superskill_menu(ctrl):
    superskill = ctrl.superskill
    person = ctrl.person
    ret = []
    for idx, nd in enumerate(superskill.nodes):
        learn_sts = superskill.learn_status(person, idx)
        enable = True
        if learn_sts == -1:
            nd_str = nd.name + ui.nodecond(nd)
            enable = False
        elif learn_sts == 0:
            nd_str = nd.name + "(已习得)"
            enable = False
        elif nd == person.studying:
            nd_str = nd.name + "(修炼中)"
            enable = False
        else:
            nd_str = nd.name
        comments = [nd.description]
        grey = not enable
        for nt in nd.tags:
            if nt.startswith("SKILL_"):
                sk = Skill.one(nt)
                if "Neigong" not in sk.style:
                    comments.append(ui.skill(sk, grey=grey))
                    for effe in sk.effects:
                        comments.append(ui.effect(effe, grey=grey))
                else:
                    for effe in sk.effects:
                        comments.append(ui.effect(effe.exertion, grey=grey))
        if enable:
            ret.append(
                ui.menuitem(nd_str,
                            value=nd,
                            comments=comments,
                            goto=ctrl.select))
        else:
            ret.append(
                ui.menuitem(nd_str,
                            value=nd,
                            comments=comments,
                            validator=lambda x: False))
    return ret
Esempio n. 6
0
def skills(p):
    ret = []
    ret.append("【运行心法】")
    ret.append("")
    if p.running is None:
        ret.append("  无")
    else:
        ret.append("  " + ui.rank(p.running))
        #for isk_str in ui.inner_skill(p.running, p):
        #    ret.append("  %s" % isk_str)
        isk_str = ui.inner_skill(p.running, p)[0]
        ret.append("  %s" % isk_str)
    ret.append("")
    ret.append("【使用武学】")
    ret.append("")
    #str_list = ["一", "二", "三", "四", "五", "六", "七", "八", "九", ]
    for idx, sk in enumerate(p.skills):
        ret.append("  " + "%s:%s" % (ui.rank(sk.belongs), ui.rank(sk)))
        ret.append("  " + ui.skill(sk))
        for effe in sk.effects:
            ret.append("  " + ui.effect(effe))
    return ret