rpg-event-generator 4.0.0 → 5.0.0
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/README.md +48 -371
- package/demo.js +80 -1055
- package/dist/RPGEventGenerator.d.ts +25 -3
- package/dist/RPGEventGenerator.d.ts.map +1 -1
- package/dist/RPGEventGenerator.js +52 -26
- package/dist/RPGEventGenerator.js.map +1 -1
- package/dist/chains/ChainSystem.d.ts +3 -2
- package/dist/chains/ChainSystem.d.ts.map +1 -1
- package/dist/chains/ChainSystem.js +5 -5
- package/dist/chains/ChainSystem.js.map +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/core/ContextAnalyzer.js +1 -1
- package/dist/core/DescriptionFragmentLibrary.d.ts +3 -2
- package/dist/core/DescriptionFragmentLibrary.d.ts.map +1 -1
- package/dist/core/DescriptionFragmentLibrary.js +4 -4
- package/dist/core/DescriptionFragmentLibrary.js.map +1 -1
- package/dist/core/DifficultyScaler.js +1 -1
- package/dist/core/GeneratorCore.d.ts +4 -43
- package/dist/core/GeneratorCore.d.ts.map +1 -1
- package/dist/core/GeneratorCore.js +29 -71
- package/dist/core/GeneratorCore.js.map +1 -1
- package/dist/core/GrammarRulesEngine.d.ts +3 -2
- package/dist/core/GrammarRulesEngine.d.ts.map +1 -1
- package/dist/core/GrammarRulesEngine.js +4 -4
- package/dist/core/GrammarRulesEngine.js.map +1 -1
- package/dist/core/MarkovEngine.js +1 -1
- package/dist/core/SentenceBuilder.d.ts +3 -2
- package/dist/core/SentenceBuilder.d.ts.map +1 -1
- package/dist/core/SentenceBuilder.js +7 -36
- package/dist/core/SentenceBuilder.js.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/database/MemoryDatabaseAdapter.js +1 -1
- package/dist/database/TemplateDatabase.js +1 -1
- package/dist/environment/EnvironmentalSystem.d.ts +5 -2
- package/dist/environment/EnvironmentalSystem.d.ts.map +1 -1
- package/dist/environment/EnvironmentalSystem.js +50 -14
- package/dist/environment/EnvironmentalSystem.js.map +1 -1
- package/dist/environment/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces/systems.d.ts +1 -1
- package/dist/interfaces/systems.d.ts.map +1 -1
- package/dist/localization/LocalizationSystem.js +1 -1
- package/dist/localization/index.js +1 -1
- package/dist/relationships/RelationshipSystem.js +1 -1
- package/dist/relationships/index.js +1 -1
- package/dist/rules/RuleEngine.js +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/src/types/config.d.ts +3 -1
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/world.d.ts +9 -0
- package/dist/src/types/world.d.ts.map +1 -1
- package/dist/src/utils/random.d.ts +73 -0
- package/dist/src/utils/random.d.ts.map +1 -0
- package/dist/src/utils/random.js +182 -0
- package/dist/src/utils/random.js.map +1 -0
- package/dist/templates/TemplateSystem.js +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/time/TimeSystem.d.ts +3 -2
- package/dist/time/TimeSystem.d.ts.map +1 -1
- package/dist/time/TimeSystem.js +7 -7
- package/dist/time/TimeSystem.js.map +1 -1
- package/dist/time/index.js +1 -1
- package/dist/types/config.d.ts +3 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/world.d.ts +9 -0
- package/dist/types/world.d.ts.map +1 -1
- package/dist/utils/array.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/file.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/random.d.ts +23 -2
- package/dist/utils/random.d.ts.map +1 -1
- package/dist/utils/random.js +62 -5
- package/dist/utils/random.js.map +1 -1
- package/dist/utils/text.js +1 -1
- package/dist/utils/validation.js +1 -1
- package/dist/utils/version.d.ts +8 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +11 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/world/WorldBuildingSystem.d.ts +16 -2
- package/dist/world/WorldBuildingSystem.d.ts.map +1 -1
- package/dist/world/WorldBuildingSystem.js +364 -155
- package/dist/world/WorldBuildingSystem.js.map +1 -1
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js.map +1 -1
- package/dist/world/worldContent.d.ts +13 -0
- package/dist/world/worldContent.d.ts.map +1 -0
- package/dist/world/worldContent.js +109 -0
- package/dist/world/worldContent.js.map +1 -0
- package/package.json +1 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { SeededRandom } from '../utils/random';
|
|
1
2
|
import { Event, PlayerContext } from '../types';
|
|
2
3
|
import { IGeneratorCore } from '../interfaces';
|
|
3
4
|
export interface GeneratorOptions {
|
|
4
|
-
|
|
5
|
+
rng?: SeededRandom;
|
|
5
6
|
debug?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface TrainingDataOptions {
|
|
@@ -17,66 +18,26 @@ export interface TrainingDataOptions {
|
|
|
17
18
|
texts?: string[];
|
|
18
19
|
}
|
|
19
20
|
export declare class GeneratorCore implements IGeneratorCore {
|
|
20
|
-
private
|
|
21
|
+
private rng;
|
|
21
22
|
private contextAnalyzer;
|
|
22
23
|
private options;
|
|
23
24
|
private customTitles;
|
|
24
25
|
private customDescriptions;
|
|
25
26
|
private customChoices;
|
|
26
27
|
constructor(options?: GeneratorOptions);
|
|
27
|
-
/**
|
|
28
|
-
* Generate a complete event - CLEAN AND SIMPLE
|
|
29
|
-
*/
|
|
30
28
|
generateEvent(playerContext?: PlayerContext): Event;
|
|
31
|
-
/**
|
|
32
|
-
* Generate multiple events
|
|
33
|
-
*/
|
|
34
29
|
generateEvents(playerContext?: PlayerContext, count?: number): Event[];
|
|
35
|
-
/**
|
|
36
|
-
* Add training data - allows users to extend the generator with custom content
|
|
37
|
-
* Supports both simple text training and structured custom content
|
|
38
|
-
*/
|
|
39
30
|
addTrainingData(data: string[] | TrainingDataOptions, theme?: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* Process raw training texts for backward compatibility
|
|
42
|
-
*/
|
|
31
|
+
/** @deprecated No-op for backward compatibility; use structured addTrainingData. */
|
|
43
32
|
private processRawTrainingTexts;
|
|
44
|
-
/**
|
|
45
|
-
* Add contextual enhancements to descriptions
|
|
46
|
-
*/
|
|
47
33
|
private addContextualEnhancements;
|
|
48
|
-
/**
|
|
49
|
-
* Generate unique event ID
|
|
50
|
-
*/
|
|
51
34
|
private generateEventId;
|
|
52
|
-
/**
|
|
53
|
-
* Select appropriate event type
|
|
54
|
-
*/
|
|
55
35
|
private selectEventType;
|
|
56
|
-
/**
|
|
57
|
-
* Calculate event difficulty
|
|
58
|
-
*/
|
|
59
36
|
private calculateDifficulty;
|
|
60
|
-
/**
|
|
61
|
-
* Generate event title - SIMPLE LOOKUP
|
|
62
|
-
*/
|
|
63
37
|
private generateTitle;
|
|
64
|
-
/**
|
|
65
|
-
* Generate event description - SIMPLE AND RELIABLE
|
|
66
|
-
* Direct mapping from event type to meaningful descriptions
|
|
67
|
-
*/
|
|
68
38
|
private generateDescription;
|
|
69
|
-
/**
|
|
70
|
-
* Generate event choices - SIMPLE VERSION
|
|
71
|
-
*/
|
|
72
39
|
private generateChoices;
|
|
73
|
-
/**
|
|
74
|
-
* Generate effect for a choice
|
|
75
|
-
*/
|
|
76
40
|
private generateChoiceEffect;
|
|
77
|
-
/**
|
|
78
|
-
* Generate tags
|
|
79
|
-
*/
|
|
80
41
|
private generateTags;
|
|
81
42
|
}
|
|
82
43
|
//# sourceMappingURL=GeneratorCore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorCore.d.ts","sourceRoot":"","sources":["../../src/core/GeneratorCore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GeneratorCore.d.ts","sourceRoot":"","sources":["../../src/core/GeneratorCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAmC,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAC3C,YAAY,CAAC,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IACjD,OAAO,CAAC,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,qBAAa,aAAc,YAAW,cAAc;IAClD,OAAO,CAAC,GAAG,CAAe;IAC1B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAmB;IAElC,OAAO,CAAC,YAAY,CAAyD;IAC7E,OAAO,CAAC,kBAAkB,CAAyD;IACnF,OAAO,CAAC,aAAa,CAAyD;gBAElE,OAAO,GAAE,gBAAqB;IAM1C,aAAa,CAAC,aAAa,GAAE,aAAkB,GAAG,KAAK;IAwBvD,cAAc,CAAC,aAAa,GAAE,aAAkB,EAAE,KAAK,GAAE,MAAU,GAAG,KAAK,EAAE;IAQ7E,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,KAAK,GAAE,MAAkB,GAAG,IAAI;IA+BtF,oFAAoF;IACpF,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,yBAAyB;IA2JjC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,aAAa;IA6arB,OAAO,CAAC,mBAAmB;IA8pB3B,OAAO,CAAC,eAAe;IA6kBvB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,YAAY;CAiBrB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// RPG
|
|
3
|
-
// Simple, reliable event generation with guaranteed coherent descriptions
|
|
2
|
+
// GeneratorCore - RPG event generation (v4)
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
4
|
exports.GeneratorCore = void 0;
|
|
6
|
-
const
|
|
5
|
+
const random_1 = require("../utils/random");
|
|
7
6
|
const ContextAnalyzer_1 = require("./ContextAnalyzer");
|
|
8
7
|
class GeneratorCore {
|
|
9
8
|
constructor(options = {}) {
|
|
@@ -11,12 +10,9 @@ class GeneratorCore {
|
|
|
11
10
|
this.customDescriptions = {};
|
|
12
11
|
this.customChoices = {};
|
|
13
12
|
this.options = options;
|
|
14
|
-
this.
|
|
13
|
+
this.rng = options.rng || new random_1.SeededRandom();
|
|
15
14
|
this.contextAnalyzer = new ContextAnalyzer_1.ContextAnalyzer();
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Generate a complete event - CLEAN AND SIMPLE
|
|
19
|
-
*/
|
|
20
16
|
generateEvent(playerContext = {}) {
|
|
21
17
|
const analyzedContext = this.contextAnalyzer.analyzeContext(playerContext);
|
|
22
18
|
const id = this.generateEventId();
|
|
@@ -36,9 +32,6 @@ class GeneratorCore {
|
|
|
36
32
|
tags: this.generateTags(type, analyzedContext)
|
|
37
33
|
};
|
|
38
34
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Generate multiple events
|
|
41
|
-
*/
|
|
42
35
|
generateEvents(playerContext = {}, count = 1) {
|
|
43
36
|
const events = [];
|
|
44
37
|
for (let i = 0; i < count; i++) {
|
|
@@ -46,10 +39,6 @@ class GeneratorCore {
|
|
|
46
39
|
}
|
|
47
40
|
return events;
|
|
48
41
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Add training data - allows users to extend the generator with custom content
|
|
51
|
-
* Supports both simple text training and structured custom content
|
|
52
|
-
*/
|
|
53
42
|
addTrainingData(data, theme = 'default') {
|
|
54
43
|
if (typeof data === 'object' && !Array.isArray(data)) {
|
|
55
44
|
const options = data;
|
|
@@ -77,18 +66,15 @@ class GeneratorCore {
|
|
|
77
66
|
this.processRawTrainingTexts(data, theme);
|
|
78
67
|
}
|
|
79
68
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Process raw training texts for backward compatibility
|
|
82
|
-
*/
|
|
69
|
+
/** @deprecated No-op for backward compatibility; use structured addTrainingData. */
|
|
83
70
|
processRawTrainingTexts(texts, theme) {
|
|
84
|
-
|
|
71
|
+
if (this.options.debug) {
|
|
72
|
+
console.warn(`[GeneratorCore] Raw training texts are not supported in v4.0.0. Use structured content (titles, descriptions, choices) instead. Received ${texts.length} texts for theme '${theme}' which will be ignored.`);
|
|
73
|
+
}
|
|
85
74
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Add contextual enhancements to descriptions
|
|
88
|
-
*/
|
|
89
75
|
addContextualEnhancements(description, context) {
|
|
90
76
|
const contextEnhancements = [];
|
|
91
|
-
if (context.location && this.
|
|
77
|
+
if (context.location && this.rng.bool({ likelihood: 70 })) {
|
|
92
78
|
const locationPrefixes = [
|
|
93
79
|
`In the ${context.location}, `,
|
|
94
80
|
`Deep within the ${context.location}, `,
|
|
@@ -101,9 +87,9 @@ class GeneratorCore {
|
|
|
101
87
|
`At the center of the ${context.location}, `,
|
|
102
88
|
`Surrounded by the ${context.location}, `
|
|
103
89
|
];
|
|
104
|
-
contextEnhancements.push(this.
|
|
90
|
+
contextEnhancements.push(this.rng.pickone(locationPrefixes));
|
|
105
91
|
}
|
|
106
|
-
if (context.weather && this.
|
|
92
|
+
if (context.weather && this.rng.bool({ likelihood: 60 })) {
|
|
107
93
|
const weatherPrefixes = {
|
|
108
94
|
sunny: [
|
|
109
95
|
'Under the brilliant sun, ',
|
|
@@ -149,9 +135,9 @@ class GeneratorCore {
|
|
|
149
135
|
]
|
|
150
136
|
};
|
|
151
137
|
const weatherOptions = weatherPrefixes[context.weather] || ['In this weather, '];
|
|
152
|
-
contextEnhancements.push(this.
|
|
138
|
+
contextEnhancements.push(this.rng.pickone(weatherOptions));
|
|
153
139
|
}
|
|
154
|
-
if (context.timeOfDay && this.
|
|
140
|
+
if (context.timeOfDay && this.rng.bool({ likelihood: 50 })) {
|
|
155
141
|
const timePrefixes = {
|
|
156
142
|
dawn: [
|
|
157
143
|
'At the break of dawn, ',
|
|
@@ -203,9 +189,9 @@ class GeneratorCore {
|
|
|
203
189
|
]
|
|
204
190
|
};
|
|
205
191
|
const timeOptions = timePrefixes[context.timeOfDay] || ['At this hour, '];
|
|
206
|
-
contextEnhancements.push(this.
|
|
192
|
+
contextEnhancements.push(this.rng.pickone(timeOptions));
|
|
207
193
|
}
|
|
208
|
-
if ((context.class || context.race) && this.
|
|
194
|
+
if ((context.class || context.race) && this.rng.bool({ likelihood: 40 })) {
|
|
209
195
|
if (context.class) {
|
|
210
196
|
const classContexts = {
|
|
211
197
|
fighter: ['As a warrior, ', 'In your martial tradition, ', 'Drawing on your combat experience, '],
|
|
@@ -215,7 +201,7 @@ class GeneratorCore {
|
|
|
215
201
|
necromancer: ['With your deathly arts, ', 'Through your necrotic knowledge, ', 'Using your dark magic, ']
|
|
216
202
|
};
|
|
217
203
|
const classOptions = classContexts[context.class] || [`As a ${context.class}, `];
|
|
218
|
-
contextEnhancements.push(this.
|
|
204
|
+
contextEnhancements.push(this.rng.pickone(classOptions));
|
|
219
205
|
}
|
|
220
206
|
else if (context.race) {
|
|
221
207
|
const raceContexts = {
|
|
@@ -226,34 +212,25 @@ class GeneratorCore {
|
|
|
226
212
|
orc: ['With orcish fury, ', 'Using orcish strength, ', 'Through orcish determination, ']
|
|
227
213
|
};
|
|
228
214
|
const raceOptions = raceContexts[context.race] || [`As a ${context.race}, `];
|
|
229
|
-
contextEnhancements.push(this.
|
|
215
|
+
contextEnhancements.push(this.rng.pickone(raceOptions));
|
|
230
216
|
}
|
|
231
217
|
}
|
|
232
218
|
if (contextEnhancements.length > 0) {
|
|
233
|
-
const selectedEnhancement = this.
|
|
219
|
+
const selectedEnhancement = this.rng.pickone(contextEnhancements);
|
|
234
220
|
description = selectedEnhancement + description.charAt(0).toLowerCase() + description.slice(1);
|
|
235
221
|
}
|
|
236
222
|
return description;
|
|
237
223
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Generate unique event ID
|
|
240
|
-
*/
|
|
241
224
|
generateEventId() {
|
|
242
225
|
return `event_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
243
226
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Select appropriate event type
|
|
246
|
-
*/
|
|
247
227
|
selectEventType(context) {
|
|
248
228
|
const types = [
|
|
249
229
|
'ADVENTURE', 'COMBAT', 'ECONOMIC', 'EXPLORATION', 'GUILD', 'MAGIC', 'MYSTERY',
|
|
250
230
|
'POLITICAL', 'QUEST', 'SOCIAL', 'SPELLCASTING', 'SUPERNATURAL', 'TECHNOLOGICAL', 'UNDERWORLD'
|
|
251
231
|
];
|
|
252
|
-
return this.
|
|
232
|
+
return this.rng.pickone(types);
|
|
253
233
|
}
|
|
254
|
-
/**
|
|
255
|
-
* Calculate event difficulty
|
|
256
|
-
*/
|
|
257
234
|
calculateDifficulty(context) {
|
|
258
235
|
const powerLevel = context.powerLevel || 50;
|
|
259
236
|
if (powerLevel <= 25)
|
|
@@ -264,16 +241,12 @@ class GeneratorCore {
|
|
|
264
241
|
return 'hard';
|
|
265
242
|
return 'legendary';
|
|
266
243
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Generate event title - SIMPLE LOOKUP
|
|
269
|
-
*/
|
|
270
244
|
generateTitle(type, context) {
|
|
271
|
-
// Check all available themes for custom titles, prioritizing 'default'
|
|
272
245
|
const themesToCheck = ['default', ...Object.keys(this.customTitles).filter(k => k !== 'default')];
|
|
273
246
|
for (const theme of themesToCheck) {
|
|
274
247
|
const customThemeTitles = this.customTitles[theme];
|
|
275
248
|
if (customThemeTitles && customThemeTitles[type] && customThemeTitles[type].length > 0) {
|
|
276
|
-
return this.
|
|
249
|
+
return this.rng.pickone(customThemeTitles[type]);
|
|
277
250
|
}
|
|
278
251
|
}
|
|
279
252
|
const titles = {
|
|
@@ -691,19 +664,14 @@ class GeneratorCore {
|
|
|
691
664
|
]
|
|
692
665
|
};
|
|
693
666
|
const typeTitles = titles[type] || ['Unexpected Event', 'Strange Occurrence', 'Curious Situation', 'Interesting Development'];
|
|
694
|
-
return this.
|
|
667
|
+
return this.rng.pickone(typeTitles);
|
|
695
668
|
}
|
|
696
|
-
/**
|
|
697
|
-
* Generate event description - SIMPLE AND RELIABLE
|
|
698
|
-
* Direct mapping from event type to meaningful descriptions
|
|
699
|
-
*/
|
|
700
669
|
generateDescription(title, type, context) {
|
|
701
|
-
// Check all available themes for custom descriptions, prioritizing 'default'
|
|
702
670
|
const themesToCheck = ['default', ...Object.keys(this.customDescriptions).filter(k => k !== 'default')];
|
|
703
671
|
for (const theme of themesToCheck) {
|
|
704
672
|
const customThemeDescriptions = this.customDescriptions[theme];
|
|
705
673
|
if (customThemeDescriptions && customThemeDescriptions[type] && customThemeDescriptions[type].length > 0) {
|
|
706
|
-
let description = this.
|
|
674
|
+
let description = this.rng.pickone(customThemeDescriptions[type]);
|
|
707
675
|
description = this.addContextualEnhancements(description, context);
|
|
708
676
|
description = description.trim();
|
|
709
677
|
if (!/[.!?]$/.test(description)) {
|
|
@@ -1346,7 +1314,7 @@ class GeneratorCore {
|
|
|
1346
1314
|
'You face circumstances that require decisive action.',
|
|
1347
1315
|
'A meaningful opportunity or challenge appears before you.'
|
|
1348
1316
|
];
|
|
1349
|
-
let description = this.
|
|
1317
|
+
let description = this.rng.pickone(typeDescriptions);
|
|
1350
1318
|
description = this.addContextualEnhancements(description, context);
|
|
1351
1319
|
description = description.trim();
|
|
1352
1320
|
if (!/[.!?]$/.test(description)) {
|
|
@@ -1354,18 +1322,14 @@ class GeneratorCore {
|
|
|
1354
1322
|
}
|
|
1355
1323
|
return description;
|
|
1356
1324
|
}
|
|
1357
|
-
/**
|
|
1358
|
-
* Generate event choices - SIMPLE VERSION
|
|
1359
|
-
*/
|
|
1360
1325
|
generateChoices(type, difficulty, context) {
|
|
1361
|
-
// Check all available themes for custom choices, prioritizing 'default'
|
|
1362
1326
|
const themesToCheck = ['default', ...Object.keys(this.customChoices).filter(k => k !== 'default')];
|
|
1363
1327
|
for (const theme of themesToCheck) {
|
|
1364
1328
|
const customThemeChoices = this.customChoices[theme];
|
|
1365
1329
|
if (customThemeChoices && customThemeChoices[type] && customThemeChoices[type].length > 0) {
|
|
1366
1330
|
const texts = customThemeChoices[type];
|
|
1367
1331
|
const choiceCount = Math.min(4, texts.length);
|
|
1368
|
-
const selectedTexts = this.
|
|
1332
|
+
const selectedTexts = this.rng.pickset(texts, choiceCount);
|
|
1369
1333
|
return selectedTexts.map((text, index) => ({
|
|
1370
1334
|
text,
|
|
1371
1335
|
effect: this.generateChoiceEffect(type, difficulty, index)
|
|
@@ -1820,7 +1784,7 @@ class GeneratorCore {
|
|
|
1820
1784
|
'Test security', 'Probe defenses', 'Check vulnerabilities', 'Assess weaknesses',
|
|
1821
1785
|
'Create diversion', 'Cause distraction', 'Generate confusion', 'Produce chaos',
|
|
1822
1786
|
'Escape pursuit', 'Evade capture', 'Shake followers', 'Lose tails',
|
|
1823
|
-
'Blend into crowd', 'Disappear in masses', '
|
|
1787
|
+
'Blend into crowd', 'Disappear in masses', 'Vanish in groups', 'Hide among people',
|
|
1824
1788
|
'Use terrain', 'Leverage environment', 'Exploit surroundings', 'Utilize landscape',
|
|
1825
1789
|
'Time action', 'Coordinate timing', 'Synchronize effort', 'Align execution',
|
|
1826
1790
|
'Adapt to situation', 'Adjust plan', 'Modify approach', 'Change strategy',
|
|
@@ -1935,27 +1899,21 @@ class GeneratorCore {
|
|
|
1935
1899
|
};
|
|
1936
1900
|
const texts = choiceTexts[type] || ['Accept', 'Decline', 'Investigate', 'Wait'];
|
|
1937
1901
|
const choiceCount = Math.min(4, texts.length);
|
|
1938
|
-
const selectedTexts = this.
|
|
1902
|
+
const selectedTexts = this.rng.pickset(texts, choiceCount);
|
|
1939
1903
|
return selectedTexts.map((text, index) => ({
|
|
1940
1904
|
text,
|
|
1941
1905
|
effect: this.generateChoiceEffect(type, difficulty, index)
|
|
1942
1906
|
}));
|
|
1943
1907
|
}
|
|
1944
|
-
/**
|
|
1945
|
-
* Generate effect for a choice
|
|
1946
|
-
*/
|
|
1947
1908
|
generateChoiceEffect(type, difficulty, index) {
|
|
1948
1909
|
const effects = [
|
|
1949
|
-
{ gold: this.
|
|
1950
|
-
{ health: this.
|
|
1951
|
-
{ experience: this.
|
|
1952
|
-
{ reputation: this.
|
|
1910
|
+
{ gold: this.rng.integer({ min: -10, max: 50 }) },
|
|
1911
|
+
{ health: this.rng.integer({ min: -5, max: 10 }) },
|
|
1912
|
+
{ experience: this.rng.integer({ min: 0, max: 20 }) },
|
|
1913
|
+
{ reputation: this.rng.integer({ min: -2, max: 5 }) }
|
|
1953
1914
|
];
|
|
1954
1915
|
return effects[index % effects.length] || {};
|
|
1955
1916
|
}
|
|
1956
|
-
/**
|
|
1957
|
-
* Generate tags
|
|
1958
|
-
*/
|
|
1959
1917
|
generateTags(type, context) {
|
|
1960
1918
|
const tags = [type.toLowerCase()];
|
|
1961
1919
|
if (context.wealthTier && context.wealthTier !== 'moderate') {
|