mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Commit for testing
This commit is contained in:
parent
e706aadcd7
commit
97542cefd8
@ -2448,7 +2448,11 @@ export class ModifierTypeOption {
|
||||
*/
|
||||
export function getPartyLuckValue(party: Pokemon[]): integer {
|
||||
if (party[0].scene.gameMode.isDaily) {
|
||||
return 0;
|
||||
let DailyLuck: integer = 0;
|
||||
party[0].scene.executeWithSeedOffset(() => {
|
||||
DailyLuck = Utils.randSeedInt(15); // Random number between 0 and 14
|
||||
}, 0, party[0].scene.seed);
|
||||
return DailyLuck;
|
||||
}
|
||||
const luck = Phaser.Math.Clamp(party.map(p => p.isAllowedInBattle() ? (p.scene.gameMode.isDaily ? 0 : p.getLuck()) : 0)
|
||||
.reduce((total: integer, value: integer) => total += value, 0), 0, 14);
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { MapModifier } from "#app/modifier/modifier";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import GameManager from "./utils/gameManager";
|
||||
import { Moves } from "#app/enums/moves";
|
||||
import { getPartyLuckValue } from "#app/modifier/modifier-type";
|
||||
import { Biome } from "#app/enums/biome";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||
import { Species } from "#app/enums/species";
|
||||
|
||||
//const TIMEOUT = 20 * 1000;
|
||||
|
||||
@ -62,8 +60,9 @@ describe("Shop modifications", async () => {
|
||||
.disableTrainerWaves()
|
||||
.moveset([Moves.KOWTOW_CLEAVE])
|
||||
.enemyMoveset(Moves.SPLASH);
|
||||
game.modifiers.addCheck("EVIOLITE");
|
||||
game.modifiers.addCheck("MINI_BLACK_HOLE");
|
||||
game.modifiers
|
||||
.addCheck("EVIOLITE")
|
||||
.addCheck("MINI_BLACK_HOLE");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -99,48 +98,3 @@ describe("Shop modifications", async () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Luck modifications", async() => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
game.override
|
||||
.startingWave(9)
|
||||
.startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather
|
||||
.battleType("single")
|
||||
.startingLevel(100) // Avoid levelling up
|
||||
.enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents()
|
||||
.disableTrainerWaves()
|
||||
.moveset([Moves.KOWTOW_CLEAVE])
|
||||
.enemyMoveset(Moves.SPLASH);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
it("should apply luck in Classic Mode", async () => {
|
||||
await game.classicMode.startBattle([Species.PIKACHU]);
|
||||
const party = game.scene.getParty();
|
||||
vi.spyOn(party[0], "getLuck").mockReturnValue(3);
|
||||
expect(party[0].getLuck()).toBeGreaterThan(0);
|
||||
expect(getPartyLuckValue(party)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("should not apply luck in Daily Run", async () => {
|
||||
await game.dailyMode.startBattle();
|
||||
const party = game.scene.getParty();
|
||||
vi.spyOn(party[0], "getLuck").mockReturnValue(3);
|
||||
expect(party[0].getLuck()).toBeGreaterThan(0);
|
||||
expect(getPartyLuckValue(party)).toBe(0);
|
||||
});
|
||||
});
|
||||
//*/
|
||||
|
@ -8,9 +8,11 @@ export class ModifierHelper extends GameManagerHelper {
|
||||
*
|
||||
* Note that all modifiers are updated during the start of `SelectModifierPhase`.
|
||||
* @param modifier The Modifier to add.
|
||||
* @returns `this`
|
||||
*/
|
||||
addCheck(modifier: ModifierTypeKeys) {
|
||||
addCheck(modifier: ModifierTypeKeys): this {
|
||||
itemPoolChecks.set(modifier, undefined);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkHasRun(modifier: ModifierTypeKeys): boolean {
|
||||
@ -51,9 +53,10 @@ export class ModifierHelper extends GameManagerHelper {
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Removes all modifier checks. */
|
||||
/** Removes all modifier checks. @returns `this` */
|
||||
clearChecks() {
|
||||
itemPoolChecks.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
private log(...params: any[]) {
|
||||
|
Loading…
Reference in New Issue
Block a user