mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
blackjack: fix double doubling the wrong bet amount
It would double the current full amount bet, rather than the original bet of the current hand only. Also fix an error message using a variable before it's initialized when telling the player his/her balance is not enough when doing so.
This commit is contained in:
parent
1a6476d2f0
commit
bb7d4c9f2c
1 changed files with 4 additions and 3 deletions
|
@ -585,6 +585,7 @@ def Blackjack(link,cmd):
|
||||||
players[identity] = {
|
players[identity] = {
|
||||||
'deck': MakeNewDeck(config.blackjack_decks,seed),
|
'deck': MakeNewDeck(config.blackjack_decks,seed),
|
||||||
'amount': total_units_wagered,
|
'amount': total_units_wagered,
|
||||||
|
'base_amount': units,
|
||||||
'player_hands': [dict({
|
'player_hands': [dict({
|
||||||
'amount': units,
|
'amount': units,
|
||||||
'hand': [],
|
'hand': [],
|
||||||
|
@ -818,6 +819,7 @@ def Split(link,cmd):
|
||||||
if not enough:
|
if not enough:
|
||||||
link.send("%s: %s - please refund your account to continue playing" % (link.user.nick, reason))
|
link.send("%s: %s - please refund your account to continue playing" % (link.user.nick, reason))
|
||||||
return
|
return
|
||||||
|
idx = players[identity]['player_current_hand']
|
||||||
hand = GetPlayerCurrentHand(link)
|
hand = GetPlayerCurrentHand(link)
|
||||||
if len(hand)!=2 or GetCardScore(hand[0])!=GetCardScore(hand[1]):
|
if len(hand)!=2 or GetCardScore(hand[0])!=GetCardScore(hand[1]):
|
||||||
link.send("%s: only pairs with the same value can be split" % (link.user.nick))
|
link.send("%s: only pairs with the same value can be split" % (link.user.nick))
|
||||||
|
@ -825,12 +827,11 @@ def Split(link,cmd):
|
||||||
if len(players[identity]['player_hands']) >= config.blackjack_split_to:
|
if len(players[identity]['player_hands']) >= config.blackjack_split_to:
|
||||||
link.send("%s: you can only split to %d" % (link.user.nick, config.blackjack_split_to))
|
link.send("%s: you can only split to %d" % (link.user.nick, config.blackjack_split_to))
|
||||||
return
|
return
|
||||||
enough, reason = IsPlayerBalanceAtLeast(link,units*2)
|
enough, reason = IsPlayerBalanceAtLeast(link,units+players[identity]['base_amount'])
|
||||||
if not enough:
|
if not enough:
|
||||||
link.send("%s: you do not have enough %s in your account to split hand %d" % (link.user.nick,coinspecs.name,idx+1))
|
link.send("%s: you do not have enough %s in your account to split hand %d" % (link.user.nick,coinspecs.name,idx+1))
|
||||||
return
|
return
|
||||||
players[identity]['amount'] = players[identity]['amount'] * 2
|
players[identity]['amount'] = players[identity]['amount'] + players[identity]['base_amount']
|
||||||
idx = players[identity]['player_current_hand']
|
|
||||||
RecordMove(link,"split")
|
RecordMove(link,"split")
|
||||||
log_log('splitting hand %d' % idx)
|
log_log('splitting hand %d' % idx)
|
||||||
split_card = hand[0]
|
split_card = hand[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue