afnm-types 0.6.34 → 0.6.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/buff.d.ts CHANGED
@@ -128,7 +128,7 @@ export interface Buff {
128
128
  setupPercent?: number;
129
129
  cantUpgrade?: boolean;
130
130
  }
131
- type BuffCombatImage = ScatterCombatImage | ArcCombatImage | FloatingCombatImage | OverlayCombatImage | CompanionCombatImage | GroundCombatImage | FormationCombatImage;
131
+ type BuffCombatImage = ScatterCombatImage | ArcCombatImage | FloatingCombatImage | OverlayCombatImage | CompanionCombatImage | GroundCombatImage | FormationCombatImage | TransformationCombatImage;
132
132
  interface BaseCombatImage {
133
133
  image: string;
134
134
  imageOverrides?: {
@@ -196,6 +196,50 @@ export interface FormationCombatImage extends BaseCombatImage {
196
196
  scale?: number;
197
197
  showSingleInstance?: boolean;
198
198
  }
199
+ /** Image configuration for a single avatar state in transformation */
200
+ export interface TransformationImageConfig {
201
+ image: string;
202
+ scale?: number;
203
+ imageOffset?: {
204
+ x: number;
205
+ y: number;
206
+ };
207
+ }
208
+ /** Stack-based override for transformation images */
209
+ export interface TransformationImageOverride {
210
+ stacks: number;
211
+ idle?: TransformationImageConfig;
212
+ support?: TransformationImageConfig;
213
+ defensive?: TransformationImageConfig;
214
+ utility?: TransformationImageConfig;
215
+ aggressive?: TransformationImageConfig;
216
+ offensive?: TransformationImageConfig;
217
+ hit?: TransformationImageConfig;
218
+ }
219
+ /**
220
+ * Transformation combat image that replaces the avatar's images while the buff exists.
221
+ * Used for "transformation" techniques like turning into a spirit beast.
222
+ * Only the last active transformation buff applies.
223
+ * Unset image fields inherit from the idle image using the "closest" stack logic.
224
+ */
225
+ export interface TransformationCombatImage {
226
+ position: 'transformation';
227
+ /** The base idle image for the transformation */
228
+ idle: TransformationImageConfig;
229
+ /** Optional stance-specific images. If not set, falls back to idle. */
230
+ support?: TransformationImageConfig;
231
+ defensive?: TransformationImageConfig;
232
+ utility?: TransformationImageConfig;
233
+ aggressive?: TransformationImageConfig;
234
+ offensive?: TransformationImageConfig;
235
+ hit?: TransformationImageConfig;
236
+ /** Stack-based overrides. Uses "closest" logic (findLast where stacks <= current). */
237
+ imageOverrides?: TransformationImageOverride[];
238
+ /** Animations to trigger on the entity when this buff is applied/updated */
239
+ animations?: ('buff' | 'bump' | 'attack' | 'debuff')[];
240
+ /** Whether animations should trigger on the entity. Defaults to true for transformation. */
241
+ animateOnEntity?: boolean;
242
+ }
199
243
  export type BuffEffect = DamageEffect | DamageSelfEffect | HealEffect | BarrierEffect | CreateBuffSelfEffect | ConsumeBuffSelfEffect | CreateBuffTargetEffect | ConsumeBuffTargetEffect | NegateEffect | AddEffect | MultiplyEffect | MergeEffect | TriggerEffect | ModifyBuffGroupEffect | CleanseToxicityEffect | SetStateEffect | ConvertSelfEffect;
200
244
  interface BaseBuff {
201
245
  condition?: TechniqueCondition;
@@ -9,7 +9,7 @@ import { Realm, RealmProgress } from './realm';
9
9
  import { IntimateTrait } from './dualCultivation';
10
10
  export interface Character {
11
11
  name: string;
12
- displayName?: string;
12
+ displayName?: Translatable;
13
13
  allegiance: string | undefined;
14
14
  bio?: string;
15
15
  condition: string;
@@ -37,6 +37,7 @@ export interface KnownCraftingTechnique {
37
37
  }
38
38
  export interface CraftingTechnique {
39
39
  name: string;
40
+ displayName?: Translatable;
40
41
  icon: string;
41
42
  poolCost: number;
42
43
  toxicityCost?: number;
@@ -7,6 +7,7 @@ declare const intimateTechniqueTypes: readonly ["rough", "tender", "passionate"]
7
7
  export type IntimateTechniqueType = (typeof intimateTechniqueTypes)[number];
8
8
  export declare const intimateTechniqueTypeToName: Record<IntimateTechniqueType, string>;
9
9
  export declare const intimateResourceToName: Record<IntimateResource, string>;
10
+ export declare const dualCultivationCompletionStateToName: Record<string, string>;
10
11
  export type IntimateTrait = {
11
12
  name: string;
12
13
  description: Translatable;
@@ -15,6 +16,7 @@ export type IntimateTrait = {
15
16
  };
16
17
  export type IntimateTechnique = {
17
18
  name: string;
19
+ displayName?: Translatable;
18
20
  condition: string;
19
21
  type: IntimateTechniqueType;
20
22
  icon: string;
@@ -12,3 +12,7 @@ export const intimateResourceToName = {
12
12
  excitement: 'Excitement',
13
13
  rhythm: 'Rhythm',
14
14
  };
15
+ export const dualCultivationCompletionStateToName = {
16
+ success: 'Success',
17
+ failure: 'Failure',
18
+ };
package/dist/entity.d.ts CHANGED
@@ -20,6 +20,9 @@ export declare const entityTypes: readonly ["Player", "Lifeform", "Enemy"];
20
20
  export type EntityType = (typeof entityTypes)[number];
21
21
  export declare const sexes: readonly ["male", "female"];
22
22
  export type Sex = (typeof sexes)[number];
23
+ export declare const sexToName: {
24
+ [key in Sex]: string;
25
+ };
23
26
  export interface PlayerEntity {
24
27
  imageIndex: number;
25
28
  originalImageIndex?: number;
package/dist/entity.js CHANGED
@@ -1,2 +1,6 @@
1
1
  export const entityTypes = ['Player', 'Lifeform', 'Enemy'];
2
2
  export const sexes = ['male', 'female'];
3
+ export const sexToName = {
4
+ male: 'Male',
5
+ female: 'Female',
6
+ };
package/dist/guild.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface GuildMission {
10
10
  }
11
11
  export interface Guild {
12
12
  name: string;
13
+ displayName?: Translatable;
13
14
  description: Translatable;
14
15
  icon: string;
15
16
  image: string;
@@ -1,5 +1,7 @@
1
+ import { Translatable } from './translatable';
1
2
  export interface SoilCondition {
2
3
  name: string;
4
+ displayName?: Translatable;
3
5
  icon: string;
4
6
  soilImage: string;
5
7
  soilZ: number;
package/dist/house.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface RoomDef {
28
28
  export type Room = BuffRoom | CultivationRoom | CraftingRoom | CompendiumRoom | HealerRoom | TeleportRoom;
29
29
  interface RoomBase {
30
30
  name: string;
31
+ displayName?: Translatable;
31
32
  description: Translatable;
32
33
  realm: Realm | 'any';
33
34
  rarity: Rarity;
package/dist/item.d.ts CHANGED
@@ -17,6 +17,9 @@ export type ItemKind = (typeof itemKinds)[number];
17
17
  export declare const itemKindToName: {
18
18
  [key in ItemKind]: string;
19
19
  };
20
+ export declare const itemKindPluralToName: {
21
+ [key in ItemKind]: string;
22
+ };
20
23
  export type ItemCostMap = {
21
24
  [key in ItemKind]: number;
22
25
  };
@@ -94,6 +97,7 @@ export interface ManualStyle {
94
97
  }
95
98
  export interface ManualStance {
96
99
  name: string;
100
+ displayName?: Translatable;
97
101
  stance: string[];
98
102
  stanceRule?: StoredRule;
99
103
  }
@@ -327,6 +331,7 @@ export interface Enchantment {
327
331
  rarity: Rarity;
328
332
  itemKind: ItemKind;
329
333
  name: string;
334
+ displayName?: Translatable;
330
335
  }
331
336
  export type EnchantmentMap<T extends Enchantment> = Record<Realm, Record<Rarity, T>>;
332
337
  export interface MountEnchantment extends Enchantment {
@@ -417,6 +422,7 @@ export interface QiDensityFormationItem extends FormationItemBase {
417
422
  }
418
423
  export interface PillarShardVariant {
419
424
  title: string;
425
+ displayName?: Translatable;
420
426
  icon: string;
421
427
  physicalStats?: Partial<Record<PhysicalStatistic, number>>;
422
428
  socialStats?: Partial<Record<SocialStatistic, number>>;
package/dist/item.js CHANGED
@@ -68,6 +68,41 @@ export const itemKindToName = {
68
68
  device: 'Device',
69
69
  manual: 'Manual',
70
70
  };
71
+ export const itemKindPluralToName = {
72
+ clothing: 'Clothing',
73
+ talisman: 'Talismans',
74
+ artefact: 'Artefacts',
75
+ mount: 'Mounts',
76
+ cauldron: 'Cauldrons',
77
+ flame: 'Flames',
78
+ upgrade: 'Upgrades',
79
+ fruit: 'Fruits',
80
+ elixir: 'Elixirs',
81
+ recipe: 'Recipes',
82
+ technique: 'Techniques',
83
+ action: 'Actions',
84
+ transport_seal: 'Transport Seals',
85
+ enchantment: 'Enchantments',
86
+ pill: 'Pills',
87
+ reagent: 'Reagents',
88
+ concoction: 'Concoctions',
89
+ consumable: 'Consumables',
90
+ recuperation: 'Recuperation',
91
+ formation: 'Formations',
92
+ breakthrough: 'Breakthroughs',
93
+ pillar_shard: 'Pillar Shards',
94
+ material: 'Materials',
95
+ flare: 'Flares',
96
+ mystical_key: 'Mystical Keys',
97
+ condensation_art: 'Condensation Arts',
98
+ blueprint: 'Blueprints',
99
+ trophy: 'Trophies',
100
+ treasure: 'Treasures',
101
+ token: 'Tokens',
102
+ life_essence: 'Life Essences',
103
+ device: 'Devices',
104
+ manual: 'Manuals',
105
+ };
71
106
  export const buyItemCostMap = {
72
107
  technique: 3000,
73
108
  artefact: 3500,
@@ -11,7 +11,7 @@ import { Buff } from './buff';
11
11
  import { AmbienceName, MusicName } from './audio';
12
12
  export interface GameLocation {
13
13
  name: string;
14
- displayName?: string;
14
+ displayName?: Translatable;
15
15
  description: Translatable;
16
16
  image: string;
17
17
  icon: string;
package/dist/location.js CHANGED
@@ -21,7 +21,7 @@ export const buildingTypeToName = {
21
21
  house: '',
22
22
  altar: 'Compression Altar',
23
23
  research: 'Vault of Infinite Reflections',
24
- reforge: `Infusion Workshop`,
24
+ reforge: `Reforge Workshop`,
25
25
  guild: '',
26
26
  tenThousandFlames: 'Furnace of Ten Thousand Flames',
27
27
  modBuilding: '',
package/dist/mod.d.ts CHANGED
@@ -10,23 +10,25 @@ import { Character } from './character';
10
10
  import { CraftingTechnique, CraftingRecipeStats } from './craftingTechnique';
11
11
  import { RecipeConditionEffect } from './crafting';
12
12
  import { Destiny } from './destiny';
13
- import { CombatEntity, EnemyEntity, PlayerEntity } from './entity';
13
+ import { BattleLength, CombatEntity, CraftingEntity, EnemyDifficulty, EnemyEntity, PlayerEntity } from './entity';
14
14
  import { AuctionStep, CombatStep, CraftingStep, DualCultivationStep, EventStep, FightCharacterStep, GameEvent, StoneCuttingStep, TournamentStep, TriggeredEvent } from './event';
15
15
  import { Guild } from './guild';
16
16
  import { Crop } from './herbField';
17
- import { Enchantment, Item, ItemDesc, ManualItem, RecipeItem, UncutStonePool } from './item';
17
+ import { Enchantment, EnchantmentDesc, Item, ItemDesc, ManualItem, RecipeItem, UncutStonePool } from './item';
18
18
  import { ConditionalLink, ExplorationLink, GameLocation, LocationBuilding, LocationEnemy, LocationEvent, LocationMapEvent, SectMission, CraftingMission } from './location';
19
19
  import { MineChamber } from './mine';
20
20
  import { Quest } from './quest';
21
21
  import { Realm, RealmProgress } from './realm';
22
- import { CraftingStatistic, ReputationTier } from './stat';
23
- import { Technique } from './technique';
22
+ import { CraftingStatistic, ReputationTier, Scaling } from './stat';
23
+ import { KnownTechnique, Technique } from './technique';
24
24
  import { IntimateTechnique } from './dualCultivation';
25
+ import { KnownCraftingTechnique } from './craftingTechnique';
25
26
  import { FallenStar } from './fallenStar';
26
27
  import { Room } from './house';
27
28
  import { Blessing } from './mysticalRegion';
28
- import { CraftingResult } from './craftingState';
29
- import { HarmonyTypeConfig, RecipeHarmonyType } from './crafting';
29
+ import { CraftingResult, CraftingState, ProgressState } from './craftingState';
30
+ import { CraftingTechniqueCondition } from './craftingBuff';
31
+ import { CraftingCondition, HarmonyTypeConfig, RecipeHarmonyType } from './crafting';
30
32
  import { ItemKind } from './item';
31
33
  import { SoundEffectName } from './audio';
32
34
  import { ScreenEffectType } from './ScreenEffectType';
@@ -759,6 +761,99 @@ export interface ModAPI {
759
761
  * });
760
762
  */
761
763
  addTranslation: (language: string, translations: Record<string, unknown>) => void;
764
+ /**
765
+ * Set the font size multiplier for a specific language.
766
+ * Use this to adjust text size for languages that render larger or smaller
767
+ * than English (e.g., Russian text tends to be longer).
768
+ *
769
+ * @param language - Language code (e.g., 'ru', 'zh', 'de')
770
+ * @param multiplier - Font size multiplier (e.g., 0.9 for 90%, 1.1 for 110%)
771
+ * @example
772
+ * // Make Russian text 10% smaller
773
+ * setLanguageFontSize('ru', 0.9);
774
+ *
775
+ * // Make Chinese text 5% larger
776
+ * setLanguageFontSize('zh', 1.05);
777
+ */
778
+ setLanguageFontSize: (language: string, multiplier: number) => void;
779
+ /**
780
+ * Add a custom font that can be used in the game.
781
+ *
782
+ * @param fontFamily - Font family name to use in CSS
783
+ * @param fontUrl - URL or data URL of the font file (use mod:// for mod assets)
784
+ * @param format - Font format ('opentype', 'truetype', 'woff', 'woff2')
785
+ * @param options - Optional font weight and style
786
+ * @example
787
+ * // Add a custom font from a mod asset
788
+ * addCustomFont('MyCustomFont', 'mod://fonts/custom.ttf', 'truetype');
789
+ *
790
+ * // Add with specific weight and style
791
+ * addCustomFont('MyCustomFont', 'mod://fonts/custom-bold.ttf', 'truetype', {
792
+ * fontWeight: 700,
793
+ * fontStyle: 'normal'
794
+ * });
795
+ */
796
+ addCustomFont: (fontFamily: string, fontUrl: string, format: 'opentype' | 'truetype' | 'woff' | 'woff2', options?: {
797
+ fontWeight?: number;
798
+ fontStyle?: 'normal' | 'italic';
799
+ }) => void;
800
+ /**
801
+ * Set a custom font as the primary font for the entire game.
802
+ * This replaces the default fonts with the specified custom font family.
803
+ * The font must first be added using addCustomFont.
804
+ *
805
+ * @param fontFamily - Font family name (must match a font added via addCustomFont)
806
+ * @example
807
+ * // First add the font
808
+ * addCustomFont('MyCustomFont', 'mod://fonts/custom.ttf', 'truetype');
809
+ *
810
+ * // Then set it as the primary font
811
+ * setCustomFontFamily('MyCustomFont');
812
+ */
813
+ setCustomFontFamily: (fontFamily: string) => void;
814
+ /**
815
+ * Override the game's MUI theme with custom options.
816
+ * This allows complete control over colors, component styles, typography, etc.
817
+ * Multiple overrides are merged in order, with later overrides taking precedence.
818
+ *
819
+ * @param overrides - Partial MUI ThemeOptions to merge with the base theme
820
+ * @example
821
+ * // Change the primary color scheme
822
+ * addThemeOverride({
823
+ * palette: {
824
+ * primary: {
825
+ * main: '#1976d2',
826
+ * light: '#42a5f5',
827
+ * dark: '#1565c0',
828
+ * },
829
+ * },
830
+ * });
831
+ *
832
+ * // Customize button styles
833
+ * addThemeOverride({
834
+ * components: {
835
+ * MuiButton: {
836
+ * styleOverrides: {
837
+ * root: {
838
+ * borderRadius: '20px',
839
+ * textTransform: 'none',
840
+ * },
841
+ * },
842
+ * },
843
+ * },
844
+ * });
845
+ *
846
+ * // Change background colors
847
+ * addThemeOverride({
848
+ * palette: {
849
+ * background: {
850
+ * default: '#121212',
851
+ * paper: '#1e1e1e',
852
+ * },
853
+ * },
854
+ * });
855
+ */
856
+ addThemeOverride: (overrides: Record<string, unknown>) => void;
762
857
  };
763
858
  utils: {
764
859
  /**
@@ -1191,6 +1286,380 @@ export interface ModAPI {
1191
1286
  * // Returns { 'tutorialName': 1, 'tutorialNameStarted': 1, 'tutorialNameCompleted': 1, ... }
1192
1287
  */
1193
1288
  generateSkipTutorialFlags: (tutorials: Tutorial[], triggers: TriggeredEvent[]) => Record<string, number>;
1289
+ /**
1290
+ * Evaluate a Scaling object against current variables.
1291
+ * Applies base value, stat/scaling multipliers, equations, custom scaling, max constraints, and stance length division.
1292
+ * @param scaling - The scaling definition
1293
+ * @param variables - Current variable values (stats, buffs, etc.)
1294
+ * @param stanceLength - Number of techniques in the current stance
1295
+ * @param preMaxTransform - Optional transform applied before max constraint
1296
+ * @returns The computed numeric value
1297
+ */
1298
+ evaluateScaling: (scaling: Scaling, variables: Record<string, number>, stanceLength: number, preMaxTransform?: (value: number) => number) => number;
1299
+ /**
1300
+ * Calculate crit multiplier with overflow conversion for crafting.
1301
+ * Crit chance over 100% is converted to bonus crit multiplier at a 1:3 ratio.
1302
+ * @param critChance - The total crit chance (can be > 100%)
1303
+ * @param critMultiplier - The crit multiplier (as percentage, e.g., 200 for 2x)
1304
+ * @returns Object with multiplier, critCount, and didCrit
1305
+ */
1306
+ calculateCraftingOvercrit: (critChance: number, critMultiplier: number) => {
1307
+ multiplier: number;
1308
+ critCount: number;
1309
+ didCrit: boolean;
1310
+ };
1311
+ /**
1312
+ * Get the maximum achievable completion for a recipe.
1313
+ * @param recipe - The recipe item
1314
+ * @param recipeStats - The crafting recipe stats
1315
+ * @param realm - The player's realm
1316
+ * @returns Object with flat value and percentage
1317
+ */
1318
+ getMaxCompletion: (recipe: RecipeItem, recipeStats: CraftingRecipeStats, realm: Realm) => {
1319
+ flat: number;
1320
+ percentage: number;
1321
+ };
1322
+ /**
1323
+ * Get the maximum achievable perfection for a recipe.
1324
+ * @param recipe - The recipe item
1325
+ * @param recipeStats - The crafting recipe stats
1326
+ * @param realm - The player's realm
1327
+ * @returns Object with flat value and percentage
1328
+ */
1329
+ getMaxPerfection: (recipe: RecipeItem, recipeStats: CraftingRecipeStats, realm: Realm) => {
1330
+ flat: number;
1331
+ percentage: number;
1332
+ };
1333
+ /**
1334
+ * Check whether a crafting technique can be used given current state.
1335
+ * Validates pool cost, buff costs, condition requirements, buff requirements, toxicity capacity, stability, and cooldown.
1336
+ * @param technique - The crafting technique to check
1337
+ * @param variables - Current crafting variable values
1338
+ * @param poolCost - The pool cost of the technique
1339
+ * @param condition - The current crafting condition
1340
+ * @returns Whether the technique can be used
1341
+ */
1342
+ canUseAction: (technique: CraftingTechnique, variables: Record<string, number>, poolCost: number, condition: CraftingCondition) => boolean;
1343
+ /**
1344
+ * Get a full Item from an item descriptor (name + optional enchantment, quality, etc.).
1345
+ * Resolves techniques, manuals, blueprints, crafting actions, and regular items,
1346
+ * then applies quality tier upgrades and enchantments.
1347
+ * @param desc - Item descriptor with name and optional properties
1348
+ * @returns Fully resolved Item
1349
+ * @example
1350
+ * const item = getFullItem({ name: 'Spirit Core (III)', qualityTier: 3 });
1351
+ */
1352
+ getFullItem: (desc: {
1353
+ name: string;
1354
+ stacks?: number;
1355
+ enchantment?: EnchantmentDesc;
1356
+ qualityTier?: number;
1357
+ hiddenPotential?: number;
1358
+ } | undefined) => Item;
1359
+ /**
1360
+ * Resolve a KnownCraftingTechnique into a full CraftingTechnique with masteries applied.
1361
+ * @param known - The known crafting technique reference
1362
+ * @returns Fully resolved CraftingTechnique
1363
+ * @example
1364
+ * const technique = craftingTechniqueFromKnown(knownTechnique);
1365
+ */
1366
+ craftingTechniqueFromKnown: (known: KnownCraftingTechnique | undefined) => CraftingTechnique;
1367
+ /**
1368
+ * Resolve a KnownTechnique into a full Technique with masteries applied.
1369
+ * @param known - The known technique reference
1370
+ * @returns Fully resolved Technique
1371
+ * @example
1372
+ * const technique = techniqueFromKnown(knownTechnique);
1373
+ */
1374
+ techniqueFromKnown: (known: KnownTechnique | undefined) => Technique;
1375
+ /**
1376
+ * Scale an enemy entity to a different realm and progress.
1377
+ * Adjusts stances to fill available technique slots.
1378
+ * @param base - Base enemy entity template
1379
+ * @param realm - Target realm
1380
+ * @param realmProgress - Target realm progress
1381
+ * @returns Scaled enemy entity
1382
+ * @example
1383
+ * const scaledBandit = scaleEnemy(bandit, 'coreFormation', 'Middle');
1384
+ */
1385
+ scaleEnemy: (base: EnemyEntity, realm: Realm, realmProgress: RealmProgress) => EnemyEntity;
1386
+ /**
1387
+ * Calculate expected HP for an enemy based on its realm, progress, and battle length.
1388
+ * @param enemy - Enemy entity definition
1389
+ * @returns Expected HP value
1390
+ * @example
1391
+ * const hp = calculateEnemyHp(myEnemy);
1392
+ */
1393
+ calculateEnemyHp: (enemy: EnemyEntity) => number;
1394
+ /**
1395
+ * Calculate expected power for an enemy based on its realm, progress, difficulty, and battle length.
1396
+ * @param enemy - Enemy entity definition
1397
+ * @returns Expected power value
1398
+ * @example
1399
+ * const power = calculateEnemyPower(myEnemy);
1400
+ */
1401
+ calculateEnemyPower: (enemy: EnemyEntity) => number;
1402
+ /**
1403
+ * Create a full CombatEntity from an EnemyEntity definition.
1404
+ * Applies equipment, stats, mod hooks, and spawn conditions.
1405
+ * @param enemy - Enemy entity definition
1406
+ * @param gameFlags - Current game flags
1407
+ * @returns Fully resolved combat entity
1408
+ * @example
1409
+ * const combatEntity = createEnemyCombatEntity(myEnemy, {});
1410
+ */
1411
+ createEnemyCombatEntity: (enemy: EnemyEntity, gameFlags: Record<string, number>) => CombatEntity;
1412
+ /**
1413
+ * Convert a BattleLength enum value to a numeric time-to-kill multiplier.
1414
+ * @param battleLength - Battle length setting
1415
+ * @returns TTK multiplier
1416
+ * @example
1417
+ * const ttk = battleLengthToTTK('medium'); // Returns 4
1418
+ */
1419
+ battleLengthToTTK: (battleLength: BattleLength) => number;
1420
+ /**
1421
+ * Convert an EnemyDifficulty enum value to a numeric damage multiplier.
1422
+ * @param difficulty - Enemy difficulty setting
1423
+ * @returns Damage multiplier
1424
+ * @example
1425
+ * const dmgMult = difficultyToDamage('hard'); // Returns 1.2
1426
+ */
1427
+ difficultyToDamage: (difficulty: EnemyDifficulty) => number;
1428
+ /**
1429
+ * Calculate the spirit stone cost of an item based on kind, realm, rarity, quality, and enchantment.
1430
+ * @param item - Fully resolved item
1431
+ * @returns Spirit stone cost
1432
+ * @example
1433
+ * const cost = getItemCost(myItem);
1434
+ */
1435
+ getItemCost: (item: Item) => number;
1436
+ /**
1437
+ * Derive crafting recipe difficulty stats (stability, completion, perfection, condition type).
1438
+ * @param recipe - Recipe item definition
1439
+ * @param gameFlags - Current game flags
1440
+ * @returns Crafting recipe stats
1441
+ * @example
1442
+ * const stats = deriveRecipeDifficulty(myRecipe, {});
1443
+ */
1444
+ deriveRecipeDifficulty: (recipe: RecipeItem, gameFlags: Record<string, number>) => CraftingRecipeStats;
1445
+ /**
1446
+ * Get the number of technique slots in a stance for a given realm.
1447
+ * @param realm - Cultivation realm
1448
+ * @returns Number of technique slots
1449
+ * @example
1450
+ * const slots = getTechniqueSlots('coreFormation'); // Returns 6
1451
+ */
1452
+ getTechniqueSlots: (realm: Realm) => number;
1453
+ /**
1454
+ * Get maximum toxicity capacity for a realm.
1455
+ * @param realm - Cultivation realm
1456
+ * @returns Max toxicity value
1457
+ * @example
1458
+ * const maxTox = getMaxToxicity('qiCondensation');
1459
+ */
1460
+ getMaxToxicity: (realm: Realm) => number;
1461
+ /**
1462
+ * Calculate damage after defense, protection, DR, and vulnerability.
1463
+ * @param attackPower - Raw attack power
1464
+ * @param defenderDefense - Defender's defense stat
1465
+ * @param defenderDr - Defender's damage reduction (0-1)
1466
+ * @param defenderDefenseFactor - Defense scaling factor
1467
+ * @param maxReduction - Maximum damage reduction cap
1468
+ * @param defenderVulnerability - Vulnerability percentage
1469
+ * @param realm - Combat realm
1470
+ * @param realmProgress - Realm progress
1471
+ * @param defenderProtection - Defender's protection stat
1472
+ * @returns Final damage value
1473
+ */
1474
+ calculateDamage: (attackPower: number, defenderDefense: number, defenderDr: number, defenderDefenseFactor: number, maxReduction: number, defenderVulnerability: number, realm: Realm, realmProgress: RealmProgress, defenderProtection: number) => number;
1475
+ /**
1476
+ * Format a number for display (e.g. 1000 -> "1,000").
1477
+ * @param number - Number to format
1478
+ * @returns Formatted string
1479
+ * @example
1480
+ * formatNumber(12500); // "12,500"
1481
+ */
1482
+ formatNumber: (number: number) => string;
1483
+ /**
1484
+ * Get the stat scaling multiplier for a realm and progress.
1485
+ * Used to scale base stats to appropriate power levels.
1486
+ * @param realm - Cultivation realm
1487
+ * @param progress - Realm progress
1488
+ * @returns Scaling multiplier
1489
+ * @example
1490
+ * const scaling = getPlayerRealmScaling('coreFormation', 'Middle');
1491
+ */
1492
+ getPlayerRealmScaling: (realm: Realm, progress: RealmProgress) => number;
1493
+ /**
1494
+ * Resolve all combat variables from a CombatEntity (stats, buffs, derived values).
1495
+ * Useful for inspecting or testing enemy/player combat state.
1496
+ * @param entity - Combat entity to extract variables from
1497
+ * @param opponent - Optional opponent for target-relative variables
1498
+ * @returns Record of all combat variables
1499
+ * @example
1500
+ * const vars = getVariablesFromEntity(combatEntity);
1501
+ * console.log(vars.power, vars.hp, vars.maxhp);
1502
+ */
1503
+ getVariablesFromEntity: (entity: CombatEntity, opponent?: CombatEntity) => Record<string, number>;
1504
+ /**
1505
+ * Calculate how many hits a Scaling object produces given variables.
1506
+ * @param scaling - The scaling definition
1507
+ * @param variables - Current variable values
1508
+ * @param slots - Number of technique slots
1509
+ * @returns Number of hits
1510
+ */
1511
+ calculateHits: (scaling: Scaling, variables: Record<string, number>, slots: number) => number;
1512
+ /**
1513
+ * Convert eyes stat to crit chance percentage.
1514
+ * @param eyes - Eyes physical stat value
1515
+ * @returns Crit chance percentage
1516
+ * @example
1517
+ * const critChance = eyesToCritChance(15); // 20%
1518
+ */
1519
+ eyesToCritChance: (eyes: number) => number;
1520
+ /**
1521
+ * Convert eyes stat to crit damage multiplier (combat).
1522
+ * @param eyes - Eyes physical stat value
1523
+ * @returns Crit damage multiplier (e.g. 150 = 1.5x)
1524
+ * @example
1525
+ * const critDmg = eyesToCritDamage(15); // 250
1526
+ */
1527
+ eyesToCritDamage: (eyes: number) => number;
1528
+ /**
1529
+ * Convert eyes stat to crit multiplier (crafting).
1530
+ * @param eyes - Eyes physical stat value
1531
+ * @returns Crit multiplier percentage
1532
+ */
1533
+ eyesToCritMultiplier: (eyes: number) => number;
1534
+ /**
1535
+ * Convert digestion stat to toxicity resistance.
1536
+ * @param digestion - Digestion physical stat value
1537
+ * @returns Resistance value
1538
+ */
1539
+ getResistance: (digestion: number) => number;
1540
+ /**
1541
+ * Convert digestion stat to item effectiveness.
1542
+ * @param digestion - Digestion physical stat value
1543
+ * @returns Item effectiveness value
1544
+ */
1545
+ getItemEffectiveness: (digestion: number) => number;
1546
+ /**
1547
+ * Convert raw affinity points to an affinity multiplier.
1548
+ * @param points - Raw affinity points
1549
+ * @returns Affinity multiplier
1550
+ */
1551
+ getAffinityMultiplier: (points: number) => number;
1552
+ /**
1553
+ * Convert dantian stat and realm scaling to max barrier.
1554
+ * @param dantian - Dantian physical stat value
1555
+ * @param scaling - Realm scaling multiplier (from getPlayerRealmScaling)
1556
+ * @returns Max barrier value
1557
+ */
1558
+ dantianToMaxBarrier: (dantian: number, scaling: number) => number;
1559
+ /**
1560
+ * Get the UI border color for an item kind.
1561
+ * @param kind - Item kind
1562
+ * @returns CSS color string
1563
+ * @example
1564
+ * const color = getItemBorderCol('pill'); // '#7c4c85'
1565
+ */
1566
+ getItemBorderCol: (kind: ItemKind) => string;
1567
+ /**
1568
+ * Get craft skill bonus multiplier from raw craft skill value.
1569
+ * @param craftSkill - Raw craft skill number
1570
+ * @returns Bonus multiplier (e.g. 0.33 = +33%)
1571
+ */
1572
+ getCraftSkillBonus: (craftSkill: number) => number;
1573
+ /**
1574
+ * Get the craft skill cap for a realm and progress.
1575
+ * Players stop earning craft skill from recipes at or below this cap.
1576
+ * @param realm - Cultivation realm
1577
+ * @param realmProgress - Realm progress
1578
+ * @returns Craft skill cap
1579
+ */
1580
+ getCraftSkillCap: (realm: Realm, realmProgress: RealmProgress) => number;
1581
+ /**
1582
+ * Calculate charisma-based price discount multiplier.
1583
+ * @param charisma - Player's charisma value
1584
+ * @param realm - Item's realm
1585
+ * @returns Discount multiplier (0.1 to 1.0, lower = bigger discount)
1586
+ */
1587
+ getCharismaDiscount: (charisma: number, realm: Realm | 'any') => number;
1588
+ /**
1589
+ * Calculate reputation-based price discount.
1590
+ * @param reputation - Current reputation value
1591
+ * @returns Discount as a fraction (e.g. 0.15 = 15% off)
1592
+ */
1593
+ getReputationDiscount: (reputation: number) => number;
1594
+ /**
1595
+ * Convert a numeric reputation value to a named tier.
1596
+ * @param reputation - Current reputation value
1597
+ * @returns Reputation tier name
1598
+ * @example
1599
+ * getReputationTierName(500); // 'honoured'
1600
+ */
1601
+ getReputationTierName: (reputation: number) => ReputationTier;
1602
+ /**
1603
+ * Get the technique element associated with a calendar year.
1604
+ * Elements cycle every 6 years starting from 1066.
1605
+ * @param year - In-game year
1606
+ * @returns Technique element for that year
1607
+ * @example
1608
+ * getYearElement(1066); // 'blood'
1609
+ * getYearElement(1067); // 'blossom'
1610
+ */
1611
+ getYearElement: (year: number) => TechniqueElement;
1612
+ /**
1613
+ * Resolve all crafting variables from a CraftingEntity, recipe stats, and progress.
1614
+ * Returns actual stat values after applying buffs, conditions, and scaling.
1615
+ * @param entity - The crafting entity
1616
+ * @param recipe - The crafting recipe stats
1617
+ * @param progress - The current crafting progress state
1618
+ * @returns Record of all crafting variables
1619
+ * @example
1620
+ * const vars = getVariablesFromCraftingEntity(entity, recipeStats, progress);
1621
+ * console.log(vars.control, vars.intensity, vars.pool);
1622
+ */
1623
+ getVariablesFromCraftingEntity: (entity: CraftingEntity, recipe: CraftingRecipeStats, progress: ProgressState) => Record<string, number>;
1624
+ /**
1625
+ * Calculate guaranteed bonus count and chance for the next bonus from a value/target pair.
1626
+ * Uses exponential scaling (1.3x per tier).
1627
+ * @param value - The current accumulated value
1628
+ * @param target - The base target threshold
1629
+ * @returns Object with guaranteed count, bonus chance fraction, and next threshold
1630
+ * @example
1631
+ * const result = getBonusAndChance(250, 100);
1632
+ * // { guaranteed: 2, bonusChance: 0.38, nextThreshold: 269 }
1633
+ */
1634
+ getBonusAndChance: (value: number, target: number) => {
1635
+ guaranteed: number;
1636
+ bonusChance: number;
1637
+ nextThreshold: number;
1638
+ };
1639
+ /**
1640
+ * Get the effective value of a crafting statistic after applying buffs and condition effects.
1641
+ * @param stat - The crafting statistic to evaluate
1642
+ * @param entity - The crafting entity
1643
+ * @param condition - The current crafting condition
1644
+ * @param recipeConditionEffect - The recipe's condition effect configuration
1645
+ * @param progress - The current crafting progress
1646
+ * @param recipeStats - The recipe stats
1647
+ * @returns The effective stat value
1648
+ */
1649
+ getActualCraftingStat: (stat: CraftingStatistic, entity: CraftingEntity, condition: CraftingCondition, recipeConditionEffect: RecipeConditionEffect, progress: ProgressState, recipeStats: CraftingRecipeStats) => number;
1650
+ /**
1651
+ * Evaluate a crafting technique condition against current state.
1652
+ * Supports buff counts, pool/perfection/stability/completion/toxicity percentages,
1653
+ * expression conditions, and random chance.
1654
+ * @param condition - The condition to evaluate
1655
+ * @param entity - The crafting entity
1656
+ * @param variables - Current crafting variables
1657
+ * @param selfStacks - Stack count of the technique's own buff
1658
+ * @param progress - Current crafting progress
1659
+ * @param state - Full crafting state
1660
+ * @returns Whether the condition is met
1661
+ */
1662
+ evaluateCraftingCondition: (condition: CraftingTechniqueCondition, entity: CraftingEntity, variables: Record<string, number>, selfStacks: number, progress: ProgressState, state: CraftingState) => boolean;
1194
1663
  };
1195
1664
  hooks: {
1196
1665
  /**
@@ -19,7 +19,6 @@ import { Buff } from './buff';
19
19
  import { EventStep, GameEvent, ReportAnalyticsStep, TournamentStep } from './event';
20
20
  import { Background } from './background';
21
21
  import { Realm } from './realm';
22
- import { TechniqueElement } from './element';
23
22
  export interface Viewport {
24
23
  x: number;
25
24
  y: number;
@@ -387,7 +386,7 @@ export interface RecipeFilters {
387
386
  category: 'all' | ItemKind;
388
387
  }
389
388
  export interface CharacterUiPreferencesState {
390
- techniqueFilter: 'all' | TechniqueElement;
389
+ techniqueFilter: string;
391
390
  recipeFilters: RecipeFilters;
392
391
  }
393
392
  export interface RootState {
package/dist/stat.js CHANGED
@@ -166,7 +166,7 @@ export const combatStatToDescription = {
166
166
  protection: '',
167
167
  dr: '',
168
168
  lifesteal: '',
169
- critchance: 'Your chance to get a critical effect on damage, healing, and barrier. Crit chance over 100% converts to bonus crit damage at a 1:3 ratio.',
169
+ critchance: 'Your chance to get a critical effect on damage, healing, and barrier. Crit chance over 100% converts to bonus crit multiplier at a 1:3 ratio.',
170
170
  critmultiplier: '',
171
171
  vulnerability: '',
172
172
  weakness: '',
@@ -21,6 +21,7 @@ export type StanceRestriction = (typeof stanceRestriction)[number];
21
21
  export declare const stanceRestrictionToName: Record<StanceRestriction, string>;
22
22
  export interface Technique {
23
23
  name: string;
24
+ displayName?: Translatable;
24
25
  icon: string;
25
26
  toxicityCost?: number;
26
27
  costs?: {
@@ -35,6 +36,10 @@ export interface Technique {
35
36
  mode?: 'more' | 'less' | 'equal';
36
37
  upgradeKey?: string;
37
38
  }[];
39
+ itemCosts?: {
40
+ itemName: string;
41
+ amount: number;
42
+ }[];
38
43
  type: TechniqueElement;
39
44
  noneType?: string;
40
45
  secondaryType?: TechniqueElement | 'origin';
@@ -7,6 +7,7 @@ export interface TranslatableString {
7
7
  readonly _translatable: true;
8
8
  readonly key: string;
9
9
  readonly variables?: Record<string, Translatable | number>;
10
+ readonly context?: string;
10
11
  }
11
12
  /**
12
13
  * A deferred plural translation object. Stores both singular and plural keys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afnm-types",
3
- "version": "0.6.34",
3
+ "version": "0.6.38",
4
4
  "description": "Type definitions for Ascend From Nine Mountains",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",