@wayward/types 2.15.0-beta.dev.20251003.1 → 2.15.0-beta.dev.20251005.1

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.
@@ -28,7 +28,7 @@ import { AutoSave } from "@wayward/game/game/meta/AutoSave";
28
28
  import { SaveLoad } from "@wayward/game/game/meta/SaveLoad";
29
29
  import type { Milestone } from "@wayward/game/game/milestones/IMilestone";
30
30
  import { MilestoneManager } from "@wayward/game/game/milestones/MilestoneManager";
31
- import type { IGameOptions } from "@wayward/game/game/options/IGameOptions";
31
+ import type { IGameOptions, IGameOptionsPartial } from "@wayward/game/game/options/IGameOptions";
32
32
  import { GameMode } from "@wayward/game/game/options/IGameOptions";
33
33
  import type { GameplayModifiersCollection } from "@wayward/game/game/options/modifiers/GameplayModifiersManager";
34
34
  import type { ChallengeModifiersCollection } from "@wayward/game/game/options/modifiers/challenge/ChallengeModifiers";
@@ -177,6 +177,8 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
177
177
  selectBiome(position: IVector2 | undefined, random: Random): BiomeTypes;
178
178
  getGameMode(): GameMode;
179
179
  getGameOptionsBeforeModifiers(): IGameOptions;
180
+ /** A game options modifier that always returns an empty array by default, to be injected into */
181
+ getAdditionalGameOptionsSources(): IGameOptionsPartial[];
180
182
  getGameOptions(): IGameOptions;
181
183
  uncacheGameOptions(): void;
182
184
  updateGameOptions(gameOptions: IGameOptions): void;
@@ -34,12 +34,6 @@ import type { IVector2, IVector3 } from "@wayward/game/utilities/math/IVector";
34
34
  import type { IBuildId } from "@wayward/hosts/shared/globalTypes";
35
35
  import type { IRange } from "@wayward/utilities/math/Range";
36
36
  export interface IGameEvents {
37
- /**
38
- * Called when game options are first processed, after modifiers are applied.
39
- *
40
- * You can use this combined with `game.uncacheGameOptions()` to dynamically modify game options.
41
- */
42
- getGameOptions(gameOptions: IGameOptions): IGameOptions;
43
37
  /**
44
38
  * Called when the game is starting
45
39
  * @param isLoadingSave True if a save game was loaded
@@ -8,16 +8,19 @@
8
8
  * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
- import type { CurseEventContext, CurseEventSubscriber } from "@wayward/game/game/curse/CurseEvent";
12
- import { CurseComponent, CurseEventType } from "@wayward/game/game/curse/ICurse";
11
+ import type { CurseEvent, CurseEventContext } from "@wayward/game/game/curse/CurseEvent";
12
+ import { CurseEventSubscriber } from "@wayward/game/game/curse/CurseEvent";
13
+ import { CurseCategory, CurseComponent, CurseEventDisplayMode, CurseEventType } from "@wayward/game/game/curse/ICurse";
13
14
  import type Human from "@wayward/game/game/entity/Human";
14
15
  import { SkillType } from "@wayward/game/game/entity/IHuman";
15
16
  import type Island from "@wayward/game/game/island/Island";
16
17
  import type { IVector2 } from "@wayward/game/utilities/math/IVector";
18
+ import { IRange } from "@wayward/utilities/math/Range";
17
19
  export declare const CURSE_WEIGHTS: PartialRecord<CurseComponent, number>;
18
20
  export declare const CURSE_ATTACK_MAX = 50;
19
21
  export declare const CURSE_DEFENSE_MAX = 100;
20
22
  export declare const CURSE_CRAFTING_MAX = 100;
23
+ export declare const CURSE_KILLING_MAX = 100;
21
24
  export declare const CURSE_SKILL_MAX = 100;
22
25
  export declare const CURSE_COMPONENTS: Record<CurseComponent, (human: Human) => number>;
23
26
  /**
@@ -44,26 +47,55 @@ export declare const CURSE_EVENTS_MAX = 5;
44
47
  */
45
48
  export declare const CURSE_EVENTS_MAELSTROM_SPEED = 1;
46
49
  /**
47
- * The maximum chance that a curse event will occur, given the opportunity. The chance scales up from 0% at 0% curse, to this value at 100% curse.
50
+ * The chance that a curse event will occur, given the opportunity.
51
+ * The chance scales up from the minimum (left) value at 0% curse, to the maximum (right) value at 100% curse.
48
52
  *
49
53
  * There can be up to CURSE_EVENTS_MAX opportunities per night, based on maelstrom level.
50
54
  * At 0-1 maelstrom, there are up to 2 opportunities per night. (Per player, because curse events are localised.)
51
55
  * Additional opportunities before the top opportunity always use the max chance.
52
56
  */
53
- export declare const CURSE_EVENTS_MAX_CHANCE = 0.5;
57
+ export declare const CURSE_EVENTS_CHANCE: IRange;
54
58
  export declare const CURSE_EVENTS_NEARBY_PLAYERS_RADIUS = 25;
59
+ /**
60
+ * For randomly selecting the cooldown time between curse event nights.
61
+ * Interpolates between the minimum and maximum values based on the player's curse — minimum at 0% curse, maximum at 100% curse.
62
+ */
63
+ export declare const CURSE_EVENTS_COOLDOWN_RANGE: {
64
+ minimum: IRange;
65
+ maximum: IRange;
66
+ };
55
67
  declare namespace Curse {
68
+ interface Helper {
69
+ context: CurseEventContext;
70
+ instance: CurseEventInstance;
71
+ definition: CurseEvent;
72
+ }
73
+ function get(island?: Island, type?: CurseEventType): Helper | undefined;
56
74
  function tickCurse(island: Island, humans: Human[]): void;
57
75
  function reload(island: Island): void;
58
76
  function spawnCurseEvents(island: Island, humans: Human[]): void;
59
- function attemptCurseEventSpawn(human: Human, curse: number, humans: Human[], events: CurseEventInstance[]): CurseEventInstance | undefined;
77
+ function attemptCurseEventSpawn(category: CurseCategory, human: Human, curse: number, humans: Human[], events: CurseEventInstance[]): CurseEventInstance | undefined;
60
78
  function attemptSpecificCurseEventSpawn(human: Human, type: CurseEventType, humans: Human[], curse?: number): CurseEventInstance | undefined;
61
79
  function cleanup(island: Island, humans?: Human[]): void;
62
- function createCurseEventContext(instance: CurseEventInstance, island: Island, humans: Human[], cursebearer?: Human): CurseEventContext;
80
+ function createCurseEventContext(instance: CurseEventInstance, island: Island, humans?: Human[], cursebearer?: Human): CurseEventContext;
63
81
  }
82
+ declare const SYMBOL_CURSE_EVENT_SUBSCRIBER_INSTANCES: unique symbol;
83
+ declare const SYMBOL_CURSE_EVENT_GLOBAL_SUBSCRIBER_INSTANCE: unique symbol;
64
84
  interface Curse {
65
- active?: true;
85
+ night?: true;
66
86
  events?: CurseEventInstance[];
87
+ cooldown?: number;
88
+ warned?: true;
89
+ [SYMBOL_CURSE_EVENT_GLOBAL_SUBSCRIBER_INSTANCE]?: CurseEventSubscriber;
90
+ }
91
+ interface CurseEventInstance {
92
+ type: CurseEventType;
93
+ display: CurseEventDisplayMode;
94
+ cursebearerIdentifier: string;
95
+ point: IVector2;
96
+ subscribers?: string[];
97
+ scriptProcesses?: ScriptProcessState[];
98
+ [SYMBOL_CURSE_EVENT_SUBSCRIBER_INSTANCES]?: Record<string, CurseEventSubscriber>;
67
99
  }
68
100
  interface ScriptProcessState {
69
101
  /** The path of keys/indices from the root of the script to the step this process is currently on. */
@@ -75,14 +107,4 @@ interface ScriptProcessState {
75
107
  /** The state of any child processes started by a "simultaneously" or "repeat" block. */
76
108
  childProcesses?: ScriptProcessState[];
77
109
  }
78
- declare const SYMBOL_CURSE_EVENT_SUBSCRIBER_INSTANCES: unique symbol;
79
- interface CurseEventInstance {
80
- type: CurseEventType;
81
- visible: boolean;
82
- cursebearerIdentifier: string;
83
- point: IVector2;
84
- subscribers?: string[];
85
- scriptProcesses?: ScriptProcessState[];
86
- [SYMBOL_CURSE_EVENT_SUBSCRIBER_INSTANCES]?: Record<string, CurseEventSubscriber>;
87
- }
88
110
  export default Curse;
@@ -9,13 +9,14 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type { BiomeType } from "@wayward/game/game/biome/IBiome";
12
- import type { CurseCategory, CurseEventType } from "@wayward/game/game/curse/ICurse";
12
+ import type { CurseGroup, CurseEventDisplayMode, CurseEventType, CurseCategory } from "@wayward/game/game/curse/ICurse";
13
13
  import type Human from "@wayward/game/game/entity/Human";
14
14
  import type Island from "@wayward/game/game/island/Island";
15
15
  import type { IGameOptionsPartial } from "@wayward/game/game/options/IGameOptions";
16
16
  import type { TimeString } from "@wayward/game/game/time/ITimeManager";
17
17
  import type { IVector2 } from "@wayward/game/utilities/math/IVector";
18
18
  import type { IRange } from "@wayward/utilities/math/Range";
19
+ /** The API that curse events have access to */
19
20
  export interface CurseEventContext {
20
21
  readonly island: Island;
21
22
  readonly point: IVector2;
@@ -28,21 +29,13 @@ export interface CurseEventContext {
28
29
  * This class *must* be included in `CurseEvent.subscribers`.
29
30
  */
30
31
  inject<T extends CurseEventSubscriber>(subscriber: Class<T>): void;
31
- setVisible(visible: boolean): void;
32
+ setDisplay(mode: CurseEventDisplayMode): void;
32
33
  uninject(): void;
33
34
  uninject<T extends CurseEventSubscriber>(subscriber: Class<T>): void;
34
35
  toString(): string;
35
36
  }
36
- /**
37
- * A base class for subscribing to game events & applying game options during a curse event.
38
- * Note that renaming this class will result in it no longer being subscribed for a curse event, if it was before.
39
- */
40
- export declare abstract class CurseEventSubscriber {
41
- protected readonly event: CurseEventContext;
42
- constructor(event: CurseEventContext);
43
- protected getOptions?(): IGameOptionsPartial;
44
- }
45
37
  export interface CurseEvent {
38
+ group: CurseGroup;
46
39
  category: CurseCategory;
47
40
  /** A number 0-1 representing the curse level that the randomly selected player must have in order for this curse event to be chosen */
48
41
  requiredCurseLevel?: number;
@@ -53,6 +46,7 @@ export interface CurseEvent {
53
46
  /** If one event is marked as conflicting with another, they will both have the conflict registered. */
54
47
  conflicts?: CurseEventType[];
55
48
  requiredPredicate?(context: CurseEventContext): boolean;
49
+ getOptions?(): IGameOptionsPartial;
56
50
  subscribers?: Array<Class<CurseEventSubscriber>>;
57
51
  onStart?(context: CurseEventContext): void;
58
52
  onEnd?(context: CurseEventContext): void;
@@ -109,3 +103,13 @@ export declare namespace CurseEventScript {
109
103
  export type Step = Wait | Action | Repeat | Simultaneously;
110
104
  export {};
111
105
  }
106
+ /**
107
+ * A base class for subscribing to game events & applying game options during a curse event.
108
+ * Note that renaming this class will result in it no longer being subscribed for a curse event, if it was before.
109
+ */
110
+ export declare abstract class CurseEventSubscriber {
111
+ protected readonly event: CurseEventContext;
112
+ constructor(event: CurseEventContext);
113
+ protected getOptions?(): IGameOptionsPartial;
114
+ private getAdditionalGameOptionsSources;
115
+ }
@@ -30,20 +30,44 @@ export declare enum CurseEventType {
30
30
  FrigidNight = 18,
31
31
  HeatWave = 19
32
32
  }
33
- export declare enum CurseCategory {
33
+ export declare enum CurseGroup {
34
34
  Lucky = 0,
35
35
  Neutral = 1,
36
36
  Unlucky = 2
37
37
  }
38
+ export declare enum CurseCategory {
39
+ /**
40
+ * Primary curses are the main ones that players should be responding to.
41
+ */
42
+ Primary = 0,
43
+ /**
44
+ * Secondary curses are ones that interact with the primary curses in interesting ways.
45
+ *
46
+ * Secondary curses are selected before primary curses.
47
+ */
48
+ Secondary = 1,
49
+ /**
50
+ * Dependent curses are secondary curses that can ONLY be selected if a specific primary curse is also selected.
51
+ *
52
+ * They're still selected before primary curses, but will be cancelled if no primary curse is selected.
53
+ */
54
+ Dependent = 2
55
+ }
38
56
  export declare enum CurseComponent {
39
57
  Skill = 0,
40
58
  HighestAttack = 1,
41
59
  HighestDefense = 2,
42
60
  CumulativeEvilCrafting = 3,
43
61
  Equipment = 4,
44
- Modifier = 5
62
+ Modifier = 5,
63
+ CumulativeKilling = 6
45
64
  }
46
65
  export declare enum CurseSystemDiscovery {
47
66
  CurseFactors = 0,
48
67
  CurseFactorsExact = 1
49
68
  }
69
+ export declare enum CurseEventDisplayMode {
70
+ Hidden = 0,
71
+ Mystery = 1,
72
+ Revealed = 2
73
+ }
@@ -46,7 +46,7 @@ import ItemReference from "@wayward/game/game/item/ItemReference";
46
46
  import MagicalPropertyType from "@wayward/game/game/magic/MagicalPropertyType";
47
47
  import { Milestone } from "@wayward/game/game/milestones/IMilestone";
48
48
  import Runekeeper from "@wayward/game/game/milestones/milestone/Runekeeper";
49
- import type { IGameOptionsPlayer } from "@wayward/game/game/options/IGameOptions";
49
+ import type { IGameOptionsPartial, IGameOptionsPlayer } from "@wayward/game/game/options/IGameOptions";
50
50
  import type { Reference, ReferenceType } from "@wayward/game/game/reference/IReferenceManager";
51
51
  import type { IHasInsulation } from "@wayward/game/game/temperature/ITemperature";
52
52
  import { TempType } from "@wayward/game/game/temperature/ITemperature";
@@ -130,6 +130,7 @@ export default abstract class Human<DescriptionType = unknown, TypeType extends
130
130
  highestAttack?: number;
131
131
  highestDefense?: number;
132
132
  cumulativeEvilCrafting: number;
133
+ cumulativeKilling: number;
133
134
  itemDiscovered: ItemType[];
134
135
  /** @deprecated (use the entity itself) */
135
136
  readonly inventory: IContainer;
@@ -182,8 +183,11 @@ export default abstract class Human<DescriptionType = unknown, TypeType extends
182
183
  */
183
184
  get lastAttackedByEntityHuman(): Human | undefined;
184
185
  getDefense(): PlayerDefense;
186
+ /** A game options modifier that always returns an empty array by default, to be injected into */
187
+ getAdditionalGameOptionsSources(): IGameOptionsPartial[];
185
188
  getGameOptionsBeforeModifiers(): ImmutableObject<IGameOptionsPlayer>;
186
189
  getGameOptions(): ImmutableObject<IGameOptionsPlayer>;
190
+ clearGameOptionsCache(): void;
187
191
  setOptions(options: IOptions): void;
188
192
  getEquipEffect<E extends EquipEffect>(type: E): FirstIfOne<EquipEffectByType<E>>;
189
193
  /**
@@ -97,6 +97,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
97
97
  biomeOptions?: unknown;
98
98
  biomeType: BiomeTypes;
99
99
  contaminatedWater: IWaterContamination[];
100
+ curse: Curse;
100
101
  lastPlayerGameTimeTicks?: number;
101
102
  loadCount: number;
102
103
  name?: string;
@@ -106,7 +107,6 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
106
107
  readonly wellData: SaferNumberIndexedObject<IWell>;
107
108
  referenceId?: number;
108
109
  tileContainers: ITileContainer[];
109
- curse: Curse;
110
110
  tileData: SaferNumberIndexedObject<SaferNumberIndexedObject<SaferNumberIndexedObject<ITileData[]>>>;
111
111
  readonly seeds: ISeeds;
112
112
  get mapGenVersionInfo(): Version.Info;
@@ -174,9 +174,11 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
174
174
  */
175
175
  private deactivate;
176
176
  private gameOptionsCached?;
177
+ private gameOptionsWithoutModifiersCached?;
177
178
  /** A game options modifier that always returns an empty array by default, to be injected into */
178
179
  getAdditionalGameOptionsSources(): IGameOptionsPartial[];
179
180
  getGameOptions(): ImmutableObject<IGameOptions>;
181
+ getGameOptionsWithoutModifiers(): ImmutableObject<IGameOptions>;
180
182
  clearGameOptionsCache(): void;
181
183
  rename(human: Human, newName: string): void;
182
184
  private generatedName?;
@@ -24,7 +24,7 @@ import type { IGameOptionsPartial, IGameOptionsStatus } from "@wayward/game/game
24
24
  import MilestoneModifier, { MilestoneModifierInstance } from "@wayward/game/game/options/modifiers/milestone/MilestoneModifier";
25
25
  import { MilestoneModifierGroup } from "@wayward/game/game/options/modifiers/milestone/IMilestoneModifier";
26
26
  import type { TranslationArg } from "@wayward/game/language/ITranslation";
27
- import type { IInjectionApi } from "@wayward/utilities/class/Inject";
27
+ import type { IInjectionApi } from "@wayward/game/utilities/Inject";
28
28
  export default class Exsanguinated extends MilestoneModifier {
29
29
  getOptions(): IGameOptionsPartial;
30
30
  getTranslationArgs(): TranslationArg[] | undefined;
@@ -34,7 +34,7 @@ declare enum Dictionary {
34
34
  Creature = 22,
35
35
  CurseComponent = 23,
36
36
  CurseEvent = 24,
37
- CurseEventCategory = 25,
37
+ CurseEventGroup = 25,
38
38
  DamageType = 26,
39
39
  Deity = 27,
40
40
  DeitySymbol = 28,
@@ -11,7 +11,7 @@
11
11
  import { Command } from "@wayward/game/command/ICommand";
12
12
  import { Quality } from "@wayward/game/game/IObject";
13
13
  import { BiomeType } from "@wayward/game/game/biome/IBiome";
14
- import { CurseCategory, CurseComponent, CurseEventType } from "@wayward/game/game/curse/ICurse";
14
+ import { CurseGroup, CurseComponent, CurseEventType } from "@wayward/game/game/curse/ICurse";
15
15
  import Deity from "@wayward/game/game/deity/Deity";
16
16
  import { DoodadType, DoodadTypeExtra, DoodadTypeGroup, GrowingStage } from "@wayward/game/game/doodad/IDoodad";
17
17
  import { CombatDangerLevel } from "@wayward/game/game/entity/ICombatStrength";
@@ -125,7 +125,7 @@ declare const dictionaryMap: {
125
125
  22: typeof CreatureType;
126
126
  23: typeof CurseComponent;
127
127
  24: typeof CurseEventType;
128
- 25: typeof CurseCategory;
128
+ 25: typeof CurseGroup;
129
129
  26: typeof DamageType;
130
130
  27: typeof Deity;
131
131
  28: typeof Deity;
@@ -1959,7 +1959,7 @@ export declare const strictDictionaries: {
1959
1959
  22: typeof CreatureType;
1960
1960
  23: typeof CurseComponent;
1961
1961
  24: typeof CurseEventType;
1962
- 25: typeof CurseCategory;
1962
+ 25: typeof CurseGroup;
1963
1963
  26: typeof DamageType;
1964
1964
  27: typeof Deity;
1965
1965
  28: typeof Deity;