-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug] Lock Capsule no longer treats common items as free (#3591)
* Fixed null check to actually check for null and not 0 * Add test and `startingModifier()` override helper function * Add tsdoc
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phase from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; | ||
import { Abilities } from "#app/enums/abilities.js"; | ||
import { Moves } from "#app/enums/moves.js"; | ||
import { getMovePosition } from "../utils/gameManagerUtils"; | ||
import { SelectModifierPhase } from "#app/phases.js"; | ||
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js"; | ||
|
||
describe("Items - Lock Capsule", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phase.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(() => { | ||
game = new GameManager(phaserGame); | ||
|
||
game.override | ||
.battleType("single") | ||
.startingLevel(200) | ||
.moveset([Moves.SURF]) | ||
.enemyAbility(Abilities.BALL_FETCH) | ||
.startingModifier([{name: "LOCK_CAPSULE"}]); | ||
}); | ||
|
||
it("doesn't set the cost of common tier items to 0", async() => { | ||
await game.startBattle(); | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.SURF)); | ||
await game.phaseInterceptor.to(SelectModifierPhase, false); | ||
|
||
const rewards = game.scene.getCurrentPhase() as SelectModifierPhase; | ||
const potion = new ModifierTypeOption(modifierTypes.POTION(), 0, 40); // Common tier item | ||
const rerollCost = rewards.getRerollCost([potion, potion, potion], true); | ||
|
||
expect(rerollCost).toBe(150); | ||
}, 20000); | ||
}); |
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