Skip to content

MISC: Validate bet input of casino mini games #1694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

catloversg
Copy link
Collaborator

The "bet input" of 3 games (Coin flip, Slot machine, Roulette) has many problems:

  • The validation logic is duplicated.
  • The validation logic does not check the current player's money.
  • When the bet amount is "out-of-range", it's silently changed to the min/max value.
  • When the bet amount is invalid, there is no error shown in the UI.
  • There is no way to know the max bet amount of a game.

Blackjack does not have these problems, so this PR pulls the "bet input" of Blackjack out and reuses it in other games.

Before:
before

After:
after

@d0sboots
Copy link
Collaborator

Nice, the greater consistency looks good. This will of course mess up existing Casino scripts (again) XD

Copy link
Collaborator

@d0sboots d0sboots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no I forgot to send these pending comments from forever ago

@catloversg
Copy link
Collaborator Author

I updated based on your feedback. I also made 2 changes to make the behaviors of 4 games more consistent.
Currently, their behaviors are like this:

  • All games enable the play button without checking the bet, except Blackjack.
  • Roulette and slot machine call reachedLimit() after playing. Coin flip and blackjack do not.

My changes:

  • All games enable the play button without checking the bet. We will check the bet after the player presses the play button.
  • No game calls reachedLimit() after playing. We only need to call it after the player presses the play button.

@d0sboots d0sboots merged commit 86d5a02 into bitburner-official:dev Jun 24, 2025
5 checks passed
@catloversg catloversg deleted the pull-request/misc/validate-bet-input-of-casino-mini-games branch June 24, 2025 04:21
antoinedube pushed a commit to antoinedube/bitburner-source that referenced this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants