View/Edit #6161:deal

Switch to edit mode.

Name(s): deal
1:  if (caller != this)
2:    raise(E_PERM)
3:  endif
4:  "if (!(gs = this:gs(player)))"
5:  "  return player:tell(\"You have to \\\"bet\\\" first.\");"
6:  "elseif (gs[9])"
7:  "  return player:Tell(\"You can only deal once.\");"
8:  "endif"
9:  gs = this:gs(player)
10: this.games[gs in this.games][9] = 1
11: bet = gs[8]
12: playerhand = {this:give_card(player, 0), this:give_card(player, 0)}
13: dealerhand = {this:give_card(player, 1), this:give_card(player, 1)}
14: this:showg(1)
15: cashonhand = this:money(player)
16: if (this.values[dealerhand[2]] == 0)
17:   if (cashonhand >= bet)
18:     while (`yon = $cmd_utils:yes_or_no(tostr("Do you wish to buy insurance for ", this:m_string(bet), "?")) ! E_INVARG' == E_INVARG)
19:       player:tell("Enter yes or no, or else.")
20:     endwhile
21:     if (yon)
22:       this:decrease_money(player, bet)
23:       this.dealer_income = this.dealer_income + bet
24:       if (this:tv(dealerhand) == 21)
25:         payoff = bet * 3.0
26:         player:tell("The dealer has a blackjack. You are given ", this:m_string(payoff), ".")
27:         this.dealer_income = this.dealer_income - payoff
28:         this:increase_money(player, payoff)
29:         this:streak(player, 1)
30:         this:mod(player, 2, 1)
31:         return this.games = setremove(this.games, this:gs(player))
32:       else
33:         player:tell("Sorry, the dealer doesn't have a blackjack.")
34:       endif
35:     else
36:       player:tell("You turn down the insurance.")
37:     endif
38:   else
39:     player:tell("You can't afford insurance.")
40:   endif
41: endif
42: gs = this:gs(player)
43: if (this:tv(gs[4]) + this:tv(gs[5]) == 42)
44:   player:tell("You got a BLACKJACK!  Fuck, that bastard dealer got one too.  Tie game.")
45:   this:announce(player:titlec(), " got a BLACKJACK!  Too bad the dealer got one too, eh?")
46:   this:increase_money(player, bet)
47:   this:streak(player, 1)
48:   this:mod(player, 2, 1)
49:   this:mod(player, 5, 1)
50:   player:tell("You get your ", this:m_string(bet), " back.")
51:   return this.games = setremove(this.games, gs)
52: elseif (this:tv(gs[4]) == 21)
53:   player:tell("The dealer got a BLACKJACK.  You lose. ")
54:   this:announce("The dealer gets a BLACKJACK, ", player:titlec(), " loses.")
55:   this:mod(player, 6, 1)
56:   this:mod(player, 3, 1)
57:   this:streak(player, 0)
58:   this.games = setremove(this.games, this:gs(player))
59:   return
60: elseif (this:tv(gs[5]) == 21)
61:   player:tell("You got a BLACKJACK!  Yeehaw.  You get ", this:m_String(bet * 3.0), ".")
62:   this:announce(player:titlec(), " gets a BLACKJACK, does a little happy-dance, and rakes the cash up.")
63:   this:increase_money(player, bet * 3.0)
64:   this:mod(player, 2, 1)
65:   this:streak(player, 1)
66:   this:mod(player, 5, 1)
67:   return this.games = setremove(this.games, gs)
68: endif
69: if (player:display_pueblo())
70:   player:tell("          [<a xch_cmd=\"H\">H</a>]it   [<a xch_cmd=\"S\">S</a>]tand   [<a xch_cmd=\"D\">D</a>]ouble", gs[5][1] % 13 == gs[5][2] % 13 ? "   [<a xch_cmd=\"SP\">SP</a>]lit" | "")
71: else
72:   player:tell("          [H]it   [S]tand   [D]ouble", gs[5][1] % 13 == gs[5][2] % 13 ? "   [SP]lit" | "")
73: endif
74: "player:tell(\"          [H]it   [S]tand   [D]ouble   [F]old\", (gs[5][1]%13 == gs[5][2]%13) ? \"   [SP]lit\" | \"\");"
75: "Last modified by James (#6397) on Thu Mar 15 00:59:24 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]