예제 #1
0
def consecrate(var, wrapper, message):
    """Consecrates a corpse, putting its spirit to rest and preventing other unpleasant things from happening."""
    alive = get_players()
    targ = re.split(" +", message)[0]
    if not targ:
        wrapper.pm(messages["not_enough_parameters"])
        return

    dead = set(var.ALL_PLAYERS) - set(alive)
    target, _ = users.complete_match(targ, dead)
    if target is None:
        wrapper.pm(messages["consecrate_fail"].format(targ))
        return

    # we have a target, so mark them as consecrated, right now all this does is silence a VG for a night
    # but other roles that do stuff after death or impact dead players should have functionality here as well
    # (for example, if there was a role that could raise corpses as undead somethings, this would prevent that from working)
    # regardless if this has any actual effect or not, it still removes the priest from being able to vote

    evt = Event("consecrate", {})
    evt.dispatch(var, wrapper.source, target)

    wrapper.pm(messages["consecrate_success"].format(target))
    debuglog("{0} (priest) CONSECRATE: {1}".format(wrapper.source, target))
    add_absent(var, wrapper.source, "consecrating")
    from src.votes import chk_decision
    from src.wolfgame import chk_win
    if not chk_win():
        # game didn't immediately end due to marking as absent, see if we should force through a lynch
        chk_decision(var)
예제 #2
0
파일: priest.py 프로젝트: lykoss/lykos
def consecrate(var, wrapper, message):
    """Consecrates a corpse, putting its spirit to rest and preventing other unpleasant things from happening."""
    alive = get_players()
    targ = re.split(" +", message)[0]
    if not targ:
        wrapper.pm(messages["not_enough_parameters"])
        return

    dead = set(var.ALL_PLAYERS) - set(alive)
    target, _ = users.complete_match(targ, dead)
    if target is None:
        wrapper.pm(messages["consecrate_fail"].format(targ))
        return

    # we have a target, so mark them as consecrated, right now all this does is silence a VG for a night
    # but other roles that do stuff after death or impact dead players should have functionality here as well
    # (for example, if there was a role that could raise corpses as undead somethings, this would prevent that from working)
    # regardless if this has any actual effect or not, it still removes the priest from being able to vote

    evt = Event("consecrate", {})
    evt.dispatch(var, wrapper.source, target)

    wrapper.pm(messages["consecrate_success"].format(target))
    debuglog("{0} (priest) CONSECRATE: {1}".format(wrapper.source, target))
    add_absent(var, wrapper.source, "consecrating")
    from src.votes import chk_decision
    from src.wolfgame import chk_win
    if not chk_win():
        # game didn't immediately end due to marking as absent, see if we should force through a lynch
        chk_decision(var)
예제 #3
0
def on_begin_day(evt, var):
    for sick in SICK.values():
        status.add_disease(var, sick)
        status.add_absent(var, sick, "illness")
        var.SILENCED.add(sick.nick)  # FIXME

    SEEN.clear()
    KILLS.clear()
예제 #4
0
파일: doomsayer.py 프로젝트: lykoss/lykos
def on_begin_day(evt, var):
    for sick in SICK.values():
        status.add_disease(var, sick)
        status.add_absent(var, sick, "illness")
        status.add_silent(var, sick)

    SEEN.clear()
    KILLS.clear()
예제 #5
0
파일: doomsayer.py 프로젝트: mweinelt/lykos
def on_begin_day(evt, var):
    for sick in SICK.values():
        status.add_disease(var, sick)
        status.add_absent(var, sick, "illness")
        status.add_silent(var, sick)

    SEEN.clear()
    KILLS.clear()
예제 #6
0
파일: gunners.py 프로젝트: rdococ/lykos
    def on_transition_day_resolve_end(evt, var, victims):
        for victim in list(evt.data["dead"]):
            if GUNNERS.get(
                    victim) and "@wolves" in evt.data["killers"][victim]:
                if random.random() < var.GUNNER_KILLS_WOLF_AT_NIGHT_CHANCE:
                    # pick a random wolf to be shot
                    wolves = [
                        wolf for wolf in get_players(Wolf & Killer)
                        if wolf not in evt.data["dead"]
                    ]
                    if wolves:
                        shot = random.choice(wolves)
                        event = Event("gun_shoot", {"hit": True, "kill": True})
                        event.dispatch(var, victim, shot, rolename)
                        GUNNERS[victim] -= 1  # deduct the used bullet
                        if event.data["hit"] and event.data["kill"]:
                            to_send = "gunner_killed_wolf_overnight_no_reveal"
                            if var.ROLE_REVEAL in ("on", "team"):
                                to_send = "gunner_killed_wolf_overnight"
                            evt.data["message"][victim].append(
                                messages[to_send].format(
                                    victim, shot, get_reveal_role(shot)))
                            evt.data["dead"].append(shot)
                            evt.data["killers"][shot].append(victim)
                        elif event.data["hit"]:
                            # shot hit, but didn't kill
                            evt.data["message"][victim].append(
                                messages["gunner_shoot_overnight_hit"].format(
                                    victim))
                            add_absent(var, shot, "wounded")
                        else:
                            # shot was fired and missed
                            evt.data["message"][victim].append(
                                messages["gunner_shoot_overnight_missed"].
                                format(victim))

                # let wolf steal gun if the gunner has any bullets remaining
                # this gives the looter the "wolf gunner" secondary role
                # if the wolf gunner role isn't loaded, guns cannot be stolen regardless of var.WOLF_STEALS_GUN
                if var.WOLF_STEALS_GUN and GUNNERS[
                        victim] and "wolf gunner" in _rolestate:
                    possible = get_players(Wolf & Killer)
                    random.shuffle(possible)
                    for looter in possible:
                        if looter not in evt.data["dead"]:
                            break
                    else:
                        return  # no live wolf, nothing to do here

                    _rolestate["wolf gunner"]["GUNNERS"][
                        looter] = _rolestate["wolf gunner"]["GUNNERS"].get(
                            looter, 0) + 1
                    del GUNNERS[victim]
                    var.ROLES["wolf gunner"].add(looter)
                    looter.send(messages["wolf_gunner"].format(victim))
예제 #7
0
def on_begin_day(evt, var):
    # Apply totem effects that need to begin on day proper
    for absent in NARCOLEPSY:
        add_absent(var, absent, "totem")
    for misdirected in MISDIRECTION:
        add_misdirection(var, misdirected, as_actor=True)
    for lucky in LUCK:
        add_misdirection(var, lucky, as_target=True)
    for exchanging in EXCHANGE:
        add_exchange(var, exchanging)
    var.SILENCED.update(p.nick for p in SILENCE)
예제 #8
0
def on_begin_day(evt, var):
    for sick in SICK.values():
        status.add_absent(var, sick, "illness")
        status.add_silent(var, sick)

    # clear out LASTSEEN for people that didn't see last night
    for doom in list(LASTSEEN.keys()):
        if doom not in SEEN:
            del LASTSEEN[doom]

    SEEN.clear()
    KILLS.clear()
예제 #9
0
파일: shamans.py 프로젝트: svdermant/lykos
def on_begin_day(evt, var):
    # Apply totem effects that need to begin on day proper
    for player in NARCOLEPSY:
        status.add_absent(var, player, "totem")
    for player in IMPATIENCE:
        status.add_force_vote(var, player, get_all_players() - {player})
    for player in PACIFISM:
        status.add_force_abstain(var, player)
    for player in INFLUENCE:
        status.add_vote_weight(var, player)
    for player in REVEALING:
        status.add_lynch_immunity(var, player, "totem")
    for player in MISDIRECTION:
        status.add_misdirection(var, player, as_actor=True)
    for player in LUCK:
        status.add_misdirection(var, player, as_target=True)
    for player in EXCHANGE:
        status.add_exchange(var, player)
    for player in SILENCE:
        status.add_silent(var, player)
예제 #10
0
    def shoot(var, wrapper, message):
        """Use this to fire off a bullet at someone in the day if you have bullets."""
        if not GUNNERS[wrapper.source]:
            wrapper.pm(messages["no_bullets"])
            return

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

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

        GUNNERS[wrapper.source] -= 1

        gun_evt = Event("gun_chances", {"hit": 0, "miss": 0, "headshot": 0})
        gun_evt.dispatch(var, wrapper.source, rolename)

        rand = random.random() # need to save it

        shoot_evt = Event("gun_shoot", {"hit": rand <= gun_evt.data["hit"], "kill": random.random() <= gun_evt.data["headshot"]})
        shoot_evt.dispatch(var, wrapper.source, target)

        realrole = get_main_role(target)
        targrole = get_reveal_role(target)

        if shoot_evt.data["hit"]:
            wrapper.send(messages["shoot_success"].format(wrapper.source, target))
            an = "n" if targrole.startswith(("a", "e", "i", "o", "u")) else ""
            if realrole in Wolf:
                if var.ROLE_REVEAL == "on":
                    wrapper.send(messages["gunner_victim_wolf_death"].format(target, an, targrole))
                else: # off and team
                    wrapper.send(messages["gunner_victim_wolf_death_no_reveal"].format(target))
                add_dying(var, target, killer_role=get_main_role(wrapper.source), reason="gunner_victim")
                if kill_players(var):
                    return
            elif shoot_evt.data["kill"]:
                accident = "accidentally "
                if gun_evt.data["headshot"] == 1: # would always headshot
                    accident = ""
                wrapper.send(messages["gunner_victim_villager_death"].format(target, accident))
                if var.ROLE_REVEAL in ("on", "team"):
                    wrapper.send(messages["gunner_victim_role"].format(an, targrole))
                add_dying(var, target, killer_role=get_main_role(wrapper.source), reason="gunner_victim")
                if kill_players(var):
                    return
            else:
                wrapper.send(messages["gunner_victim_injured"].format(target))
                add_absent(var, target, "wounded")
                from src.wolfgame import chk_decision, chk_win
                chk_decision()
                chk_win()

        elif rand <= gun_evt.data["hit"] + gun_evt.data["miss"]:
            wrapper.send(messages["gunner_miss"].format(wrapper.source))
        else: # BOOM! your gun explodes, you're dead
            if var.ROLE_REVEAL in ("on", "team"):
                wrapper.send(messages["gunner_suicide"].format(wrapper.source, get_reveal_role(wrapper.source)))
            else:
                wrapper.send(messages["gunner_suicide_no_reveal"].format(wrapper.source))
            add_dying(var, wrapper.source, killer_role="villager", reason="gunner_suicide") # blame explosion on villager's shoddy gun construction or something
            kill_players(var)
예제 #11
0
파일: gunners.py 프로젝트: lykoss/lykos
    def shoot(var, wrapper, message):
        """Use this to fire off a bullet at someone in the day if you have bullets."""
        if not GUNNERS[wrapper.source]:
            wrapper.pm(messages["no_bullets"])
            return

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

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

        GUNNERS[wrapper.source] -= 1

        gun_evt = Event("gun_chances", {"hit": 0, "miss": 0, "headshot": 0})
        gun_evt.dispatch(var, wrapper.source, rolename)

        rand = random.random() # need to save it

        shoot_evt = Event("gun_shoot", {"hit": rand <= gun_evt.data["hit"], "kill": random.random() <= gun_evt.data["headshot"]})
        shoot_evt.dispatch(var, wrapper.source, target)

        realrole = get_main_role(target)
        targrole = get_reveal_role(target)

        if shoot_evt.data["hit"]:
            wrapper.send(messages["shoot_success"].format(wrapper.source, target))
            an = "n" if targrole.startswith(("a", "e", "i", "o", "u")) else ""
            if realrole in Wolf:
                if var.ROLE_REVEAL == "on":
                    wrapper.send(messages["gunner_victim_wolf_death"].format(target, an, targrole))
                else: # off and team
                    wrapper.send(messages["gunner_victim_wolf_death_no_reveal"].format(target))
                add_dying(var, target, killer_role=get_main_role(wrapper.source), reason="gunner_victim")
                if kill_players(var):
                    return
            elif shoot_evt.data["kill"]:
                accident = "accidentally "
                if gun_evt.data["headshot"] == 1: # would always headshot
                    accident = ""
                wrapper.send(messages["gunner_victim_villager_death"].format(target, accident))
                if var.ROLE_REVEAL in ("on", "team"):
                    wrapper.send(messages["gunner_victim_role"].format(an, targrole))
                add_dying(var, target, killer_role=get_main_role(wrapper.source), reason="gunner_victim")
                if kill_players(var):
                    return
            else:
                wrapper.send(messages["gunner_victim_injured"].format(target))
                add_absent(var, target, "wounded")
                from src.votes import chk_decision
                from src.wolfgame import chk_win
                if not chk_win():
                    # game didn't immediately end due to injury, see if we should force through a vote
                    chk_decision(var)

        elif rand <= gun_evt.data["hit"] + gun_evt.data["miss"]:
            wrapper.send(messages["gunner_miss"].format(wrapper.source))
        else: # BOOM! your gun explodes, you're dead
            if var.ROLE_REVEAL in ("on", "team"):
                wrapper.send(messages["gunner_suicide"].format(wrapper.source, get_reveal_role(wrapper.source)))
            else:
                wrapper.send(messages["gunner_suicide_no_reveal"].format(wrapper.source))
            add_dying(var, wrapper.source, killer_role="villager", reason="gunner_suicide") # blame explosion on villager's shoddy gun construction or something
            kill_players(var)