Skip to content
Snippets Groups Projects
Commit f948b2bc authored by cyan's avatar cyan
Browse files

* Plenty of updates

parent f393b9ee
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ this.Bot_Commands["GO"].command = function (target,onick,ouh,srv,lvl,cmd) {
srv.o(target, "No poker game to 'GO' with. Type '" + get_cmd_prefix() + "DEAL' to "
+ "start a new one.");
return;
} else if(poker_games[target].round>0) {
} else if(poker_games[target].round>=0) {
srv.o(target, "This hand has already started.");
return;
}
......@@ -32,6 +32,7 @@ this.Bot_Commands["GO"].command = function (target,onick,ouh,srv,lvl,cmd) {
srv.o(target, "At least two players are necessary to start the game.");
return;
}
poker_games[target].round = 0;
poker_init_hand(target);
poker_deal_hole_cards(target,srv);
poker_prompt_player(target,srv);
......@@ -46,10 +47,12 @@ this.Bot_Commands["FOLD"].command = function (target,onick,ouh,srv,lvl,cmd) {
} else if (!poker_games[target].users[onick.toUpperCase()]) {
srv.o(target, onick + ", you aren't playing this game.");
return;
} else if(poker_games[target].round<1) {
} else if(poker_games[target].round<0) {
srv.o(target, onick + ", the game hasn't started yet.");
return;
}
if(!poker_verify_game_status(target,srv,onick)) return;
delete poker_games[target].users[onick.toUpperCase()];
srv.o(target, onick + " folded their hand.");
......@@ -151,3 +154,24 @@ this.Bot_Commands["LIST"].command = function (target,onick,ouh,srv,lvl,cmd) {
return;
}
this.Bot_Commands["SHOW"] = new Bot_Command(0,false,false);
this.Bot_Commands["SHOW"].command = function (target,onick,ouh,srv,lvl,cmd) {
if (!poker_games[target]) {
srv.o(target,"There is no active game.");
return;
}
if (!poker_games[target].users[onick.toUpperCase()]) {
srv.o(target, onick + ", you aren't playing this game.");
return;
}
if(poker_games[target].round<0) {
srv.o(target, onick + ", the game hasn't started yet.");
return;
}
srv.o(target, onick + " shows: "
+ poker_show_card(poker_games[target].users[onick.toUpperCase()].cards[0])
+ poker_show_card(poker_games[target].users[onick.toUpperCase()].cards[1])
);
}
......@@ -76,7 +76,6 @@ function poker_next_turn(target,srv) {
function poker_deal_flop(target,srv) {
var poker_game=poker_games[target];
poker_game.round = 2;
poker_game.community_cards[0] = poker_game.deck.deal();
poker_game.community_cards[1] = poker_game.deck.deal();
poker_game.community_cards[2] = poker_game.deck.deal();
......@@ -89,7 +88,6 @@ function poker_deal_flop(target,srv) {
function poker_deal_turn(target,srv) {
var poker_game=poker_games[target];
poker_game.round = 3;
poker_game.community_cards[3] = poker_game.deck.deal();
srv.o(target, "The Turn: "
+ poker_show_card(poker_game.community_cards[0])
......@@ -101,7 +99,6 @@ function poker_deal_turn(target,srv) {
function poker_deal_river(target,srv) {
var poker_game=poker_games[target];
poker_game.round = 4;
poker_game.community_cards[4] = poker_game.deck.deal();
srv.o(target, "The River: " +
+ poker_show_card(poker_game.community_cards[0])
......@@ -113,7 +110,7 @@ function poker_deal_river(target,srv) {
}
function poker_show_card(card) {
return(card.color + "[ " + card.char + " ]");
return(card.color + "[ " + card.char + " ] ");
}
function poker_load_pot(target,srv) {
......@@ -129,9 +126,9 @@ function poker_load_pot(target,srv) {
function poker_prompt_player(target,srv) {
var poker=poker_games[target];
var turn=poker.users_map[poker.turn];
srv.o(turn, "It is your turn. You may CHECK, CALL, BET, RAISE or FOLD"
srv.o(turn, "It is your turn. You may CHECK, CALL, BET, RAISE or FOLD. "
+ "Minimum bet: $" + poker.current_bet
,"NOTICE");
srv.o(turn, "Minimum bet: $" + poker.current_bet, "NOTICE");
}
function poker_verify_game_status(target,srv,onick) {
......
......@@ -46,7 +46,7 @@ function Poker_Game()
this.sm_blind=5;
this.min_bet=this.sm_blind;
this.current_bet=this.min_bet;
this.round=0;
this.round=-1;
this.deck=new Deck();
this.community_cards=new Array();
this.paused=false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment