mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 22:12:16 +02:00
[P2] Make weather damage round down for consistency (#4559)
* fmake weather damage consistent with the rest of the game * [test] add some sandstorm and hail tests
This commit is contained in:
parent
f634b7c044
commit
831efeb6bf
@ -44,7 +44,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const damage = Math.ceil(pokemon.getMaxHp() / 16);
|
const damage = Utils.toDmgValue(pokemon.getMaxHp() / 16);
|
||||||
|
|
||||||
this.scene.queueMessage(getWeatherDamageMessage(this.weather?.weatherType!, pokemon)!); // TODO: are those bangs correct?
|
this.scene.queueMessage(getWeatherDamageMessage(this.weather?.weatherType!, pokemon)!); // TODO: are those bangs correct?
|
||||||
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
|
||||||
|
@ -39,7 +39,7 @@ describe("Weather - Hail", () => {
|
|||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
game.scene.getField(true).forEach(pokemon => {
|
game.scene.getField(true).forEach(pokemon => {
|
||||||
expect(pokemon.hp).toBeLessThan(pokemon.getMaxHp() - Math.floor(pokemon.getMaxHp() / 16));
|
expect(pokemon.hp).toBe(pokemon.getMaxHp() - Math.max(Math.floor(pokemon.getMaxHp() / 16), 1));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -56,6 +56,20 @@ describe("Weather - Hail", () => {
|
|||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
||||||
expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp() - Math.floor(enemyPokemon.getMaxHp() / 16));
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp() - Math.max(Math.floor(enemyPokemon.getMaxHp() / 16), 1));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not inflict damage to Ice type Pokemon", async () => {
|
||||||
|
await game.classicMode.startBattle([Species.CLOYSTER]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
||||||
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp() - Math.max(Math.floor(enemyPokemon.getMaxHp() / 16), 1));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { WeatherType } from "#app/data/weather";
|
import { WeatherType } from "#app/data/weather";
|
||||||
|
import { Abilities } from "#app/enums/abilities";
|
||||||
|
import { Stat } from "#app/enums/stat";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
@ -37,7 +39,7 @@ describe("Weather - Sandstorm", () => {
|
|||||||
await game.phaseInterceptor.to("TurnEndPhase");
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
game.scene.getField(true).forEach(pokemon => {
|
game.scene.getField(true).forEach(pokemon => {
|
||||||
expect(pokemon.hp).toBeLessThan(pokemon.getMaxHp() - Math.floor(pokemon.getMaxHp() / 16));
|
expect(pokemon.hp).toBe(pokemon.getMaxHp() - Math.max(Math.floor(pokemon.getMaxHp() / 16), 1));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,6 +55,37 @@ describe("Weather - Sandstorm", () => {
|
|||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp());
|
||||||
expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp() - Math.floor(enemyPokemon.getMaxHp() / 16));
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp() - Math.max(Math.floor(enemyPokemon.getMaxHp() / 16), 1));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not inflict damage to Rock, Ground and Steel type Pokemon", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("double")
|
||||||
|
.enemySpecies(Species.SANDSHREW)
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([Species.ROCKRUFF, Species.KLINK]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
game.scene.getField(true).forEach(pokemon => {
|
||||||
|
expect(pokemon.hp).toBe(pokemon.getMaxHp());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("increases Rock type Pokemon Sp.Def by 50%", async () => {
|
||||||
|
await game.classicMode.startBattle([Species.ROCKRUFF]);
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
const playerSpdef = playerPokemon.getStat(Stat.SPDEF);
|
||||||
|
expect(playerPokemon.getEffectiveStat(Stat.SPDEF)).toBe(Math.floor(playerSpdef * 1.5));
|
||||||
|
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
const enemySpdef = enemyPokemon.getStat(Stat.SPDEF);
|
||||||
|
expect(enemyPokemon.getEffectiveStat(Stat.SPDEF)).toBe(enemySpdef);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user