Advertisement
Astfgl

AstfglFSS

Oct 19th, 2016
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // AstfglFSS
  3. // by Astfgl
  4. // Date: 19/10/2016  
  5. // Free to use both commercial and non commercial. Credits not required.
  6. // Free to edit and redistribute as long as it is on the same terms of use.
  7. // 19/10/2016 revision: proper aliasing of the original function
  8. // 19/10/2016 revision 2: Yanfly passive states compatibily
  9. // 19/10/2016 revision 3: modified to apply to enemies as well
  10. // 19/10/2016 revision 4: release version, help updated.
  11. // 24/11/2016 revision 5: modified function to allow to refer to the user's params.
  12. //=============================================================================
  13.  
  14.  
  15. /*:
  16.  * @plugindesc Provides notetags to give flat stat boosts.
  17.  * @author Astfgl
  18.  * @help Use: mhpB, mmpB, atkB, defB, mdefB, matkB, agiB and lckB
  19.  * You can use v(your number) inside a notetag to boost based on a variable
  20.  * Example:
  21.  * <mhpB: 100> Will boost the max hp of whoever is affected by it by 100;
  22.  * <atkB: 10* v(1) + 5> Will boost the atk by 10 * game variable 1 plus 5.
  23.  * <hpB: user.mp> Will boost the hp by the mp value.
  24.  * For the javascript savvy: the notetags are evaled.
  25.  */
  26.  (function() {
  27.  
  28.     var parameters = PluginManager.parameters('AstfglFSS');
  29.    
  30.     var _Astfgl_newBBPP = Game_BattlerBase.prototype.paramPlus
  31.     Game_BattlerBase.prototype.paramPlus = function(paramId) {
  32.         if (!this._passiveStatesRaw) {this._passiveStatesRaw = []};
  33.         var value = _Astfgl_newBBPP.call(this, paramId);
  34.         value += getBonus(paramId, this._states, this)
  35.         value += getBonus(paramId, this._passiveStatesRaw, this)
  36.         return value
  37.     };
  38.    
  39.     var getBonus = function(paramId,states, battler) {
  40.         var user = battler;
  41.         var value = 0;
  42.         var v = function(id) {
  43.             return $gameVariables.value(id)
  44.         }
  45.        
  46.         for (var i = 0; i < states.length; i++) {
  47.             var data = $dataStates[states[i]];
  48.             switch (paramId) {
  49.                 case 0:
  50.                     if (data.meta.mhpB) {value += eval(data.meta.mhpB)};
  51.                     break;
  52.                 case 1:
  53.                     if (data.meta.mmpB) {value += eval(data.meta.mmpB)};
  54.                     break;
  55.                 case 2:
  56.                     if (data.meta.atkB) {value += eval(data.meta.atkB)};
  57.                     break;
  58.                 case 3:
  59.                     if (data.meta.defB) {value += eval(data.meta.defB)};
  60.                     break;
  61.                 case 4:
  62.                     if (data.meta.matkB) {value += eval(data.meta.matkB)};
  63.                     break;
  64.                 case 5:
  65.                     if (data.meta.mdefB) {value += eval(data.meta.mdefB)};
  66.                     break;
  67.                 case 6:
  68.                     if (data.meta.agiB) {value += eval(data.meta.agiB)};
  69.                     break;
  70.                 case 7:
  71.                     if (data.meta.lckB) {value += eval(data.meta.lckB)};
  72.                     break;
  73.                 default:
  74.                     break; 
  75.             }
  76.         }
  77.         return value
  78.     }
  79.    
  80.  })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement