Advertisement
ICF-Soft

ICFSoft_SRDTpDistAddon

Jun 16th, 2018
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Tp distribution addon for srd stat distribution plugin
  3. // ICFSoft_SRDTpDistAddon.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_SRDTpDistAddon = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.SRDTpDistAddon = ICF.SRDTpDistAddon || {};
  11.  
  12. ICF.SRDTpDistAddon.Version = 100; // 1.00
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.00 This plugin allows you to increase max tp througth srd stat
  17.  * 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 max tp througth srd stat distribution
  26.  * plugin.
  27.  *
  28.  * It is based on Stat Distribution v1.07 and TP Upgrade v3.03 SumRndmDde plugins.
  29.  * Place below them.
  30.  *
  31.  * ============================================================================
  32.  * How to use
  33.  * ============================================================================
  34.  *
  35.  * Just use mtp as a upgradeable stat.
  36.  *
  37.  * If you have DistributionStats.json file in data folder you should delete it
  38.  * or change it's name as backup. A new file will be created with a mtp field.
  39.  *
  40.  * ============================================================================
  41.  * Incompatibilities
  42.  * ============================================================================
  43.  *
  44.  * There's no known incompatible plugins yet.
  45.  *
  46.  * ============================================================================
  47.  * Known isues
  48.  * ============================================================================
  49.  *
  50.  * Not yet.
  51.  *
  52.  * ============================================================================
  53.  *
  54.  * For commercial and non-commercial games.
  55.  * Credit to ICF-Soft.
  56.  * This entire header must be included with plugin.
  57.  *
  58.  * ============================================================================
  59. */
  60. //=============================================================================
  61.  /*:es
  62.  * @plugindesc v1.00 Permite incrementar el tp máximo mediante el complemento de
  63.  * srd stat distribution.
  64.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  65.  *
  66.  * @help
  67.  * ============================================================================
  68.  * Introducción
  69.  * ============================================================================
  70.  *
  71.  * Este plugin permite incrementar el tp máximo mediante el complemento de
  72.  * SumRndmDde stat distribution.
  73.  *
  74.  * Basado en los plugins Stat Distribution v1.07 y TP Upgrade v3.03 de
  75.  * SumRndmDde. Debe estar colocado debajo de ambos.
  76.  *
  77.  * ============================================================================
  78.  * Uso
  79.  * ============================================================================
  80.  *
  81.  * Utiliza mtp como uno de los parámetros que se pueden mejorar.
  82.  *
  83.  * Si tienes el archivo DistributionStats.json en la carpeta data conviene
  84.  * borrarlo o cambiarle el nombre. Se creará un nuevo archivo con un campo para
  85.  * la edición de mtp.
  86.  *
  87.  * ============================================================================
  88.  * Incompatibilidades
  89.  * ============================================================================
  90.  *
  91.  * No se conocen complementos que sean incompatibles hasta la fecha.
  92.  *
  93.  * ============================================================================
  94.  * Problemas conocidos
  95.  * ============================================================================
  96.  *
  97.  * De momento ninguno.
  98.  *
  99.  * ============================================================================
  100.  *
  101.  * Para juegos comerciales y no comerciales.
  102.  * Se debe incluir a ICF-Soft en los créditos.
  103.  * Esta cabecera debe incluirse íntegramente con el plugin.
  104.  *
  105.  * ============================================================================
  106. */
  107. //=============================================================================
  108.  
  109. //=============================================================================
  110. // SRD.StatDistribution
  111. //=============================================================================
  112.  
  113. SRD.StatDistribution.checkFileExists = function() {
  114.     FileManager.checkDataExists("DistributionStats.json", JsonEx.stringify({
  115.         "mhp":{"name":"Max HP","description":"The maximum amount of HP for the actor.","cost":"1","gain":"5","max":"500","min_col":"#ffa655","max_col":"#ea7000"},
  116.         "mmp":{"name":"Max MP","description":"The maximum amount of MP for the actor.","cost":"1","gain":"2","max":"200","min_col":"#6666ff","max_col":"#0000ff"},
  117.         "atk":{"name":"Attack","description":"Strengthens the damage of physical skills used by \nthe actor.","cost":"1","gain":"1","max":"100","min_col":"#ff7777","max_col":"#f90000"},
  118.         "def":{"name":"Defense","description":"Reduces the damage of physical skills the actor is \ntargeted with.","cost":"1","gain":"1","max":"100","min_col":"#52ff33","max_col":"#12b700"},
  119.         "mat":{"name":"Magic Attack","description":"Strengthens the damage of magical skills used by \nthe actor.","cost":"1","gain":"1","max":"100","min_col":"#b355ff","max_col":"#a300d9"},
  120.         "mdf":{"name":"Magic Defense","description":"Reduces the damage of magical skills the actor is \ntargeted with.","cost":"1","gain":"1","max":"100","min_col":"#55ffe6","max_col":"#00d7b7"},
  121.         "agi":{"name":"Agility","description":"Determines how soon the actor will be able to \npreform a turn in battle.","cost":"1","gain":"1","max":"100","min_col":"#fbff55","max_col":"#d9d300"},      
  122.         "luk":{"name":"Luck","description":"Influences various luck factors for the actor in \ntheir favor.","cost":"1","gain":"1","max":"100","min_col":"#ff55e6","max_col":"#cc00ad"},
  123.         "hit":{"name":"Hit Rate","description":"Increases the chance of skills hitting their \ntarget.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  124.         "eva":{"name":"Evasion Rate","description":"Increases the likely-hood of an actor evading\na physical skill.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  125.         "cri":{"name":"Critical Rate","description":"Determines how likely an actor will preform \na critical hit.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  126.         "cev":{"name":"Critical Evasion Rate","description":"Decreases the likely-hood of skills targeting \nthe actor being critical.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  127.         "mev":{"name":"Magic Evasion Rate","description":"Increases the likely-hood of an actor evading \na magical skill.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  128.         "mrf":{"name":"Magic Reflection Rate","description":"The higher the value, the more likely magical \nreflection will occur.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  129.         "cnt":{"name":"Counter Attack Rate","description":"The higher the value, the more likely physical \nreflection will occur.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  130.         "hrg":{"name":"Hp Regeneration","description":"The rate in which the actor gains HP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  131.         "mrg":{"name":"Mp Regeneration","description":"The rate in which the actor gains MP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  132.         "trg":{"name":"Tp Regeneration","description":"The rate in which the actor gains TP each turn.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  133.         "tgr":{"name":"Target Rate","description":"Increases the chance of the actor being attacked.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  134.         "grd":{"name":"Guard Effect Rate","description":"Increases the effectiveness of the actor's guard","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  135.         "rec":{"name":"Recovery Effect Rate","description":"Determines the effectiveness of recovery skills.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  136.         "pha":{"name":"Pharmacology","description":"Determines the effectiveness of recovery items.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  137.         "mcr":{"name":"Mp Cost Rate","description":"The rate in which MP skills cost.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  138.         "tcr":{"name":"Tp Charge Rate","description":"The rate in which TP skills cost.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  139.         "pdr":{"name":"Physical Damage Rate","description":"The rate in which physical damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  140.         "mdr":{"name":"Magical Damage Rate","description":"The rate in which magical damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  141.         "fdr":{"name":"Floor Damage Rate","description":"The rate in which floor damage occurs.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  142.         "exr":{"name":"Experience Rate","description":"The rate in which the actor gains experience.","cost":"2","gain":"0.005","max":"0.5","min_col":"#aaaaaa","max_col":"#ffffff"},
  143.         "mtp":{"name":"Max TP","description":"The maximum amount of TP for the actor.","cost":"1","gain":"2","max":"200","min_col":"#6666ff","max_col":"#0000ff"}
  144.     }));
  145. };
  146.  
  147. //=============================================================================
  148. // DataManagerEX
  149. //=============================================================================
  150.  
  151. DataManagerEX.getStatDistributionHtmlOptions = function() {
  152.     return `<option value="mhp" selected>Max HP</option>
  153.             <option value="mmp">Max MP</option>
  154.             <option value="mtp">Max TP</option>
  155.             <option value="atk">Attack</option>
  156.             <option value="def">Defense</option>
  157.             <option value="mat">Magical Attack</option>
  158.             <option value="mdf">Magical Defense</option>
  159.             <option value="agi">Agility</option>
  160.             <option value="luk">Luck</option>
  161.             <option value="frame">   </option>
  162.             <option value="hit">Hit Rate</option>
  163.             <option value="eva">Evasion Rate</option>
  164.             <option value="cri">Critical Rate</option>
  165.             <option value="cev">Critical Evasion Rate</option>
  166.             <option value="mev">Magic Evasion Rate</option>
  167.             <option value="mrf">Magic Reflection Rate</option>
  168.             <option value="cnt">Counter Attack Rate</option>
  169.             <option value="hrg">Hp Regeneration</option>
  170.             <option value="mrg">Mp Regeneration</option>
  171.             <option value="trg">Tp Regeneration</option>
  172.             <option value="frame">   </option>
  173.             <option value="tgr">Target Rate</option>
  174.             <option value="grd">Guard Effect Rate</option>
  175.             <option value="rec">Recovery Effect Rate</option>
  176.             <option value="pha">Pharmacology</option>
  177.             <option value="mcr">Mp Cost Rate</option>
  178.             <option value="tcr">Tp Charge Rate</option>
  179.             <option value="pdr">Physical Damage Rate</option>
  180.             <option value="mdr">Magical Damage Rate</option>
  181.             <option value="fdr">Floor Damage Rate</option>
  182.             <option value="exr">Experience Rate</option>`;
  183. };
  184.  
  185. DataManagerEX.updateStatDistribution = function() {
  186.     const doc = MakerManager.document;
  187.     this._distributeStat = doc.getElementById('StatSelect').value;
  188.     const data = $dataDistributeStats[this._distributeStat];
  189.     if(data) {
  190.         doc.getElementById('name').value = data.name;
  191.         doc.getElementById('description').value = data.description;
  192.         doc.getElementById('cost').value = data.cost;
  193.         doc.getElementById('gain').value = data.gain;
  194.         doc.getElementById('max').value = data.max;
  195.         doc.getElementById('min_col').value = data.min_col;
  196.         doc.getElementById('max_col').value = data.max_col;
  197.     } else if (this._distributeStat == "mtp") {
  198.         $dataDistributeStats[this._distributeStat] = {};
  199.         $dataDistributeStats[this._distributeStat].name = "Max TP";
  200.         $dataDistributeStats[this._distributeStat].description = "The maximum amount of TP for the actor.";
  201.         $dataDistributeStats[this._distributeStat].cost = 1;
  202.         $dataDistributeStats[this._distributeStat].gain = 2;
  203.         $dataDistributeStats[this._distributeStat].max = 200;
  204.         $dataDistributeStats[this._distributeStat].min_col = "#6666ff";
  205.         $dataDistributeStats[this._distributeStat].max_col = "#0000ff";
  206.         DataManagerEX.updateStatDistribution();
  207.         FileManager.saveData($dataDistributeStats, "DistributionStats.json");
  208.     } else {
  209.         doc.getElementById('name').value = '';
  210.         doc.getElementById('description').value = '';
  211.         doc.getElementById('cost').value = '';
  212.         doc.getElementById('gain').value = '';
  213.         doc.getElementById('max').value = '';
  214.         doc.getElementById('min_col').value = '';
  215.         doc.getElementById('max_col').value = '';
  216.     }
  217. };
  218.  
  219. //=============================================================================
  220. // Game_BattlerBase
  221. //=============================================================================
  222.  
  223. Object.defineProperties(Game_BattlerBase.prototype, {
  224.     // Max TP
  225.     mtp: { get: function() { return this.maxTp(); }, configurable: true },
  226. });
  227.  
  228.  
  229. //=============================================================================
  230. // Game_Actor
  231. //=============================================================================
  232.  
  233. ICF.SRDTpDistAddon.maxTp = Game_Actor.prototype.maxTp;
  234. Game_Actor.prototype.maxTp = function() {
  235.     if (!this._distributeTP) this._distributeTP = 0;
  236.     return ICF.SRDTpDistAddon.maxTp.apply(this, arguments) + this._distributeTP;
  237. };
  238.  
  239. ICF.SRDTpDistAddon.clearDistributeStats = Game_Actor.prototype.clearDistributeStats;
  240. Game_Actor.prototype.clearDistributeStats = function() {
  241.     ICF.SRDTpDistAddon.clearDistributeStats.call(this);
  242.     this._distributeTP = 0;
  243. };
  244.  
  245. ICF.SRDTpDistAddon.getAbnormalParam = Game_Actor.prototype.getAbnormalParam;
  246. Game_Actor.prototype.getAbnormalParam = function(param) {
  247.     if (param == "mtp") return this._distributeTP || 0;
  248.     return ICF.SRDTpDistAddon.getAbnormalParam.apply(this, arguments);
  249. };
  250.  
  251. ICF.SRDTpDistAddon.addAbnormalParam = Game_Actor.prototype.addAbnormalParam;
  252. Game_Actor.prototype.addAbnormalParam = function(param, value) {
  253.     ICF.SRDTpDistAddon.addAbnormalParam.apply(this, arguments);
  254.     if (param == "mtp") {
  255.         this._distributeTP = this._distributeTP || 0;
  256.         this._distributeTP += value;
  257.     }
  258. };
  259.  
  260. //=============================================================================
  261. // End of File
  262. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement