コード例 #1
0
ファイル: wolfshaman.py プロジェクト: Satssuki/lykos
def on_transition_day_begin(evt, var):
    # Select random totem recipients if shamans didn't act
    pl = get_players()
    for shaman in get_players(("wolf shaman", )):
        if shaman not in SHAMANS and shaman.nick not in var.SILENCED:
            ps = pl[:]
            if shaman in LASTGIVEN:
                if LASTGIVEN[shaman] in ps:
                    ps.remove(LASTGIVEN[shaman])
            if ps:
                target = random.choice(ps)
                dispatcher = MessageDispatcher(shaman, shaman)

                SHAMANS[shaman] = give_totem(
                    var,
                    dispatcher,
                    target,
                    prefix=messages["random_totem_prefix"],
                    role="wolf shaman",
                    msg=" of {0}".format(TOTEMS[shaman]))
                relay_wolfchat_command(shaman.client,
                                       shaman.nick,
                                       messages["shaman_wolfchat"].format(
                                           shaman, target), ("wolf shaman", ),
                                       is_wolf_command=True)
            else:
                LASTGIVEN[shaman] = None
        elif shaman not in SHAMANS:
            LASTGIVEN[shaman] = None
コード例 #2
0
ファイル: shaman.py プロジェクト: IamInferior/ppd-werewolves
def on_transition_day_begin(evt, var):
    # Select random totem recipients if shamans didn't act
    pl = get_players()
    for shaman in get_players(("shaman", )):
        if shaman not in SHAMANS and shaman.nick not in var.SILENCED:
            ps = pl[:]
            if shaman in LASTGIVEN:
                if LASTGIVEN[shaman] in ps:
                    ps.remove(LASTGIVEN[shaman])
            levt = Event("get_random_totem_targets", {"targets": ps})
            levt.dispatch(var, shaman)
            ps = levt.data["targets"]
            if ps:
                target = random.choice(ps)
                dispatcher = MessageDispatcher(shaman, shaman)

                tags = get_tags(var, TOTEMS[shaman])

                SHAMANS[shaman] = give_totem(
                    var,
                    dispatcher,
                    target,
                    prefix=messages["random_totem_prefix"],
                    tags=tags,
                    role="shaman",
                    msg=" of {0}".format(TOTEMS[shaman]))
            else:
                LASTGIVEN[shaman] = None
        elif shaman not in SHAMANS:
            LASTGIVEN[shaman] = None
コード例 #3
0
def shaman_totem(var, wrapper, message):
    """Give a totem to a player."""

    target = get_totem_target(var, wrapper, message, LASTGIVEN)
    if not target:
        return

    SHAMANS[wrapper.source] = give_totem(var, wrapper, target, prefix="You", role="shaman", msg=" of {0}".format(TOTEMS[wrapper.source]))
コード例 #4
0
def crazed_shaman_totem(var, wrapper, message):
    """Give a random totem to a player."""

    target = get_totem_target(var, wrapper, message, LASTGIVEN)
    if not target:
        return

    totem = TOTEMS[wrapper.source]

    SHAMANS[wrapper.source] = give_totem(var, wrapper, target, prefix="You", tags=get_tags(var, totem), role="crazed shaman", msg="")
コード例 #5
0
ファイル: wolfshaman.py プロジェクト: Satssuki/lykos
def wolf_shaman_totem(var, wrapper, message):
    """Give a totem to a player."""

    target = get_totem_target(var, wrapper, message, LASTGIVEN)
    if not target:
        return

    SHAMANS[wrapper.source] = give_totem(var,
                                         wrapper,
                                         target,
                                         prefix="You",
                                         role="wolf shaman",
                                         msg=" of {0}".format(
                                             TOTEMS[wrapper.source]))

    relay_wolfchat_command(wrapper.client,
                           wrapper.source.nick,
                           messages["shaman_wolfchat"].format(
                               wrapper.source, target), ("wolf shaman", ),
                           is_wolf_command=True)
コード例 #6
0
def on_transition_day_begin(evt, var):
    # Select random totem recipients if shamans didn't act
    pl = get_players()
    for shaman in get_players(("crazed shaman", )):
        if shaman not in SHAMANS and shaman.nick not in var.SILENCED:
            ps = pl[:]
            if shaman in LASTGIVEN:
                if LASTGIVEN[shaman] in ps:
                    ps.remove(LASTGIVEN[shaman])
            if ps:
                target = random.choice(ps)
                dispatcher = MessageDispatcher(shaman, shaman)

                SHAMANS[shaman] = give_totem(
                    var,
                    dispatcher,
                    target,
                    prefix=messages["random_totem_prefix"],
                    role="crazed shaman",
                    msg="")
            else:
                LASTGIVEN[shaman] = None
        elif shaman not in SHAMANS:
            LASTGIVEN[shaman] = None