From 27a8d854dfc926a7c65403da1d46b938307b3f9e Mon Sep 17 00:00:00 2001 From: lonevox Date: Wed, 29 Jul 2026 15:26:02 +1200 Subject: [PATCH] Improve mod creation --- sim/sim/dex.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sim/sim/dex.ts b/sim/sim/dex.ts index 5831268c..5d7dbd0f 100644 --- a/sim/sim/dex.ts +++ b/sim/sim/dex.ts @@ -145,7 +145,7 @@ type DeepPartial = { : DeepPartial }; -export type ModData = DeepPartial; +export type ModData = DeepPartial & {Formats?: FormatList}; export const toID = Data.toID; @@ -217,7 +217,7 @@ export class ModdedDex { return dexes; } - mod(mod: string | undefined, modData?: DeepPartial & {Formats?: FormatList}): ModdedDex { + mod(mod: string | undefined, modData?: ModData): ModdedDex { if (!mod) return dexes['base']; const modid = toID(mod); if (modData?.Types && !modData.TypeChart) modData.TypeChart = modData.Types; @@ -325,10 +325,10 @@ export class ModdedDex { const typeData = this.types.get(targetTyping); if (!typeData) return 0; switch (typeData.damageTaken[sourceType]) { - case 1: return 1; // super-effective - case 2: return -1; // resist - // in case of weird situations like Gravity, immunity is handled elsewhere - default: return 0; + case 1: return 1; // super-effective + case 2: return -1; // resist + // in case of weird situations like Gravity, immunity is handled elsewhere + default: return 0; } } @@ -427,7 +427,7 @@ export class ModdedDex { loadDataFile( mod: string, dataType: DataType, - modData?: DeepPartial + modData?: ModData ): AnyObject | void { if (modData) return modData[dataType]; return (dexData as any)[mod === 'base' ? BASE_MOD : mod][dataType]; @@ -464,7 +464,7 @@ export class ModdedDex { return this; } - loadData(modData?: DeepPartial): DexTableData { + loadData(modData?: ModData): DexTableData { if (this.dataCache) return this.dataCache; const dataCache: {[k in keyof DexTableData]?: any} = {};