forked from Trivel/RMMV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMrTS_StaticExp.js
134 lines (117 loc) · 3.73 KB
/
MrTS_StaticExp.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
//==============================================================================
// MrTS_StaticExp.js
//==============================================================================
/*:
* @plugindesc Makes every level require same amount of EXP. Enemies give exp depending on actor level.
* @author Mr. Trivel
*
* @param EXP Needed
* @desc EXP Needed for each level.
* @default 200
*
* @param Overflow
* @desc Does EXP Overflow to next level? (Y/N)
* @default N
*
* @param EXP Reward
* @desc EXP rewarded for killing same level enemy
* @default 15
*
* @param EXP Bonus
* @desc EXP bonus for killing higher level enemy per it's level
* @default 7
*
* @param EXP Loss
* @desc EXP Loss for killing lower level enemy per it's level
* @default 3
*
* @param Obtained Exp Message
* @desc Message display after victory
* @default %1 received %2 %3!
*
* @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
* --------------------------------------------------------------------------------
*
* Enemies give EXP according to Actor level.
* Enemies that have lower level will give less EXP while enemies higher level than
* Actor give more EXP.
*
* Tags for enemy note fields:
* <level: X> - Level of enemy. If no level noted assumes level 1.
* <custom_base_exp> - instead of using default base EXP,
* use the number in enemy database EXP field for it.
*/
(function(){
var parameters = PluginManager.parameters('MrTS_StaticExp');
var overflow = String(parameters['Overflow'] || "N");
var expNeeded = Number(parameters['EXP Needed'] || 200);
var expReward = Number(parameters['EXP Reward'] || 15);
var expBonus = Number(parameters['EXP Bonus'] || 7);
var expLoss = Number(parameters['EXP Loss'] || 3);
var expObtainedMessage = String(parameters['Obtained Exp Message'] || "%1 received %2 %3!");
Game_Actor.prototype.expForLevel = function(level) {
return expNeeded*(level-1);
};
var _Game_Actor_levelUp = Game_Actor.prototype.levelUp;
Game_Actor.prototype.levelUp = function() {
_Game_Actor_levelUp.call(this);
if (overflow.toUpperCase() == "N")
this._exp[this._classId] = this.expForLevel(this._level);
}
var _Game_Enemy_exp = Game_Enemy.prototype.exp;
Game_Enemy.prototype.exp = function() {
if (this.enemy().meta.custom_base_exp)
return _Game_Enemy_exp.call(this);
else
return expReward;
}
Game_Troop.prototype.expTotal = function() {
var t_exp = [];
var i = 0;
$gameParty.allMembers().forEach(function(member){
t_exp[i] = 0;
$gameTroop.deadMembers().forEach(function(enemy){
var dif = (enemy.enemy().meta.level ? enemy.enemy().meta.level : 1) - member.level;
var exp = enemy.exp();
if (dif > 0)
exp += expBonus * dif;
else if (dif < 0)
exp += expLoss * dif;
if (exp < 0) exp = 0;
t_exp[i] += exp;
});
i++;
});
return t_exp;
}
BattleManager.gainExp = function() {
var exp = this._rewards.exp;
var i = 0;
$gameParty.allMembers().forEach(function(actor) {
actor.gainExp(exp[i]);
i++;
});
};
BattleManager.displayExp = function() {
var exp = this._rewards.exp;
$gameMessage.newPage();
var i = 0;
$gameParty.battleMembers().forEach(function(member){
var t_exp = exp[i];
if (t_exp > 0)
{
var text = expObtainedMessage.format(member.name(), exp[i], TextManager.exp);
$gameMessage.add('\\.' + text);
}
i++;
});
};
})();