Exemplo n.º 1
0
    def chancellor(self, mask, target, args):
        """Choose chancellor.

            %%chancellor <player>
        """
        if self.paused:
            return
        nick = mask.nick
        try:
            self.game.nominate_chancellor(Player(args["<player>"]))
            events, stage = self.game.advance()
            for event in events:
                if isinstance(event, game.PresidentNominates):
                    self.send(
                        f"Le choix du président se porte sur {event.candidate_chancellor.name} comme chancelier."
                    )
                else:
                    raise game.Error("wat")
            if stage is game.Stage.chancellor_election:
                self.send(
                    f"Approuvez-vous ce choix ? Votez avec /query {self.bot.nick} !oui / !non."
                )
            else:
                raise game.Error("wtf")
        except game.Error as e:
            self.send(
                f"{nick}: ENSHULDIGONG ES GIBT EIN PRÖBLEM: {type(e)} {e}")
Exemplo n.º 2
0
def example_players():
    players = [Player(p) for p in ["zopieux", "delroth", "halfr", "spider", "sophie"]]
    for p in players[:3]:
        p.role = Role.liberal
    players[3].role = Role.fascist
    players[4].role = Role.hitler
    return players
Exemplo n.º 3
0
    def join(self, mask, target, args):
        """Join the next game.

            %%join
        """
        if self.paused:
            return
        nick = mask.nick
        try:
            self.game.add_player(Player(nick))
            self.mode(("+v", nick))
            self.send(f"{nick}: HEIL DAS IST GUT")
        except game.Error:
            self.send(f"{nick}: ASH DAS IST KEINE POßIBL")
Exemplo n.º 4
0
    def no(self, mask, target, args):
        """Choose chancellor.

            %%no
        """
        if self.paused:
            return
        nick = mask.nick
        try:
            self.game.record_vote(Player(nick), False)
            self.send_private(nick, "Je note ce NOPE.")
        except game.Error as e:
            self.send(
                f"{nick}: ENSHULDIGONG ES GIBT EIN PRÖBLEM: {type(e)} {e}")
Exemplo n.º 5
0
    def part(self, mask, target, args):
        """Flee from the next game.

            %%part
        """
        if self.paused:
            return
        nick = mask.nick
        try:
            self.game.remove_player(Player(nick))
            self.mode(("-v", nick))
            self.send(f"{nick}: NEIN :'(")
        except game.Error:
            self.send(f"{nick}: ASH DAS IST KEINE POßIBL")
Exemplo n.º 6
0
def more_example_players():
    players = [Player(p) for p in ["robert", "amour"]]
    players[0].role = Role.liberal
    players[1].role = Role.fascist
    return players
Exemplo n.º 7
0
def test_cannot_play(state):
    state.add_player(Player("zopieux"))
    assert not state.can_game_start