-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathAXY_Battle.js
162 lines (150 loc) · 4.98 KB
/
AXY_Battle.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
//=============================================================================
// A XueYu Plugins - Battle
// AXY_Battle.js
// Version: 1.00
// License: MIT
//=============================================================================
/*:
* @plugindesc v1.00 Allows to adjust battle's staff.
* @author A XueYu Plugins
*
* @help
* Introduction
* This plugin allows to adjust battle's staff.
*
* Example:
* not yet
*
* changelog
* 1.00 2019.11.23
* first release;
*
* //=============================================================================
* End of Help File
* //=============================================================================
*
* @param messageSpeed
* @text Message Speed
* @desc Message Speed. default: 16
* @type number
* @default 16
*
* @param animationBaseDelay
* @text Animation Base Delay
* @desc Animation Base Delay. default: 8
* @type number
* @default 8
*
* @param animationNextDelay
* @text Animation Next Delay
* @desc Animation Next Delay. default: 12
* @type number
* @default 12
*
*/
// Imported
var Imported = Imported || {};
Imported.AXY_Battle = true;
// Parameter Variables
var AXY = AXY || {};
AXY.Battle = AXY.Battle || {};
AXY.Battle.Parameters = PluginManager.parameters('AXY_Battle');
AXY.Battle.Param = AXY.Battle.Param || {};
AXY.Battle.Alias = AXY.Battle.Alias || {};
//=============================================================================
// Utils
//=============================================================================
// Create a utility function to parse complex parameters.
//=============================================================================
Utils.recursiveParse = function (param) {
try {
if (typeof JSON.parse(param) == 'object') {
return JSON.parse(
param,
function (key, value) {
try {
return this.recursiveParse(value);
} catch (e) {
return value;
}
}.bind(this)
);
} else {
return JSON.parse(
param,
function (key, value) {
return value;
}.bind(this)
);
}
} catch (e) {
return param;
}
};
//=============================================================================
// Parameters
//=============================================================================
// Read and parse parameters into a locally scoped Parameters object.
//=============================================================================
Object.keys(AXY.Battle.Parameters).forEach(function (key) {
return (AXY.Battle.Param[key] = Utils.recursiveParse(
AXY.Battle.Parameters[key]
));
});
// Main
(function () {
/*Window_BattleLog.prototype.showAnimation = function (subject, targets, animationId) {
if (animationId < 0) {
this.showAttackAnimation(subject, targets);
} else {
this.showNormalAnimation(targets, animationId);
}
console.log(subject);
console.log(targets);
};*/
/*AXY.Battle.Alias.Window_BattleLog_prototype_startAction = Window_BattleLog.prototype.startAction;
Window_BattleLog.prototype.startAction = function (subject, action, targets) {
AXY.Battle.Alias.Window_BattleLog_prototype_startAction.call(this, subject, action, targets);
var item = action.item();
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation1', subject, targets.clone(), item.animationId, item);
this.displayAction(subject, item);
//console.log(item);
};
AXY.Battle.Alias.Window_BattleLog_prototype_showAnimation = Window_BattleLog.prototype.showAnimation;
Window_BattleLog.prototype.showAnimation = function (subject, targets, animationId, item) {
AXY.Battle.Alias.Window_BattleLog_prototype_showAnimation.call(this, subject, targets, animationId);
console.log(item);
if (animationId < 0) {
this.showAttackAnimation(subject, targets);
} else {
this.showNormalAnimation(targets, animationId, false, item);
}
};
AXY.Battle.Alias.Window_BattleLog_prototype_showNormalAnimation = Window_BattleLog.prototype.showNormalAnimation;
Window_BattleLog.prototype.showNormalAnimation = function (targets, animationId, mirror, item) {
console.log(item);
AXY.Battle.Alias.Window_BattleLog_prototype_showNormalAnimation.call(this, targets, animationId, mirror);
var animation = $dataAnimations[animationId];
if (animation) {
var delay = this.animationBaseDelay();
var nextDelay = this.animationNextDelay();
targets.forEach(function (target) {
target.startAnimation(animationId, mirror, delay);
delay += nextDelay;
});
}
console.log(item);
};*/
Window_BattleLog.prototype.messageSpeed = function () {
return AXY.Battle.Param.messageSpeed;
};
Window_BattleLog.prototype.animationBaseDelay = function () {
return AXY.Battle.Param.animationBaseDelay;
};
Window_BattleLog.prototype.animationNextDelay = function () {
return AXY.Battle.Param.animationNextDelay;
};
})();