Skip to content

Commit 4cc96e5

Browse files
Add battle object types
1 parent 52f79ef commit 4cc96e5

File tree

13 files changed

+1174
-107
lines changed

13 files changed

+1174
-107
lines changed

lib/rmmz_managers/AudioManager.d.ts

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,85 @@ declare class AudioManager {
1313
private static _bgsVolume: number;
1414
private static _meVolume: number;
1515
private static _seVolume: number;
16+
1617
private static _currentBgm: CurrentAudio;
1718
private static _currentBgs: CurrentAudio;
19+
1820
private static _bgmBuffer: WebAudio;
1921
private static _bgsBuffer: WebAudio;
2022
private static _meBuffer: WebAudio;
2123
private static _seBuffer: WebAudio;
24+
2225
private static _staticBuffers: WebAudio[];
26+
2327
private static _replayFadeTime: number;
2428
private static _path: string;
2529

26-
public static get bgmVolume(): number;
27-
public static set bgmVolume(value: number);
28-
29-
public static get bgsVolume(): number;
30-
public static set bgsVolume(value: number);
31-
32-
public static get meVolume(): number;
33-
public static set meVolume(value: number);
34-
35-
public static get seVolume(): number;
36-
public static set seVolume(value: number);
30+
public static bgmVolume: number;
31+
public static bgsVolume: number;
32+
public static meVolume: number;
33+
public static seVolume: number;
3734

3835
public static playBgm(bgm: CurrentAudio, pos: number): void;
3936
public static replayBgm(bgm: CurrentAudio): void;
37+
4038
public static isCurrentBgm(bgm: CurrentAudio): boolean;
39+
4140
public static updateBgmParameters(bgm: CurrentAudio): void;
4241
public static updateCurrentBgm(bgm: CurrentAudio, pos: number): void;
42+
4343
public static stopBgm(): void;
44+
4445
public static fadeOutBgm(duration: number): void;
4546
public static fadeInBgm(duration: number): void;
47+
4648
public static playBgs(bgs: CurrentAudio, pos: number): void;
4749
public static replayBgs(bgs: CurrentAudio): void;
50+
4851
public static isCurrentBgs(bgs: CurrentAudio): boolean;
52+
4953
public static updateBgsParameters(bgs: CurrentAudio): void;
54+
5055
public static stopBgs(): void;
56+
5157
public static fadeOutBgs(duration: number): void;
5258
public static fadeInBgs(duration: number): void;
59+
5360
public static playMe(me: CurrentAudio): void;
61+
5462
public static updateMeParameters(me: CurrentAudio): void;
63+
5564
public static fadeOutMe(duration: number): void;
65+
5666
public static stopMe(): void;
67+
5768
public static playSe(se: CurrentAudio): void;
69+
5870
public static updateSeParameters(buffer: WebAudio, se: CurrentAudio): void;
71+
5972
public static cleanupSe(): void;
73+
6074
public static stopSe(): void;
75+
6176
public static playStaticSe(se: CurrentAudio): void;
6277
public static loadStaticSe(se: CurrentAudio): void;
78+
6379
public static isStaticSe(se: CurrentAudio): boolean;
80+
6481
public static stopAll(): void;
82+
6583
public static saveBgm(): CurrentAudio;
6684
public static saveBgs(): CurrentAudio;
85+
6786
public static makeEmptyAudioObject(): CurrentAudio;
87+
6888
public static createBuffer(folder: string, name: string): WebAudio;
69-
public static updateufferParameters(buffer: WebAudio, configVolume: number, audio: CurrentAudio): void;
89+
public static updateBufferParameters(buffer: WebAudio, configVolume: number, audio: CurrentAudio): void;
90+
7091
public static audioFileExt(): string;
92+
7193
public static checkErrors(): void;
7294
public static throwLoadError(webAudio: WebAudio): void;
7395
}
7496

75-
export { AudioManager, CurrentAudio}
97+
export { AudioManager, CurrentAudio };
Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import {CurrentAudio} from "./AudioManager";
1+
import { CurrentAudio } from "./AudioManager";
2+
3+
import { Game_Actor } from '../rmmz_objects/Game_Actor';
4+
import { Game_Action } from '../rmmz_objects/Game_Action';
5+
6+
import { Spriteset_Battle } from "../rmmz_sprites/Spriteset_Battle";
7+
8+
import { Window_BattleLog } from '../rmmz_windows/Window_BattleLog';
29

310
declare class BattleManager {
411

@@ -10,19 +17,23 @@ declare class BattleManager {
1017
private static _eventCallback: boolean;
1118
private static _preemptive: boolean;
1219
private static _surprise: boolean;
13-
private static _currentActor: unknown // TODO fix the typing.
14-
private static _actionForceBattler: unknown // TODO fix typing.
20+
private static _currentActor: Game_Actor;
21+
private static _actionForceBattler: Game_Action;
1522
private static _mapBgm: CurrentAudio;
1623
private static _mapBgs: CurrentAudio;
17-
private static _actionBattlers: unknown[];
18-
private static _subject: unknown;
19-
private static _action: unknown;
20-
private static _targets: unknown[];
21-
private static _logWindow: unknown;
22-
private static _spriteset;
24+
25+
private static _actionBattlers: Game_Battler[];
26+
27+
private static _subject: Game_Battler;
28+
private static _action: Game_Action;
29+
30+
private static _targets: Game_Battler[];
31+
private static _logWindow: Window_BattleLog;
32+
33+
private static _spriteset: Spriteset_Battle;
2334
private static _escapeRatio: number;
2435
private static _escaped: boolean;
2536
private static _rewards: Record<string, unknown>;
2637
private static _tpbNeedsPartyCommand: boolean;
27-
38+
2839
}

lib/rmmz_managers/ColorManager.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ declare class ColorManager {
3636
public static dimColor2(): string;
3737
public static itemBackColor1(): string;
3838
public static itemBackColor2(): string;
39+
3940
}
4041

41-
export { ColorManager }
42+
export { ColorManager };

lib/rmmz_managers/DataManager.d.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
//-----------------------------------------------------------------------------
2-
// DataManager
3-
//
4-
// The static class that manages the database and game objects.
5-
// @TODO : this class still need fix.
6-
//mport { RPG } from "./RPG";
1+
import { RPG } from "./RPG";
72

83

94
/**
@@ -68,10 +63,10 @@ declare class DataManager {
6863
public static setupEventTest(): void;
6964
public static isEventTest(): boolean;
7065

71-
public static isSkill(item: Record<string, unknown>): boolean;
72-
public static isItem(item: Record<string, unknown>): boolean;
73-
public static isWeapon(item: Record<string, unknown>): boolean;
74-
public static isArmor(item: Record<string, unknown>): boolean;
66+
public static isSkill(item: unknown): item is RPG.DataSkill;
67+
public static isItem(item: unknown): item is RPG.DataItem;
68+
public static isWeapon(item: unknown): item is RPG.DataWeapon;
69+
public static isArmor(item: unknown): item is RPG.DataArmor;
7570

7671
public static setupNewGame(): void;
7772
public static createGameObjects(): void;

lib/rmmz_managers/RPG.d.ts

Lines changed: 46 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,86 @@
11
declare namespace RPG {
22

3-
export interface DataActor {
3+
export interface Data {
44
id: number;
5+
name: string;
6+
note: string;
7+
}
8+
9+
export interface DataActor extends Data {
510
battlerName: string;
611
characterIndex: number;
712
characterName: string;
813
classId: number;
914
equips: number[];
1015
faceIndex: number;
1116
faceName: string;
12-
traits: Trait[]; // TODO : define the trait
17+
traits: Trait[];
1318
initialLevel: number;
1419
maxLevel: number;
15-
name: string;
1620
nickname: string;
17-
note: string;
1821
profile: string;
1922
}
2023

21-
export interface DataSkill {
22-
id: number;
23-
animationId: number;
24-
damage: Damage;
24+
export interface DataItemBase extends Data {
2525
description: string;
26-
effects: Effect[];
27-
hitType: number;
2826
iconIndex: number;
29-
message1: string;
30-
message2: string;
31-
messageType: number;
32-
mpCost: number;
33-
name: string;
34-
note: string;
35-
occasion: number;
36-
repeats: number;
37-
requiredWtypeId1: number;
38-
requiredWtypeId2: number;
39-
scope: number;
40-
speed: number;
41-
stypeId: number;
42-
successRate: number;
43-
tpCost: number;
44-
tpGain: number;
4527
}
4628

47-
export interface DataClass {
48-
id: number;
49-
expParams: number[];
29+
export interface DataEquipItem extends DataItemBase {
30+
etypeId: number;
5031
traits: Trait[];
51-
learnings: Learning[];
52-
name: string;
53-
note: string;
54-
params: Array<number[]>;
32+
params: number[];
33+
price: number;
5534
}
5635

57-
export interface DataItem {
58-
id: number;
36+
export interface DataWeapon extends DataEquipItem {
37+
animationId: number;
38+
wtypeId: number;
39+
etypeId: 1;
40+
}
41+
42+
export interface DataArmor {
43+
atypeId: number;
44+
etypeId: 2 | 3 | 4 | 5;
45+
}
46+
47+
export interface DataConsumable extends DataItemBase {
5948
animationId: number;
60-
consumable: boolean;
6149
damage: Damage;
62-
description: string;
6350
effects: Effect[];
6451
hitType: number;
65-
iconIndex: number;
66-
itypeId: number;
67-
name: string;
68-
note: string;
6952
occasion: number;
70-
price: number;
7153
repeats: number;
7254
scope: number;
7355
speed: number;
7456
successRate: number;
7557
tpGain: number;
7658
}
7759

78-
export interface DataWeapon {
79-
id: number;
80-
animationId: number;
81-
description: string;
82-
etypeId: number;
83-
traits: Trait[];
84-
iconIndex: number;
85-
name: string;
86-
note: string;
87-
params: number[];
60+
export interface DataSkill extends Data {
61+
message1: string;
62+
message2: string;
63+
messageType: number;
64+
mpCost: number;
65+
requiredWtypeId1: number;
66+
requiredWtypeId2: number;
67+
stypeId: number;
68+
tpCost: number;
69+
}
70+
71+
export interface DataItem extends Data {
72+
itypeId: number;
8873
price: number;
89-
wtypeId: number;
9074
}
9175

92-
export interface DataArmor {
93-
id: number;
94-
atypeId: number;
95-
description: string;
96-
etypeId: number;
76+
export interface DataClass extends Data {
77+
expParams: number[];
9778
traits: Trait[];
98-
iconIndex: number;
99-
name: string;
100-
note: string;
101-
params: number[];
102-
price: number;
79+
learnings: Learning[];
80+
params: Array<number[]>;
10381
}
10482

105-
export interface DataEnemy {
83+
export interface DataEnemy extends Data {
10684
id: number;
10785
actions: Action[];
10886
battlerHue: number;
@@ -116,14 +94,14 @@ declare namespace RPG {
11694
params: number[];
11795
}
11896

119-
export interface DataTroop {
97+
export interface DataTroop extends Data {
12098
id: number;
12199
members: Member[];
122100
name: string;
123101
pages: Page[];
124102
}
125103

126-
export interface DataState {
104+
export interface DataState extends Data {
127105
id: number;
128106
autoRemovalTiming: number;
129107
chanceByDamage: number;
@@ -164,7 +142,7 @@ declare namespace RPG {
164142
speed: number;
165143
}
166144

167-
export interface DataTileset {
145+
export interface DataTileset extends Data {
168146
id: number;
169147
flags: number[];
170148
mode: number;
@@ -287,10 +265,7 @@ declare namespace RPG {
287265
volume: number;
288266
}
289267

290-
export interface Event {
291-
id: number;
292-
name: string;
293-
note: string;
268+
export interface Event extends Data {
294269
pages: Page[];
295270
x: number;
296271
y: number;

0 commit comments

Comments
 (0)