-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathAkeaBattleCamera.js
683 lines (626 loc) · 24.5 KB
/
AkeaBattleCamera.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
//============================================================================
// Akea Battle Camera
//----------------------------------------------------------------------------
// 07/07/21 | Version: 1.1.0 | Various improvements and fixes
// 11/09/20 | Version: 1.0.5 | Fixed smooth exponent issue
// 04/09/20 | Version: 1.0.4 | Fixed camera offset
// 04/09/20 | Version: 1.0.3 | Akea 1.1.0 note style compatibility
// 03/09/20 | Version: 1.0.2 | Fixed Ojima offset
// 03/09/20 | Version: 1.0.1 | Fixed Camera angle
// 02/09/20 | Version: 1.0.0 | Released
//----------------------------------------------------------------------------
// This software is released under the zlib License.
//============================================================================
/*:
* @target MZ
* @plugindesc [v1.1.0] Akea Battle Camera
* @author Gabe (Gabriel Nascimento)
* @url http://patreon.com/gabriel_nfd
* @base AkeaAnimatedBattleSystem
* @orderAfter AkeaAnimatedBattleSystem
*
* @help Akea - Battle Camera
* - This plugin is released under the zlib License.
* - This plugin requires the AkeaAnimatedBattleSystem base plugin.
*
* This plugin adds a camera to battle and allows to control it during the
* skills.
*
* Set the default camera position during actor and enemy selections through
* plugin parameters.
*
* Next check out the skill notes available to control the camera during
* the skills. The parameters signed as (optional) are not required. Those
* without any signage are required.
*
* Skill Notes Tag:
* <akeaCameraOnUser>
* zoom: number (optional)
* time: number (optional)
* </akeaCameraOnUser>
* | Sets the camera for the skill user.
* | zoom: the camera zoom scale
* | time: the camera movement duration
*
* <akeaCameraOnTarget>
* id: number
* zoom: number (optional)
* time: number (optional)
* </akeaCameraOnTarget>
* | Sets the camera for the id target.
* | id: the target id
* | zoom: the camera zoom scale
* | time: the camera movement duration
*
* <akeaCameraAbsolute>
* x: number
* y: number
* zoom: number
* time: number
* </akeaCameraAbsolute>
* | Sets the camera to the absolute coordinate.
* | x: the x coordinate
* | y: the y coordinate
* | zoom: the camera zoom scale
* | time: the camera movement duration
*
* <akeaCameraZoom>
* zoom: number
* time: number (optional)
* </akeaCameraZoom>
* | Sets the camera zoom scale at the current coordinate.
* | zoom: the camera zoom scale
* | time: the camera movement duration
*
* <akeaCameraOffset>
* x: number
* y: number
* </akeaCameraOffset>
* | Sets the camera offset.
* | x: the x coordinate
* | y: the y coordinate
*
* <akeaCameraMode>
* mode: number
* </akeaCameraMode>
* | Sets the camera mode.
* | mode: the camera mode.
* | - 0: Dynamic
* | - 1: Smoothing Start
* | - 2: Smoothing End
* | - 3: Full Smoothing
*
* <akeaCameraReset>
* time: number (optional)
* </akeaCameraReset>
* | Resets all camera settings
* | time: the camera movement duration
*
* Usage Examples:
* <akeaCameraOnUser>
* </akeaCameraOnUser>
* | Focus the camera on the skill user.
* <akeaCameraOnUser>
* zoom: 1.5
* time: 30
* </akeaCameraOnUser>
* | Focus the camera on the skill user at speed 30 with
* | a 1.5 zoom scale.
*
* <akeaCameraOnTarget>
* id: 1
* </akeaCameraOnTarget>
* | Focus the camera on the id 1 target.
* <akeaCameraOnTarget>
* id: 2
* zoom: 1.2
* time: 60
* </akeaCameraOnTarget>
* | Focus the camera on the id 2 target at speed 60 with
* | a 1.2 zoom scale.
*
* <akeaCameraAbsolute>
* x: 50
* y: 120
* zoom: 1
* time: 30
* </akeaCameraAbsolute>
* | Focus the camera on the 50 x 120 coordinates at speed
* | 30 with a 1 zoom scale.
*
* <akeaCameraZoom>
* zoom: 2
* </akeaCameraZoom>
* | Changes the camera zoom scale to 2
* <akeaCameraZoom>
* zoom: 1.2
* time: 20
* </akeaCameraZoom>
* | Changes the camera zoom scale to 1.2 at speed 20.
*
* <akeaCameraOffset>
* x: 0
* y: 48
* </akeaCameraOffset>
* | Sets the camera offset to 0 x 48
*
* <akeaCameraMode>
* mode: 2
* </akeaCameraMode>
* | Change the camera mode to 1 (Smoothing Start)
*
* <akeaCameraReset>
* time: 30
* </akeaCameraReset>
* | Reset all camera changes at speed 30.
*
* It may seem complex at first, but using and managing the camera
* is quite simple. Just pay attention to the name of each required
* parameter and which ones are optional.Look carefully at the examples
* provided to have a basis.
*
* For support and new plugins join our Discord server:
* https://discord.gg/GG85QRz
*
* @param defaultCameraMode
* @text Default Camera Mode
* @desc Set the default camera mode.
* @type select
* @option Dynamic
* @value 0
* @option Smoothing Start
* @value 1
* @option Smoothing End
* @value 2
* @option Full Smoothing
* @value 3
* @default 0
*
* @param defaultSmoothExponent
* @text Default Smooth Exponent
* @desc Set the default camera smooth exponent when using the modes 1, 2 or 3.
* @type number
* @decimals 5
* @min 0
* @default 1.5
*
* @param defaultActor
* @text Default Actor Focus
* @type struct<defaultFocus>
*
* @param defaultEnemy
* @text Default Enemy Focus
* @type struct<defaultFocus>
*
* @param resetCameraActionEnd
* @text Reset Camera when Action End?
* @desc Set true if you want the camera reset at the end of the actions.
* @type boolean
* @default false
*/
/*~struct~defaultFocus:
* @param x
* @text X
* @desc Set the X offset.
* @type number
* @min -1000
* @default 0
*
* @param y
* @text Y
* @desc Set the Y offset.
* @type number
* @min -1000
* @default 0
*
* @param zoom
* @text Zoom
* @desc Set the zoom scale.
* @type number
* @decimals 1
* @min -1000
* @default 1.4
*
* @param duration
* @text duration
* @desc Set the focus speed in frames
* @type number
* @min 0
* @default 30
*/
var Akea = Akea || {};
Akea.BattleCamera = Akea.BattleCamera || {};
Akea.BattleCamera.VERSION = [1, 0, 5];
if (!Akea.BattleSystem) throw new Error("Akea Battle Camera plugin needs the Akea Animated Battle System base.");
if (Akea.BattleSystem.VERSION < [1, 1, 0]) throw new Error("Akea Battle Camera plugin only works with versions 1.1.0 or higher of the Akea Animated Battle System.");
(() => {
const pluginName = "AkeaBattleCamera";
Akea.params = PluginManager.parameters(pluginName);
Akea.BattleCamera.defaultCameraMode = parseInt(Akea.params.defaultCameraMode);
Akea.BattleCamera.defaultSmoothExponent = parseFloat(Akea.params.defaultSmoothExponent);
Akea.BattleCamera.defaultActor = {
x: parseInt(JSON.parse(Akea.params.defaultActor).x),
y: parseInt(JSON.parse(Akea.params.defaultActor).y),
zoom: parseFloat(JSON.parse(Akea.params.defaultActor).zoom),
duration: parseInt(JSON.parse(Akea.params.defaultActor).duration)
};
Akea.BattleCamera.defaultEnemy = {
x: parseInt(JSON.parse(Akea.params.defaultEnemy).x),
y: parseInt(JSON.parse(Akea.params.defaultEnemy).y),
zoom: parseFloat(JSON.parse(Akea.params.defaultEnemy).zoom),
duration: parseInt(JSON.parse(Akea.params.defaultEnemy).duration)
};
Akea.BattleCamera.resetCameraActionEnd = JSON.parse(Akea.params.resetCameraActionEnd);
//-----------------------------------------------------------------------------
// SceneManager
//
// The static class that manages scene transitions.
SceneManager.battleCamera = function () {
return this._scene.camera();
}
//-----------------------------------------------------------------------------
// BattleManager
//
// The static class that manages battle progress.
const _BattleManager_startActorInput = BattleManager.startActorInput;
BattleManager.startActorInput = function () {
_BattleManager_startActorInput.call(this);
if (!this._currentActor) return;
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultActor.x, Akea.BattleCamera.defaultActor.y);
SceneManager.battleCamera().focusIn(this._currentActor, Akea.BattleCamera.defaultActor.zoom, Akea.BattleCamera.defaultActor.duration);
};
const _BattleManager_finishActorInput = BattleManager.finishActorInput;
BattleManager.finishActorInput = function () {
_BattleManager_finishActorInput.call(this);
if (Akea.BattleCamera.resetCameraActionEnd) SceneManager.battleCamera().reset();
};
const _BattleManager_cancelActorInput = BattleManager.cancelActorInput;
BattleManager.cancelActorInput = function () {
_BattleManager_cancelActorInput.call(this);
if (!this._currentActor) return;
SceneManager.battleCamera().reset(Akea.BattleCamera.defaultActor.duration);
};
const _BattleManager_endBattlerActions = BattleManager.endBattlerActions;
BattleManager.endBattlerActions = function (battler) {
_BattleManager_endBattlerActions.call(this, battler);
if (this._currentActor) {
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultActor.x, Akea.BattleCamera.defaultActor.y);
SceneManager.battleCamera().focusIn(this._currentActor, Akea.BattleCamera.defaultActor.zoom, Akea.BattleCamera.defaultActor.duration);
} else {
SceneManager.battleCamera().reset(Akea.BattleCamera.defaultActor.duration);
}
};
//-----------------------------------------------------------------------------
// Scene_Battle
//
// The scene class of the battle screen.
const _Scene_Battle_create = Scene_Battle.prototype.create;
Scene_Battle.prototype.create = function () {
_Scene_Battle_create.call(this);
this._camera = new Game_BattleCamera(this._spriteset);
};
const _Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function () {
_Scene_Battle_update.call(this);
this._camera.update();
};
Scene_Battle.prototype.camera = function () {
return this._camera;
}
const _Scene_Battle_startActorSelection = Scene_Battle.prototype.startActorSelection;
Scene_Battle.prototype.startActorSelection = function () {
_Scene_Battle_startActorSelection.call(this);
this._actorWindow.focusInActor();
};
const _Scene_Battle_onActorOk = Scene_Battle.prototype.onActorOk;
Scene_Battle.prototype.onActorOk = function () {
_Scene_Battle_onActorOk.call(this);
};
const _Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel;
Scene_Battle.prototype.onActorCancel = function () {
_Scene_Battle_onActorCancel.call(this);
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultActor.x, Akea.BattleCamera.defaultActor.y);
SceneManager.battleCamera().focusIn(this._actorCommandWindow.actor(), Akea.BattleCamera.defaultActor.zoom, Akea.BattleCamera.defaultActor.duration);
};
const _Scene_Battle_startEnemySelection = Scene_Battle.prototype.startEnemySelection;
Scene_Battle.prototype.startEnemySelection = function () {
_Scene_Battle_startEnemySelection.call(this);
this._enemyWindow.focusInEnemy();
};
const _Scene_Battle_onEnemyOk = Scene_Battle.prototype.onEnemyOk;
Scene_Battle.prototype.onEnemyOk = function () {
_Scene_Battle_onEnemyOk.call(this);
};
const _Scene_Battle_onEnemyCancel = Scene_Battle.prototype.onEnemyCancel;
Scene_Battle.prototype.onEnemyCancel = function () {
_Scene_Battle_onEnemyCancel.call(this);
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultActor.x, Akea.BattleCamera.defaultActor.y);
SceneManager.battleCamera().focusIn(this._actorCommandWindow.actor(), Akea.BattleCamera.defaultActor.zoom, Akea.BattleCamera.defaultActor.duration);
};
//-----------------------------------------------------------------------------
// Window_BattleActor
//
// The window for selecting a target actor on the battle screen.
const _Window_BattleActor_update = Window_BattleActor.prototype.update;
Window_BattleActor.prototype.update = function () {
_Window_BattleActor_update.call(this);
if (!SceneManager.battleCamera()) return;
if (this.index() != this._lastIndex && this.index() >= 0) {
this._lastIndex = this.index();
this.focusInActor();
}
};
Window_BattleActor.prototype.focusInActor = function () {
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultActor.x, Akea.BattleCamera.defaultActor.y);
SceneManager.battleCamera().focusIn(this.actor(this.index()), Akea.BattleCamera.defaultActor.zoom, Akea.BattleCamera.defaultActor.duration);
};
//-----------------------------------------------------------------------------
// Window_BattleEnemy
//
// The window for selecting a target enemy on the battle screen.
const _Window_BattleEnemy_update = Window_BattleEnemy.prototype.update;
Window_BattleEnemy.prototype.update = function () {
_Window_BattleEnemy_update.call(this);
if (!SceneManager.battleCamera()) return;
if (this.index() != this._lastIndex && this.index() >= 0) {
this._lastIndex = this.index();
this.focusInEnemy();
}
};
Window_BattleEnemy.prototype.focusInEnemy = function () {
SceneManager.battleCamera().setOffset(Akea.BattleCamera.defaultEnemy.x, Akea.BattleCamera.defaultEnemy.y);
SceneManager.battleCamera().focusIn(this.enemy(), Akea.BattleCamera.defaultEnemy.zoom, Akea.BattleCamera.defaultEnemy.duration);
};
//-----------------------------------------------------------------------------
// Game_BattlerCamera
//
// The game object class for battle camera.
function Game_BattleCamera() {
this.initialize(...arguments);
}
Game_BattleCamera.prototype.initialize = function (spriteset) {
this._spriteset = spriteset;
this.setup();
};
Game_BattleCamera.prototype.setup = function () {
this._x = this._spriteset.x;
this._y = this._spriteset.y;
this._scaleX = this._spriteset.scale.x;
this._scaleY = this._spriteset.scale.y;
this._offset = { x: 0, y: 0 };
this._cameraMode = Akea.BattleCamera.defaultCameraMode;
this._smoothExponent = Akea.BattleCamera.defaultSmoothExponent;
};
Game_BattleCamera.prototype.setOffset = function (x, y) {
this._offset = { x: x, y: y };
};
Game_BattleCamera.prototype.setCameraMode = function (mode) {
this._cameraMode = mode;
};
Game_BattleCamera.prototype.focusIn = function (target, zoom, time) {
target = this._spriteset.findTargetSprite(target);
const scaleX = zoom || this._scaleX;
const scaleY = zoom || this._scaleY;
let maxX = Graphics.boxWidth - (Graphics.boxWidth * scaleX);
let x = (Graphics.boxWidth / scaleX) - ((target.x + this._offset.x) * scaleX);
let maxY = Graphics.boxHeight - (Graphics.boxHeight * scaleY);
let y = (Graphics.boxHeight / scaleY) - (((target.y - (target.height / 2)) + this._offset.y) * scaleY);
x = this.checkCoord(x, maxX);
y = this.checkCoord(y, maxY);
const duration = time || 1;
this.move(x, y, scaleX, scaleY, duration);
}
Game_BattleCamera.prototype.moveIn = function (x, y, zoom, time) {
const scaleX = zoom || this._scaleX;
const scaleY = zoom || this._scaleY;
let maxX = (Graphics.width - (Graphics.width * scaleX) * 1);
x = this._x + ((x + this._offset.x) * scaleX);
let maxY = (Graphics.height - (Graphics.height * scaleY) * 1);
y = this._y + ((y + this._offset.y) * scaleY);
x = this.checkCoord(x, maxX);
y = this.checkCoord(y, maxY);
const duration = time || 1;
this.move(x, y, scaleX, scaleY, duration);
}
Game_BattleCamera.prototype.zoom = function (zoom, duration) {
const x = this._x;
const y = this._y;
const scaleX = zoom;
const scaleY = zoom;
this.move(x, y, scaleX, scaleY, duration);
}
Game_BattleCamera.prototype.reset = function (duration) {
this._offset = { x: 0, y: 0 };
this._cameraMode = Akea.BattleCamera.defaultCameraMode;
this.move(0, 0, 1, 1, duration);
}
Game_BattleCamera.prototype.move = function (x, y, scaleX, scaleY, duration) {
this._targetX = x;
this._targetY = y;
this._targetScaleX = scaleX;
this._targetScaleY = scaleY;
this._duration = duration;
this._wholeDuration = duration;
}
Game_BattleCamera.prototype.update = function () {
this.updateMove();
this.updateSpriteset();
};
Game_BattleCamera.prototype.updateMove = function () {
if (this._duration > 0) {
this._x = this.applySmoothing(this._x, this._targetX);
this._y = this.applySmoothing(this._y, this._targetY);
this._scaleX = this.applySmoothing(this._scaleX, this._targetScaleX);
this._scaleY = this.applySmoothing(this._scaleY, this._targetScaleY);
this._duration--;
}
};
Game_BattleCamera.prototype.updateSpriteset = function () {
this._spriteset.children[0].x = this._x
this._spriteset.children[0].y = this._y
this._spriteset.children[0].scale.x = this._scaleX;
this._spriteset.children[0].scale.y = this._scaleY;
}
Game_BattleCamera.prototype.applySmoothing = function (current, target) {
const d = this._duration;
const wd = this._wholeDuration;
const lt = this.calcSmoothing((wd - d) / wd);
const t = this.calcSmoothing((wd - d + 1) / wd);
const start = (current - target * lt) / (1 - lt);
return start + (target - start) * t;
};
Game_BattleCamera.prototype.calcSmoothing = function (t) {
const exponent = this._smoothExponent;
switch (this._cameraMode) {
case 1:
return this.easeIn(t, exponent);
case 2:
return this.easeOut(t, exponent);
case 3:
return this.easeInOut(t, exponent);
default:
return t;
}
};
Game_BattleCamera.prototype.easeIn = function (t, exponent) {
return Math.pow(t, exponent);
};
Game_BattleCamera.prototype.easeOut = function (t, exponent) {
return 1 - Math.pow(1 - t, exponent);
};
Game_BattleCamera.prototype.easeInOut = function (t, exponent) {
if (t < 0.5) {
return this.easeIn(t * 2, exponent) / 2;
} else {
return this.easeOut(t * 2 - 1, exponent) / 2 + 0.5;
}
};
Game_BattleCamera.prototype.checkCoord = function(value, max) {
return Math.min(0 , Math.max(value, max))
}
//-----------------------------------------------------------------------------
// Game_Battler
//
// The superclass of Game_Actor and Game_Enemy. It contains methods for sprites
// and actions.
const _Game_Battler_callAkeaActions = Game_Battler.prototype.callAkeaActions;
Game_Battler.prototype.callAkeaActions = function (actionName, parameters, action, targets) {
_Game_Battler_callAkeaActions.call(this, actionName, parameters, action, targets)
let regex = /(\w+):\s*([^\s]*)/gm;
let id = {};
do {
param = regex.exec(parameters);
if (param) {
id[RegExp.$1] = RegExp.$2;
}
} while (param);
switch (actionName) {
case "CameraOnUser":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraOnTarget":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraAbsolute":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraMove":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraZoom":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraOffset":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraMode":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
case "CameraReset":
this._akeaAnimatedBSActions.addCustomAddon(id, targets, actionName, this, action);
break;
}
}
//-----------------------------------------------------------------------------
// Sprite_Battler
//
// The superclass of Sprite_Actor and Sprite_Enemy.
const _Sprite_Battler_manageAkeaActions = Sprite_Battler.prototype.manageAkeaActions;
Sprite_Battler.prototype.manageAkeaActions = function (action) {
_Sprite_Battler_manageAkeaActions.call(this, action);
let params;
let zoom;
let duration;
switch (action.getActionType()) {
case "CameraOnUser":
params = action.getId();
duration = parseInt(params.time) || null;
zoom = parseFloat(params.zoom) || null;
subject = action.getSubject();
SceneManager.battleCamera().focusIn(subject, zoom, duration);
break;
case "CameraOnTarget":
params = action.getId();
id = parseInt(params.id);
if (!id) return;
duration = parseInt(params.time);
zoom = parseFloat(params.zoom);
targets = action.getTargets();
if (!targets[id - 1]) return;
SceneManager.battleCamera().focusIn(targets[id - 1], zoom, duration);
break;
case "CameraAbsolute":
params = action.getId();
x = parseInt(params.x);
y = parseInt(params.y);
duration = parseInt(params.time);
zoom = parseFloat(params.zoom);
SceneManager.battleCamera().move(x, y, zoom, duration);
break;
case "CameraMove":
params = action.getId();
x = parseInt(params.x);
y = parseInt(params.y);
duration = parseInt(params.time);
zoom = parseFloat(params.zoom);
SceneManager.battleCamera().moveIn(x, y, zoom, duration);
break;
case "CameraZoom":
params = action.getId();
zoom = parseFloat(params.zoom);
duration = parseInt(params.time) || 1;
SceneManager.battleCamera().zoom(zoom, duration);
break;
case "CameraOffset":
params = action.getId();
x = parseInt(params.x);
y = parseInt(params.y);
SceneManager.battleCamera().setOffset(x, y);
break;
case "CameraMode":
params = action.getId();
mode = parseInt(params.mode);
SceneManager.battleCamera().setCameraMode(mode);
break;
case "CameraReset":
params = action.getId();
duration = parseInt(params.time);
SceneManager.battleCamera().reset(duration);
break;
}
}
//-----------------------------------------------------------------------------
// Sprite_Animation
//
// The sprite for displaying an animation.
const _Sprite_Animation_updateEffectGeometry = Sprite_Animation.prototype.updateEffectGeometry;
Sprite_Animation.prototype.updateEffectGeometry = function() {
_Sprite_Animation_updateEffectGeometry.call(this);
if (SceneManager._scene instanceof Scene_Battle && SceneManager.battleCamera()) {
const scale = (this._animation.scale / 100) * SceneManager.battleCamera()._scaleX;
if (this._handle) {
this._handle.setScale(scale, scale, scale);
}
}
};
})();