-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ability] Ignore Held Items for Stat Calculation (#5254)
* added the ability to ignore held items at stat calculation * integer -> number in src/field/pokemon.ts * added tests from @SirzBenjie * Update test * Fix test filename * added turnorder to tests * added tera_blast changes and tests --------- Co-authored-by: damocleas <[email protected]> Co-authored-by: NightKev <[email protected]>
- Loading branch information
1 parent
8012a1b
commit e75ddfa
Showing
5 changed files
with
157 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Abilities } from "#enums/abilities"; | ||
import { Moves } from "#enums/moves"; | ||
import { Nature } from "#enums/nature"; | ||
import { Species } from "#enums/species"; | ||
import { Stat } from "#enums/stat"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phaser from "phaser"; | ||
import { BattlerIndex } from "#app/battle"; | ||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; | ||
|
||
describe("Abilities - Protosynthesis", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
game.override | ||
.moveset([ Moves.SPLASH, Moves.TACKLE ]) | ||
.ability(Abilities.PROTOSYNTHESIS) | ||
.battleType("single") | ||
.disableCrits() | ||
.enemySpecies(Species.MAGIKARP) | ||
.enemyAbility(Abilities.BALL_FETCH) | ||
.enemyMoveset(Moves.SPLASH); | ||
}); | ||
|
||
it("should not consider temporary items when determining which stat to boost", async() => { | ||
// Mew has uniform base stats | ||
game.override.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.DEF }]) | ||
.enemyMoveset(Moves.SUNNY_DAY) | ||
.startingLevel(100) | ||
.enemyLevel(100); | ||
await game.classicMode.startBattle([ Species.MEW ]); | ||
const mew = game.scene.getPlayerPokemon()!; | ||
// Nature of starting mon is randomized. We need to fix it to a neutral nature for the automated test. | ||
mew.setNature(Nature.HARDY); | ||
const enemy = game.scene.getEnemyPokemon()!; | ||
const def_before_boost = mew.getEffectiveStat(Stat.DEF, undefined, undefined, false, undefined, false, false, true); | ||
const atk_before_boost = mew.getEffectiveStat(Stat.ATK, undefined, undefined, false, undefined, false, false, true); | ||
const initialHp = enemy.hp; | ||
game.move.select(Moves.TACKLE); | ||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); | ||
await game.toNextTurn(); | ||
const unboosted_dmg = initialHp - enemy.hp; | ||
enemy.hp = initialHp; | ||
const def_after_boost = mew.getEffectiveStat(Stat.DEF, undefined, undefined, false, undefined, false, false, true); | ||
const atk_after_boost = mew.getEffectiveStat(Stat.ATK, undefined, undefined, false, undefined, false, false, true); | ||
game.move.select(Moves.TACKLE); | ||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); | ||
await game.toNextTurn(); | ||
const boosted_dmg = initialHp - enemy.hp; | ||
expect(boosted_dmg).toBeGreaterThan(unboosted_dmg); | ||
expect(def_after_boost).toEqual(def_before_boost); | ||
expect(atk_after_boost).toBeGreaterThan(atk_before_boost); | ||
}); | ||
}); |
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