Advertisement
ICF-Soft

ICF-Soft Formula Shortcut RPG Maker MV

May 25th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Formula Shortcut
  3. // ICFSoft_FormulaShortcut.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_FormulaShortcut = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.FormulaShortcut = ICF.FormulaShortcut || {};
  11.  
  12. //=============================================================================
  13.  /*:
  14.  * @plugindesc v1.00 This plugin adds a lot of usefull shortcuts to use in
  15.  * formulas.
  16.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  17.  *
  18.  * @help
  19.  * ============================================================================
  20.  * Introduction
  21.  * ============================================================================
  22.  *
  23.  * In skills and items there are fields to place a formula to determine damage
  24.  * and heal.
  25.  * Also is known that some plugins enables more places to put formulas like in
  26.  * notes, comments, plugin params, etc...
  27.  * Sometimes there isn't enough space or formulas become too complicated.
  28.  *
  29.  * With this plugin you can use some shortcuts and simplify formulas to make
  30.  * the effect you want.
  31.  *
  32.  * ============================================================================
  33.  * How to use
  34.  * ============================================================================
  35.  *
  36.  * You can use shortcuts same way as other params inside formulas:
  37.  *
  38.  * highparam() lowparam()
  39.  *
  40.  *  - To check best or worst param.
  41.  *
  42.  * hprate() hppercent()
  43.  *
  44.  *  - You can check how much is hp filled in rate (0-1) or percent (0-100).
  45.  *    Same is aplicable for mp and tp.
  46.  *
  47.  * wound() mpl() etp()
  48.  *
  49.  *  - You can also check how much hp/mp are losed or tp empty.
  50.  *    Can also check rate or percent.
  51.  *
  52.  * teamhp() teamwound() allteamwound()
  53.  *
  54.  *  - You can check entire team hp remain, hp loss (alive members) and all hp
  55.  *    loss (alive and defeated ones). Also for mp and tp.
  56.  *
  57.  * teamatk() avgatk() entireatk()
  58.  *
  59.  *  - You can use the attack of the entire alive team, the average attack and
  60.  *    the attack of the entire team (alive and defeated ones).
  61.  *    Aplicable for def, mat, mdf, agi and luk.
  62.  *
  63.  * ============================================================================
  64.  * Incompatibilities
  65.  * ============================================================================
  66.  *
  67.  * There's no known incompatible plugins yet.
  68.  *
  69.  * ============================================================================
  70.  * Known isues
  71.  * ============================================================================
  72.  *
  73.  * Not yet.
  74.  *
  75.  * ============================================================================
  76.  *
  77.  * For commercial and non-commercial games.
  78.  * Credit to ICF-Soft.
  79.  * This entire header must be included with plugin.
  80.  *
  81.  * ============================================================================
  82. */
  83. //=============================================================================
  84.  /*:es
  85.  * @plugindesc v1.00 Este complemento añade atajos útiles para simplificar las
  86.  * fórmulas.
  87.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  88.  *
  89.  * @help
  90.  * ============================================================================
  91.  * Introducción
  92.  * ============================================================================
  93.  *
  94.  * En las habilidades y objetos hay campos en donde poner una fórmula para
  95.  * calcular el daño y la curación.
  96.  * Además se sabe que hay plugins que permiten poner fórmulas en las notas,
  97.  * comentarios, parámetros en el plugin, etc...
  98.  * Varias veces no hay espacio suficiente o las fórmulas se complican.
  99.  *
  100.  * Con este plugin puedes usar atajos y simplificar fórmulas consiguiendo el
  101.  * efecto deseado.
  102.  *
  103.  * ============================================================================
  104.  * Uso
  105.  * ============================================================================
  106.  *
  107.  * Puedes usar los atajos del mismo modo que otros parámetros en las fórmulas:
  108.  *
  109.  * highparam() lowparam()
  110.  *
  111.  *  - Para usar el mejor o el peor parámetro.
  112.  *
  113.  * hprate() hppercent()
  114.  *
  115.  *  - Comprobar cuanta vida queda en proporción (0-1) o porcentaje (0-100).
  116.  *    También se aplica a mp y tp.
  117.  *
  118.  * wound() mpl() etp()
  119.  *
  120.  *  - Además puedes comprobar cuanto hp/mp se ha perdido o tp vacío.
  121.  *    Incluso en proporción o porcentaje.
  122.  *
  123.  * teamhp() teamwound() allteamwound()
  124.  *
  125.  *  - Para comprobar cuanta hp queda a todo el equipo, el hp perdido de los que
  126.  *    siguen en pie o el hp perdido de todos (en pie y caidos).
  127.  *    También para mp y tp.
  128.  *
  129.  * teamatk() avgatk() entireatk()
  130.  *
  131.  *  - Puedes usar el ataque de todo el equipo en pie, ya media de sus ataques
  132.  *    y el ataque de todos (en pie y caidos).
  133.  *    También para def, mat, mdf, agi y luk.
  134.  *
  135.  * ============================================================================
  136.  * Incompatibilidades
  137.  * ============================================================================
  138.  *
  139.  * No se conocen complementos que sean incompatibles hasta la fecha.
  140.  *
  141.  * ============================================================================
  142.  * Problemas conocidos
  143.  * ============================================================================
  144.  *
  145.  * Por el momento ninguno.
  146.  *
  147.  * ============================================================================
  148.  *
  149.  * Para juegos comerciales y no comerciales.
  150.  * Se debe incluir a ICF-Soft en los créditos.
  151.  * Esta cabecera debe incluirse íntegramente con el plugin.
  152.  *
  153.  * ============================================================================
  154. */
  155. //=============================================================================
  156.  
  157. //=============================================================================
  158. // Game_BattlerBase
  159. //=============================================================================
  160.  
  161. Game_BattlerBase.prototype.highparam = function() {
  162.     return Math.max(this.param(2),this.param(3),this.param(4),this.param(5),this.param(6),this.param(7));
  163. };
  164.  
  165. Game_BattlerBase.prototype.lowparam = function() {
  166.     return Math.min(this.param(2),this.param(3),this.param(4),this.param(5),this.param(6),this.param(7));
  167. };
  168.  
  169. Game_BattlerBase.prototype.hprate = function() {
  170.     return this.hp / this.mhp;
  171. };
  172.  
  173. Game_BattlerBase.prototype.hppercent = function() {
  174.     return Math.floor(100 * this.hp / this.mhp);
  175. };
  176.  
  177. Game_BattlerBase.prototype.wound = function() {
  178.     return this.mhp - this.hp;
  179. };
  180.  
  181. Game_BattlerBase.prototype.woundrate = function() {
  182.     return 1 - (this.hp / this.mhp);
  183. };
  184.  
  185. Game_BattlerBase.prototype.woundpercent = function() {
  186.     return 100 - Math.floor(100 * this.hp / this.mhp);
  187. };
  188.  
  189. Game_BattlerBase.prototype.mprate = function() {
  190.     return this.mp / this.mmp;
  191. };
  192.  
  193. Game_BattlerBase.prototype.mppercent = function() {
  194.     return Math.floor(100 * this.mp / this.mmp);
  195. };
  196.  
  197. Game_BattlerBase.prototype.mpl = function() {
  198.     return this.mmp - this.mp;
  199. };
  200.  
  201. Game_BattlerBase.prototype.mplrate = function() {
  202.     return 1 - (this.mp / this.mmp);
  203. };
  204.  
  205. Game_BattlerBase.prototype.mplpercent = function() {
  206.     return 100 - Math.floor(100 * this.mp / this.mmp);
  207. };
  208.  
  209. Game_BattlerBase.prototype.tprate = function() {
  210.     return this.tp / this.maxTp();
  211. };
  212.  
  213. Game_BattlerBase.prototype.tppercent = function() {
  214.     return Math.floor(100 * this.tp / this.maxTp());
  215. };
  216.  
  217. Game_BattlerBase.prototype.etp = function() {
  218.     return this.maxTp() - this.tp;
  219. };
  220.  
  221. Game_BattlerBase.prototype.etprate = function() {
  222.     return 1 - (this.tp / this.maxTp());
  223. };
  224.  
  225. Game_BattlerBase.prototype.etppercent = function() {
  226.     return 100 - Math.floor(100 * this.tp / this.maxTp());
  227. };
  228.  
  229. Game_BattlerBase.prototype.teamparam = function(paramid) {
  230.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  231.         return r + battler.param(paramid);
  232.     }, 0);
  233. };
  234.  
  235. Game_BattlerBase.prototype.avgparam = function(paramid) {
  236.     var ary = this.friendsUnit().aliveMembers();
  237.     return ary.reduce(function(r, battler) {
  238.         return r + battler.param(paramid);
  239.     }, 0) / ary.length;
  240. };
  241.  
  242. Game_BattlerBase.prototype.entireparam = function(paramid) {
  243.     return this.friendsUnit().members().reduce(function(r, battler) {
  244.         return r + battler.param(paramid);
  245.     }, 0);
  246. };
  247.  
  248. Game_BattlerBase.prototype.teamhp = function() {
  249.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  250.         return r + battler.hp;
  251.     }, 0);
  252. };
  253.  
  254. Game_BattlerBase.prototype.teamwound = function() {
  255.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  256.         return r + battler.mhp - battler.hp;
  257.     }, 0);
  258. };
  259.  
  260. Game_BattlerBase.prototype.allteamwound = function() {
  261.     return this.friendsUnit().members().reduce(function(r, battler) {
  262.         return r + battler.mhp - battler.hp;
  263.     }, 0);
  264. };
  265.  
  266. Game_BattlerBase.prototype.teammp = function() {
  267.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  268.         return r + battler.mp;
  269.     }, 0);
  270. };
  271.  
  272. Game_BattlerBase.prototype.teammpl = function() {
  273.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  274.         return r + battler.mmp - battler.mp;
  275.     }, 0);
  276. };
  277.  
  278. Game_BattlerBase.prototype.allteammpl = function() {
  279.     return this.friendsUnit().members().reduce(function(r, battler) {
  280.         return r + battler.mmp - battler.mp;
  281.     }, 0);
  282. };
  283.  
  284. Game_BattlerBase.prototype.teamtp = function() {
  285.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  286.         return r + battler.tp;
  287.     }, 0);
  288. };
  289.  
  290. Game_BattlerBase.prototype.teametp = function() {
  291.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  292.         return r + battler.maxTp() - battler.tp;
  293.     }, 0);
  294. };
  295.  
  296. Game_BattlerBase.prototype.allteametp = function() {
  297.     return this.friendsUnit().members().reduce(function(r, battler) {
  298.         return r + battler.maxTp() - battler.tp;
  299.     }, 0);
  300. };
  301.  
  302. Game_BattlerBase.prototype.teamatk = function() {
  303.     return this.teamparam(2);
  304. };
  305.  
  306. Game_BattlerBase.prototype.teamdef = function() {
  307.     return this.teamparam(3);
  308. };
  309.  
  310. Game_BattlerBase.prototype.teammat = function() {
  311.     return this.teamparam(4);
  312. };
  313.  
  314. Game_BattlerBase.prototype.teammdf = function() {
  315.     return this.teamparam(5);
  316. };
  317.  
  318. Game_BattlerBase.prototype.teamagi = function() {
  319.     return this.teamparam(6);
  320. };
  321.  
  322. Game_BattlerBase.prototype.teamluk = function() {
  323.     return this.teamparam(7);
  324. };
  325.  
  326. Game_BattlerBase.prototype.avgatk = function() {
  327.     return this.avgparam(2);
  328. };
  329.  
  330. Game_BattlerBase.prototype.avgdef = function() {
  331.     return this.avgparam(3);
  332. };
  333.  
  334. Game_BattlerBase.prototype.avgmat = function() {
  335.     return this.avgparam(4);
  336. };
  337.  
  338. Game_BattlerBase.prototype.avgmdf = function() {
  339.     return this.avgparam(5);
  340. };
  341.  
  342. Game_BattlerBase.prototype.avgagi = function() {
  343.     return this.avgparam(6);
  344. };
  345.  
  346. Game_BattlerBase.prototype.avgluk = function() {
  347.     return this.avgparam(7);
  348. };
  349.  
  350. Game_BattlerBase.prototype.entireatk = function() {
  351.     return this.entireparam(2);
  352. };
  353.  
  354. Game_BattlerBase.prototype.entiredef = function() {
  355.     return this.entireparam(3);
  356. };
  357.  
  358. Game_BattlerBase.prototype.entiremat = function() {
  359.     return this.entireparam(4);
  360. };
  361.  
  362. Game_BattlerBase.prototype.entiremdf = function() {
  363.     return this.entireparam(5);
  364. };
  365.  
  366. Game_BattlerBase.prototype.entireagi = function() {
  367.     return this.entireparam(6);
  368. };
  369.  
  370. Game_BattlerBase.prototype.entireluk = function() {
  371.     return this.entireparam(7);
  372. };
  373.  
  374. //=============================================================================
  375. // End of File
  376. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement