@rpgjs/server 5.0.0-alpha.2 → 5.0.0-alpha.21
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/Gui/DialogGui.d.ts +4 -0
- package/dist/Gui/index.d.ts +1 -0
- package/dist/Player/BattleManager.d.ts +32 -22
- package/dist/Player/ClassManager.d.ts +31 -18
- package/dist/Player/ComponentManager.d.ts +123 -0
- package/dist/Player/Components.d.ts +345 -0
- package/dist/Player/EffectManager.d.ts +40 -0
- package/dist/Player/ElementManager.d.ts +31 -0
- package/dist/Player/GoldManager.d.ts +22 -0
- package/dist/Player/GuiManager.d.ts +176 -0
- package/dist/Player/ItemFixture.d.ts +6 -0
- package/dist/Player/ItemManager.d.ts +164 -10
- package/dist/Player/MoveManager.d.ts +32 -44
- package/dist/Player/ParameterManager.d.ts +343 -14
- package/dist/Player/Player.d.ts +266 -8
- package/dist/Player/SkillManager.d.ts +27 -19
- package/dist/Player/StateManager.d.ts +28 -35
- package/dist/Player/VariableManager.d.ts +30 -0
- package/dist/RpgServer.d.ts +227 -1
- package/dist/decorators/event.d.ts +46 -0
- package/dist/decorators/map.d.ts +177 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +17472 -18167
- package/dist/index.js.map +1 -1
- package/dist/rooms/map.d.ts +486 -8
- package/package.json +17 -15
- package/src/Gui/DialogGui.ts +7 -2
- package/src/Gui/index.ts +3 -1
- package/src/Player/BattleManager.ts +97 -38
- package/src/Player/ClassManager.ts +95 -35
- package/src/Player/ComponentManager.ts +425 -19
- package/src/Player/Components.ts +380 -0
- package/src/Player/EffectManager.ts +110 -27
- package/src/Player/ElementManager.ts +126 -25
- package/src/Player/GoldManager.ts +32 -35
- package/src/Player/GuiManager.ts +187 -140
- package/src/Player/ItemFixture.ts +4 -5
- package/src/Player/ItemManager.ts +363 -48
- package/src/Player/MoveManager.ts +323 -308
- package/src/Player/ParameterManager.ts +499 -99
- package/src/Player/Player.ts +719 -80
- package/src/Player/SkillManager.ts +44 -23
- package/src/Player/StateManager.ts +210 -95
- package/src/Player/VariableManager.ts +180 -48
- package/src/RpgServer.ts +236 -1
- package/src/core/context.ts +1 -0
- package/src/decorators/event.ts +61 -0
- package/src/decorators/map.ts +198 -0
- package/src/index.ts +7 -1
- package/src/module.ts +24 -0
- package/src/rooms/map.ts +1054 -54
- package/dist/Player/Event.d.ts +0 -0
- package/src/Player/Event.ts +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { RpgPlayer } from './Player';
|
|
2
|
+
import { Gui } from '../Gui';
|
|
3
|
+
import { DialogOptions, Choice } from '../Gui/DialogGui';
|
|
4
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
5
|
+
/**
|
|
6
|
+
* GUI Manager Mixin
|
|
7
|
+
*
|
|
8
|
+
* Provides graphical user interface management capabilities to any class. This mixin handles
|
|
9
|
+
* dialog boxes, menus, notifications, shops, and custom GUI components. It manages the
|
|
10
|
+
* complete GUI system including opening, closing, and data passing between client and server.
|
|
11
|
+
*
|
|
12
|
+
* @param Base - The base class to extend with GUI management
|
|
13
|
+
* @returns Extended class with GUI management methods
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* class MyPlayer extends WithGuiManager(BasePlayer) {
|
|
18
|
+
* constructor() {
|
|
19
|
+
* super();
|
|
20
|
+
* // GUI system is automatically initialized
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* const player = new MyPlayer();
|
|
25
|
+
* await player.showText('Hello World!');
|
|
26
|
+
* player.callMainMenu();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function WithGuiManager<TBase extends PlayerCtor>(Base: TBase): new (...args: ConstructorParameters<TBase>) => InstanceType<TBase> & IGuiManager;
|
|
30
|
+
/**
|
|
31
|
+
* Interface for GUI management capabilities
|
|
32
|
+
* Defines the methods that will be available on the player
|
|
33
|
+
*/
|
|
34
|
+
export interface IGuiManager {
|
|
35
|
+
/**
|
|
36
|
+
* Show a text. This is a graphical interface already built. Opens the GUI named `rpg-dialog`
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* player.showText('Hello World')
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* The method returns a promise. It is resolved when the dialog box is closed.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* await player.showText('Hello World')
|
|
46
|
+
* // dialog box is closed, then ...
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* **Option: position**
|
|
50
|
+
*
|
|
51
|
+
* You can define how the dialog box is displayed:
|
|
52
|
+
* - top
|
|
53
|
+
* - middle
|
|
54
|
+
* - bottom
|
|
55
|
+
*
|
|
56
|
+
* (bottom by default)
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* player.showText('Hello World', {
|
|
60
|
+
* position: 'top'
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* **Option: fullWidth**
|
|
65
|
+
*
|
|
66
|
+
* `boolean` (true by default)
|
|
67
|
+
*
|
|
68
|
+
* Indicate that the dialog box will take the full width of the screen.
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* player.showText('Hello World', {
|
|
72
|
+
* fullWidth: true
|
|
73
|
+
* })
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* **Option: autoClose**
|
|
77
|
+
*
|
|
78
|
+
* `boolean` (false by default)
|
|
79
|
+
*
|
|
80
|
+
* If false, the user will have to press Enter to close the dialog box.
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* player.showText('Hello World', {
|
|
84
|
+
* autoClose: true
|
|
85
|
+
* })
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* **Option: typewriterEffect**
|
|
89
|
+
*
|
|
90
|
+
* `boolean` (true by default)
|
|
91
|
+
*
|
|
92
|
+
* Performs a typewriter effect
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* player.showText('Hello World', {
|
|
96
|
+
* typewriterEffect: false
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* **Option: talkWith**
|
|
101
|
+
*
|
|
102
|
+
* `RpgPlayer` (nothing by default)
|
|
103
|
+
*
|
|
104
|
+
* If you specify the event or another player, the other player will stop his or her movement and look in the player's direction.
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* // Code in an event
|
|
108
|
+
* player.showText('Hello World', {
|
|
109
|
+
* talkWith: this
|
|
110
|
+
* })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @title Show Text
|
|
114
|
+
* @method player.showText(text,options)
|
|
115
|
+
* @param {string} text
|
|
116
|
+
* @param {object} [options] the different options, see usage below
|
|
117
|
+
* @returns {Promise}
|
|
118
|
+
* @memberof GuiManager
|
|
119
|
+
*/
|
|
120
|
+
showText(msg: string, options?: DialogOptions): Promise<any>;
|
|
121
|
+
/**
|
|
122
|
+
* Shows a dialog box with a choice. Opens the GUI named `rpg-dialog`
|
|
123
|
+
*
|
|
124
|
+
* ```ts
|
|
125
|
+
* const choice = await player.showChoices('What color do you prefer?', [
|
|
126
|
+
* { text: 'Black', value: 'black' },
|
|
127
|
+
* { text: 'Rather the blue', value: 'blue' },
|
|
128
|
+
* { text: 'I don\'t have a preference!', value: 'none' }
|
|
129
|
+
* ])
|
|
130
|
+
*
|
|
131
|
+
* // If the player selects the first
|
|
132
|
+
* console.log(choice) // { text: 'Black', value: 'black' }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @title Show Choices
|
|
136
|
+
* @method player.showChoices(text,choices)
|
|
137
|
+
* @param {string} text
|
|
138
|
+
* @param {Array<{ text: string, value: any }>} choices
|
|
139
|
+
* @param {object} [options] Same options as the openDialog method
|
|
140
|
+
* @returns {Promise<Choice | null>}
|
|
141
|
+
* @memberof GuiManager
|
|
142
|
+
*/
|
|
143
|
+
showChoices(msg: string, choices: Choice[], options?: DialogOptions): Promise<Choice | null>;
|
|
144
|
+
/**
|
|
145
|
+
* Displays a notification . Opens the GUI named `rpg-notification`
|
|
146
|
+
*
|
|
147
|
+
* @title Displays a notification
|
|
148
|
+
* @method player.showNotification()
|
|
149
|
+
* @param {string} message - The message to display in the notification
|
|
150
|
+
* @param {object} options - An object containing options for the notification
|
|
151
|
+
* @param {number} options.time - The time to display the notification for (in ms). Default: 2000ms
|
|
152
|
+
* @param {string} options.icon - The icon to display in the notification. Put the identifier of the spritesheet (defined on the client side)
|
|
153
|
+
* @param {string} options.sound - The sound to play when the notification is shown. Set the sound ID (defined on the client side)
|
|
154
|
+
* @returns {void}
|
|
155
|
+
* @memberof GuiManager
|
|
156
|
+
*/
|
|
157
|
+
showNotification(message: string, options?: {
|
|
158
|
+
time?: number;
|
|
159
|
+
icon?: string;
|
|
160
|
+
sound?: string;
|
|
161
|
+
}): Promise<any>;
|
|
162
|
+
/**
|
|
163
|
+
* Calls main menu. Opens the GUI named `rpg-main-menu`
|
|
164
|
+
*
|
|
165
|
+
* @title Call Main Menu
|
|
166
|
+
* @method player.callMainMenu()
|
|
167
|
+
* @returns {void}
|
|
168
|
+
* @memberof GuiManager
|
|
169
|
+
*/
|
|
170
|
+
callMainMenu(): void;
|
|
171
|
+
callShop(items: any[]): void;
|
|
172
|
+
gui(guiId: string): Gui;
|
|
173
|
+
removeGui(guiId: string, data?: any): void;
|
|
174
|
+
showAttachedGui(players?: RpgPlayer[] | RpgPlayer): void;
|
|
175
|
+
hideAttachedGui(players?: RpgPlayer[] | RpgPlayer): void;
|
|
176
|
+
}
|
|
@@ -1,17 +1,171 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
import { RpgPlayer } from './Player';
|
|
3
3
|
/**
|
|
4
|
-
* Interface defining
|
|
4
|
+
* Interface defining the hooks that can be implemented on item classes or objects
|
|
5
|
+
*
|
|
6
|
+
* These hooks are called at specific moments during the item lifecycle:
|
|
7
|
+
* - `onAdd`: When the item is added to the player's inventory
|
|
8
|
+
* - `onUse`: When the item is successfully used
|
|
9
|
+
* - `onUseFailed`: When the item usage fails (e.g., chance roll failed)
|
|
10
|
+
* - `onRemove`: When the item is removed from the inventory
|
|
11
|
+
* - `onEquip`: When the item is equipped or unequipped
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const itemHooks: ItemHooks = {
|
|
16
|
+
* onAdd(player) {
|
|
17
|
+
* console.log('Item added to inventory');
|
|
18
|
+
* },
|
|
19
|
+
* onUse(player) {
|
|
20
|
+
* player.hp += 100;
|
|
21
|
+
* }
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface ItemHooks {
|
|
26
|
+
/**
|
|
27
|
+
* Called when the item is added to the player's inventory
|
|
28
|
+
*
|
|
29
|
+
* @param player - The player receiving the item
|
|
30
|
+
*/
|
|
31
|
+
onAdd?: (player: RpgPlayer) => void | Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Called when the item is successfully used
|
|
34
|
+
*
|
|
35
|
+
* @param player - The player using the item
|
|
36
|
+
*/
|
|
37
|
+
onUse?: (player: RpgPlayer) => void | Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Called when the item usage fails (e.g., chance roll failed)
|
|
40
|
+
*
|
|
41
|
+
* @param player - The player attempting to use the item
|
|
42
|
+
*/
|
|
43
|
+
onUseFailed?: (player: RpgPlayer) => void | Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Called when the item is removed from the inventory
|
|
46
|
+
*
|
|
47
|
+
* @param player - The player losing the item
|
|
48
|
+
*/
|
|
49
|
+
onRemove?: (player: RpgPlayer) => void | Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Called when the item is equipped or unequipped
|
|
52
|
+
*
|
|
53
|
+
* @param player - The player equipping/unequipping the item
|
|
54
|
+
* @param equip - true if equipping, false if unequipping
|
|
55
|
+
*/
|
|
56
|
+
onEquip?: (player: RpgPlayer, equip: boolean) => void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Base properties that can be included in an item object
|
|
60
|
+
*
|
|
61
|
+
* This interface defines the common properties that items can have.
|
|
62
|
+
* Use this as a base and extend it with specific item types.
|
|
63
|
+
*
|
|
64
|
+
* @template T - Additional properties specific to the item type
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* interface PotionData extends ItemData {
|
|
69
|
+
* hpValue: number;
|
|
70
|
+
* mpValue: number;
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* const potion: ItemObject<PotionData> = {
|
|
74
|
+
* name: 'Health Potion',
|
|
75
|
+
* description: 'Restores 100 HP',
|
|
76
|
+
* price: 200,
|
|
77
|
+
* hpValue: 100,
|
|
78
|
+
* mpValue: 0,
|
|
79
|
+
* onUse(player) {
|
|
80
|
+
* player.hp += this.hpValue;
|
|
81
|
+
* }
|
|
82
|
+
* };
|
|
83
|
+
* ```
|
|
5
84
|
*/
|
|
6
|
-
export interface
|
|
7
|
-
|
|
85
|
+
export interface ItemData {
|
|
86
|
+
/** Item name */
|
|
87
|
+
name?: string;
|
|
88
|
+
/** Item description */
|
|
89
|
+
description?: string;
|
|
90
|
+
/** Item price */
|
|
91
|
+
price?: number;
|
|
92
|
+
/** HP value restored when used */
|
|
93
|
+
hpValue?: number;
|
|
94
|
+
/** MP/SP value restored when used */
|
|
95
|
+
mpValue?: number;
|
|
96
|
+
/** Chance to successfully use the item (0-1) */
|
|
97
|
+
hitRate?: number;
|
|
98
|
+
/** Whether the item is consumable */
|
|
99
|
+
consumable?: boolean;
|
|
100
|
+
/** States to add when used */
|
|
101
|
+
addStates?: any[];
|
|
102
|
+
/** States to remove when used */
|
|
103
|
+
removeStates?: any[];
|
|
104
|
+
/** Elemental properties */
|
|
105
|
+
elements?: any[];
|
|
106
|
+
/** Parameter modifiers */
|
|
107
|
+
paramsModifier?: Record<string, any>;
|
|
108
|
+
/** Item type (for equipment validation) */
|
|
109
|
+
_type?: 'item' | 'weapon' | 'armor';
|
|
8
110
|
}
|
|
9
111
|
/**
|
|
10
|
-
*
|
|
112
|
+
* Item object type that combines data properties with hooks
|
|
113
|
+
*
|
|
114
|
+
* This type allows you to create item objects directly without needing a class.
|
|
115
|
+
* The object can contain both item data properties and lifecycle hooks.
|
|
11
116
|
*
|
|
12
|
-
*
|
|
117
|
+
* @template T - Additional properties specific to the item type (extends ItemData)
|
|
13
118
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const potion: ItemObject = {
|
|
122
|
+
* name: 'Health Potion',
|
|
123
|
+
* description: 'Restores 100 HP',
|
|
124
|
+
* price: 200,
|
|
125
|
+
* hpValue: 100,
|
|
126
|
+
* consumable: true,
|
|
127
|
+
* onAdd(player) {
|
|
128
|
+
* console.log('Potion added!');
|
|
129
|
+
* },
|
|
130
|
+
* onUse(player) {
|
|
131
|
+
* player.hp += 100;
|
|
132
|
+
* }
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* player.addItem(potion);
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export type ItemObject<T extends ItemData = ItemData> = T & ItemHooks & {
|
|
139
|
+
/** Item identifier (required if not using class or string) */
|
|
140
|
+
id?: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Item Manager Mixin
|
|
144
|
+
*
|
|
145
|
+
* Provides comprehensive item management capabilities to any class. This mixin handles
|
|
146
|
+
* inventory management, item usage, equipment, buying/selling, and item effects.
|
|
147
|
+
* It manages the complete item system including restrictions, transactions, and equipment.
|
|
148
|
+
*
|
|
149
|
+
* @param Base - The base class to extend with item management
|
|
150
|
+
* @returns Extended class with item management methods
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* class MyPlayer extends WithItemManager(BasePlayer) {
|
|
155
|
+
* constructor() {
|
|
156
|
+
* super();
|
|
157
|
+
* // Item system is automatically initialized
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
*
|
|
161
|
+
* const player = new MyPlayer();
|
|
162
|
+
* player.addItem('potion', 5);
|
|
163
|
+
* player.useItem('potion');
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare function WithItemManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
167
|
+
/**
|
|
168
|
+
* Type helper to extract the interface from the WithItemManager mixin
|
|
169
|
+
* This provides the type without duplicating method signatures
|
|
16
170
|
*/
|
|
17
|
-
export
|
|
171
|
+
export type IItemManager = InstanceType<ReturnType<typeof WithItemManager>>;
|
|
@@ -1,48 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlayerCtor, Direction } from '@rpgjs/common';
|
|
2
2
|
import { RpgPlayer } from './Player';
|
|
3
|
-
export interface IMoveManager {
|
|
4
|
-
addMovement(strategy: MovementStrategy): void;
|
|
5
|
-
removeMovement(strategy: MovementStrategy): boolean;
|
|
6
|
-
clearMovements(): void;
|
|
7
|
-
hasActiveMovements(): boolean;
|
|
8
|
-
getActiveMovements(): MovementStrategy[];
|
|
9
|
-
moveTo(target: RpgCommonPlayer | {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
}): void;
|
|
13
|
-
stopMoveTo(): void;
|
|
14
|
-
dash(direction: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
}, speed?: number, duration?: number): void;
|
|
18
|
-
knockback(direction: {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
}, force?: number, duration?: number): void;
|
|
22
|
-
followPath(waypoints: Array<{
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
}>, speed?: number, loop?: boolean): void;
|
|
26
|
-
oscillate(direction: {
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
}, amplitude?: number, period?: number): void;
|
|
30
|
-
applyIceMovement(direction: {
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
}, maxSpeed?: number): void;
|
|
34
|
-
shootProjectile(type: ProjectileType, direction: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
}, speed?: number): void;
|
|
38
|
-
moveRoutes(routes: Routes): Promise<boolean>;
|
|
39
|
-
infiniteMoveRoute(routes: Routes): void;
|
|
40
|
-
breakRoutes(force?: boolean): void;
|
|
41
|
-
replayRoutes(): void;
|
|
42
|
-
}
|
|
43
3
|
type CallbackTileMove = (player: RpgPlayer, map: any) => Direction[];
|
|
44
4
|
type CallbackTurnMove = (player: RpgPlayer, map: any) => string;
|
|
45
|
-
type Routes = (string | Promise<any> | Direction | Direction[] | Function)[];
|
|
46
5
|
export declare enum Frequency {
|
|
47
6
|
Lowest = 600,
|
|
48
7
|
Lower = 400,
|
|
@@ -129,7 +88,7 @@ export declare const Move: MoveList;
|
|
|
129
88
|
* - **Strategy Management**: Add, remove, and query movement strategies
|
|
130
89
|
* - **Predefined Movements**: Quick access to common movement patterns
|
|
131
90
|
* - **Composite Movements**: Combine multiple strategies
|
|
132
|
-
* - **Physics Integration**: Seamless integration with
|
|
91
|
+
* - **Physics Integration**: Seamless integration with the deterministic @rpgjs/physic engine
|
|
133
92
|
*
|
|
134
93
|
* ## Available Movement Strategies
|
|
135
94
|
* - `LinearMove`: Constant velocity movement
|
|
@@ -173,5 +132,34 @@ export declare const Move: MoveList;
|
|
|
173
132
|
* }
|
|
174
133
|
* ```
|
|
175
134
|
*/
|
|
176
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Move Manager Mixin
|
|
137
|
+
*
|
|
138
|
+
* Provides comprehensive movement management capabilities to any class. This mixin handles
|
|
139
|
+
* various types of movement including pathfinding, physics-based movement, route following,
|
|
140
|
+
* and advanced movement strategies like dashing, knockback, and projectile movement.
|
|
141
|
+
*
|
|
142
|
+
* @param Base - The base class to extend with movement management
|
|
143
|
+
* @returns Extended class with movement management methods
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* class MyPlayer extends WithMoveManager(BasePlayer) {
|
|
148
|
+
* constructor() {
|
|
149
|
+
* super();
|
|
150
|
+
* this.frequency = Frequency.High;
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
*
|
|
154
|
+
* const player = new MyPlayer();
|
|
155
|
+
* player.moveTo({ x: 100, y: 100 });
|
|
156
|
+
* player.dash({ x: 1, y: 0 }, 8, 200);
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare function WithMoveManager<TBase extends PlayerCtor>(Base: TBase): PlayerCtor;
|
|
160
|
+
/**
|
|
161
|
+
* Type helper to extract the interface from the WithMoveManager mixin
|
|
162
|
+
* This provides the type without duplicating method signatures
|
|
163
|
+
*/
|
|
164
|
+
export type IMoveManager = InstanceType<ReturnType<typeof WithMoveManager>>;
|
|
177
165
|
export {};
|