• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python functions.get_all_players函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中src.functions.get_all_players函数的典型用法代码示例。如果您正苦于以下问题:Python get_all_players函数的具体用法?Python get_all_players怎么用?Python get_all_players使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_all_players函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: hvisit

def hvisit(var, wrapper, message):
    """Entrance a player, converting them to your team."""
    if VISITED.get(wrapper.source):
        wrapper.send(messages["succubus_already_visited"].format(VISITED[wrapper.source]))
        return

    target = get_target(var, wrapper, re.split(" +", message)[0], not_self_message="succubus_not_self")
    if not target:
        return

    target = try_misdirection(var, wrapper.source, target)
    if try_exchange(var, wrapper.source, target):
        return

    VISITED[wrapper.source] = target
    PASSED.discard(wrapper.source)

    if target not in get_all_players(("succubus",)):
        ENTRANCED.add(target)
        wrapper.send(messages["succubus_target_success"].format(target))
    else:
        wrapper.send(messages["harlot_success"].format(target))

    if wrapper.source is not target:
        if target not in get_all_players(("succubus",)):
            target.send(messages["notify_succubus_target"].format(wrapper.source))
        else:
            target.send(messages["harlot_success"].format(wrapper.source))

        revt = Event("succubus_visit", {})
        revt.dispatch(var, wrapper.source, target)

    debuglog("{0} (succubus) VISIT: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
开发者ID:lykoss,项目名称:lykos,代码行数:33,代码来源:succubus.py


示例2: curse

def curse(var, wrapper, message):
    target = get_target(var, wrapper, re.split(" +", message)[0])
    if not target:
        return

    if target in get_all_players(("cursed villager",)):
        wrapper.pm(messages["target_already_cursed"].format(target))
        return

    # There may actually be valid strategy in cursing other wolfteam members,
    # but for now it is not allowed. If someone seems suspicious and shows as
    # villager across multiple nights, safes can use that as a tell that the
    # person is likely wolf-aligned.
    if is_known_wolf_ally(var, wrapper.source, target):
        wrapper.pm(messages["no_curse_wolf"])
        return

    orig = target
    target = try_misdirection(var, wrapper.source, target)
    if try_exchange(var, wrapper.source, target):
        return

    CURSED[wrapper.source] = target
    PASSED.discard(wrapper.source)

    wrapper.pm(messages["curse_success"].format(orig))
    send_wolfchat_message(var, wrapper.source, messages["curse_success_wolfchat"].format(wrapper.source, orig), {"warlock"}, role="warlock", command="curse")

    debuglog("{0} (warlock) CURSE: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
开发者ID:lykoss,项目名称:lykos,代码行数:29,代码来源:warlock.py


示例3: on_transition_night_end

 def on_transition_night_end(evt, var):
     for gunner in get_all_players((rolename,)):
         if GUNNERS[gunner]:
             if gunner.prefers_simple(): # gunner and sharpshooter share the same key for simple
                 gunner.send(messages["gunner_simple"].format(rolename, GUNNERS[gunner], "s" if GUNNERS[gunner] > 1 else ""))
             else:
                 gunner.send(messages["{0}_notify".format(rolename)].format(botconfig.CMD_CHAR, GUNNERS[gunner], "s" if GUNNERS[gunner] > 1 else ""))
开发者ID:lykoss,项目名称:lykos,代码行数:7,代码来源:gunners.py


示例4: on_transition_night_end

def on_transition_night_end(evt, var):
    for monster in get_all_players(("monster",)):
        add_protection(var, monster, protector=None, protector_role="monster", scope=Wolf)
        if monster.prefers_simple():
            monster.send(messages["monster_simple"])
        else:
            monster.send(messages["monster_notify"])
开发者ID:lykoss,项目名称:lykos,代码行数:7,代码来源:monster.py


示例5: on_transition_night_end

    def on_transition_night_end(evt, var):
        pl = set()
        ctr = Counter()

        for t in types:
            cat = cats.get(t)
            players = get_players(cat)
            pl.update(players)
            ctr[t] += len(players)

        values = []
        plural = True
        for name in types:
            keyname = "mystic_" + name.lower().replace(" ", "_")
            l = ctr[name]
            if l:
                if not values and l == 1:
                    plural = False
            else:
                l = "no"
            values.append("\u0002{0}\u0002 {1}{2}".format(l, messages[keyname], "" if l == 1 else "s"))

        if len(values) > 2:
            value = " and ".join((", ".join(values[:-1]), values[-1]))
        else:
            value = " and ".join(values)
        msg = messages["mystic_info"].format("are" if plural else "is", value, " still", "")

        for mystic in get_all_players((rolename,)):
            LAST_COUNT[mystic] = (value, plural)
            if send_role:
                to_send = "{0}_{1}".format(role, ("simple" if mystic.prefers_simple() else "notify"))
                mystic.send(messages[to_send])
            mystic.send(msg)
开发者ID:lykoss,项目名称:lykos,代码行数:34,代码来源:mystics.py


示例6: on_myrole

def on_myrole(evt, var, user):
    if user in get_all_players(("minion",)):
        wolves = []
        for wolfrole in Wolf:
            for player in var.ORIGINAL_ROLES[wolfrole]:
                wolves.append(player.nick)
        evt.data["messages"].append(messages["original_wolves"].format(", ".join(wolves)))
开发者ID:lykoss,项目名称:lykos,代码行数:7,代码来源:minion.py


示例7: on_gun_chances

def on_gun_chances(evt, var, user, role):
    if role != "sharpshooter" and user in get_all_players(("village drunk",)):
        hit, miss, headshot = var.DRUNK_GUN_CHANCES
        evt.data["hit"] = hit
        evt.data["miss"] = miss
        evt.data["headshot"] = headshot
        evt.stop_processing = True
开发者ID:lykoss,项目名称:lykos,代码行数:7,代码来源:villagedrunk.py


示例8: on_assassin_target

def on_assassin_target(evt, var, assassin, players):
    if evt.data["target"] is None and assassin in get_all_players(("village drunk",)):
        evt.data["target"] = random.choice(players)
        message = messages["drunken_assassin_notification"].format(evt.data["target"])
        if not assassin.prefers_simple():
            message += messages["assassin_info"]
        assassin.send(message)
开发者ID:lykoss,项目名称:lykos,代码行数:7,代码来源:villagedrunk.py


示例9: on_transition_night_end

def on_transition_night_end(evt, var):
    if get_all_players(("doomsayer",)):
        status.add_lycanthropy_scope(var, All) # any role can transform if ds is in play
    for lycan in LYCANS.values():
        status.add_lycanthropy(var, lycan)

    LYCANS.clear()
    SICK.clear()
开发者ID:lykoss,项目名称:lykos,代码行数:8,代码来源:doomsayer.py


示例10: on_transition_night_end

def on_transition_night_end(evt, var):
    for blessed in get_all_players(("blessed villager",)):
        status.add_protection(var, blessed, blessed, "blessed villager")
        if var.NIGHT_COUNT == 1 or var.ALWAYS_PM_ROLE:
            to_send = "blessed_notify"
            if blessed.prefers_simple():
                to_send = "blessed_simple"
            blessed.send(messages[to_send])
开发者ID:lykoss,项目名称:lykos,代码行数:8,代码来源:blessed.py


示例11: on_transition_day_begin

def on_transition_day_begin(evt, var):
    pl = get_players()
    for mm in get_all_players(("matchmaker",)):
        if mm not in MATCHMAKERS:
            lovers = random.sample(pl, 2)
            MATCHMAKERS.add(mm)
            _set_lovers(*lovers)
            mm.send(messages["random_matchmaker"])
开发者ID:lykoss,项目名称:lykos,代码行数:8,代码来源:matchmaker.py


示例12: on_transition_night_end

def on_transition_night_end(evt, var):
    if not ENABLED:
        return
    can_bite = get_all_players(("alpha wolf",)) - ALPHAS
    if can_bite:
        for alpha in can_bite:
            alpha.queue_message(messages["wolf_bite"])
        alpha.send_messages()
开发者ID:lykoss,项目名称:lykos,代码行数:8,代码来源:alphawolf.py


示例13: on_get_role_metadata

def on_get_role_metadata(evt, var, kind):
    if kind == "night_kills" and ENABLED:
        # biting someone has a chance of killing them instead of turning
        # and it can be guarded against, so it's close enough to a kill by that measure
        can_bite = get_all_players(("alpha wolf",)) - ALPHAS
        evt.data["alpha wolf"] = len(can_bite)
    elif kind == "role_categories":
        evt.data["alpha wolf"] = {"Wolf", "Wolfchat", "Wolfteam", "Killer", "Nocturnal"}
开发者ID:lykoss,项目名称:lykos,代码行数:8,代码来源:alphawolf.py


示例14: on_transition_night_end

def on_transition_night_end(evt, var):
    for harlot in get_all_players(("harlot",)):
        pl = get_players()
        random.shuffle(pl)
        pl.remove(harlot)
        to_send = "harlot_info"
        if harlot.prefers_simple():
            to_send = "harlot_simple"
        harlot.send(messages[to_send], messages["players_list"].format(", ".join(p.nick for p in pl)), sep="\n")
开发者ID:lykoss,项目名称:lykos,代码行数:9,代码来源:harlot.py


示例15: on_transition_night_end

def on_transition_night_end(evt, var):
    wolves = get_players(get_wolfchat_roles(var))
    for child in get_all_players(("wild child",)):
        if child in wolves:
            continue
        if child.prefers_simple():
            child.send(messages["wild_child_simple"])
        else:
            child.send(messages["wild_child_notify"])
开发者ID:lykoss,项目名称:lykos,代码行数:9,代码来源:wildchild.py


示例16: on_transition_night_end

def on_transition_night_end(evt, var):
    for ms in get_all_players(("mad scientist",)):
        pl = get_players()
        target1, target2 = _get_targets(var, pl, ms)

        to_send = "mad_scientist_notify"
        if ms.prefers_simple():
            to_send = "mad_scientist_simple"
        ms.send(messages[to_send].format(target1, target2))
开发者ID:lykoss,项目名称:lykos,代码行数:9,代码来源:madscientist.py


示例17: on_transition_night_end

def on_transition_night_end(evt, var):
    lycans = get_all_players(("lycan",))
    if lycans:
        add_lycanthropy_scope(var, {"lycan"})
    for lycan in lycans:
        add_lycanthropy(var, lycan)
        if lycan.prefers_simple():
            lycan.send(messages["lycan_simple"])
        else:
            lycan.send(messages["lycan_notify"])
开发者ID:lykoss,项目名称:lykos,代码行数:10,代码来源:lycan.py


示例18: on_transition_night_begin

def on_transition_night_begin(evt, var):
    global STATS_FLAG
    if var.NIGHT_COUNT == var.AMNESIAC_NIGHTS:
        amnesiacs = get_all_players(("amnesiac",))
        if amnesiacs and not var.HIDDEN_AMNESIAC:
            STATS_FLAG = True

        for amn in amnesiacs:
            role = change_role(var, amn, "amnesiac", ROLES[amn], message="amnesia_clear")
            debuglog("{0} REMEMBER: {1}".format(amn, role))
开发者ID:lykoss,项目名称:lykos,代码行数:10,代码来源:amnesiac.py


示例19: on_del_player

def on_del_player(evt, var, player, all_roles, death_triggers):
    del IDOLS[:player:]
    if not death_triggers:
        return

    for child in get_all_players(("wild child",)):
        if IDOLS.get(child) is player:
            # Change their main role to wolf
            change_role(var, child, get_main_role(child), "wolf", message="wild_child_idol_died")
            var.ROLES["wild child"].add(child)
开发者ID:lykoss,项目名称:lykos,代码行数:10,代码来源:wildchild.py


示例20: on_transition_night_end

def on_transition_night_end(evt, var):
    ps = set(get_players()) - CHARMED
    for piper in get_all_players(("piper",)):
        pl = list(ps)
        random.shuffle(pl)
        pl.remove(piper)
        to_send = "piper_notify"
        if piper.prefers_simple():
            to_send = "piper_simple"
        piper.send(messages[to_send], messages["players_list"].format(", ".join(p.nick for p in pl)), sep="\n")
开发者ID:lykoss,项目名称:lykos,代码行数:10,代码来源:piper.py



注:本文中的src.functions.get_all_players函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python functions.get_players函数代码示例发布时间:2022-05-27
下一篇:
Python firm.Firm类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap