mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Updated.
This commit is contained in:
parent
d88d7797be
commit
9f372e60d9
@ -48,11 +48,11 @@ __contributors__ = {}
|
|||||||
# the bankroll.
|
# the bankroll.
|
||||||
# Write a command to allow Owner users to give a person money.
|
# Write a command to allow Owner users to give a person money.
|
||||||
# Re-expand the commands using forwarder so they can have better help.
|
# Re-expand the commands using forwarder so they can have better help.
|
||||||
# Have tables in each channel be entirely configurable.
|
# Have tables in each channel be entirely persistently configurable.
|
||||||
# Have the bot automatically start the next hand if people are seated.
|
# Have the bot automatically start the next hand if people are seated.
|
||||||
# Improve the "you've bet X already" to say something cooler when X is 0.
|
|
||||||
# Have a slight pause before sending the "foo, it's your turn to bet" message,
|
# Have a slight pause before sending the "foo, it's your turn to bet" message,
|
||||||
# and if the user replies before then, don't send it.
|
# and if the user replies before then, don't send it.
|
||||||
|
# ??? Should we allow "to" in a raise command? raise to 100?
|
||||||
###
|
###
|
||||||
|
|
||||||
import sets
|
import sets
|
||||||
@ -273,9 +273,16 @@ class Table(object):
|
|||||||
def pot(self):
|
def pot(self):
|
||||||
return sum(self.buckets.values()) + sum(self.foldedBuckets)
|
return sum(self.buckets.values()) + sum(self.foldedBuckets)
|
||||||
|
|
||||||
|
def possibleBettors(self):
|
||||||
|
L = []
|
||||||
|
for player in self.hands:
|
||||||
|
if player.stack > 0:
|
||||||
|
L.append(player)
|
||||||
|
return L
|
||||||
|
|
||||||
def startBettingRound(self):
|
def startBettingRound(self):
|
||||||
player = self.nextPlayer()
|
player = self.nextPlayer()
|
||||||
if player is None:
|
if player is None or len(self.possibleBettors()) <= 1:
|
||||||
self.nextRound()
|
self.nextRound()
|
||||||
return
|
return
|
||||||
s = 'Betting begins with %s.' % self.waitingOn().nick()
|
s = 'Betting begins with %s.' % self.waitingOn().nick()
|
||||||
@ -321,10 +328,17 @@ class Table(object):
|
|||||||
else:
|
else:
|
||||||
player = self.nextPlayer()
|
player = self.nextPlayer()
|
||||||
if player is not None:
|
if player is not None:
|
||||||
self.public('%s, it\'s your turn. The current bet is %s. '
|
s = '%s, it\'s your turn. ' % player.nick()
|
||||||
'You\'ve bet %s already this round.' %
|
if self.currentBet:
|
||||||
(player.nick(), self.currentBet,
|
s += 'The current bet is %s. ' % self.currentBet
|
||||||
self.currentBets[player]))
|
playerBet = self.currentBets[player]
|
||||||
|
if playerBet:
|
||||||
|
s += 'You\'ve already bet %s this round.' % playerBet
|
||||||
|
else:
|
||||||
|
s += 'You haven\'t yet bet this round.'
|
||||||
|
else:
|
||||||
|
s += 'There have not yet been any bets this round.'
|
||||||
|
self.public(s)
|
||||||
else:
|
else:
|
||||||
self.nextRound()
|
self.nextRound()
|
||||||
|
|
||||||
@ -351,7 +365,7 @@ class Table(object):
|
|||||||
if bucket:
|
if bucket:
|
||||||
self.foldedBuckets.append(bucket)
|
self.foldedBuckets.append(bucket)
|
||||||
del self.hands[player]
|
del self.hands[player]
|
||||||
self.public('%s folds.' % player.name())
|
self.public('%s folds.' % player.nick())
|
||||||
self.checkEndOfRound()
|
self.checkEndOfRound()
|
||||||
|
|
||||||
def check(self, player):
|
def check(self, player):
|
||||||
@ -375,6 +389,10 @@ class Table(object):
|
|||||||
def call(self, player):
|
def call(self, player):
|
||||||
if self.checkWrongPlayer(player):
|
if self.checkWrongPlayer(player):
|
||||||
return
|
return
|
||||||
|
if not self.currentBet:
|
||||||
|
self.error('There isn\'t any bet to call. '
|
||||||
|
'Perhaps you should check.')
|
||||||
|
return
|
||||||
toCall = self.currentBet - self.currentBets[player]
|
toCall = self.currentBet - self.currentBets[player]
|
||||||
bet = self.addCurrentBet(player, min(toCall, player.stack))
|
bet = self.addCurrentBet(player, min(toCall, player.stack))
|
||||||
self.public('%s calls %s.' % (player.nick(), bet))
|
self.public('%s calls %s.' % (player.nick(), bet))
|
||||||
@ -383,7 +401,9 @@ class Table(object):
|
|||||||
def bet(self, player, amount):
|
def bet(self, player, amount):
|
||||||
if self.checkWrongPlayer(player):
|
if self.checkWrongPlayer(player):
|
||||||
return
|
return
|
||||||
if self.checkNoCurrentBet():
|
if self.currentBet and amount < self.currentBet:
|
||||||
|
self.error('The current bet is %s, you must bet at least that.' %
|
||||||
|
self.currentBet)
|
||||||
return
|
return
|
||||||
if amount > player.stack:
|
if amount > player.stack:
|
||||||
self.error('You only have %s in your stack, you can\'t '
|
self.error('You only have %s in your stack, you can\'t '
|
||||||
|
Loading…
Reference in New Issue
Block a user