mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
* Stage release v1.10.0
* [GitHub] Workflows will now run on `release` branch (#6329)
* [Beta] [Balance] Add Wild Evo Delay to Gallade / Froslass (#6324)
* Update pokemon-evolutions.ts
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* [Beta] [Balance] Fix Wrong Teras in Trainer Config (#6326)
* Update trainer-config.ts
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
* Revert #6307 "Remove duplicate animation json for ... variants" (#6332)
Revert "[Refactor][Sprite] Remove duplicate animation json for shinies, sprite-based variants (#6307)"
This reverts commit 7bdb62ed1d
.
* [Beta] Fresh Start no longer overrides IV unlocks (#6333)
Unpack ivs when copying dexData
* [UI/UX] Always show starter's natures and ivs in evolution's dex entry (#6335)
Natures and ivs use starter's dexEntry
* [Bug] Sheer Force no longer boosts Fickle Beam; Focus Energy gives +2 crit instead of +1 (#6331)
[Bug] Sheer Force no longer boosts Fickle Beam; Focus Energy correctly gives +2 crit stages instead of +1
* Restricted party options for fainted mons in hardcore (#6336)
* [Challenge] No hardcore breeder (#6334)
Disallow expert breeder encounter in space
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* [Bug] [Beta] Fix trick room message (#6327)
Fix trick room's arena tag message
* [Beta][Bug][UI/UX] Fix broken candy upgrades (#6322)
* Candy upgrades change permanent starter data again
* Updating cost icon and passive bg in starter select after buying pokédex upgrades
* [Beta] [Balance] Even More 1.10 Balance Changes (Egg Moves + Passive Changes) (#6339)
1.10 Egg Moves and Passives pt 3
* [Bug][Sprite] Remove fake Deerling variants (#6330)
* Remove fake Deerling variants
* Remove unused json
* [Bug] Ensure MEs disabled in a challenge mode only do so while challenge is active (#6337)
* Ensure MEs disabled in a challenge mode only do so while challenge is active
* Optimize checking disallowed challenges
* [Misc] Moved `scrapeTrainerNames` to a script; removed `selfStatLowerMoves` (#6258)
* Removed scrape trainer names
* Removed `selfStatLowerMoves`
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Started work on the script again
* Made script actually work
* Made finishing touches on script
* Fixed main repo code to not expect snake cased locale strings
* Update trainer.ts
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Remove biome ignore range
* Fix typedoc.json
* rename `getRandomLocaleKey` to `getRandomLocaleEntry`
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Update locales
* [Balance] [ME] Trash to Treasure Option 1 Adjustment (#6341)
* Update trash-to-treasure-encounter.ts
* Update trash-to-treasure-encounter.test.ts tests
* [Misc] [UX] Add Daily Run Achievement, Re-Arrange Achievements, Replace some Icon Sprites (#6292)
* wip achievement changes
* Adjust egg image sizes, re-export item atlas
* painful eggs
* Add egg to legacy UI, re-export item atlas
* run biome
* Update achievement.test.ts
* Fix achievement test file
* Fix tera stellar missing icon path
* Fix achievement test file
* egg s
* Optimize new images, re-export item atlas
* update pngs and locale
* add daily achv and other sorting
* Optimize ribbons, re-export item atlas
* Bump to version 1.11.0
* more changes, waiting on pngs
* Update package.json
* ribbon fixes
* images!
* Optimize images, re-export item atlas
* final fix
---------
Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* [Bug] [UI/UX] [Beta] Fix visibility of egg moves in ssui (#6343)
Fix visibility of egg moves when backing out of fresh start and back into ssui
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Blitzy <118096277+Blitz425@users.noreply.github.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: AJ Fontaine <36677462+Fontbane@users.noreply.github.com>
Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
281 lines
9.7 KiB
TypeScript
281 lines
9.7 KiB
TypeScript
import type { BattleScene } from "#app/battle-scene";
|
|
import { TurnHeldItemTransferModifier } from "#modifiers/modifier";
|
|
import {
|
|
Achv,
|
|
AchvTier,
|
|
achvs,
|
|
DamageAchv,
|
|
HealAchv,
|
|
LevelAchv,
|
|
ModifierAchv,
|
|
MoneyAchv,
|
|
RibbonAchv,
|
|
} from "#system/achv";
|
|
import { GameManager } from "#test/test-utils/game-manager";
|
|
import { NumberHolder } from "#utils/common";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
describe("Achv", () => {
|
|
let achv: Achv;
|
|
|
|
beforeEach(() => {
|
|
achv = new Achv("", "This is a test achievement", "test_icon", 10);
|
|
});
|
|
|
|
it("should have the correct description", () => {
|
|
expect(achv.getDescription()).toBe("This is a test achievement");
|
|
});
|
|
|
|
it("should have the correct icon image", () => {
|
|
expect(achv.getIconImage()).toBe("test_icon");
|
|
});
|
|
|
|
it("should set the achievement as secret", () => {
|
|
achv.setSecret();
|
|
expect(achv.secret).toBe(true);
|
|
expect(achv.hasParent).toBe(false);
|
|
|
|
achv.setSecret(true);
|
|
expect(achv.secret).toBe(true);
|
|
expect(achv.hasParent).toBe(true);
|
|
|
|
achv.setSecret(false);
|
|
expect(achv.secret).toBe(true);
|
|
expect(achv.hasParent).toBe(false);
|
|
});
|
|
|
|
it("should return the correct tier based on the score", () => {
|
|
const achv1 = new Achv("", "Test Description", "test_icon", 10);
|
|
const achv2 = new Achv("", "Test Description", "test_icon", 25);
|
|
const achv3 = new Achv("", "Test Description", "test_icon", 50);
|
|
const achv4 = new Achv("", "Test Description", "test_icon", 75);
|
|
const achv5 = new Achv("", "Test Description", "test_icon", 100);
|
|
|
|
expect(achv1.getTier()).toBe(AchvTier.COMMON);
|
|
expect(achv2.getTier()).toBe(AchvTier.GREAT);
|
|
expect(achv3.getTier()).toBe(AchvTier.ULTRA);
|
|
expect(achv4.getTier()).toBe(AchvTier.ROGUE);
|
|
expect(achv5.getTier()).toBe(AchvTier.MASTER);
|
|
});
|
|
|
|
it("should validate the achievement based on the condition function", () => {
|
|
const conditionFunc = vi.fn(args => args[0] === 10);
|
|
const achv2 = new Achv("", "Test Description", "test_icon", 10, conditionFunc);
|
|
|
|
expect(achv2.validate([5])).toBe(false);
|
|
expect(achv2.validate([10])).toBe(true);
|
|
expect(conditionFunc).toHaveBeenCalledTimes(2);
|
|
});
|
|
});
|
|
|
|
describe("MoneyAchv", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
let scene: BattleScene;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
scene = game.scene;
|
|
});
|
|
|
|
it("should create an instance of MoneyAchv", () => {
|
|
const moneyAchv = new MoneyAchv("", 10000, "money_icon", 10);
|
|
expect(moneyAchv).toBeInstanceOf(MoneyAchv);
|
|
expect(moneyAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the money amount", () => {
|
|
const moneyAchv = new MoneyAchv("", 10000, "money_icon", 10);
|
|
scene.money = 5000;
|
|
|
|
expect(moneyAchv.validate([])).toBe(false);
|
|
|
|
scene.money = 15000;
|
|
expect(moneyAchv.validate([])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("RibbonAchv", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
let scene: BattleScene;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
scene = game.scene;
|
|
});
|
|
|
|
it("should create an instance of RibbonAchv", () => {
|
|
const ribbonAchv = new RibbonAchv("", 10, "ribbon_icon", 10);
|
|
expect(ribbonAchv).toBeInstanceOf(RibbonAchv);
|
|
expect(ribbonAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the ribbon amount", () => {
|
|
const ribbonAchv = new RibbonAchv("", 10, "ribbon_icon", 10);
|
|
scene.gameData.gameStats.ribbonsOwned = 5;
|
|
|
|
expect(ribbonAchv.validate([])).toBe(false);
|
|
|
|
scene.gameData.gameStats.ribbonsOwned = 15;
|
|
expect(ribbonAchv.validate([])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("DamageAchv", () => {
|
|
it("should create an instance of DamageAchv", () => {
|
|
const damageAchv = new DamageAchv("", 250, "damage_icon", 10);
|
|
expect(damageAchv).toBeInstanceOf(DamageAchv);
|
|
expect(damageAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the damage amount", () => {
|
|
const damageAchv = new DamageAchv("", 250, "damage_icon", 10);
|
|
const numberHolder = new NumberHolder(200);
|
|
|
|
expect(damageAchv.validate([numberHolder])).toBe(false);
|
|
|
|
numberHolder.value = 300;
|
|
expect(damageAchv.validate([numberHolder])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("HealAchv", () => {
|
|
it("should create an instance of HealAchv", () => {
|
|
const healAchv = new HealAchv("", 250, "heal_icon", 10);
|
|
expect(healAchv).toBeInstanceOf(HealAchv);
|
|
expect(healAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the heal amount", () => {
|
|
const healAchv = new HealAchv("", 250, "heal_icon", 10);
|
|
const numberHolder = new NumberHolder(200);
|
|
|
|
expect(healAchv.validate([numberHolder])).toBe(false);
|
|
|
|
numberHolder.value = 300;
|
|
expect(healAchv.validate([numberHolder])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("LevelAchv", () => {
|
|
it("should create an instance of LevelAchv", () => {
|
|
const levelAchv = new LevelAchv("", 100, "level_icon", 10);
|
|
expect(levelAchv).toBeInstanceOf(LevelAchv);
|
|
expect(levelAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the level", () => {
|
|
const levelAchv = new LevelAchv("", 100, "level_icon", 10);
|
|
const integerHolder = new NumberHolder(50);
|
|
|
|
expect(levelAchv.validate([integerHolder])).toBe(false);
|
|
|
|
integerHolder.value = 150;
|
|
expect(levelAchv.validate([integerHolder])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("ModifierAchv", () => {
|
|
it("should create an instance of ModifierAchv", () => {
|
|
const modifierAchv = new ModifierAchv("", "Test Description", "modifier_icon", 10, () => true);
|
|
expect(modifierAchv).toBeInstanceOf(ModifierAchv);
|
|
expect(modifierAchv instanceof Achv).toBe(true);
|
|
});
|
|
|
|
it("should validate the achievement based on the modifier function", () => {
|
|
const modifierAchv = new ModifierAchv("", "Test Description", "modifier_icon", 10, () => true);
|
|
const modifier = new TurnHeldItemTransferModifier(null!, 3, 1);
|
|
|
|
expect(modifierAchv.validate([modifier])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("achvs", () => {
|
|
it("should contain the predefined achievements", () => {
|
|
expect(achvs._10K_MONEY).toBeInstanceOf(MoneyAchv);
|
|
expect(achvs._100K_MONEY).toBeInstanceOf(MoneyAchv);
|
|
expect(achvs._1M_MONEY).toBeInstanceOf(MoneyAchv);
|
|
expect(achvs._10M_MONEY).toBeInstanceOf(MoneyAchv);
|
|
expect(achvs._250_DMG).toBeInstanceOf(DamageAchv);
|
|
expect(achvs._1000_DMG).toBeInstanceOf(DamageAchv);
|
|
expect(achvs._2500_DMG).toBeInstanceOf(DamageAchv);
|
|
expect(achvs._10000_DMG).toBeInstanceOf(DamageAchv);
|
|
expect(achvs._250_HEAL).toBeInstanceOf(HealAchv);
|
|
expect(achvs._1000_HEAL).toBeInstanceOf(HealAchv);
|
|
expect(achvs._2500_HEAL).toBeInstanceOf(HealAchv);
|
|
expect(achvs._10000_HEAL).toBeInstanceOf(HealAchv);
|
|
expect(achvs.LV_100).toBeInstanceOf(LevelAchv);
|
|
expect(achvs.LV_250).toBeInstanceOf(LevelAchv);
|
|
expect(achvs.LV_1000).toBeInstanceOf(LevelAchv);
|
|
expect(achvs._10_RIBBONS).toBeInstanceOf(RibbonAchv);
|
|
expect(achvs._25_RIBBONS).toBeInstanceOf(RibbonAchv);
|
|
expect(achvs._50_RIBBONS).toBeInstanceOf(RibbonAchv);
|
|
expect(achvs._75_RIBBONS).toBeInstanceOf(RibbonAchv);
|
|
expect(achvs._100_RIBBONS).toBeInstanceOf(RibbonAchv);
|
|
expect(achvs.TRANSFER_MAX_STAT_STAGE).toBeInstanceOf(Achv);
|
|
expect(achvs.MAX_FRIENDSHIP).toBeInstanceOf(Achv);
|
|
expect(achvs.MEGA_EVOLVE).toBeInstanceOf(Achv);
|
|
expect(achvs.GIGANTAMAX).toBeInstanceOf(Achv);
|
|
expect(achvs.TERASTALLIZE).toBeInstanceOf(Achv);
|
|
expect(achvs.STELLAR_TERASTALLIZE).toBeInstanceOf(Achv);
|
|
expect(achvs.SPLICE).toBeInstanceOf(Achv);
|
|
expect(achvs.MINI_BLACK_HOLE).toBeInstanceOf(ModifierAchv);
|
|
expect(achvs.CATCH_MYTHICAL).toBeInstanceOf(Achv);
|
|
expect(achvs.CATCH_SUB_LEGENDARY).toBeInstanceOf(Achv);
|
|
expect(achvs.CATCH_LEGENDARY).toBeInstanceOf(Achv);
|
|
expect(achvs.SEE_SHINY).toBeInstanceOf(Achv);
|
|
expect(achvs.SHINY_PARTY).toBeInstanceOf(Achv);
|
|
expect(achvs.HATCH_MYTHICAL).toBeInstanceOf(Achv);
|
|
expect(achvs.HATCH_SUB_LEGENDARY).toBeInstanceOf(Achv);
|
|
expect(achvs.HATCH_LEGENDARY).toBeInstanceOf(Achv);
|
|
expect(achvs.HATCH_SHINY).toBeInstanceOf(Achv);
|
|
expect(achvs.HIDDEN_ABILITY).toBeInstanceOf(Achv);
|
|
expect(achvs.PERFECT_IVS).toBeInstanceOf(Achv);
|
|
expect(achvs.CLASSIC_VICTORY).toBeInstanceOf(Achv);
|
|
});
|
|
|
|
it("should initialize the achievements with IDs and parent IDs", () => {
|
|
expect(achvs._10K_MONEY.id).toBe("_10K_MONEY");
|
|
expect(achvs._10K_MONEY.hasParent).toBe(undefined);
|
|
expect(achvs._100K_MONEY.id).toBe("_100K_MONEY");
|
|
expect(achvs._100K_MONEY.hasParent).toBe(true);
|
|
expect(achvs._100K_MONEY.parentId).toBe("_10K_MONEY");
|
|
expect(achvs._1M_MONEY.id).toBe("_1M_MONEY");
|
|
expect(achvs._1M_MONEY.hasParent).toBe(true);
|
|
expect(achvs._1M_MONEY.parentId).toBe("_100K_MONEY");
|
|
expect(achvs._10M_MONEY.id).toBe("_10M_MONEY");
|
|
expect(achvs._10M_MONEY.hasParent).toBe(true);
|
|
expect(achvs._10M_MONEY.parentId).toBe("_1M_MONEY");
|
|
expect(achvs.LV_100.id).toBe("LV_100");
|
|
expect(achvs.LV_100.hasParent).toBe(false);
|
|
expect(achvs.LV_250.id).toBe("LV_250");
|
|
expect(achvs.LV_250.hasParent).toBe(true);
|
|
expect(achvs.LV_250.parentId).toBe("LV_100");
|
|
expect(achvs.LV_1000.id).toBe("LV_1000");
|
|
expect(achvs.LV_1000.hasParent).toBe(true);
|
|
expect(achvs.LV_1000.parentId).toBe("LV_250");
|
|
});
|
|
});
|