Fix hanging after catching Pokemon without releasing
parent
0c24ef3e42
commit
9e0a8a3030
|
@ -19,6 +19,15 @@
|
||||||
"vite-plugin-fs": "^1.0.0-beta.6"
|
"vite-plugin-fs": "^1.0.0-beta.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
|
"version": "1.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
||||||
|
"integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
"version": "7.21.0",
|
"version": "7.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
||||||
|
@ -1817,17 +1826,17 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/optionator": {
|
"node_modules/optionator": {
|
||||||
"version": "0.9.1",
|
"version": "0.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
|
||||||
"integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
|
"integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aashutoshrathi/word-wrap": "^1.2.3",
|
||||||
"deep-is": "^0.1.3",
|
"deep-is": "^0.1.3",
|
||||||
"fast-levenshtein": "^2.0.6",
|
"fast-levenshtein": "^2.0.6",
|
||||||
"levn": "^0.4.1",
|
"levn": "^0.4.1",
|
||||||
"prelude-ls": "^1.2.1",
|
"prelude-ls": "^1.2.1",
|
||||||
"type-check": "^0.4.0",
|
"type-check": "^0.4.0"
|
||||||
"word-wrap": "^1.2.3"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
|
@ -2411,9 +2420,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "3.2.5",
|
"version": "3.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.7.tgz",
|
||||||
"integrity": "sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==",
|
"integrity": "sha512-29pdXjk49xAP0QBr0xXqu2s5jiQIXNvE/xwd0vUizYT2Hzqe4BksNNoWllFVXJf4eLZ+UlVQmXfB4lWrc+t18g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.15.9",
|
"esbuild": "^0.15.9",
|
||||||
|
@ -2512,15 +2521,6 @@
|
||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/word-wrap": {
|
|
||||||
"version": "1.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/wrappy": {
|
"node_modules/wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
|
|
@ -2316,15 +2316,18 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
this.removePb();
|
this.removePb();
|
||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
const removePokemon = () => {
|
||||||
|
this.scene.getPlayerField().forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
||||||
|
pokemon.hp = 0;
|
||||||
|
pokemon.trySetStatus(StatusEffect.FAINT);
|
||||||
|
this.scene.clearEnemyModifiers();
|
||||||
|
this.scene.field.remove(pokemon, true);
|
||||||
|
};
|
||||||
const addToParty = () => {
|
const addToParty = () => {
|
||||||
const newPokemon = pokemon.addToParty();
|
const newPokemon = pokemon.addToParty();
|
||||||
const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
|
const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
|
||||||
Promise.all(modifiers.map(m => this.scene.addModifier(m))).then(() => {
|
Promise.all(modifiers.map(m => this.scene.addModifier(m))).then(() => {
|
||||||
this.scene.getPlayerField().forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
removePokemon();
|
||||||
pokemon.hp = 0;
|
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
|
||||||
this.scene.clearEnemyModifiers();
|
|
||||||
this.scene.field.remove(pokemon, true);
|
|
||||||
if (newPokemon)
|
if (newPokemon)
|
||||||
newPokemon.loadAssets().then(end);
|
newPokemon.loadAssets().then(end);
|
||||||
else
|
else
|
||||||
|
@ -2345,9 +2348,10 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
pokemon.hp = 0;
|
removePokemon();
|
||||||
end();
|
end();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue