-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug] Fix strong winds calculation (#2423)
* Fix strong winds calculation * add unit test * Add strong winds effect message * Update src/locales/de/weather.ts Co-authored-by: Jannik Tappert <[email protected]> * Update src/locales/es/weather.ts Co-authored-by: Jannik Tappert <[email protected]> * Update src/locales/fr/weather.ts Co-authored-by: Jannik Tappert <[email protected]> * Update src/locales/it/weather.ts Co-authored-by: Jannik Tappert <[email protected]> * Update src/locales/ko/weather.ts Co-authored-by: Jannik Tappert <[email protected]> --------- Co-authored-by: torranx <[email protected]> Co-authored-by: Jannik Tappert <[email protected]>
- Loading branch information
1 parent
160a5ce
commit 0f51099
Showing
11 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; | ||
import Phaser from "phaser"; | ||
import GameManager from "#app/test/utils/gameManager"; | ||
import * as overrides from "#app/overrides"; | ||
import { Species } from "#enums/species"; | ||
import { | ||
TurnStartPhase, | ||
} from "#app/phases"; | ||
import { Moves } from "#enums/moves"; | ||
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; | ||
import { Abilities } from "#enums/abilities"; | ||
import { allMoves } from "#app/data/move.js"; | ||
|
||
describe("Weather - Strong Winds", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true); | ||
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); | ||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.TAILLOW); | ||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DELTA_STREAM); | ||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); | ||
}); | ||
|
||
it("electric type move is not very effective on Rayquaza", async () => { | ||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RAYQUAZA); | ||
|
||
await game.startBattle([Species.PIKACHU]); | ||
const pikachu = game.scene.getPlayerPokemon(); | ||
const enemy = game.scene.getEnemyPokemon(); | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.THUNDERBOLT)); | ||
|
||
await game.phaseInterceptor.to(TurnStartPhase); | ||
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(0.5); | ||
}); | ||
|
||
it("electric type move is neutral for flying type pokemon", async () => { | ||
await game.startBattle([Species.PIKACHU]); | ||
const pikachu = game.scene.getPlayerPokemon(); | ||
const enemy = game.scene.getEnemyPokemon(); | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.THUNDERBOLT)); | ||
|
||
await game.phaseInterceptor.to(TurnStartPhase); | ||
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(1); | ||
}); | ||
|
||
it("ice type move is neutral for flying type pokemon", async () => { | ||
await game.startBattle([Species.PIKACHU]); | ||
const pikachu = game.scene.getPlayerPokemon(); | ||
const enemy = game.scene.getEnemyPokemon(); | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.ICE_BEAM)); | ||
|
||
await game.phaseInterceptor.to(TurnStartPhase); | ||
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ICE_BEAM].type, pikachu)).toBe(1); | ||
}); | ||
|
||
it("rock type move is neutral for flying type pokemon", async () => { | ||
await game.startBattle([Species.PIKACHU]); | ||
const pikachu = game.scene.getPlayerPokemon(); | ||
const enemy = game.scene.getEnemyPokemon(); | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.ROCK_SLIDE)); | ||
|
||
await game.phaseInterceptor.to(TurnStartPhase); | ||
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ROCK_SLIDE].type, pikachu)).toBe(1); | ||
}); | ||
}); |