MV_Musashi

ExpRatebyParameters

Nov 2nd, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ExpRatebyParameters
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Parameters can increase EXP rate.
  7.  *                                                                
  8.  *                                                                  
  9.  * <Musashi MV_Plugin>
  10.  * @param Parameter
  11.  * @desc Which parameter the experience rate is based on. Goes from 0(MHP) to 7(Luck).
  12.  * @default 4
  13.  * @param Rate
  14.  * @desc Percentual increased by each parameter point (1 = +1% exp for every parameter point)
  15.  * @default 1
  16.  */
  17.  
  18. (function() {
  19.   var _Game_Actor_gainExp_update = Game_Actor.prototype.gainExp.update;
  20.   Game_Actor.prototype.gainExp = function(exp) {
  21.     var newExp = this.currentExp() + Math.round(exp * this.finalExpRate() * this.attributeRate());
  22.     this.changeExp(newExp, this.shouldDisplayLevelUp());
  23. };
  24.  
  25. Game_Actor.prototype.attributeRate = function() {
  26. var parameters = $plugins.filter(function(p) { return p.description.contains('<Musashi MV_Plugin>'); })[0].parameters;
  27. //Choose parameter / 0 =  MHP, 1 = MMP, 2 = ATK, 3 = DEF, 4 = MATK, 5 = MDEF, 6 = AGI, 7 = Luck
  28. var paramInt = Number(parameters['Attribute'] || 4);
  29. // 0.01 = 1%
  30. paramPercentage = Number(parameters['Rate']/100 || 0.01);
  31. var rateParam = this.param(paramInt) * paramPercentage;
  32.     return this.exr * (1 + rateParam);
  33. };
  34.  
  35. })();
Advertisement
Add Comment
Please, Sign In to add comment