mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-27 09:16:03 +00:00
move "battle:fainted" into koPlayerPokemon
This commit is contained in:
parent
41cacde623
commit
3e6183cd50
@ -688,12 +688,14 @@ export function calculateMEAggregateStats(scene: BattleScene, baseSpawnWeight: n
|
||||
/**
|
||||
* Takes care of handling player pokemon KO (with all its side effects)
|
||||
*
|
||||
* @param scene the battle scene
|
||||
* @param pokemon the player pokemon to KO
|
||||
*/
|
||||
export function koPlayerPokemon(pokemon: PlayerPokemon) {
|
||||
export function koPlayerPokemon(scene: BattleScene, pokemon: PlayerPokemon) {
|
||||
pokemon.hp = 0;
|
||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
||||
pokemon.updateInfo();
|
||||
queueEncounterMessage(scene, i18next.t("battle:fainted", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -709,8 +711,7 @@ function applyHpChangeToPokemon(scene: BattleScene, pokemon: PlayerPokemon, valu
|
||||
const hpChange = Math.round(pokemon.hp + value);
|
||||
const nextHp = Math.max(Math.min(hpChange, pokemon.getMaxHp()), 0);
|
||||
if (nextHp === 0) {
|
||||
koPlayerPokemon(pokemon);
|
||||
queueEncounterMessage(scene, i18next.t("battle:fainted", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||
koPlayerPokemon(scene, pokemon);
|
||||
} else {
|
||||
pokemon.hp = nextHp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user