Пример #1
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    if not death_triggers or "mad scientist" not in all_roles:
        return

    target1, target2 = _get_targets(var, get_players(), player)

    prots1 = try_protection(var, target1, player, "mad scientist",
                            "mad_scientist_fail")
    prots2 = try_protection(var, target2, player, "mad scientist",
                            "mad_scientist_fail")
    if prots1:
        channels.Main.send(*prots1)
    if prots2:
        channels.Main.send(*prots2)

    kill1 = prots1 is None and add_dying(
        var, target1, killer_role="mad scientist", reason="mad_scientist")
    kill2 = prots2 is None and target1 is not target2 and add_dying(
        var, target2, killer_role="mad scientist", reason="mad_scientist")

    role1 = kill1 and get_reveal_role(target1)
    role2 = kill2 and get_reveal_role(target2)
    if kill1 and kill2:
        to_send = "mad_scientist_kill"
        debuglog(
            player.nick, "(mad scientist) KILL: {0} ({1}) - {2} ({3})".format(
                target1, get_main_role(target1), target2,
                get_main_role(target2)))
    elif kill1:
        to_send = "mad_scientist_kill_single"
        debuglog(
            player.nick,
            "(mad scientist) KILL: {0} ({1})".format(target1,
                                                     get_main_role(target1)))
    elif kill2:
        to_send = "mad_scientist_kill_single"
        debuglog(
            player.nick,
            "(mad scientist) KILL: {0} ({1})".format(target2,
                                                     get_main_role(target2)))
        # swap the targets around to show the proper target
        target1, target2 = target2, target1
        role1, role2 = role2, role1
    else:
        to_send = "mad_scientist_fail"
        debuglog(player.nick, "(mad scientist) KILL FAIL")

    if to_send != "mad_scientist_fail" and var.ROLE_REVEAL not in ("on",
                                                                   "team"):
        to_send += "_no_reveal"

    channels.Main.send(messages[to_send].format(player, target1, role1,
                                                target2, role2))
Пример #2
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    if not death_triggers or "mad scientist" not in all_roles:
        return

    target1, target2 = _get_targets(var, get_players(), player)

    prots1 = try_protection(var, target1, player, "mad scientist", "mad_scientist_fail")
    prots2 = try_protection(var, target2, player, "mad scientist", "mad_scientist_fail")
    if prots1:
        channels.Main.send(*prots1)
    if prots2:
        channels.Main.send(*prots2)

    kill1 = prots1 is None and add_dying(var, target1, killer_role="mad scientist", reason="mad_scientist")
    kill2 = prots2 is None and target1 is not target2 and add_dying(var, target2, killer_role="mad scientist", reason="mad_scientist")

    if kill1:
        if kill2:
            if var.ROLE_REVEAL in ("on", "team"):
                r1 = get_reveal_role(target1)
                an1 = "n" if r1.startswith(("a", "e", "i", "o", "u")) else ""
                r2 = get_reveal_role(target2)
                an2 = "n" if r2.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill"].format(player, target1, an1, r1, target2, an2, r2)
            else:
                tmsg = messages["mad_scientist_kill_no_reveal"].format(player, target1, target2)
            channels.Main.send(tmsg)
            debuglog(player.nick, "(mad scientist) KILL: {0} ({1}) - {2} ({3})".format(target1, get_main_role(target1), target2, get_main_role(target2)))
        else:
            if var.ROLE_REVEAL in ("on", "team"):
                r1 = get_reveal_role(target1)
                an1 = "n" if r1.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill_single"].format(player, target1, an1, r1)
            else:
                tmsg = messages["mad_scientist_kill_single_no_reveal"].format(player, target1)
            channels.Main.send(tmsg)
            debuglog(player.nick, "(mad scientist) KILL: {0} ({1})".format(target1, get_main_role(target1)))
    else:
        if kill2:
            if var.ROLE_REVEAL in ("on", "team"):
                r2 = get_reveal_role(target2)
                an2 = "n" if r2.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill_single"].format(player, target2, an2, r2)
            else:
                tmsg = messages["mad_scientist_kill_single_no_reveal"].format(player, target2)
            channels.Main.send(tmsg)
            debuglog(player.nick, "(mad scientist) KILL: {0} ({1})".format(target2, get_main_role(target2)))
        else:
            tmsg = messages["mad_scientist_fail"].format(player)
            channels.Main.send(tmsg)
            debuglog(player.nick, "(mad scientist) KILL FAIL")
Пример #3
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    for h, v in list(KILLS.items()):
        if v is player:
            h.send(messages["hunter_discard"])
            del KILLS[h]
        elif h is player:
            del KILLS[h]
    if death_triggers and "dullahan" in all_roles:
        pl = get_players()
        with TARGETS[player].intersection(pl) as targets:
            if targets:
                target = random.choice(list(targets))
                protected = try_protection(var, target, player, "dullahan",
                                           "dullahan_die")
                if protected is not None:
                    channels.Main.send(*protected)
                    return

                if var.ROLE_REVEAL in ("on", "team"):
                    role = get_reveal_role(target)
                    channels.Main.send(messages["dullahan_die_success"].format(
                        player, target, role))
                else:
                    channels.Main.send(
                        messages["dullahan_die_success_noreveal"].format(
                            player, target))
                debuglog(
                    "{0} (dullahan) DULLAHAN ASSASSINATE: {1} ({2})".format(
                        player, target, get_main_role(target)))
                add_dying(var, target, "dullahan", "dullahan_die")
Пример #4
0
def on_chk_decision_lynch5(evt, var, voters):
    votee = evt.data["votee"]
    if votee in DESPERATION:
        # Also kill the very last person to vote them, unless they voted themselves last in which case nobody else dies
        target = voters[-1]
        if target is not votee:
            protected = try_protection(var,
                                       target,
                                       attacker=votee,
                                       attacker_role="shaman",
                                       reason="totem_desperation")
            if protected is not None:
                channels.Main.send(*protected)
                return

            if var.ROLE_REVEAL in ("on", "team"):
                r1 = get_reveal_role(target)
                an1 = "n" if r1.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["totem_desperation"].format(
                    votee, target, an1, r1)
            else:
                tmsg = messages["totem_desperation_no_reveal"].format(
                    votee, target)
            channels.Main.send(tmsg)
            add_dying(var,
                      target,
                      killer_role="shaman",
                      reason="totem_desperation")
Пример #5
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    if player in TARGETED.values():
        for x, y in list(TARGETED.items()):
            if y is player:
                del TARGETED[x]
                PREV_ACTED.discard(x)

    if death_triggers and "assassin" in all_roles and player in TARGETED:
        target = TARGETED[player]
        del TARGETED[player]
        PREV_ACTED.discard(player)
        if target in get_players():
            protected = try_protection(var, target, player, "assassin", "assassin_fail")
            if protected is not None:
                channels.Main.send(*protected)
                return
            if var.ROLE_REVEAL in ("on", "team"):
                role = get_reveal_role(target)
                an = "n" if role.startswith(("a", "e", "i", "o", "u")) else ""
                message = messages["assassin_success"].format(player, target, an, role)
            else:
                message = messages["assassin_success_no_reveal"].format(player, target)
            channels.Main.send(message)
            debuglog("{0} (assassin) ASSASSINATE: {1} ({2})".format(player, target, get_main_role(target)))
            add_dying(var, target, killer_role=evt.params.main_role, reason="assassin")
Пример #6
0
def on_transition_day_resolve6(evt, var, victims):
    for victim in victims:
        if victim in RETRIBUTION:
            killers = list(evt.data["killers"].get(victim, []))
            loser = None
            while killers:
                loser = random.choice(killers)
                if loser in evt.data["dead"] or victim is loser:
                    killers.remove(loser)
                    continue
                break
            if loser in evt.data["dead"] or victim is loser:
                loser = None
            ret_evt = Event("retribution_kill", {"target": loser, "message": []})
            ret_evt.dispatch(var, victim, loser)
            loser = ret_evt.data["target"]
            evt.data["message"][loser].extend(ret_evt.data["message"])
            if loser in evt.data["dead"] or victim is loser:
                loser = None
            if loser is not None:
                protected = try_protection(var, loser, victim, get_main_role(victim), "retribution_totem")
                if protected is not None:
                    channels.Main.send(*protected)
                    return

                evt.data["dead"].append(loser)
                to_send = "totem_death_no_reveal"
                if var.ROLE_REVEAL in ("on", "team"):
                    to_send = "totem_death"
                evt.data["message"][loser].append(messages[to_send].format(victim, loser, get_reveal_role(loser)))
Пример #7
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    for h, v in list(KILLS.items()):
        if v is player:
            h.send(messages["hunter_discard"])
            del KILLS[h]
        elif h is player:
            del KILLS[h]
    if death_triggers and "dullahan" in all_roles:
        pl = get_players()
        with TARGETS[player].intersection(pl) as targets:
            if targets:
                target = random.choice(list(targets))
                protected = try_protection(var, target, player, "dullahan", "dullahan_die")
                if protected is not None:
                    channels.Main.send(*protected)
                    return

                if var.ROLE_REVEAL in ("on", "team"):
                    role = get_reveal_role(target)
                    an = "n" if role.startswith(("a", "e", "i", "o", "u")) else ""
                    channels.Main.send(messages["dullahan_die_success"].format(player, target, an, role))
                else:
                    channels.Main.send(messages["dullahan_die_success_noreveal"].format(player, target))
                debuglog("{0} (dullahan) DULLAHAN ASSASSINATE: {1} ({2})".format(player, target, get_main_role(target)))
                add_dying(var, target, "dullahan", "dullahan_die")
Пример #8
0
def on_lynch(evt, var, votee, voters):
    if votee in DESPERATION:
        # Also kill the very last person to vote them, unless they voted themselves last in which case nobody else dies
        target = voters[-1]
        if target is not votee:
            protected = try_protection(var, target, attacker=votee, attacker_role="shaman", reason="totem_desperation")
            if protected is not None:
                channels.Main.send(*protected)
                return

            to_send = "totem_desperation_no_reveal"
            if var.ROLE_REVEAL in ("on", "team"):
                to_send = "totem_desperation"
            channels.Main.send(messages[to_send].format(votee, target, get_reveal_role(target)))
            status.add_dying(var, target, killer_role="shaman", reason="totem_desperation")
Пример #9
0
def on_del_player(evt, var, player, all_roles, death_triggers):
    if not death_triggers or "mad scientist" not in all_roles:
        return

    target1, target2 = _get_targets(var, get_players(), player)

    prots1 = try_protection(var, target1, player, "mad scientist",
                            "mad_scientist_fail")
    prots2 = try_protection(var, target2, player, "mad scientist",
                            "mad_scientist_fail")
    if prots1:
        channels.Main.send(*prots1)
    if prots2:
        channels.Main.send(*prots2)

    kill1 = prots1 is None and add_dying(
        var, target1, killer_role="mad scientist", reason="mad_scientist")
    kill2 = prots2 is None and target1 is not target2 and add_dying(
        var, target2, killer_role="mad scientist", reason="mad_scientist")

    if kill1:
        if kill2:
            if var.ROLE_REVEAL in ("on", "team"):
                r1 = get_reveal_role(target1)
                an1 = "n" if r1.startswith(("a", "e", "i", "o", "u")) else ""
                r2 = get_reveal_role(target2)
                an2 = "n" if r2.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill"].format(
                    player, target1, an1, r1, target2, an2, r2)
            else:
                tmsg = messages["mad_scientist_kill_no_reveal"].format(
                    player, target1, target2)
            channels.Main.send(tmsg)
            debuglog(
                player.nick,
                "(mad scientist) KILL: {0} ({1}) - {2} ({3})".format(
                    target1, get_main_role(target1), target2,
                    get_main_role(target2)))
        else:
            if var.ROLE_REVEAL in ("on", "team"):
                r1 = get_reveal_role(target1)
                an1 = "n" if r1.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill_single"].format(
                    player, target1, an1, r1)
            else:
                tmsg = messages["mad_scientist_kill_single_no_reveal"].format(
                    player, target1)
            channels.Main.send(tmsg)
            debuglog(
                player.nick, "(mad scientist) KILL: {0} ({1})".format(
                    target1, get_main_role(target1)))
    else:
        if kill2:
            if var.ROLE_REVEAL in ("on", "team"):
                r2 = get_reveal_role(target2)
                an2 = "n" if r2.startswith(("a", "e", "i", "o", "u")) else ""
                tmsg = messages["mad_scientist_kill_single"].format(
                    player, target2, an2, r2)
            else:
                tmsg = messages["mad_scientist_kill_single_no_reveal"].format(
                    player, target2)
            channels.Main.send(tmsg)
            debuglog(
                player.nick, "(mad scientist) KILL: {0} ({1})".format(
                    target2, get_main_role(target2)))
        else:
            tmsg = messages["mad_scientist_fail"].format(player)
            channels.Main.send(tmsg)
            debuglog(player.nick, "(mad scientist) KILL FAIL")