Prevent multiple pokeball throws: add throwing guard flag and block at 0 pokeballs
This commit is contained in:
1 parent
2c88aa2a5b
commit
ddf96d87ac
2 files changed
+6
-1
No files matched your search
@@ -1455,6 +1455,7 @@ class Game {
|
||||
showCatchScreen() {
|
||||
const wild = this.state.currentWild;
|
||||
if (!wild) return;
|
||||
this._throwing = false;
|
||||
|
||||
this.show('catch');
|
||||
this._showController(true);
|
||||
@@ -1496,6 +1497,9 @@ class Game {
|
||||
}
|
||||
|
||||
throwPokeball(wild, canCatch) {
|
||||
if (this._throwing) return;
|
||||
if (this.state.pokeballs <= 0) return;
|
||||
this._throwing = true;
|
||||
this.state.pokeballs--;
|
||||
SFX.pokeball();
|
||||
|
||||
@@ -1563,6 +1567,7 @@ class Game {
|
||||
}
|
||||
|
||||
_showCatchResult(wild, canCatch) {
|
||||
this._throwing = false;
|
||||
this.show('catch-result');
|
||||
this._showController(true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user