forked from MarseyWorld/MarseyWorld
fix blackjack when hitting blackjack
parent
970cf6dccd
commit
11b391c437
|
@ -51,7 +51,7 @@ def get_active_game(gambler):
|
||||||
game = g.db.query(Casino_Game) \
|
game = g.db.query(Casino_Game) \
|
||||||
.filter(Casino_Game.active == True,
|
.filter(Casino_Game.active == True,
|
||||||
Casino_Game.kind == 'blackjack',
|
Casino_Game.kind == 'blackjack',
|
||||||
Casino_Game.user_id == gambler.id).first()
|
Casino_Game.user_id == gambler.id).one_or_none()
|
||||||
|
|
||||||
if game:
|
if game:
|
||||||
return game, json.loads(game.game_state)
|
return game, json.loads(game.game_state)
|
||||||
|
@ -95,6 +95,7 @@ def apply_blackjack_result(gambler):
|
||||||
gambler.winnings += reward
|
gambler.winnings += reward
|
||||||
game.winnings += reward
|
game.winnings += reward
|
||||||
|
|
||||||
|
if result not in ('push','blackjack'):
|
||||||
game.active = False
|
game.active = False
|
||||||
g.db.add(game)
|
g.db.add(game)
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,8 @@ def deal_blackjack(v):
|
||||||
|
|
||||||
if game and game.active:
|
if game and game.active:
|
||||||
safe_state = get_safe_game_state(v)
|
safe_state = get_safe_game_state(v)
|
||||||
|
if safe_state['status'] in ('push','blackjack'):
|
||||||
|
game.active = False
|
||||||
return {"game_state": safe_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}
|
return {"game_state": safe_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}
|
||||||
else:
|
else:
|
||||||
return {"game_state": game_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}
|
return {"game_state": game_state, "gambler": { "coins": v.coins, "procoins": v.procoins }}
|
||||||
|
|
Loading…
Reference in New Issue