mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
test: 添加 PP 递减测试
验证使用招式后 PP 减少 1,maxPp 保持不变。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -146,6 +146,8 @@ export interface BattleAssertions {
|
||||
turnIs(n: number): BattleAssertions
|
||||
/** Player party has N alive (hp > 0) Pokémon */
|
||||
aliveInParty(n: number): BattleAssertions
|
||||
/** Player's move at index has expected pp and maxPp */
|
||||
playerMovePp(moveIndex: number, pp: number, maxPp: number): BattleAssertions
|
||||
/** Generic assertion */
|
||||
satisfies(fn: (state: BattleState) => boolean, msg?: string): BattleAssertions
|
||||
}
|
||||
@@ -297,6 +299,14 @@ class BattleAssertionsImpl implements BattleAssertions {
|
||||
return this
|
||||
}
|
||||
|
||||
playerMovePp(moveIndex: number, pp: number, maxPp: number) {
|
||||
const move = this.s.playerPokemon.moves[moveIndex]
|
||||
expect(move).toBeDefined()
|
||||
expect(move!.pp).toBe(pp)
|
||||
expect(move!.maxPp).toBe(maxPp)
|
||||
return this
|
||||
}
|
||||
|
||||
satisfies(fn: (state: BattleState) => boolean, msg?: string) {
|
||||
expect(fn(this.s), msg).toBe(true)
|
||||
return this
|
||||
|
||||
@@ -69,6 +69,23 @@ describe('Battle Scenario: 单回合事件', () => {
|
||||
.hasMove('opponent')
|
||||
})
|
||||
|
||||
battleTest('使用招式后 PP 递减', async () => {
|
||||
const s = await battleScenario()
|
||||
.party('charmander', 50, ['flamethrower', 'scratch'])
|
||||
.opponent('squirtle', 50)
|
||||
.start()
|
||||
|
||||
// Record initial PP
|
||||
const initialState = s.state
|
||||
const initialPp = initialState.playerPokemon.moves[0]!.pp
|
||||
const maxPp = initialState.playerPokemon.moves[0]!.maxPp
|
||||
expect(initialPp).toBe(maxPp)
|
||||
|
||||
const state = await s.useMove(0).runTurn()
|
||||
// PP should decrease by 1, maxPp stays the same
|
||||
s.expect(state).playerMovePp(0, initialPp - 1, maxPp)
|
||||
})
|
||||
|
||||
battleTest('等级碾压一击击杀', async () => {
|
||||
const s = await battleScenario()
|
||||
.party('charmander', 100, ['flamethrower'], { ev: { hp: 252, attack: 252, speed: 252 } })
|
||||
|
||||
Reference in New Issue
Block a user