Prevent multiple pokeball throws: add throwing guard flag and block at 0 pokeballs

This commit is contained in:
Sterling Archer
2026-05-28 13:27:37 -07:00
parent 2c88aa2a5b
commit ddf96d87ac
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -1455,6 +1455,7 @@ class Game {
showCatchScreen() { showCatchScreen() {
const wild = this.state.currentWild; const wild = this.state.currentWild;
if (!wild) return; if (!wild) return;
this._throwing = false;
this.show('catch'); this.show('catch');
this._showController(true); this._showController(true);
@@ -1496,6 +1497,9 @@ class Game {
} }
throwPokeball(wild, canCatch) { throwPokeball(wild, canCatch) {
if (this._throwing) return;
if (this.state.pokeballs <= 0) return;
this._throwing = true;
this.state.pokeballs--; this.state.pokeballs--;
SFX.pokeball(); SFX.pokeball();
@@ -1563,6 +1567,7 @@ class Game {
} }
_showCatchResult(wild, canCatch) { _showCatchResult(wild, canCatch) {
this._throwing = false;
this.show('catch-result'); this.show('catch-result');
this._showController(true); this._showController(true);
+1 -1
View File
@@ -7,7 +7,7 @@
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="theme-color" content="#0a0520"> <meta name="theme-color" content="#0a0520">
<title>PokéSQL — Learn SQL</title> <title>PokéSQL — Lean SQL</title>
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>