global schmobal
This commit is contained in:
parent
2553883571
commit
839452d394
|
@ -19,61 +19,61 @@ const parseCards = msg => {
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
let hand = false;
|
let g_hand = false;
|
||||||
let board = false;
|
let g_board = false;
|
||||||
let winchance = false;
|
let g_winchance = false;
|
||||||
let called = false;
|
let g_called = false;
|
||||||
let joined = false;
|
let g_joined = false;
|
||||||
let callphase = true;
|
let g_callphase = true;
|
||||||
let callamount = 0;
|
let g_callamount = 0;
|
||||||
let pot = 0;
|
let g_pot = 0;
|
||||||
|
|
||||||
bot.on("message", e => {
|
bot.on("message", e => {
|
||||||
if(e.message === ".pj" || e.message === "pj" && !hand && !joined) {
|
if(e.message === ".pj" || e.message === "pj" && !g_hand && !g_joined) {
|
||||||
joined = true;
|
g_joined = true;
|
||||||
return e.reply("pj");
|
return e.reply("pj");
|
||||||
}
|
}
|
||||||
if(e.message === ".pl" && !hand)
|
if(e.message === ".pl" && !g_hand)
|
||||||
return e.reply("pl");
|
return e.reply("pl");
|
||||||
if(e.message === ".bb" && !hand)
|
if(e.message === ".bb" && !g_hand)
|
||||||
return e.reply("bb");
|
return e.reply("bb");
|
||||||
if(e.message === ".bl" && !hand)
|
if(e.message === ".bl" && !g_hand)
|
||||||
return e.reply("bank loan");
|
return e.reply("bank loan");
|
||||||
if(e.message === ".s" && hand)
|
if(e.message === ".s" && g_hand)
|
||||||
return e.reply("s");
|
return e.reply("s");
|
||||||
|
|
||||||
if(e.user.nick !== 'hirc' || !hand)
|
if(e.user.nick !== 'hirc' || !g_hand)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(e.message.match(/(small|big) blind/)) {
|
if(e.message.match(/(small|big) blind/)) {
|
||||||
callamount = +e.message.match(/pays (\d+) \(/)[1];
|
g_callamount = +e.message.match(/pays (\d+) \(/)[1];
|
||||||
callphase = true;
|
g_callphase = true;
|
||||||
pot += callamount;
|
g_pot += g_callamount;
|
||||||
console.log(`callphase: ${callphase ? 'yes': 'no'}; callamount: ${callamount}; potsize: ${pot}; winchance: ${winchance}`);
|
console.log(`callphase: ${g_callphase ? 'yes': 'no'}; callamount: ${g_callamount}; potsize: ${g_pot}; winchance: ${g_winchance}`);
|
||||||
}
|
}
|
||||||
if(e.message.match(/raises the pot/)) {
|
if(e.message.match(/raises the pot/)) {
|
||||||
callamount = +e.message.match(/pot by (\d+)/)[1];
|
g_callamount = +e.message.match(/pot by (\d+)/)[1];
|
||||||
callphase = true;
|
g_callphase = true;
|
||||||
pot += callamount;
|
g_pot += g_callamount;
|
||||||
console.log(`callphase: ${callphase ? 'yes': 'no'}; callamount: ${callamount}; potsize: ${pot}; winchance: ${winchance}`);
|
console.log(`callphase: ${g_callphase ? 'yes': 'no'}; callamount: ${g_callamount}; potsize: ${g_pot}; winchance: ${g_winchance}`);
|
||||||
}
|
}
|
||||||
if(e.message.match(/calls \d+\./)) {
|
if(e.message.match(/calls \d+\./)) {
|
||||||
callamount = +e.message.match(/calls (\d+)\./)[1];
|
g_callamount = +e.message.match(/calls (\d+)\./)[1];
|
||||||
pot += callamount;
|
g_pot += g_callamount;
|
||||||
console.log(`callphase: ${callphase ? 'yes': 'no'}; callamount: ${callamount}; potsize: ${pot}; winchance: ${winchance}`);
|
console.log(`callphase: ${g_callphase ? 'yes': 'no'}; callamount: ${g_callamount}; potsize: ${g_pot}; winchance: ${g_winchance}`);
|
||||||
}
|
}
|
||||||
if(e.message.match(/check/)) {
|
if(e.message.match(/check/)) {
|
||||||
callphase = false;
|
g_callphase = false;
|
||||||
console.log(`callphase: ${callphase ? 'yes': 'no'}; callamount: ${callamount}; potsize: ${pot}; winchance: ${winchance}`);
|
console.log(`callphase: ${g_callphase ? 'yes': 'no'}; callamount: ${g_callamount}; potsize: ${g_pot}; winchance: ${g_winchance}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.message.startsWith("Current player: schmirc") && hand) {
|
if(e.message.startsWith("Current player: schmirc") && g_hand) {
|
||||||
if(!winchance)
|
if(!g_winchance)
|
||||||
return e.reply('c');
|
return e.reply('c');
|
||||||
|
|
||||||
if(winchance >= 55 && callamount) {
|
if(g_winchance >= 55 && g_callamount) {
|
||||||
if((~~(Math.random() * 2)) === 1) {
|
if((~~(Math.random() * 2)) === 1) {
|
||||||
return e.reply(`r ${callamount + (~~(Math.random() * 2 + 2) * 10)}`)
|
return e.reply(`r ${g_callamount + (~~(Math.random() * 2 + 2) * 10)}`)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return e.reply('c');
|
return e.reply('c');
|
||||||
|
@ -81,11 +81,11 @@ bot.on("message", e => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.message.match(/to call/)) {
|
if(e.message.match(/to call/)) {
|
||||||
if(winchance >= 30) {
|
if(g_winchance >= 30) {
|
||||||
if(called)
|
if(g_called)
|
||||||
return e.reply('c');
|
return e.reply('c');
|
||||||
else {
|
else {
|
||||||
called = true;
|
g_called = true;
|
||||||
return e.reply( (~~(Math.random() * 2)) === 1 ? 'c' : 'f' );
|
return e.reply( (~~(Math.random() * 2)) === 1 ? 'c' : 'f' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,24 +97,24 @@ bot.on("message", e => {
|
||||||
return e.reply('c');
|
return e.reply('c');
|
||||||
}
|
}
|
||||||
if(e.message.match(/Game ended/) || e.message.match(/wins the pot/)) {
|
if(e.message.match(/Game ended/) || e.message.match(/wins the pot/)) {
|
||||||
//e.reply(`my hand: ${hand.join(', ')} (${winchance}%)`);
|
//e.reply(`my hand: ${g_hand.join(', ')} (${g_winchance}%)`);
|
||||||
hand = false;
|
g_hand = false;
|
||||||
board = false;
|
g_board = false;
|
||||||
winchance = false;
|
g_winchance = false;
|
||||||
called = false;
|
g_called = false;
|
||||||
joined = false;
|
g_joined = false;
|
||||||
pot = 0;
|
g_pot = 0;
|
||||||
callphase = false;
|
g_callphase = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.message.match(/^(Flop|Turn|River)/) && e.user.nick === 'hirc') {
|
if(e.message.match(/^(Flop|Turn|River)/) && e.user.nick === 'hirc') {
|
||||||
board = parseCards(e.message);
|
g_board = parseCards(e.message);
|
||||||
|
|
||||||
console.log(board, hand);
|
console.log(g_board, g_hand);
|
||||||
|
|
||||||
const rank = rankHands('texas', board, [hand])[0];
|
const rank = rankHands('texas', g_board, [g_hand])[0];
|
||||||
winchance = (9999 - rank.rank) / 100;
|
g_winchance = (9999 - rank.rank) / 100;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user