예제 #1
0
def guard(var, wrapper, message):
    """Guard a player, preventing them from being killed that night."""
    if wrapper.source in GUARDED:
        wrapper.pm(messages["already_protecting"])
        return

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

    if LASTGUARDED.get(wrapper.source) is target:
        wrapper.pm(messages["guardian_target_another"].format(target))
        return

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

    add_protection(var, target, wrapper.source, "guardian angel")
    GUARDED[wrapper.source] = target
    LASTGUARDED[wrapper.source] = target

    if wrapper.source is target:
        wrapper.pm(messages["guardian_guard_self"])
    else:
        wrapper.pm(messages["protecting_target"].format(target))
        target.send(messages["target_protected"])

    debuglog("{0} (guardian angel) GUARD: {1} ({2})".format(
        wrapper.source, target, get_main_role(target)))
예제 #2
0
파일: angel.py 프로젝트: lykoss/lykos
def guard(var, wrapper, message):
    """Guard a player, preventing them from being killed that night."""
    if wrapper.source in GUARDED:
        wrapper.pm(messages["already_protecting"])
        return

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

    if LASTGUARDED.get(wrapper.source) is target:
        wrapper.pm(messages["guardian_target_another"].format(target))
        return

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

    add_protection(var, target, wrapper.source, "guardian angel")
    GUARDED[wrapper.source] = target
    LASTGUARDED[wrapper.source] = target

    if wrapper.source is target:
        wrapper.pm(messages["guardian_guard_self"])
    else:
        wrapper.pm(messages["protecting_target"].format(target))
        target.send(messages["target_protected"])

    debuglog("{0} (guardian angel) GUARD: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
예제 #3
0
파일: monster.py 프로젝트: lykoss/lykos
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"])
예제 #4
0
파일: blessed.py 프로젝트: lykoss/lykos
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])
예제 #5
0
파일: blessed.py 프로젝트: mweinelt/lykos
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])
예제 #6
0
파일: shamans.py 프로젝트: svdermant/lykos
def on_transition_day3(evt, var):
    # protection totems are applied first in default logic, however
    # we set priority=4.1 to allow other modes of protection
    # to pre-empt us if desired
    for player in PROTECTION:
        status.add_protection(var,
                              player,
                              protector=None,
                              protector_role="shaman")
예제 #7
0
def on_transition_night_end(evt, var):
    for monster in get_all_players(("monster", )):
        status.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"])
예제 #8
0
def guard(var, wrapper, message):
    """Guard a player, preventing them from being killed that night."""
    if wrapper.source in GUARDED:
        wrapper.pm(messages["already_protecting"])
        return

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

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

    add_protection(var, target, wrapper.source, "bodyguard")
    GUARDED[wrapper.source] = target

    wrapper.pm(messages["protecting_target"].format(target))
    target.send(messages["target_protected"])

    debuglog("{0} (bodyguard) GUARD: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
예제 #9
0
파일: bodyguard.py 프로젝트: lykoss/lykos
def guard(var, wrapper, message):
    """Guard a player, preventing them from being killed that night."""
    if wrapper.source in GUARDED:
        wrapper.pm(messages["already_protecting"])
        return

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

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

    add_protection(var, target, wrapper.source, "bodyguard")
    GUARDED[wrapper.source] = target

    wrapper.pm(messages["protecting_target"].format(target))
    target.send(messages["target_protected"])

    debuglog("{0} (bodyguard) GUARD: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
예제 #10
0
def guard(var, wrapper, message):
    """Guard a player, preventing them from being killed that night."""
    if wrapper.source in GUARDED:
        wrapper.pm(messages["already_protecting"])
        return

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

    evt = Event("targeted_command", {"target": target, "misdirection": True, "exchange": True})
    if not evt.dispatch(var, wrapper.source, target):
        return

    target = evt.data["target"]
    status.add_protection(var, target, wrapper.source, "bodyguard")
    GUARDED[wrapper.source] = target

    wrapper.pm(messages["protecting_target"].format(target))
    target.send(messages["target_protected"])

    debuglog("{0} (bodyguard) GUARD: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
예제 #11
0
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)
        monster.send(messages["monster_notify"])
예제 #12
0
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:
            blessed.send(messages["blessed_notify"])