afnm-types 0.6.25 → 0.6.27

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.
@@ -0,0 +1,101 @@
1
+ import { Tutorial } from './tutorial';
2
+ import { TriggeredEvent, GameEvent } from './event';
3
+ import { ItemDesc } from './item';
4
+ import { PlayerEntity } from './entity';
5
+ /**
6
+ * Configuration for an alternative game start.
7
+ * Mods can register alternative starts to provide different opening experiences,
8
+ * starting locations, and initial player setups.
9
+ */
10
+ export interface AlternativeStart {
11
+ /**
12
+ * Unique identifier for this start (e.g., "defaultStart", "rogueStart")
13
+ */
14
+ name: string;
15
+ /**
16
+ * Display name shown in the UI (e.g., "Standard Start", "Rogue Cultivator")
17
+ */
18
+ displayName: string;
19
+ /**
20
+ * Description shown in the selection UI explaining this start option
21
+ */
22
+ description: string;
23
+ /**
24
+ * The root event that plays when starting the game.
25
+ * This replaces the default newGameEvent.
26
+ */
27
+ rootEvent: GameEvent;
28
+ /**
29
+ * The starting location name. This becomes the root for location discovery
30
+ * (used by discoverUnlockedLocations). All location searches will branch
31
+ * from this location.
32
+ */
33
+ startLocation: string;
34
+ /**
35
+ * Flags to set when starting the game (regardless of skip tutorial).
36
+ * These are set before the root event plays.
37
+ */
38
+ startFlags?: Record<string, number>;
39
+ /**
40
+ * Items to give the player at game start.
41
+ */
42
+ startItems?: ItemDesc[];
43
+ /**
44
+ * Technique names to teach the player at game start.
45
+ */
46
+ startTechniques?: string[];
47
+ /**
48
+ * Recipe names to teach the player at game start.
49
+ */
50
+ startRecipes?: string[];
51
+ /**
52
+ * Destiny names to grant the player at game start.
53
+ */
54
+ startDestinies?: string[];
55
+ /**
56
+ * Quest names to add to the player's quest log at game start.
57
+ */
58
+ startQuests?: string[];
59
+ /**
60
+ * Spirit stones to give at game start.
61
+ */
62
+ startMoney?: number;
63
+ /**
64
+ * Sect favour to give at game start.
65
+ */
66
+ startFavour?: number;
67
+ /**
68
+ * Custom tutorials for this start. If undefined, uses base game tutorials.
69
+ * These define what tutorials will play during the game.
70
+ */
71
+ tutorials?: Tutorial[];
72
+ /**
73
+ * Custom tutorial triggers for this start. If undefined, uses base game triggers.
74
+ * These are the triggered events that form the opening sequence.
75
+ */
76
+ tutorialTriggers?: TriggeredEvent[];
77
+ /**
78
+ * Additional flag names to set when the player chooses "Skip Tutorial".
79
+ * The system will automatically set the standard skip flags for the
80
+ * tutorials and tutorialTriggers arrays. Use this for any extra flags
81
+ * specific to your alternative start.
82
+ */
83
+ skipTutorialFlags?: string[];
84
+ /**
85
+ * Condition expression for this start to be available.
86
+ * If undefined, the start is always available.
87
+ * Example: "completedGameOnce" to require a previous completion.
88
+ */
89
+ condition?: string;
90
+ /**
91
+ * Optional function to modify the player entity after base setup.
92
+ * Called after backgrounds are applied but before the game starts.
93
+ */
94
+ modifyPlayer?: (player: PlayerEntity) => PlayerEntity;
95
+ }
96
+ /**
97
+ * Generates the flags that should be set when skipping tutorials.
98
+ * For each tutorial: sets {name}, {name}Started, {name}Completed
99
+ * For each trigger: sets {name}, {name}Started
100
+ */
101
+ export declare const generateSkipTutorialFlags: (tutorials: Tutorial[], triggers: TriggeredEvent[]) => Record<string, number>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generates the flags that should be set when skipping tutorials.
3
+ * For each tutorial: sets {name}, {name}Started, {name}Completed
4
+ * For each trigger: sets {name}, {name}Started
5
+ */
6
+ export const generateSkipTutorialFlags = (tutorials, triggers) => {
7
+ const flags = {};
8
+ for (const tutorial of tutorials) {
9
+ flags[tutorial.name] = 1;
10
+ flags[tutorial.name + 'Started'] = 1;
11
+ flags[tutorial.name + 'Completed'] = 1;
12
+ }
13
+ for (const trigger of triggers) {
14
+ flags[trigger.name] = 1;
15
+ flags[trigger.name + 'Started'] = 1;
16
+ }
17
+ return flags;
18
+ };
@@ -95,13 +95,36 @@ export interface RequirementResult {
95
95
  done: boolean;
96
96
  preview: ReactNode;
97
97
  }
98
+ /**
99
+ * Defines which items are allowed in breakthrough slots.
100
+ * Each slot type maps to an array of allowed item names.
101
+ * When a breakthrough defines allowed items for a slot, those items
102
+ * will be available in that slot's UI.
103
+ */
104
+ export interface BreakthroughAllowedSlotItems {
105
+ awakeningPill?: string[];
106
+ brain?: string[];
107
+ heart?: string[];
108
+ pill?: string[];
109
+ groin?: string[];
110
+ minorMeridian?: string[];
111
+ greaterMeridian?: string[];
112
+ vessel?: string[];
113
+ }
98
114
  export interface Breakthrough extends BreakthroughBase {
99
115
  unlocked?: (flags: Record<string, number>, args: RequirementArgs) => boolean;
116
+ hide?: string;
100
117
  hint?: ReactNode;
101
118
  requirements: ((args: RequirementArgs) => RequirementResult)[];
102
119
  totalRequirements: number | ((args: RequirementArgs) => number);
103
120
  getNumDone: (args: RequirementArgs) => number;
104
121
  extraEffects?: string[];
122
+ /**
123
+ * Defines which items are allowed in breakthrough slots for this breakthrough.
124
+ * When breakthroughs specify allowed items, those items become available in the slot UI.
125
+ * The game aggregates allowed items from ALL breakthroughs in a realm, including mod-added ones.
126
+ */
127
+ allowedSlotItems?: BreakthroughAllowedSlotItems;
105
128
  dynamicStats?: (args: RequirementArgs) => {
106
129
  physicalStats: Partial<{
107
130
  [key in PhysicalStatistic]: number;
package/dist/buff.d.ts CHANGED
@@ -249,6 +249,7 @@ interface CleanseToxicityEffect extends BaseBuff {
249
249
  }
250
250
  interface ModifyBuffGroupEffect extends BaseBuff {
251
251
  kind: 'modifyBuffGroup';
252
+ onTarget?: boolean;
252
253
  group: string;
253
254
  amount: Scaling;
254
255
  }
package/dist/item.d.ts CHANGED
@@ -357,6 +357,15 @@ export interface CondensationArtItem extends ItemBase {
357
357
  maxDroplets: number;
358
358
  restoredDroplets?: number;
359
359
  statChange: Partial<Record<PhysicalStatistic, number>>;
360
+ socialStatsChange?: Partial<Record<SocialStatistic, number>>;
361
+ combatBuffs?: {
362
+ buff: Buff;
363
+ buffStacks: Scaling;
364
+ }[];
365
+ craftingBuffs?: {
366
+ buff: CraftingBuff;
367
+ buffStacks: Scaling;
368
+ }[];
360
369
  lifespanMult?: number;
361
370
  charismaMult?: number;
362
371
  }
package/dist/mod.d.ts CHANGED
@@ -33,6 +33,9 @@ import { ScreenEffectType } from './ScreenEffectType';
33
33
  import { RootState } from './reduxState';
34
34
  import { GameButtonFC, GameDialogFC, GameIconButtonFC, MemoBackgroundImageFC } from './components';
35
35
  import { PuppetType } from './trainingGround';
36
+ import { TechniqueElement } from './element';
37
+ import { AlternativeStart } from './alternativeStart';
38
+ import { Tutorial } from './tutorial';
36
39
  export interface ModMetadata {
37
40
  name: string;
38
41
  version: string;
@@ -329,6 +332,26 @@ export interface ModAPI {
329
332
  itemTypeToHarmonyType: Record<ItemKind, RecipeHarmonyType>;
330
333
  puppets: PuppetType[];
331
334
  monsters: EnemyEntity[];
335
+ /**
336
+ * Registry of alternative game starts.
337
+ * The first entry is always the default start.
338
+ */
339
+ alternativeStarts: AlternativeStart[];
340
+ /**
341
+ * Tutorial system data for creating alternative starts.
342
+ */
343
+ tutorials: {
344
+ /**
345
+ * The tutorials that play during a new game (base game set).
346
+ * Use this as a reference when creating alternative starts.
347
+ */
348
+ newGameTutorials: Tutorial[];
349
+ /**
350
+ * The triggered events that form the opening sequence (base game set).
351
+ * Use this as a reference when creating alternative starts.
352
+ */
353
+ tutorialTriggers: TriggeredEvent[];
354
+ };
332
355
  };
333
356
  actions: {
334
357
  /**
@@ -608,6 +631,24 @@ export interface ModAPI {
608
631
  * @param puppet - Puppet configuration
609
632
  */
610
633
  addPuppetType: (puppet: PuppetType) => void;
634
+ /**
635
+ * Register an alternative game start.
636
+ * Alternative starts provide different opening experiences, starting locations,
637
+ * and initial player setups. Players can select from available starts when
638
+ * creating a new game.
639
+ * @param start - Alternative start configuration
640
+ * @example
641
+ * addAlternativeStart({
642
+ * name: 'rogueStart',
643
+ * displayName: 'Rogue Cultivator',
644
+ * description: 'Begin as a wandering cultivator with no sect affiliation.',
645
+ * rootEvent: rogueOpeningEvent,
646
+ * startLocation: 'Liang Tiao Village',
647
+ * startItems: [{ name: 'Tattered Robes', count: 1 }],
648
+ * startMoney: 50,
649
+ * });
650
+ */
651
+ addAlternativeStart: (start: AlternativeStart) => void;
611
652
  };
612
653
  utils: {
613
654
  /**
@@ -961,6 +1002,85 @@ export interface ModAPI {
961
1002
  * const mult = getPillRealmMultiplier('coreFormation');
962
1003
  */
963
1004
  getPillRealmMultiplier: (realm: Realm) => number;
1005
+ /**
1006
+ * Wrap text in a colored span for event text.
1007
+ * @param text - Text to color
1008
+ * @param col - CSS color value
1009
+ * @returns HTML string with colored text
1010
+ * @example
1011
+ * col('Important!', '#ff0000');
1012
+ */
1013
+ col: (text: string | number, col: string) => string;
1014
+ /**
1015
+ * Format text as a location name (purple color).
1016
+ * @param text - Location name
1017
+ * @returns HTML string with location styling
1018
+ * @example
1019
+ * loc('Liang Tiao Village');
1020
+ */
1021
+ loc: (text: string | number) => string;
1022
+ /**
1023
+ * Format a realm with optional progress as styled text.
1024
+ * @param realm - Cultivation realm
1025
+ * @param progress - Optional realm progress
1026
+ * @returns HTML string with realm styling
1027
+ * @example
1028
+ * rlm('coreFormation', 'Middle');
1029
+ */
1030
+ rlm: (realm: Realm, progress?: RealmProgress) => string;
1031
+ /**
1032
+ * Format a number with styling for event text.
1033
+ * @param number - Number to format
1034
+ * @returns HTML string with number styling
1035
+ * @example
1036
+ * num(1000); // Returns formatted "1,000" with styling
1037
+ */
1038
+ num: (number: string | number) => string;
1039
+ /**
1040
+ * Format text as a buff name (pink color).
1041
+ * @param buff - Buff name
1042
+ * @returns HTML string with buff styling
1043
+ * @example
1044
+ * buf('Empowered Blood');
1045
+ */
1046
+ buf: (buff: string) => string;
1047
+ /**
1048
+ * Format text as an item name (pink color).
1049
+ * @param item - Item name
1050
+ * @returns HTML string with item styling
1051
+ * @example
1052
+ * itm('Spirit Core (III)');
1053
+ */
1054
+ itm: (item: string) => string;
1055
+ /**
1056
+ * Format text as a character name (green color).
1057
+ * @param text - Character name
1058
+ * @returns HTML string with character styling
1059
+ * @example
1060
+ * char('Elder Zhang');
1061
+ */
1062
+ char: (text: string | number) => string;
1063
+ /**
1064
+ * Format a technique element with styling.
1065
+ * @param element - Technique element type
1066
+ * @returns HTML string with element styling
1067
+ * @example
1068
+ * elem('fire');
1069
+ */
1070
+ elem: (element: TechniqueElement) => string;
1071
+ /**
1072
+ * Generate the flags that should be set when skipping tutorials.
1073
+ * For each tutorial: sets {name}, {name}Started, {name}Completed
1074
+ * For each trigger: sets {name}, {name}Started
1075
+ * Use this when creating alternative starts to ensure proper skip behavior.
1076
+ * @param tutorials - Array of tutorials
1077
+ * @param triggers - Array of triggered events
1078
+ * @returns Record of flag names to values (all set to 1)
1079
+ * @example
1080
+ * const skipFlags = generateSkipTutorialFlags(myTutorials, myTriggers);
1081
+ * // Returns { 'tutorialName': 1, 'tutorialNameStarted': 1, 'tutorialNameCompleted': 1, ... }
1082
+ */
1083
+ generateSkipTutorialFlags: (tutorials: Tutorial[], triggers: TriggeredEvent[]) => Record<string, number>;
964
1084
  };
965
1085
  hooks: {
966
1086
  /**
@@ -319,6 +319,12 @@ export interface NewGameState {
319
319
  export interface GameDataState {
320
320
  flags: Record<string, number>;
321
321
  mapExploration: Record<string, number>;
322
+ /**
323
+ * The root location name for location discovery.
324
+ * Defaults to "Nine Mountain Sect" if not set.
325
+ * Can be changed by alternative starts.
326
+ */
327
+ discoveryRoot?: string;
322
328
  }
323
329
  export interface HistoryItem {
324
330
  text: string;
package/dist/stat.d.ts CHANGED
@@ -63,6 +63,11 @@ export interface Scaling {
63
63
  scaling?: 'stacks' | 'consumed' | string;
64
64
  eqn?: string;
65
65
  additiveEqn?: string;
66
+ customScaling?: {
67
+ multiplier: number;
68
+ scaling: 'stacks' | 'consumed' | string;
69
+ upgradeKey?: string;
70
+ };
66
71
  max?: Scaling;
67
72
  divideByStanceLength?: boolean;
68
73
  upgradeKey?: string;
package/dist/stat.js CHANGED
@@ -254,7 +254,7 @@ export const physicalStatToDescription = {
254
254
  muscles: 'Your ability to use your body to project force. Affects your crafting <b>Qi Intensity</b> and combat <b>Power</b>.',
255
255
  dantian: 'Your ability to store and channel Qi. Affects your combat <b>Max Barrier</b>, crafting <b>Max Qi Pool</b>, <b>Qi Absorption</b>, and <b>Technique Mastery Points</b>.',
256
256
  meridians: 'Your ability to control Qi. Affects crafting <b>Qi Control</b> and combat <b>Artefact Power</b>.',
257
- eyes: 'Your ability to perceive the fine details in the world around you. Affects <b>Critical Chance</b> and <b>Critical Damage</b>.',
257
+ eyes: 'Your ability to perceive the fine details in the world around you. Affects <b>Critical Chance</b> and <b>Critical Multiplier</b>.',
258
258
  };
259
259
  export const reputationDescription = 'Reputation affects a factions attitude towards you. High reputation reduces prices, unlocks quests, and allows the purchase of valuable items.';
260
260
  export const reputationPerTier = 5;
@@ -62,6 +62,7 @@ interface BaseTechniqueEffect {
62
62
  kind: TechniqueEffectKind;
63
63
  condition?: TechniqueCondition;
64
64
  triggerKey?: string;
65
+ isAdditionalTooltip?: boolean;
65
66
  }
66
67
  interface BuffSelfTechniqueEffect extends BaseTechniqueEffect {
67
68
  kind: 'buffSelf';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afnm-types",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
4
4
  "description": "Type definitions for Ascend From Nine Mountains",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",