示例#1
0
文件: poker.py 项目: lexikiq/Bazbot
    async def poker(self, ctx):
        try:
            x = self.pdb[ctx.guild.id]
        except:
            self.pdb[ctx.guild.id] = {}

        m.get_amount(ctx.author.id)  #assure they have money
示例#2
0
文件: poker.py 项目: lexikiq/Bazbot
    async def call(self, ctx):

        if not self.ingame(ctx):
            return await ctx.send(
                "Uh oh! You friccin moron! You aren't in a game!")

        game = self.pdb[ctx.guild.id][ctx.author.id]

        players = [i.id for i in game.players]
        aliveplayers = [i.id for i in game.aliveplayers]
        player = ctx.author.id

        if player not in aliveplayers:
            return await ctx.send(
                "Uh oh! You friccin moron! You aren't in this hand!")

        if game.phase == 1:
            return await ctx.send(
                "Uh oh! You friccin moron! You can't bet during the discard phase!"
            )

        turn = aliveplayers.index(player)

        if game.turn != turn:
            return await ctx.send(
                "Uh oh! You friccin moron! It's not your turn!")

        if game.bet > m.get_amount(player):
            return await ctx.send(
                "Uh oh! You fricicn moron! You can't meet that bet! You must either fold or go all in!"
            )

        game.handlebet(game.bet)
        await ctx.send(game.status())
示例#3
0
文件: poker.py 项目: lexikiq/Bazbot
    async def create(self, ctx, *ante):

        if self.ingame(ctx):
            return await ctx.send(
                "Uh oh! You friccin moron! You're already in a game!")

        if len(ante) != 0:
            try:
                t = int(str(ante[0]))
            except:
                return await ctx.send(
                    "Uh oh! You friccin moron! `ante` isn't an int!")

        else:
            t = 10

        if t > (m.get_amount(ctx.author.id) // 10):
            return await ctx.send(
                "Uh oh! You friccin moron! Your ante can't be more than 10% of your wealth!"
            )

        if t < 1:
            return await ctx.send(
                "Uh oh! You friccin moron! Your ante can't be less than one!")

        self.games.append(Poker(t))
        self.pdb[ctx.guild.id][ctx.author.id] = self.games[-1]
        self.games[-1].players.append(Player(ctx.author, self.games[-1]))
        self.games[-1].players[0].ishost = True
        await ctx.send("Game created with an ante of `∰" + str(t) + "`")
示例#4
0
    async def start(self, ctx):
        if not self.ingame(ctx):
            return await ctx.send("Uh oh! You friccin moron! You aren't in a game!")

        game = self.pdb[ctx.guild.id][ctx.author.id]
        player = self.getplayer(game, ctx.author.id)

        if len(game.players) < 2:
            return await ctx.send("Uh oh! You friccin moron! You can't start a game with only one player!")

        if not player.ishost:
            return await ctx.send("Uh oh! You friccin moron! You aren't the host!")

        game.started = True

        message = "```\n"

        aliveplayers = []
        for player in game.players:
            if m.get_amount(player.id) < game.ante:
                message += player.name + " can't pay the ante for this round, and will sit out."
            else:
                message += player.name + " paid the ante of ∰" + str(game.ante) + "."
                aliveplayers.append(player)

            message += "\n"

        message += "```"
        await ctx.send(message)
        game.newround(aliveplayers)
        for player in aliveplayers:
            await self.bot.get_user(player.id).send("**Your Hand**\n```\n" + player.formathand() + "\n```")

        await ctx.send(game.status())