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)
|
* Takes care of handling player pokemon KO (with all its side effects)
|
||||||
*
|
*
|
||||||
|
* @param scene the battle scene
|
||||||
* @param pokemon the player pokemon to KO
|
* @param pokemon the player pokemon to KO
|
||||||
*/
|
*/
|
||||||
export function koPlayerPokemon(pokemon: PlayerPokemon) {
|
export function koPlayerPokemon(scene: BattleScene, pokemon: PlayerPokemon) {
|
||||||
pokemon.hp = 0;
|
pokemon.hp = 0;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.trySetStatus(StatusEffect.FAINT);
|
||||||
pokemon.updateInfo();
|
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 hpChange = Math.round(pokemon.hp + value);
|
||||||
const nextHp = Math.max(Math.min(hpChange, pokemon.getMaxHp()), 0);
|
const nextHp = Math.max(Math.min(hpChange, pokemon.getMaxHp()), 0);
|
||||||
if (nextHp === 0) {
|
if (nextHp === 0) {
|
||||||
koPlayerPokemon(pokemon);
|
koPlayerPokemon(scene, pokemon);
|
||||||
queueEncounterMessage(scene, i18next.t("battle:fainted", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
|
||||||
} else {
|
} else {
|
||||||
pokemon.hp = nextHp;
|
pokemon.hp = nextHp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue