View/Edit #6161:check_winner

Switch to edit mode.

Name(s): check_winner
1:  if (caller != this)
2:    raise(E_PERM)
3:  endif
4:  if (!(gs = this:gs(player)))
5:    return player:tell("But you're not playing!")
6:  endif
7:  bet = gs[8]
8:  total = this:tv(gs[5])
9:  dtotal = this:tv(gs[4])
10: if (this:check_bust(player))
11:   return
12: endif
13: if (total == dtotal)
14:   player:tell("Tie game.  No winner.  You get ", this:m_string(bet), " back.")
15:   this:increase_money(player, bet)
16:   this:mod(player, 4, 1)
17: elseif (total < dtotal)
18:   this:streak(player, 0)
19:   this:mod(player, 3, 1)
20:   player:tell("The dealer's ", dtotal, " beats your ", total, ".  The dealer wins.")
21: elseif (total > dtotal)
22:   player:tell("Your ", total, " beats the dealer's ", dtotal, ". Congratulations, you win ", this:m_string(bet * 2.0), ".")
23:   this:streak(player, 1)
24:   this:mod(player, 2, 1)
25:   this:increase_money(player, bet * 2.0)
26:   this.dealer_income = this.dealer_income - bet * 2.0
27: endif
28: if (qq = listassoc(this.splitters, player))
29:   "Woah horsey! You ain't done yet."
30:   player:tell("You go to your split card and continue playing.")
31:   this.games[$list_utils:iassoc(player, this.games)][5] = {qq[2], this:give_card(player, 0)}
32:   this.games[$list_utils:iassoc(player, this.games)][7] = 0
33:   this:showg(1)
34:   this.splitters = setremove(this.splitters, qq)
35:   return
36: endif
37: this.games = setremove(this.games, this:gs(player))
38: "$md:even(player);"
39: "player:tell(\"You now have \", this:m_String($md:money(player)));"
40: "Last modified by James (#6397) on Thu Mar 15 00:26:17 2007 EDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: James (#6397)

You are not logged in.

[home | help | who | search | setup | code]