本文整理汇总了Python中src.functions.get_all_players函数的典型用法代码示例。如果您正苦于以下问题:Python get_all_players函数的具体用法?Python get_all_players怎么用?Python get_all_players使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_all_players函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)))
示例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)))
示例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 ""))
示例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"])
示例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)
示例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)))
示例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
示例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)
示例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()
示例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])
示例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"])
示例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()
示例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"}
示例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")
示例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"])