mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 06:49:35 +02:00
fixed weather bug
This commit is contained in:
parent
a677a71e51
commit
f3fef6cd5d
@ -3117,7 +3117,7 @@ function getHealthKnockedBelowHalf(): AbAttrCondition {
|
||||
|
||||
// Helper function to check if health has dropped below half
|
||||
const isHealthBelowHalf = (initialHealth: number, currentHealth: number) =>
|
||||
initialHealth > maxPokemonHealth / 2 && currentHealth < maxPokemonHealth / 2;
|
||||
initialHealth >= maxPokemonHealth / 2 && currentHealth < maxPokemonHealth / 2;
|
||||
|
||||
// PostSummonPhase
|
||||
/**
|
||||
@ -5267,7 +5267,6 @@ export class PostWeatherForceSwitchOutAttr extends PostWeatherLapseAbAttr {
|
||||
*/
|
||||
|
||||
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
|
||||
const scene = pokemon.scene;
|
||||
if (pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
return false;
|
||||
}
|
||||
@ -5280,16 +5279,17 @@ export class PostWeatherForceSwitchOutAttr extends PostWeatherLapseAbAttr {
|
||||
pokemon.removeTag(BattlerTagType.TRAPPED);
|
||||
}
|
||||
const damageAmount = Utils.toDmgValue(pokemon.getMaxHp() / (16 / this.damageFactor));
|
||||
if (pokemon.getHpRatio() > 0.5 && (pokemon.hp - damageAmount) / 2 < pokemon.getMaxHp()) {
|
||||
if (getWeatherCondition(WeatherType.HAIL)) {
|
||||
scene.queueMessage(i18next.t("weather:hailDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||
} else {
|
||||
scene.queueMessage(i18next.t("weather:sandstormDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||
|
||||
if (pokemon.hp + damageAmount >= pokemon.getMaxHp() / 2) {
|
||||
if (pokemon.hp < pokemon.getMaxHp() / 2) {
|
||||
return this.helper.switchOutLogic(pokemon);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
pokemon.damageAndUpdate(Utils.toDmgValue(pokemon.getMaxHp() / (16 / this.damageFactor)), HitResult.OTHER);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return this.helper.switchOutLogic(pokemon);
|
||||
|
||||
}
|
||||
|
||||
getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null {
|
||||
|
@ -67,7 +67,7 @@ describe("Abilities - Wimp Out", () => {
|
||||
// arrange
|
||||
game.override
|
||||
.enemyMoveset(Moves.SLUDGE_BOMB)
|
||||
.startingLevel(95);
|
||||
.startingLevel(85);
|
||||
await game.startBattle([
|
||||
Species.WIMPOD,
|
||||
Species.TYRUNT
|
||||
|
Loading…
Reference in New Issue
Block a user