@rpgjs/server 5.0.0-alpha.5 → 5.0.0-alpha.7
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/Player/BattleManager.d.ts +32 -22
- package/dist/Player/ClassManager.d.ts +31 -18
- package/dist/Player/ComponentManager.d.ts +30 -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 +31 -0
- package/dist/Player/ItemFixture.d.ts +6 -0
- package/dist/Player/ItemManager.d.ts +27 -13
- package/dist/Player/MoveManager.d.ts +31 -43
- package/dist/Player/ParameterManager.d.ts +27 -19
- package/dist/Player/Player.d.ts +43 -6
- 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/index.js +984 -536
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Player/BattleManager.ts +97 -38
- package/src/Player/ClassManager.ts +95 -35
- package/src/Player/ComponentManager.ts +63 -21
- 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 +36 -13
- package/src/Player/ItemFixture.ts +4 -5
- package/src/Player/ItemManager.ts +39 -26
- package/src/Player/MoveManager.ts +40 -31
- package/src/Player/ParameterManager.ts +35 -25
- package/src/Player/Player.ts +75 -35
- package/src/Player/SkillManager.ts +44 -23
- package/src/Player/StateManager.ts +210 -95
- package/src/Player/VariableManager.ts +180 -48
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Battle Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides battle management capabilities to any class. This mixin handles
|
|
6
|
+
* damage calculation, critical hits, elemental vulnerabilities, and guard effects.
|
|
7
|
+
* It implements a comprehensive battle system with customizable formulas and effects.
|
|
8
|
+
*
|
|
9
|
+
* @param Base - The base class to extend with battle management
|
|
10
|
+
* @returns Extended class with battle management methods
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithBattleManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* // Battle system is automatically initialized
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* const attacker = new MyPlayer();
|
|
23
|
+
* const result = player.applyDamage(attacker);
|
|
24
|
+
* console.log(`Damage dealt: ${result.damage}`);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function WithBattleManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
28
|
+
/**
|
|
29
|
+
* Type helper to extract the interface from the WithBattleManager mixin
|
|
30
|
+
* This provides the type without duplicating method signatures
|
|
31
|
+
*/
|
|
32
|
+
export type IBattleManager = InstanceType<ReturnType<typeof WithBattleManager>>;
|
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Class Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides class and actor management capabilities to any class. This mixin handles
|
|
6
|
+
* character class assignment and actor setup, including automatic parameter configuration,
|
|
7
|
+
* starting equipment, and skill progression based on class definitions.
|
|
8
|
+
*
|
|
9
|
+
* @param Base - The base class to extend with class management
|
|
10
|
+
* @returns Extended class with class management methods
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithClassManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* // Class system is automatically initialized
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* player.setClass(Fighter);
|
|
23
|
+
* player.setActor(Hero);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function WithClassManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
27
|
+
/**
|
|
28
|
+
* Type helper to extract the interface from the WithClassManager mixin
|
|
29
|
+
* This provides the type without duplicating method signatures
|
|
30
|
+
*/
|
|
31
|
+
export type IClassManager = InstanceType<ReturnType<typeof WithClassManager>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Component Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides graphic management capabilities to any class. This mixin allows
|
|
6
|
+
* setting single or multiple graphics for player representation, enabling
|
|
7
|
+
* dynamic visual changes and animation sequences.
|
|
8
|
+
*
|
|
9
|
+
* @param Base - The base class to extend with component management
|
|
10
|
+
* @returns Extended class with component management methods
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithComponentManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* this.setGraphic("hero");
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* player.setGraphic(["hero_idle", "hero_walk"]);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function WithComponentManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
26
|
+
/**
|
|
27
|
+
* Type helper to extract the interface from the WithComponentManager mixin
|
|
28
|
+
* This provides the type without duplicating method signatures
|
|
29
|
+
*/
|
|
30
|
+
export type IComponentManager = InstanceType<ReturnType<typeof WithComponentManager>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
export declare enum Effect {
|
|
3
|
+
CAN_NOT_SKILL = "CAN_NOT_SKILL",
|
|
4
|
+
CAN_NOT_ITEM = "CAN_NOT_ITEM",
|
|
5
|
+
CAN_NOT_STATE = "CAN_NOT_STATE",
|
|
6
|
+
CAN_NOT_EQUIPMENT = "CAN_NOT_EQUIPMENT",
|
|
7
|
+
HALF_SP_COST = "HALF_SP_COST",
|
|
8
|
+
GUARD = "GUARD",
|
|
9
|
+
SUPER_GUARD = "SUPER_GUARD"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Effect Manager Mixin
|
|
13
|
+
*
|
|
14
|
+
* Provides effect management capabilities to any class. This mixin handles
|
|
15
|
+
* player effects including restrictions, buffs, and debuffs. Effects can come
|
|
16
|
+
* from various sources like states, equipment, and temporary conditions.
|
|
17
|
+
*
|
|
18
|
+
* @param Base - The base class to extend with effect management
|
|
19
|
+
* @returns Extended class with effect management methods
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* class MyPlayer extends WithEffectManager(BasePlayer) {
|
|
24
|
+
* constructor() {
|
|
25
|
+
* super();
|
|
26
|
+
* // Effect system is automatically initialized
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* const player = new MyPlayer();
|
|
31
|
+
* player.effects = [Effect.GUARD];
|
|
32
|
+
* console.log(player.hasEffect(Effect.GUARD)); // true
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function WithEffectManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
36
|
+
/**
|
|
37
|
+
* Type helper to extract the interface from the WithEffectManager mixin
|
|
38
|
+
* This provides the type without duplicating method signatures
|
|
39
|
+
*/
|
|
40
|
+
export type IEffectManager = InstanceType<ReturnType<typeof WithEffectManager>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Element Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides elemental management capabilities to any class. This mixin handles
|
|
6
|
+
* elemental resistances, vulnerabilities, and attack elements. It manages both
|
|
7
|
+
* defensive capabilities (elementsDefense) and offensive elements from equipment,
|
|
8
|
+
* as well as player-specific elemental efficiency modifiers.
|
|
9
|
+
*
|
|
10
|
+
* @param Base - The base class to extend with element management
|
|
11
|
+
* @returns Extended class with element management methods
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* class MyPlayer extends WithElementManager(BasePlayer) {
|
|
16
|
+
* constructor() {
|
|
17
|
+
* super();
|
|
18
|
+
* this.elementsEfficiency = [{ rate: 0.5, element: 'fire' }];
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const player = new MyPlayer();
|
|
23
|
+
* const fireResistance = player.elementsDefense.find(e => e.element === 'fire');
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function WithElementManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
27
|
+
/**
|
|
28
|
+
* Type helper to extract the interface from the WithElementManager mixin
|
|
29
|
+
* This provides the type without duplicating method signatures
|
|
30
|
+
*/
|
|
31
|
+
export type IElementManager = InstanceType<ReturnType<typeof WithElementManager>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
export interface GoldManager {
|
|
3
|
+
/**
|
|
4
|
+
* You can change the game money
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* player.gold += 100
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @title Change Gold
|
|
11
|
+
* @prop {number} player.gold
|
|
12
|
+
* @default 0
|
|
13
|
+
* @memberof GoldManager
|
|
14
|
+
* */
|
|
15
|
+
gold: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function WithGoldManager<TBase extends PlayerCtor>(Base: TBase): new (...args: ConstructorParameters<TBase>) => InstanceType<TBase> & GoldManager;
|
|
18
|
+
/**
|
|
19
|
+
* Type helper to extract the interface from the WithGoldManager mixin
|
|
20
|
+
* This provides the type without duplicating method signatures
|
|
21
|
+
*/
|
|
22
|
+
export type IGoldManager = InstanceType<ReturnType<typeof WithGoldManager>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* GUI Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides graphical user interface management capabilities to any class. This mixin handles
|
|
6
|
+
* dialog boxes, menus, notifications, shops, and custom GUI components. It manages the
|
|
7
|
+
* complete GUI system including opening, closing, and data passing between client and server.
|
|
8
|
+
*
|
|
9
|
+
* @param Base - The base class to extend with GUI management
|
|
10
|
+
* @returns Extended class with GUI management methods
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithGuiManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* // GUI system is automatically initialized
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* await player.showText('Hello World!');
|
|
23
|
+
* player.callMainMenu();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function WithGuiManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
27
|
+
/**
|
|
28
|
+
* Type helper to extract the interface from the WithGuiManager mixin
|
|
29
|
+
* This provides the type without duplicating method signatures
|
|
30
|
+
*/
|
|
31
|
+
export type IGuiManager = InstanceType<ReturnType<typeof WithGuiManager>>;
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ItemClass } from '@rpgjs/database';
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Move Manager mixin
|
|
3
|
+
* Item Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides comprehensive item management capabilities to any class. This mixin handles
|
|
6
|
+
* inventory management, item usage, equipment, buying/selling, and item effects.
|
|
7
|
+
* It manages the complete item system including restrictions, transactions, and equipment.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
9
|
+
* @param Base - The base class to extend with item management
|
|
10
|
+
* @returns Extended class with item management methods
|
|
13
11
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithItemManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* // Item system is automatically initialized
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* player.addItem('potion', 5);
|
|
23
|
+
* player.useItem('potion');
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function WithItemManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
27
|
+
/**
|
|
28
|
+
* Type helper to extract the interface from the WithItemManager mixin
|
|
29
|
+
* This provides the type without duplicating method signatures
|
|
16
30
|
*/
|
|
17
|
-
export
|
|
31
|
+
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,
|
|
@@ -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): TBase;
|
|
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 {};
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface IWithParameterManager {
|
|
3
|
-
parameters: Map<string, any>;
|
|
4
|
-
hp: number;
|
|
5
|
-
sp: number;
|
|
6
|
-
exp: number;
|
|
7
|
-
level: number;
|
|
8
|
-
expForNextlevel: number;
|
|
9
|
-
param: {
|
|
10
|
-
[key: string]: number;
|
|
11
|
-
};
|
|
12
|
-
paramsModifier: {
|
|
13
|
-
[key: string]: {
|
|
14
|
-
value?: number;
|
|
15
|
-
rate?: number;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
}
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
19
2
|
/**
|
|
20
3
|
* Mixin that adds parameter management functionality to a player class.
|
|
21
4
|
*
|
|
@@ -39,4 +22,29 @@ export interface IWithParameterManager {
|
|
|
39
22
|
* }
|
|
40
23
|
* ```
|
|
41
24
|
*/
|
|
42
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Parameter Manager Mixin
|
|
27
|
+
*
|
|
28
|
+
* Provides comprehensive parameter management functionality to any class. This mixin handles
|
|
29
|
+
* health points (HP), skill points (SP), experience and level progression, custom parameters,
|
|
30
|
+
* and parameter modifiers for temporary stat changes.
|
|
31
|
+
*
|
|
32
|
+
* @param Base - The base class to extend with parameter management
|
|
33
|
+
* @returns Extended class with parameter management methods
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* class MyPlayer extends WithParameterManager(BasePlayer) {
|
|
38
|
+
* constructor() {
|
|
39
|
+
* super();
|
|
40
|
+
* this.addParameter('strength', { start: 10, end: 100 });
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* const player = new MyPlayer();
|
|
45
|
+
* player.hp = 100;
|
|
46
|
+
* player.level = 5;
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function WithParameterManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
50
|
+
export type IParameterManager = InstanceType<ReturnType<typeof WithParameterManager>>;
|
package/dist/Player/Player.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpgCommonPlayer, ShowAnimationParams
|
|
1
|
+
import { RpgCommonPlayer, ShowAnimationParams } from '@rpgjs/common';
|
|
2
2
|
import { IComponentManager } from './ComponentManager';
|
|
3
3
|
import { RpgMap } from '../rooms/map';
|
|
4
4
|
import { Context } from '@signe/di';
|
|
@@ -6,12 +6,43 @@ import { IGuiManager } from './GuiManager';
|
|
|
6
6
|
import { MockConnection } from '@signe/room';
|
|
7
7
|
import { IMoveManager } from './MoveManager';
|
|
8
8
|
import { IGoldManager } from './GoldManager';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
9
|
+
import { IVariableManager } from './VariableManager';
|
|
10
|
+
import { IParameterManager } from './ParameterManager';
|
|
11
|
+
import { IItemManager } from './ItemManager';
|
|
12
|
+
import { IEffectManager } from './EffectManager';
|
|
13
|
+
import { IElementManager } from './ElementManager';
|
|
14
|
+
import { ISkillManager } from './SkillManager';
|
|
15
|
+
import { IBattleManager } from './BattleManager';
|
|
16
|
+
import { IClassManager } from './ClassManager';
|
|
17
|
+
import { IStateManager } from './StateManager';
|
|
18
|
+
interface ZoneOptions {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
radius: number;
|
|
22
|
+
angle?: number;
|
|
23
|
+
direction?: any;
|
|
24
|
+
linkedTo?: string;
|
|
25
|
+
limitedByWalls?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare const RpgPlayer_base: typeof RpgCommonPlayer;
|
|
13
28
|
/**
|
|
14
29
|
* RPG Player class with component management capabilities
|
|
30
|
+
*
|
|
31
|
+
* Combines all player mixins to provide a complete player implementation
|
|
32
|
+
* with graphics, movement, inventory, skills, and battle capabilities.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // Create a new player
|
|
37
|
+
* const player = new RpgPlayer();
|
|
38
|
+
*
|
|
39
|
+
* // Set player graphics
|
|
40
|
+
* player.setGraphic("hero");
|
|
41
|
+
*
|
|
42
|
+
* // Add parameters and items
|
|
43
|
+
* player.addParameter("strength", { start: 10, end: 100 });
|
|
44
|
+
* player.addItem(sword);
|
|
45
|
+
* ```
|
|
15
46
|
*/
|
|
16
47
|
export declare class RpgPlayer extends RpgPlayer_base {
|
|
17
48
|
map: RpgMap | null;
|
|
@@ -68,6 +99,12 @@ export declare class RpgEvent extends RpgPlayer {
|
|
|
68
99
|
execMethod(methodName: string, methodData?: any[], instance?: this): Promise<any>;
|
|
69
100
|
remove(): void;
|
|
70
101
|
}
|
|
71
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Interface extension for RpgPlayer
|
|
104
|
+
*
|
|
105
|
+
* Extends the RpgPlayer class with additional interfaces from mixins.
|
|
106
|
+
* This provides proper TypeScript support for all mixin methods and properties.
|
|
107
|
+
*/
|
|
108
|
+
export interface RpgPlayer extends IVariableManager, IMoveManager, IGoldManager, IComponentManager, IGuiManager, IItemManager, IEffectManager, IParameterManager, IElementManager, ISkillManager, IBattleManager, IClassManager, IStateManager {
|
|
72
109
|
}
|
|
73
110
|
export {};
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RpgPlayer } from './Player';
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Skill Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides skill management capabilities to any class. This mixin handles
|
|
6
|
+
* learning, forgetting, and using skills, including SP cost management,
|
|
7
|
+
* hit rate calculations, and skill effects application.
|
|
8
|
+
*
|
|
9
|
+
* @param Base - The base class to extend with skill management
|
|
10
|
+
* @returns Extended class with skill management methods
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* class MyPlayer extends WithSkillManager(BasePlayer) {
|
|
15
|
+
* constructor() {
|
|
16
|
+
* super();
|
|
17
|
+
* // Skill system is automatically initialized
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const player = new MyPlayer();
|
|
22
|
+
* player.learnSkill(Fire);
|
|
23
|
+
* player.useSkill(Fire, targetPlayer);
|
|
24
|
+
* ```
|
|
5
25
|
*/
|
|
6
|
-
|
|
7
|
-
sp: number;
|
|
8
|
-
skills(): any[];
|
|
9
|
-
hasEffect(effect: string): boolean;
|
|
10
|
-
databaseById(id: string): any;
|
|
11
|
-
applyStates(player: RpgPlayer, skill: any): void;
|
|
12
|
-
}
|
|
26
|
+
export declare function WithSkillManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
13
27
|
/**
|
|
14
|
-
*
|
|
28
|
+
* Type helper to extract the interface from the WithSkillManager mixin
|
|
29
|
+
* This provides the type without duplicating method signatures
|
|
15
30
|
*/
|
|
16
|
-
export
|
|
17
|
-
getSkill(skillClass: any | string): any;
|
|
18
|
-
learnSkill(skillId: any | string): any;
|
|
19
|
-
forgetSkill(skillId: any | string): any;
|
|
20
|
-
useSkill(skillId: any | string, otherPlayer?: RpgPlayer | RpgPlayer[]): any;
|
|
21
|
-
}
|
|
22
|
-
export declare function WithSkillManager<TBase extends Constructor<RpgCommonPlayer & SkillManagerDependencies>>(Base: TBase): Constructor<IWithSkillManager> & TBase;
|
|
23
|
-
export {};
|
|
31
|
+
export type ISkillManager = InstanceType<ReturnType<typeof WithSkillManager>>;
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WritableArraySignal } from '@signe/reactive';
|
|
3
|
-
import { RpgPlayer } from './Player';
|
|
4
|
-
interface StateManagerDependencies {
|
|
5
|
-
equipments(): any[];
|
|
6
|
-
databaseById(id: string | StateClass): any;
|
|
7
|
-
addState(stateClass: StateClass | string, chance?: number): object | null;
|
|
8
|
-
removeState(stateClass: StateClass | string, chance?: number): void;
|
|
9
|
-
}
|
|
1
|
+
import { PlayerCtor } from '@rpgjs/common';
|
|
10
2
|
/**
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}[];
|
|
18
|
-
statesEfficiency: WritableArraySignal<any[]>;
|
|
19
|
-
applyStates(player: RpgPlayer, states: {
|
|
20
|
-
addStates?: any[];
|
|
21
|
-
removeStates?: any[];
|
|
22
|
-
}): void;
|
|
23
|
-
getState(stateClass: StateClass | string): any;
|
|
24
|
-
addState(stateClass: StateClass | string, chance?: number): object | null;
|
|
25
|
-
removeState(stateClass: StateClass | string, chance?: number): void;
|
|
26
|
-
}
|
|
27
|
-
type StateClass = {
|
|
28
|
-
new (...args: any[]): any;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Move Manager mixin
|
|
3
|
+
* State Manager Mixin
|
|
4
|
+
*
|
|
5
|
+
* Provides state management capabilities to any class. This mixin handles
|
|
6
|
+
* player states (buffs/debuffs), state defense from equipment, and state
|
|
7
|
+
* efficiency modifiers. It manages the complete state system including
|
|
8
|
+
* application, removal, and resistance mechanics.
|
|
32
9
|
*
|
|
33
|
-
*
|
|
10
|
+
* @param Base - The base class to extend with state management
|
|
11
|
+
* @returns Extended class with state management methods
|
|
34
12
|
*
|
|
35
|
-
* @
|
|
36
|
-
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* class MyPlayer extends WithStateManager(BasePlayer) {
|
|
16
|
+
* constructor() {
|
|
17
|
+
* super();
|
|
18
|
+
* // State system is automatically initialized
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const player = new MyPlayer();
|
|
23
|
+
* player.addState(Paralyze);
|
|
24
|
+
* console.log(player.getState(Paralyze));
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function WithStateManager<TBase extends PlayerCtor>(Base: TBase): TBase;
|
|
28
|
+
/**
|
|
29
|
+
* Type helper to extract the interface from the WithStateManager mixin
|
|
30
|
+
* This provides the type without duplicating method signatures
|
|
37
31
|
*/
|
|
38
|
-
export
|
|
39
|
-
export {};
|
|
32
|
+
export type IStateManager = InstanceType<ReturnType<typeof WithStateManager>>;
|