Advertisement
ICF-Soft

ICFSoft_SRD_Distribution 1.00

Sep 17th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Patch to use params core stats in srd stat distribution plugin
  3. // ICFSoft_SRD_Distribution.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_SRD_Distribution = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.SRD_Distribution = ICF.SRD_Distribution || {};
  11.  
  12. ICF.SRD_Distribution.Version = 100; // 1.00
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.00 This plugin allows you to increase params created with
  17.  * ICFSoft's Params Core througth srd stat distribution plugin.
  18.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  19.  *
  20.  * @help
  21.  * ============================================================================
  22.  * Introduction
  23.  * ============================================================================
  24.  *
  25.  * This plugin allows you to increase params created with ICFSoft's Params Core
  26.  * througth srd stat distribution plugin. Also works with max tp.
  27.  *
  28.  * It is based on Stat Distribution v1.07 and must be placed before them.
  29.  *
  30.  * ============================================================================
  31.  * How to use
  32.  * ============================================================================
  33.  *
  34.  * Just use mtp and created params as upgradeable stats.
  35.  *
  36.  * ============================================================================
  37.  * Incompatibilities
  38.  * ============================================================================
  39.  *
  40.  * There's no known incompatible plugins yet.
  41.  *
  42.  * ============================================================================
  43.  * Known isues
  44.  * ============================================================================
  45.  *
  46.  * Not yet.
  47.  *
  48.  * ============================================================================
  49.  *
  50.  * For commercial and non-commercial games.
  51.  * Credit to ICF-Soft.
  52.  * This entire header must be included with plugin.
  53.  *
  54.  * ============================================================================
  55. */
  56. //=============================================================================
  57.  /*:es
  58.  * @plugindesc v1.00 Permite incrementar los parámetros creados con ICFSoft's
  59.  * Params Core mediante el complemento de srd stat distribution.
  60.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  61.  *
  62.  * @help
  63.  * ============================================================================
  64.  * Introducción
  65.  * ============================================================================
  66.  *
  67.  * Este plugin permite incrementar los parámetros creados con ICF-Soft Params
  68.  * Core mediante el complemento de SumRndmDde stat distribution así como el tp
  69.  * máximo.
  70.  *
  71.  * Basado en Stat Distribution v1.07 de SumRndmDde.
  72.  * Debe estar colocado debajo de ambos.
  73.  *
  74.  * ============================================================================
  75.  * Uso
  76.  * ============================================================================
  77.  *
  78.  * Utiliza mtp y parámetros creados como parámetros que se pueden mejorar.
  79.  *
  80.  * ============================================================================
  81.  * Incompatibilidades
  82.  * ============================================================================
  83.  *
  84.  * No se conocen complementos que sean incompatibles hasta la fecha.
  85.  *
  86.  * ============================================================================
  87.  * Problemas conocidos
  88.  * ============================================================================
  89.  *
  90.  * De momento ninguno.
  91.  *
  92.  * ============================================================================
  93.  *
  94.  * Para juegos comerciales y no comerciales.
  95.  * Se debe incluir a ICF-Soft en los créditos.
  96.  * Esta cabecera debe incluirse íntegramente con el plugin.
  97.  *
  98.  * ============================================================================
  99. */
  100. //=============================================================================
  101.  
  102. //=============================================================================
  103. // DataManagerEX
  104. //=============================================================================
  105.  
  106. DataManagerEX.getStatDistributionHtmlOptions = function() {
  107.     var options = `<option value="mhp" selected>Max HP</option>
  108.             <option value="mmp">Max MP</option>
  109.             <option value="mtp">Max TP</option>
  110.             <option value="atk">Attack</option>
  111.             <option value="def">Defense</option>
  112.             <option value="mat">Magical Attack</option>
  113.             <option value="mdf">Magical Defense</option>
  114.             <option value="agi">Agility</option>
  115.             <option value="luk">Luck</option>
  116.             <option value="frame">   </option>
  117.             <option value="hit">Hit Rate</option>
  118.             <option value="eva">Evasion Rate</option>
  119.             <option value="cri">Critical Rate</option>
  120.             <option value="cev">Critical Evasion Rate</option>
  121.             <option value="mev">Magic Evasion Rate</option>
  122.             <option value="mrf">Magic Reflection Rate</option>
  123.             <option value="cnt">Counter Attack Rate</option>
  124.             <option value="hrg">Hp Regeneration</option>
  125.             <option value="mrg">Mp Regeneration</option>
  126.             <option value="trg">Tp Regeneration</option>
  127.             <option value="frame">   </option>
  128.             <option value="tgr">Target Rate</option>
  129.             <option value="grd">Guard Effect Rate</option>
  130.             <option value="rec">Recovery Effect Rate</option>
  131.             <option value="pha">Pharmacology</option>
  132.             <option value="mcr">Mp Cost Rate</option>
  133.             <option value="tcr">Tp Charge Rate</option>
  134.             <option value="pdr">Physical Damage Rate</option>
  135.             <option value="mdr">Magical Damage Rate</option>
  136.             <option value="fdr">Floor Damage Rate</option>
  137.             <option value="exr">Experience Rate</option>
  138.             <option value="frame">   </option>`;
  139.     for (var i = 0; i < ICF.Param.NParams.length; i++) {
  140.         if (ICF.Param.NParams[i]) {
  141.             options = options + '<option value="' + ICF.Param.NParams[i] + '">' + ICF.Param.NParamsFullName[i] + '</option>';
  142.         }
  143.     }
  144.     for (var i = 0; i < ICF.Param.PParams.length; i++) {
  145.         if (ICF.Param.PParams[i]) {
  146.             options = options + '<option value="' + ICF.Param.PParams[i] + '">' + ICF.Param.PParamsFullName[i] + '</option>';
  147.         }
  148.     }
  149.     return options;
  150. };
  151.  
  152. DataManagerEX.updateStatDistribution = function() {
  153.     const doc = MakerManager.document;
  154.     this._distributeStat = doc.getElementById('StatSelect').value;
  155.     const data = $dataDistributeStats[this._distributeStat];
  156.     if(data) {
  157.         doc.getElementById('name').value = data.name;
  158.         doc.getElementById('description').value = data.description;
  159.         doc.getElementById('cost').value = data.cost;
  160.         doc.getElementById('gain').value = data.gain;
  161.         doc.getElementById('max').value = data.max;
  162.         doc.getElementById('min_col').value = data.min_col;
  163.         doc.getElementById('max_col').value = data.max_col;
  164.     } else if (this._distributeStat == "mtp") {
  165.         $dataDistributeStats[this._distributeStat] = {};
  166.         $dataDistributeStats[this._distributeStat].name = "Max TP";
  167.         $dataDistributeStats[this._distributeStat].description = "The maximum amount of TP for the actor.";
  168.         $dataDistributeStats[this._distributeStat].cost = 1;
  169.         $dataDistributeStats[this._distributeStat].gain = 2;
  170.         $dataDistributeStats[this._distributeStat].max = 200;
  171.         $dataDistributeStats[this._distributeStat].min_col = "#6666ff";
  172.         $dataDistributeStats[this._distributeStat].max_col = "#0000ff";
  173.         DataManagerEX.updateStatDistribution();
  174.         FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  175.     } else if (ICF.Param.NParams.indexOf(this._distributeStat) > -1) {
  176.         var paramId = ICF.Param.NParams.indexOf(this._distributeStat);
  177.         $dataDistributeStats[this._distributeStat] = {};
  178.         $dataDistributeStats[this._distributeStat].name = ICF.Param.NParamsFullName[paramId];
  179.         $dataDistributeStats[this._distributeStat].description = "Actor's " + ICF.Param.NParamsFullName[paramId] + ".";
  180.         $dataDistributeStats[this._distributeStat].cost = 1;
  181.         $dataDistributeStats[this._distributeStat].gain = 1;
  182.         $dataDistributeStats[this._distributeStat].max = 100;
  183.         $dataDistributeStats[this._distributeStat].min_col = "#ff7777";
  184.         $dataDistributeStats[this._distributeStat].max_col = "#f90000";
  185.         DataManagerEX.updateStatDistribution();
  186.         FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  187.     } else if (ICF.Param.PParams.indexOf(this._distributeStat) > -1) {
  188.         var paramId = ICF.Param.PParams.indexOf(this._distributeStat);
  189.         $dataDistributeStats[this._distributeStat] = {};
  190.         $dataDistributeStats[this._distributeStat].name = ICF.Param.PParamsFullName[paramId];
  191.         $dataDistributeStats[this._distributeStat].description = "Actor's " + ICF.Param.PParamsFullName[paramId] + ".";
  192.         $dataDistributeStats[this._distributeStat].cost = 1;
  193.         $dataDistributeStats[this._distributeStat].gain = 1;
  194.         $dataDistributeStats[this._distributeStat].max = 100;
  195.         $dataDistributeStats[this._distributeStat].min_col = "#aaaaaa";
  196.         $dataDistributeStats[this._distributeStat].max_col = "#ffffff";
  197.         DataManagerEX.updateStatDistribution();
  198.         FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  199.     } else {
  200.         doc.getElementById('name').value = '';
  201.         doc.getElementById('description').value = '';
  202.         doc.getElementById('cost').value = '';
  203.         doc.getElementById('gain').value = '';
  204.         doc.getElementById('max').value = '';
  205.         doc.getElementById('min_col').value = '';
  206.         doc.getElementById('max_col').value = '';
  207.     }
  208. };
  209.  
  210. //=============================================================================
  211. // Game_BattlerBase
  212. //=============================================================================
  213.  
  214. Object.defineProperties(Game_BattlerBase.prototype, {
  215.     // Max TP
  216.     mtp: { get: function() { return this.maxTp(); }, configurable: true },
  217. });
  218.  
  219.  
  220. //=============================================================================
  221. // Game_Actor
  222. //=============================================================================
  223.  
  224. ICF.SRD_Distribution.actorNParamBase = Game_Actor.prototype.NParamBase;
  225. Game_Actor.prototype.NParamBase = function(paramId) {
  226.     if (!this._distributeNParams) this._distributeNParams = [];
  227.     return ICF.SRD_Distribution.actorNParamBase.apply(this, arguments) + (this._distributeNParams[paramId] || 0);
  228. };
  229.  
  230. ICF.SRD_Distribution.actorPParamBase = Game_Actor.prototype.PParamBase;
  231. Game_Actor.prototype.PParamBase = function(pparamId) {
  232.     if (!this._distributePParams) this._distributePParams = [];
  233.     return ICF.SRD_Distribution.actorPParamBase.apply(this, arguments) + (this._distributePParams[pparamId] || 0);
  234. };
  235.  
  236. ICF.SRD_Distribution.maxTp = Game_Actor.prototype.maxTp;
  237. Game_Actor.prototype.maxTp = function() {
  238.     if (!this._distributeTP) this._distributeTP = 0;
  239.     return ICF.SRD_Distribution.maxTp.apply(this, arguments) + this._distributeTP;
  240. };
  241.  
  242. ICF.SRD_Distribution.clearDistributeStats = Game_Actor.prototype.clearDistributeStats;
  243. Game_Actor.prototype.clearDistributeStats = function() {
  244.     ICF.SRD_Distribution.clearDistributeStats.call(this);
  245.     this._distributeTP = 0;
  246.     this._distributeNParams = [];
  247.     this._distributePParams = [];
  248. };
  249.  
  250. ICF.SRD_Distribution.getAbnormalParam = Game_Actor.prototype.getAbnormalParam;
  251. Game_Actor.prototype.getAbnormalParam = function(param) {
  252.     if (param == "mtp") return this._distributeTP || 0;
  253.     if (ICF.Param.NParams.indexOf(param) > -1) {
  254.         var paramId = ICF.Param.NParams.indexOf(param);
  255.         if (!this._distributeNParams) this._distributeNParams = [];
  256.         return this._distributeNParams[paramId] || 0;
  257.     } else if (ICF.Param.PParams.indexOf(param) > -1) {
  258.         var paramId = ICF.Param.PParams.indexOf(param);
  259.         if (!this._distributePParams) this._distributePParams = [];
  260.         return this._distributePParams[paramId] || 0;
  261.     }
  262.     return ICF.SRD_Distribution.getAbnormalParam.apply(this, arguments);
  263. };
  264.  
  265. ICF.SRD_Distribution.addAbnormalParam = Game_Actor.prototype.addAbnormalParam;
  266. Game_Actor.prototype.addAbnormalParam = function(param, value) {
  267.     ICF.SRD_Distribution.addAbnormalParam.apply(this, arguments);
  268.     if (param == "mtp") {
  269.         this._distributeTP = this._distributeTP || 0;
  270.         this._distributeTP += value;
  271.     } else if (ICF.Param.NParams.indexOf(param) > -1) {
  272.         var paramId = ICF.Param.NParams.indexOf(param);
  273.         if (!this._distributeNParams) this._distributeNParams = [];
  274.         this._distributeNParams[paramId] = this._distributeNParams[paramId] || 0;
  275.         this._distributeNParams[paramId] += value;
  276.     } else if (ICF.Param.PParams.indexOf(param) > -1) {
  277.         var paramId = ICF.Param.PParams.indexOf(param);
  278.         if (!this._distributePParams) this._distributePParams = [];
  279.         this._distributePParams[paramId] = this._distributePParams[paramId] || 0;
  280.         this._distributePParams[paramId] += value;
  281.     }
  282. };
  283.  
  284. //=============================================================================
  285. // Window_Distribute
  286. //=============================================================================
  287.  
  288. Window_Distribute.prototype.makeCommandList = function() {
  289.     if(this._actor) {
  290.         const stats = this._actor.actor()._sd_stats || SRD.StatDistribution.stats;
  291.         stats.forEach(function(stat) {
  292.             if($dataDistributeStats[stat]) {
  293.                 this.addCommand($dataDistributeStats[stat].name, stat);
  294.             } else if (stat == "mtp") {
  295.                 $dataDistributeStats[stat] = {};
  296.                 $dataDistributeStats[stat].name = "Max TP";
  297.                 $dataDistributeStats[stat].description = "The maximum amount of TP for the actor.";
  298.                 $dataDistributeStats[stat].cost = 1;
  299.                 $dataDistributeStats[stat].gain = 2;
  300.                 $dataDistributeStats[stat].max = 200;
  301.                 $dataDistributeStats[stat].min_col = "#6666ff";
  302.                 $dataDistributeStats[stat].max_col = "#0000ff";
  303.                 FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  304.                 this.addCommand($dataDistributeStats[stat].name, stat);
  305.             } else if (ICF.Param.NParams.indexOf(stat) > -1) {
  306.                 var paramId = ICF.Param.NParams.indexOf(stat);
  307.                 $dataDistributeStats[stat] = {};
  308.                 $dataDistributeStats[stat].name = ICF.Param.NParamsFullName[paramId];
  309.                 $dataDistributeStats[stat].description = "Actor's " + ICF.Param.NParamsFullName[paramId] + ".";
  310.                 $dataDistributeStats[stat].cost = 1;
  311.                 $dataDistributeStats[stat].gain = 1;
  312.                 $dataDistributeStats[stat].max = 100;
  313.                 $dataDistributeStats[stat].min_col = "#ff7777";
  314.                 $dataDistributeStats[stat].max_col = "#f90000";
  315.                 FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  316.                 this.addCommand($dataDistributeStats[stat].name, stat);
  317.             } else if (ICF.Param.PParams.indexOf(stat) > -1) {
  318.                 var paramId = ICF.Param.PParams.indexOf(stat);
  319.                 $dataDistributeStats[stat] = {};
  320.                 $dataDistributeStats[stat].name = ICF.Param.PParamsFullName[paramId];
  321.                 $dataDistributeStats[stat].description = "Actor's " + ICF.Param.PParamsFullName[paramId] + ".";
  322.                 $dataDistributeStats[stat].cost = 1;
  323.                 $dataDistributeStats[stat].gain = 1;
  324.                 $dataDistributeStats[stat].max = 100;
  325.                 $dataDistributeStats[stat].min_col = "#aaaaaa";
  326.                 $dataDistributeStats[stat].max_col = "#ffffff";
  327.                 FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  328.                 this.addCommand($dataDistributeStats[stat].name, stat);
  329.             }
  330.         }, this);
  331.     }
  332.     this.addCommand("Finish", 'finish');
  333. };
  334.  
  335. //=============================================================================
  336. // End of File
  337. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement