forked from Trivel/RMMV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMrTS_SimpleReplaceSkill.js
52 lines (50 loc) · 1.97 KB
/
MrTS_SimpleReplaceSkill.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
//=============================================================================
// MrTS_SimpleReplaceSkill.js
//=============================================================================
/*:
* @plugindesc Replace some skill when another skill is learned.
* @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
* --------------------------------------------------------------------------------
* To replace a skill when it's learned use the following tag:
* <ReplaceSkill: ID, ID, ..., ID>
* Any amount of IDs work.
*
* Example:
* <ReplaceSkill: 5, 7, 9>
* <ReplaceSkill: 5>
*
* First example would remove skills 5, 7 and 9 after learning.
* Second example would remove skill 5 after learning.
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
var _Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
Game_Actor.prototype.learnSkill = function(skillId) {
if (!this.isLearnedSkill(skillId) && $dataSkills[skillId].meta.ReplaceSkill) {
var a = $dataSkills[skillId].meta.ReplaceSkill.split(",");
for (var i = 0; i < a.length; i++) {
this.forgetSkill(Number(a[i]));
}
}
_Game_Actor_learnSkill.call(this, skillId);
};
})();