forked from Trivel/RMMV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMrTS_PassiveSkills.js
65 lines (61 loc) · 2.22 KB
/
MrTS_PassiveSkills.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
//=============================================================================
// MrTS_PassiveSkills.js
//=============================================================================
/*:
* @plugindesc Allows skills to give passive bonuses to actors.
* @author Mr. Trivel
*
* @help
* --------------------------------------------------------------------------------
* Terms of Use
* --------------------------------------------------------------------------------
* Don't remove the header or claim that you wrote this plugin.
* Credit Mr. Trivel if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Skill Tags
* --------------------------------------------------------------------------------
* Use the following tag:
* <Passive: [STATE_ID]>
* This means skill will give all bonuses state with that ID gives.
*
* Example:
* <Passive: 11>
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
var _Game_Actor_initMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function() {
_Game_Actor_initMembers.call(this);
this._skipPassives = false;
};
var _Game_Actor_traitObjects = Game_Actor.prototype.traitObjects;
Game_Actor.prototype.traitObjects = function() {
var objects = _Game_Actor_traitObjects.call(this);
if (!this._skipPassives)
objects = objects.concat(this.getPassiveSkills());
return objects;
};
Game_Actor.prototype.getPassiveSkills = function() {
var passives = [];
this._skipPassives = true;
var skills = this.skills();
for (var i = 0; i < skills.length; i++) {
var skill = skills[i];
if (skill.meta.Passive) {
passives.push($dataStates[Number(skill.meta.Passive)]);
}
}
this._skipPassives = false;
return passives;
};
})();