-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMOG_BattleCry_A2Aaddon.js
141 lines (123 loc) · 5.49 KB
/
MOG_BattleCry_A2Aaddon.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
//=============================================================================
// MOG_BattleCry_A2Aaddon.js
//=============================================================================
var Imported = Imported || {};
Imported.MOG_BattleCry_A2Aaddon = true;
if (Imported.MOG_BattleCry) {
/*:
* @plugindesc Separate voicefiles depending on who item is being used on
* @author mjshi
*
* @help
* ----------------------------------------------------------------------------
* Addon for MOG_BattleCry by mjshi
* Free for both commercial and non-commercial use, with credit.
* ----------------------------------------------------------------------------
*
* > Is something broken? Go to http://mjshi.weebly.com/contact.html and I'll
* try my best to help you!
*
* > Plugin order should be:
* Yanfly scripts
* MOG BattleCry
* MOG BattleCry A2Aaddon
*
* > This addon provides compatibility edits for Yanfly Victory Aftermath
* as well as an added functionality of different voice files being played
* depending on who the item is being used on.
*
*/
Moghunter.v_actortoactor_item = [];
//=============================================================================
// BEGIN CONFIGURATION
//=============================================================================
// What's the largest actor ID that you have that will join the party?
Moghunter.totalActors = 4;
// -----------------------------------------------------------------------
// don't touch this, things will break if you do.
// What I'm doing here is making a double array so you can call voices like [id1][id2]
for (var i = 0; i < Moghunter.totalActors + 1; i++) {
Moghunter.v_actortoactor_item[i] = new Array(Moghunter.totalActors + 1);
}
// OK to start touching again :P
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// ACTOR TO ACTOR- ITEM -- Soundfile played depends on person the item
// is being used on. If no soundfile is specified, the normal
// "Moghunter.v_actor_item" soundfile will be played.
//
// Moghunter.v_actortoactor_item[A][B] = {C:[D,D,D]}
// Actor to actor soundfiles take priority over normal item soundfiles.
//
// A - Actor ID - 1
// B - Target Actor ID
// C - Item ID
// D - Soundfiles
// -----------------------------------------------------------------------
// Examples of the v_actor_item (not actor to actor!)
// -----------------------------------------------------------------------
// Moghunter.v_actor_item[1] = {
// 1:["P1_Action_01","P1_Action_02","P1_Action_03"], // Potion
// 3:["P1_Action_01","P1_Action_02","P1_Action_03"]}; // Full Potion
// Moghunter.v_actor_item[2] = {1:["P2_Action_01","P2_Action_02","P2_Action_03"]};
// -----------------------------------------------------------------------
// Examples of actor to actor item use
// -----------------------------------------------------------------------
// Moghunter.v_actortoactor_item[1][1] = { //actor 1 using item on himself
// 1:["Recording1-1","Recording1-1A"], // Potion
// 3:["Recording1-1A"], // Full Potion
// };
// Moghunter.v_actortoactor_item[1][2] = { //actor 1 using item on actor 2
// 1:["Recording1-2"]
// };
// Moghunter.v_actortoactor_item[2][1] = { //actor 2 using item on actor
// 1:["Recording2-1"]
// };
//=============================================================================
// END OF CONFIGURATION
//=============================================================================
//==================================
// ** Process Victory
//==================================
if (Imported.YEP_VictoryAftermath) {
BattleManager.processVictory = _alias_mog_bcry_processVictory;
console.log(_alias_mog_bcry_processVictory);
var _alias_Yanfly_VA_BattleManager_playVictoryMe = Yanfly.VA.BattleManager_playVictoryMe;
BattleManager.playVictoryMe = function() {
var actor = this.randomActor();
if (actor) {SoundManager.selectVoice(actor._v_victory)};
_alias_Yanfly_VA_BattleManager_playVictoryMe.call(this);
};
}
//===============================
// ** play Voice Action
//===============================
Game_Battler.prototype.playVoiceAction = function(action) {
var actionID = action.item().id;
if (this.isActor()) {
var v_targetID = action._targetIndex + 1;
if (action.isSkill() && Moghunter.v_actor_skill[this._actorId] &&
Moghunter.v_actor_skill[this._actorId][actionID]) {
SoundManager.selectVoice(Moghunter.v_actor_skill[this._actorId][actionID]);
return;
}
else if (action.isItem() && Moghunter.v_actortoactor_item[this._actorId][v_targetID] &&
Moghunter.v_actortoactor_item[this._actorId][v_targetID][actionID])
{
SoundManager.selectVoice(Moghunter.v_actortoactor_item[this._actorId][v_targetID][actionID]);
return;
}
else if (action.isItem() && Moghunter.v_actor_item[this._actorId] &&
Moghunter.v_actor_item[this._actorId][actionID]) {
SoundManager.selectVoice(Moghunter.v_actor_item[this._actorId][actionID]);
return;
};
} else if (this.isEnemy()) {
if (Moghunter.v_enemy_skill[this._enemyId] && Moghunter.v_enemy_skill[this._enemyId][actionID]) {
SoundManager.selectVoice(Moghunter.v_enemy_skill[this._enemyId][actionID]);
return;
};
}
SoundManager.selectVoice(this._v_default_action);
};
};