From 0be82b32dd5eeb29fdfee2ee34c54eef31573dd3 Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Sun, 18 Aug 2024 12:52:06 -0400 Subject: [PATCH 1/9] Improve scroll bar Remaking these changes on the beta branch since you're supposed to do it for the PR checklist --- src/ui/scroll-bar.ts | 4 ++-- src/ui/starter-select-ui-handler.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/scroll-bar.ts b/src/ui/scroll-bar.ts index 02282edb4cd..e756393ae1a 100644 --- a/src/ui/scroll-bar.ts +++ b/src/ui/scroll-bar.ts @@ -29,8 +29,8 @@ export class ScrollBar extends Phaser.GameObjects.Container { setPages(pages: number): void { this.pages = pages; - this.handleBody.height = (this.bg.displayHeight - 1 - this.handleBottom.displayHeight) / this.pages; + this.handleBody.height = (this.bg.displayHeight - 1 - this.handleBottom.displayHeight) * 9 / this.pages; - this.setVisible(this.pages > 1); + this.setVisible(this.pages > 9); } } diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 5e942f3e75a..fcb21f0710b 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -2415,7 +2415,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } }); - this.starterSelectScrollBar.setPages(Math.ceil((this.filteredStarterContainers.length - 81) / 9) + 1); + this.starterSelectScrollBar.setPages(Math.ceil(this.filteredStarterContainers.length / 9)); this.starterSelectScrollBar.setPage(0); // sort From 103ad807ee3da23778c6726862449f6ee2c0898b Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Wed, 21 Aug 2024 06:57:59 -0400 Subject: [PATCH 2/9] Fix potential divide by zero error Thank you to KimJeongSun for bringing this up Co-authored-by: Leo Kim <47556641+KimJeongSun@users.noreply.github.com> --- src/ui/starter-select-ui-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index fcb21f0710b..50763ff219c 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -2415,7 +2415,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } }); - this.starterSelectScrollBar.setPages(Math.ceil(this.filteredStarterContainers.length / 9)); + this.starterSelectScrollBar.setPages(Math.max(Math.ceil(this.filteredStarterContainers.length / 9)), 1); this.starterSelectScrollBar.setPage(0); // sort From d1e14850efc6f44dc6184d1f1f94a85ce603488f Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:36:43 -0400 Subject: [PATCH 3/9] Fix parenthases order oops Co-authored-by: Leo Kim <47556641+KimJeongSun@users.noreply.github.com> --- src/ui/starter-select-ui-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 50763ff219c..975cac0b318 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -2415,7 +2415,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { } }); - this.starterSelectScrollBar.setPages(Math.max(Math.ceil(this.filteredStarterContainers.length / 9)), 1); + this.starterSelectScrollBar.setPages(Math.max(Math.ceil(this.filteredStarterContainers.length / 9), 1)); this.starterSelectScrollBar.setPage(0); // sort From 103c87ec3b5014cf89b0692402b3f1fe66bbdbfc Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Thu, 12 Sep 2024 01:09:44 +0100 Subject: [PATCH 4/9] Undo egg skip event --- src/modifier/modifier-type.ts | 5 +---- src/phases/trainer-victory-phase.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index f7041d55be3..20047e5b81b 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1545,7 +1545,6 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.TEMP_STAT_STAGE_BOOSTER, 4), new WeightedModifierType(modifierTypes.BERRY, 2), new WeightedModifierType(modifierTypes.TM_COMMON, 2), - new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1), ].map(m => { m.setTier(ModifierTier.COMMON); return m; }), @@ -1616,7 +1615,6 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3), new WeightedModifierType(modifierTypes.TERA_SHARD, 1), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 4 : 0), - new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(3 - rerollCount * 3, 0) : 0, 3), ].map(m => { m.setTier(ModifierTier.GREAT); return m; }), @@ -1697,7 +1695,6 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 6, 24), new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 9, 36), new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 9, 36), - new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(9 - rerollCount * 3, 0) : 0, 9), ].map(m => { m.setTier(ModifierTier.ROGUE); return m; }), @@ -1706,7 +1703,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.SHINY_CHARM, 14), new WeightedModifierType(modifierTypes.HEALING_CHARM, 18), new WeightedModifierType(modifierTypes.MULTI_LENS, 18), - new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily && !party[0].scene.gameMode.isEndless && !party[0].scene.gameMode.isSplicedOnly ? Math.max(15 - rerollCount * 5, 0) : 0, 15), + new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily && !party[0].scene.gameMode.isEndless && !party[0].scene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24), new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => (!party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE]) ? 1 : 0, 1), ].map(m => { diff --git a/src/phases/trainer-victory-phase.ts b/src/phases/trainer-victory-phase.ts index 7815244c35c..a38874c9acd 100644 --- a/src/phases/trainer-victory-phase.ts +++ b/src/phases/trainer-victory-phase.ts @@ -30,7 +30,7 @@ export class TrainerVictoryPhase extends BattlePhase { const trainerType = this.scene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct? if (vouchers.hasOwnProperty(TrainerType[trainerType])) { if (!this.scene.validateVoucher(vouchers[TrainerType[trainerType]]) && this.scene.currentBattle.trainer?.config.isBoss) { - this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM][vouchers[TrainerType[trainerType]].voucherType])); + this.scene.unshiftPhase(new ModifierRewardPhase(this.scene, [modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM][vouchers[TrainerType[trainerType]].voucherType])); } } From 801b0a66f715584aa3a61ce3c6684093c58c6f10 Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Thu, 12 Sep 2024 01:13:22 +0100 Subject: [PATCH 5/9] Readded vouchers to original weights --- src/modifier/modifier-type.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 20047e5b81b..d6cfd017829 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1615,6 +1615,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3), new WeightedModifierType(modifierTypes.TERA_SHARD, 1), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 4 : 0), + new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1), ].map(m => { m.setTier(ModifierTier.GREAT); return m; }), @@ -1695,6 +1696,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 6, 24), new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 9, 36), new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 9, 36), + new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(3 - rerollCount * 1, 0) : 0, 3), ].map(m => { m.setTier(ModifierTier.ROGUE); return m; }), From 7ea608fb8aaa0769e6a9799cbb3b1c45d3dc9474 Mon Sep 17 00:00:00 2001 From: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:56:55 +0200 Subject: [PATCH 6/9] [Bug] Fix Dire Hit & System Data Conversion Failure (#4282) Co-authored-by: xsn34kzx --- src/system/version-converter.ts | 40 +++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/system/version-converter.ts b/src/system/version-converter.ts index f7996124886..6cb2c24d84d 100644 --- a/src/system/version-converter.ts +++ b/src/system/version-converter.ts @@ -22,15 +22,25 @@ export function applySessionDataPatches(data: SessionSaveData) { } else if (m.className === "PokemonResetNegativeStatStageModifier") { m.className = "ResetNegativeStatStageModifier"; } else if (m.className === "TempBattleStatBoosterModifier") { - m.className = "TempStatStageBoosterModifier"; - m.typeId = "TEMP_STAT_STAGE_BOOSTER"; + // Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator + if (m.typeId !== "DIRE_HIT") { + m.className = "TempStatStageBoosterModifier"; + m.typeId = "TEMP_STAT_STAGE_BOOSTER"; - // Migration from TempBattleStat to Stat - const newStat = m.typePregenArgs[0] + 1; - m.typePregenArgs[0] = newStat; + // Migration from TempBattleStat to Stat + const newStat = m.typePregenArgs[0] + 1; + m.typePregenArgs[0] = newStat; + + // From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ] + m.args = [ newStat, 5, m.args[1] ]; + } else { + m.className = "TempCritBoosterModifier"; + m.typePregenArgs = []; + + // From [ stat, battlesLeft ] to [ maxBattles, battleCount ] + m.args = [ 5, m.args[1] ]; + } - // From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ] - m.args = [ newStat, 5, m.args[1] ]; } else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) { let maxBattles: number; switch (m.typeId) { @@ -73,7 +83,7 @@ export function applySystemDataPatches(data: SystemSaveData) { case "1.0.3": case "1.0.4": // --- LEGACY PATCHES --- - if (data.starterData) { + if (data.starterData && data.dexData) { // Migrate ability starter data if empty for caught species Object.keys(data.starterData).forEach(sd => { if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) { @@ -104,12 +114,14 @@ export function applySystemDataPatches(data: SystemSaveData) { // --- PATCHES --- // Fix Starter Data - for (const starterId of defaultStarterSpecies) { - if (data.starterData[starterId]?.abilityAttr) { - data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1; - } - if (data.dexData[starterId]?.caughtAttr) { - data.dexData[starterId].caughtAttr |= DexAttr.FEMALE; + if (data.starterData && data.dexData) { + for (const starterId of defaultStarterSpecies) { + if (data.starterData[starterId]?.abilityAttr) { + data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1; + } + if (data.dexData[starterId]?.caughtAttr) { + data.dexData[starterId].caughtAttr |= DexAttr.FEMALE; + } } } } From f77a36ce3d47decca163e8964216c9a3489817dc Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Tue, 17 Sep 2024 20:26:52 -0400 Subject: [PATCH 7/9] Add map commit Gives the player a Map in Daily Run mode. Comes with a unit test. --- src/phases/title-phase.ts | 1 + src/test/daily_mode.test.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index 52503501837..fcb498d21e5 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -220,6 +220,7 @@ export class TitlePhase extends Phase { const modifiers: Modifier[] = Array(3).fill(null).map(() => modifierTypes.EXP_SHARE().withIdFromFunc(modifierTypes.EXP_SHARE).newModifier()) .concat(Array(3).fill(null).map(() => modifierTypes.GOLDEN_EXP_CHARM().withIdFromFunc(modifierTypes.GOLDEN_EXP_CHARM).newModifier())) + .concat([modifierTypes.MAP().withIdFromFunc(modifierTypes.MAP).newModifier()]) .concat(getDailyRunStarterModifiers(party)) .filter((m) => m !== null); diff --git a/src/test/daily_mode.test.ts b/src/test/daily_mode.test.ts index 5cc61a62874..4934d5d081c 100644 --- a/src/test/daily_mode.test.ts +++ b/src/test/daily_mode.test.ts @@ -1,5 +1,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import GameManager from "./utils/gameManager"; +import { MapModifier } from "#app/modifier/modifier"; describe("Daily Mode", () => { let phaserGame: Phaser.Game; @@ -28,5 +29,6 @@ describe("Daily Mode", () => { expect(pkm.level).toBe(20); expect(pkm.moveset.length).toBeGreaterThan(0); }); + expect(game.scene.getModifiers(MapModifier).length).toBeGreaterThan(0); }); }); From f08bf50e33352573ec68f63dc222157548c78fd8 Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Tue, 17 Sep 2024 20:41:02 -0400 Subject: [PATCH 8/9] Update phaseInterceptor.ts --- src/test/utils/phaseInterceptor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/utils/phaseInterceptor.ts b/src/test/utils/phaseInterceptor.ts index 46bb757c867..75c387ba8e4 100644 --- a/src/test/utils/phaseInterceptor.ts +++ b/src/test/utils/phaseInterceptor.ts @@ -52,6 +52,9 @@ import { } from "#app/phases/mystery-encounter-phases"; import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase"; import { PartyExpPhase } from "#app/phases/party-exp-phase"; +import { ExpPhase } from "#app/phases/exp-phase"; +import { SelectBiomePhase } from "#app/phases/select-biome-phase"; + export interface PromptHandler { phaseTarget?: string; @@ -60,7 +63,6 @@ export interface PromptHandler { expireFn?: () => void; awaitingActionInput?: boolean; } -import { ExpPhase } from "#app/phases/exp-phase"; export default class PhaseInterceptor { public scene; @@ -130,6 +132,7 @@ export default class PhaseInterceptor { [ModifierRewardPhase, this.startPhase], [PartyExpPhase, this.startPhase], [ExpPhase, this.startPhase], + [SelectBiomePhase, this.startPhase], ]; private endBySetMode = [ From 0ebd1d70800e04a0761ab5d0666931071142a2ea Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:20:25 -0400 Subject: [PATCH 9/9] Fix reload.test.ts Huge thanks to daykev --- src/test/reload.test.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/test/reload.test.ts b/src/test/reload.test.ts index 7c4523dd9ef..daf8e43a0cd 100644 --- a/src/test/reload.test.ts +++ b/src/test/reload.test.ts @@ -1,9 +1,13 @@ -import { Species } from "#app/enums/species"; import { GameModes } from "#app/game-mode"; +import OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler"; +import { Mode } from "#app/ui/ui"; +import { Biome } from "#enums/biome"; +import { Button } from "#enums/buttons"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; +import { MockClock } from "#test/utils/mocks/mockClock"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; -import { Moves } from "#app/enums/moves"; -import { Biome } from "#app/enums/biome"; describe("Reload", () => { let phaserGame: Phaser.Game; @@ -50,6 +54,13 @@ describe("Reload", () => { game.move.select(Moves.KOWTOW_CLEAVE); await game.phaseInterceptor.to("DamagePhase"); await game.doKillOpponents(); + game.onNextPrompt("SelectBiomePhase", Mode.OPTION_SELECT, () => { + (game.scene.time as MockClock).overrideDelay = null; + const optionSelectUiHandler = game.scene.ui.getHandler() as OptionSelectUiHandler; + game.scene.time.delayedCall(1010, () => optionSelectUiHandler.processInput(Button.ACTION)); + game.endPhase(); + (game.scene.time as MockClock).overrideDelay = 1; + }); await game.toNextWave(); expect(game.phaseInterceptor.log).toContain("NewBiomeEncounterPhase");