* @brief カジノ1プレイごとのメインルーチン / gamble_comm
* @param player_ptr プレイヤーへの参照ポインタ
* @param cmd プレイするゲームID
- * @return プレイ成立やルール説明のみ等ならTRUE、賭け金不足で不成立ならFALSE
*/
-bool gamble_comm(PlayerType *player_ptr, int cmd)
+void gamble_comm(PlayerType *player_ptr, int cmd)
{
screen_save();
if (cmd == BACT_GAMBLE_RULES) {
(void)show_file(player_ptr, true, _("jgambling.txt", "gambling.txt"), 0, 0);
screen_load();
- return true;
+ return;
}
if (player_ptr->au < 1) {
msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
msg_print(nullptr);
screen_load();
- return false;
+ return;
}
clear_bldg(5, 23);
if (!wager_opt.has_value()) {
msg_print(nullptr);
screen_load();
- return true;
+ return;
}
auto wager = wager_opt.value();
msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
msg_print(nullptr);
screen_load();
- return false;
+ return;
}
msg_print(nullptr);
auto win = 0;
auto odds = 0;
auto oldgold = player_ptr->au;
-
prt(format(_("ゲーム前の所持金: %9d", "Gold before game: %9d"), oldgold), 20, 2);
prt(format(_("現在の掛け金: %9d", "Current Wager: %9d"), wager), 21, 2);
-
while (true) {
player_ptr->au -= wager;
switch (cmd) {
case BACT_IN_BETWEEN: {
c_put_str(TERM_GREEN, _("イン・ビトイーン", "In Between"), 5, 2);
-
odds = 4;
win = 0;
auto roll1 = randint1(10);
auto roll2 = randint1(10);
auto choice = randint1(10);
-
prt(format(_("黒ダイス: %d 黒ダイス: %d", "Black die: %d Black Die: %d"), roll1, roll2), 8, 3);
-
prt(format(_("赤ダイス: %d", "Red die: %d"), choice), 11, 14);
if (((choice > roll1) && (choice < roll2)) || ((choice < roll1) && (choice > roll2))) {
win = 1;
}
case BACT_CRAPS: {
c_put_str(TERM_GREEN, _("クラップス", "Craps"), 5, 2);
-
win = 3;
odds = 2;
auto roll1 = randint1(6);
prt(format(_("1振りめ: %d %d Total: %d", "First roll: %d %d Total: %d"), roll1, roll2, roll3), 7, 5);
if ((roll3 == 7) || (roll3 == 11)) {
win = 1;
- } else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12)) {
- win = 0;
- } else {
- do {
- msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
+ break;
+ }
- msg_print(nullptr);
- roll1 = randint1(6);
- roll2 = randint1(6);
- roll3 = roll1 + roll2;
- prt(format(_("出目: %d %d 合計: %d", "Roll result: %d %d Total: %d"), roll1, roll2, roll3), 8, 5);
- if (roll3 == choice) {
- win = 1;
- } else if (roll3 == 7) {
- win = 0;
- }
- } while ((win != 1) && (win != 0));
+ if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12)) {
+ win = 0;
+ break;
}
+ do {
+ msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
+
+ msg_print(nullptr);
+ roll1 = randint1(6);
+ roll2 = randint1(6);
+ roll3 = roll1 + roll2;
+ prt(format(_("出目: %d %d 合計: %d", "Roll result: %d %d Total: %d"), roll1, roll2, roll3), 8, 5);
+ if (roll3 == choice) {
+ win = 1;
+ } else if (roll3 == 7) {
+ win = 0;
+ }
+ } while ((win != 1) && (win != 0));
break;
}
case BACT_SPIN_WHEEL: {
win = 0;
odds = 9;
c_put_str(TERM_GREEN, _("ルーレット", "Wheel"), 5, 2);
-
prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
prt("--------------------------------", 8, 3);
while (true) {
}
roll1 -= i;
}
+
auto roll2 = randint1(21);
for (auto i = 6; i > 0; i--) {
if ((roll2 - i) < 1) {
}
roll2 -= i;
}
+
auto choice = randint1(21);
for (auto i = 6; i > 0; i--) {
if ((choice - i) < 1) {
}
choice -= i;
}
+
put_str("/--------------------------\\", 7, 2);
prt("\\--------------------------/", 17, 2);
display_fruit(8, 3, roll1 - 1);
odds = 1000;
break;
}
- } else if ((roll1 == 1) && (roll2 == 1)) {
+
+ break;
+ }
+
+ if ((roll1 == 1) && (roll2 == 1)) {
win = 1;
odds = 2;
}
if (win) {
prt(_("あなたの勝ち", "YOU WON"), 16, 37);
-
player_ptr->au += odds * wager;
-
prt(format(_("倍率: %d", "Payoff: %d"), odds), 17, 37);
} else {
prt(_("あなたの負け", "You Lost"), 16, 37);
prt(format(_("現在の所持金: %9d", "Current Gold: %9d"), player_ptr->au), 22, 2);
prt(_("もう一度(Y/N)?", "Again(Y/N)?"), 18, 37);
-
move_cursor(18, 52);
auto again = inkey();
prt("", 16, 37);
msg_print(nullptr);
screen_load();
- return true;
}