Advertisement
ICF-Soft

ICF-Soft Formula Shortcut 1.01 RPG Maker MV

Jul 16th, 2016
117
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.01 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, luk, params created from ICFSoft
  62.  *    Params Core and x/sparams.
  63.  *
  64.  * ============================================================================
  65.  * Incompatibilities
  66.  * ============================================================================
  67.  *
  68.  * There's no known incompatible plugins yet.
  69.  *
  70.  * ============================================================================
  71.  * Known isues
  72.  * ============================================================================
  73.  *
  74.  * Not yet.
  75.  *
  76.  * ============================================================================
  77.  * Changelog
  78.  * ============================================================================
  79.  *
  80.  * Version 1.01:
  81.  * - Added use of ICFSoft Params Core nparams and pparams.
  82.  * - Added team sparams and xparams.
  83.  *
  84.  * Version 1.00:
  85.  * - Finished plugin!
  86.  *
  87.  * ============================================================================
  88.  *
  89.  * For commercial and non-commercial games.
  90.  * Credit to ICF-Soft.
  91.  * This entire header must be included with plugin.
  92.  *
  93.  * ============================================================================
  94. */
  95. //=============================================================================
  96.  /*:es
  97.  * @plugindesc v1.01 Este complemento añade atajos útiles para simplificar las
  98.  * fórmulas.
  99.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  100.  *
  101.  * @help
  102.  * ============================================================================
  103.  * Introducción
  104.  * ============================================================================
  105.  *
  106.  * En las habilidades y objetos hay campos en donde poner una fórmula para
  107.  * calcular el daño y la curación.
  108.  * Además se sabe que hay plugins que permiten poner fórmulas en las notas,
  109.  * comentarios, parámetros en el plugin, etc...
  110.  * Varias veces no hay espacio suficiente o las fórmulas se complican.
  111.  *
  112.  * Con este plugin puedes usar atajos y simplificar fórmulas consiguiendo el
  113.  * efecto deseado.
  114.  *
  115.  * ============================================================================
  116.  * Uso
  117.  * ============================================================================
  118.  *
  119.  * Puedes usar los atajos del mismo modo que otros parámetros en las fórmulas:
  120.  *
  121.  * highparam() lowparam()
  122.  *
  123.  *  - Para usar el mejor o el peor parámetro.
  124.  *
  125.  * hprate() hppercent()
  126.  *
  127.  *  - Comprobar cuanta vida queda en proporción (0-1) o porcentaje (0-100).
  128.  *    También se aplica a mp y tp.
  129.  *
  130.  * wound() mpl() etp()
  131.  *
  132.  *  - Además puedes comprobar cuanto hp/mp se ha perdido o tp vacío.
  133.  *    Incluso en proporción o porcentaje.
  134.  *
  135.  * teamhp() teamwound() allteamwound()
  136.  *
  137.  *  - Para comprobar cuanta hp queda a todo el equipo, el hp perdido de los que
  138.  *    siguen en pie o el hp perdido de todos (en pie y caidos).
  139.  *    También para mp y tp.
  140.  *
  141.  * teamatk() avgatk() entireatk()
  142.  *
  143.  *  - Puedes usar el ataque de todo el equipo en pie, ya media de sus ataques
  144.  *    y el ataque de todos (en pie y caidos).
  145.  *    También para def, mat, mdf, agi, luk, los parámetros creados con el
  146.  *    complemento ICFSoft Params Core y los x/sparams.
  147.  *
  148.  * ============================================================================
  149.  * Incompatibilidades
  150.  * ============================================================================
  151.  *
  152.  * No se conocen complementos que sean incompatibles hasta la fecha.
  153.  *
  154.  * ============================================================================
  155.  * Problemas conocidos
  156.  * ============================================================================
  157.  *
  158.  * Por el momento ninguno.
  159.  *
  160.  * ============================================================================
  161.  * Historial de versiones
  162.  * ============================================================================
  163.  *
  164.  * Versión 1.01:
  165.  * - Se ha añadido el uso de los nparams y pparams del ICFSoft Params Core.
  166.  * - Se ha añadido el uso de sparams y xparams.
  167.  *
  168.  * Versión 1.00:
  169.  * - Complemento terminado.
  170.  *
  171.  * ============================================================================
  172.  *
  173.  * Para juegos comerciales y no comerciales.
  174.  * Se debe incluir a ICF-Soft en los créditos.
  175.  * Esta cabecera debe incluirse íntegramente con el plugin.
  176.  *
  177.  * ============================================================================
  178. */
  179. //=============================================================================
  180.  
  181. //=============================================================================
  182. // Game_BattlerBase
  183. //=============================================================================
  184.  
  185. Game_BattlerBase.prototype.highparam = function() {
  186.     return Math.max(this.param(2),this.param(3),this.param(4),this.param(5),this.param(6),this.param(7));
  187. };
  188.  
  189. Game_BattlerBase.prototype.lowparam = function() {
  190.     return Math.min(this.param(2),this.param(3),this.param(4),this.param(5),this.param(6),this.param(7));
  191. };
  192.  
  193. Game_BattlerBase.prototype.hprate = function() {
  194.     return this.hp / this.mhp;
  195. };
  196.  
  197. Game_BattlerBase.prototype.hppercent = function() {
  198.     return Math.floor(100 * this.hp / this.mhp);
  199. };
  200.  
  201. Game_BattlerBase.prototype.wound = function() {
  202.     return this.mhp - this.hp;
  203. };
  204.  
  205. Game_BattlerBase.prototype.woundrate = function() {
  206.     return 1 - (this.hp / this.mhp);
  207. };
  208.  
  209. Game_BattlerBase.prototype.woundpercent = function() {
  210.     return 100 - Math.floor(100 * this.hp / this.mhp);
  211. };
  212.  
  213. Game_BattlerBase.prototype.mprate = function() {
  214.     return this.mp / this.mmp;
  215. };
  216.  
  217. Game_BattlerBase.prototype.mppercent = function() {
  218.     return Math.floor(100 * this.mp / this.mmp);
  219. };
  220.  
  221. Game_BattlerBase.prototype.mpl = function() {
  222.     return this.mmp - this.mp;
  223. };
  224.  
  225. Game_BattlerBase.prototype.mplrate = function() {
  226.     return 1 - (this.mp / this.mmp);
  227. };
  228.  
  229. Game_BattlerBase.prototype.mplpercent = function() {
  230.     return 100 - Math.floor(100 * this.mp / this.mmp);
  231. };
  232.  
  233. Game_BattlerBase.prototype.tprate = function() {
  234.     return this.tp / this.maxTp();
  235. };
  236.  
  237. Game_BattlerBase.prototype.tppercent = function() {
  238.     return Math.floor(100 * this.tp / this.maxTp());
  239. };
  240.  
  241. Game_BattlerBase.prototype.etp = function() {
  242.     return this.maxTp() - this.tp;
  243. };
  244.  
  245. Game_BattlerBase.prototype.etprate = function() {
  246.     return 1 - (this.tp / this.maxTp());
  247. };
  248.  
  249. Game_BattlerBase.prototype.etppercent = function() {
  250.     return 100 - Math.floor(100 * this.tp / this.maxTp());
  251. };
  252.  
  253. Game_BattlerBase.prototype.teamparam = function(paramid) {
  254.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  255.         return r + battler.param(paramid);
  256.     }, 0);
  257. };
  258.  
  259. Game_BattlerBase.prototype.avgparam = function(paramid) {
  260.     var ary = this.friendsUnit().aliveMembers();
  261.     return ary.reduce(function(r, battler) {
  262.         return r + battler.param(paramid);
  263.     }, 0) / ary.length;
  264. };
  265.  
  266. Game_BattlerBase.prototype.entireparam = function(paramid) {
  267.     return this.friendsUnit().members().reduce(function(r, battler) {
  268.         return r + battler.param(paramid);
  269.     }, 0);
  270. };
  271.  
  272. Game_BattlerBase.prototype.teamhp = function() {
  273.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  274.         return r + battler.hp;
  275.     }, 0);
  276. };
  277.  
  278. Game_BattlerBase.prototype.teamwound = function() {
  279.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  280.         return r + battler.mhp - battler.hp;
  281.     }, 0);
  282. };
  283.  
  284. Game_BattlerBase.prototype.allteamwound = function() {
  285.     return this.friendsUnit().members().reduce(function(r, battler) {
  286.         return r + battler.mhp - battler.hp;
  287.     }, 0);
  288. };
  289.  
  290. Game_BattlerBase.prototype.teammp = function() {
  291.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  292.         return r + battler.mp;
  293.     }, 0);
  294. };
  295.  
  296. Game_BattlerBase.prototype.teammpl = function() {
  297.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  298.         return r + battler.mmp - battler.mp;
  299.     }, 0);
  300. };
  301.  
  302. Game_BattlerBase.prototype.allteammpl = function() {
  303.     return this.friendsUnit().members().reduce(function(r, battler) {
  304.         return r + battler.mmp - battler.mp;
  305.     }, 0);
  306. };
  307.  
  308. Game_BattlerBase.prototype.teamtp = function() {
  309.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  310.         return r + battler.tp;
  311.     }, 0);
  312. };
  313.  
  314. Game_BattlerBase.prototype.teametp = function() {
  315.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  316.         return r + battler.maxTp() - battler.tp;
  317.     }, 0);
  318. };
  319.  
  320. Game_BattlerBase.prototype.allteametp = function() {
  321.     return this.friendsUnit().members().reduce(function(r, battler) {
  322.         return r + battler.maxTp() - battler.tp;
  323.     }, 0);
  324. };
  325.  
  326. Game_BattlerBase.prototype.teamatk = function() {
  327.     return this.teamparam(2);
  328. };
  329.  
  330. Game_BattlerBase.prototype.teamdef = function() {
  331.     return this.teamparam(3);
  332. };
  333.  
  334. Game_BattlerBase.prototype.teammat = function() {
  335.     return this.teamparam(4);
  336. };
  337.  
  338. Game_BattlerBase.prototype.teammdf = function() {
  339.     return this.teamparam(5);
  340. };
  341.  
  342. Game_BattlerBase.prototype.teamagi = function() {
  343.     return this.teamparam(6);
  344. };
  345.  
  346. Game_BattlerBase.prototype.teamluk = function() {
  347.     return this.teamparam(7);
  348. };
  349.  
  350. Game_BattlerBase.prototype.avgatk = function() {
  351.     return this.avgparam(2);
  352. };
  353.  
  354. Game_BattlerBase.prototype.avgdef = function() {
  355.     return this.avgparam(3);
  356. };
  357.  
  358. Game_BattlerBase.prototype.avgmat = function() {
  359.     return this.avgparam(4);
  360. };
  361.  
  362. Game_BattlerBase.prototype.avgmdf = function() {
  363.     return this.avgparam(5);
  364. };
  365.  
  366. Game_BattlerBase.prototype.avgagi = function() {
  367.     return this.avgparam(6);
  368. };
  369.  
  370. Game_BattlerBase.prototype.avgluk = function() {
  371.     return this.avgparam(7);
  372. };
  373.  
  374. Game_BattlerBase.prototype.entireatk = function() {
  375.     return this.entireparam(2);
  376. };
  377.  
  378. Game_BattlerBase.prototype.entiredef = function() {
  379.     return this.entireparam(3);
  380. };
  381.  
  382. Game_BattlerBase.prototype.entiremat = function() {
  383.     return this.entireparam(4);
  384. };
  385.  
  386. Game_BattlerBase.prototype.entiremdf = function() {
  387.     return this.entireparam(5);
  388. };
  389.  
  390. Game_BattlerBase.prototype.entireagi = function() {
  391.     return this.entireparam(6);
  392. };
  393.  
  394. Game_BattlerBase.prototype.entireluk = function() {
  395.     return this.entireparam(7);
  396. };
  397.  
  398. Game_BattlerBase.prototype.teamxparam = function(paramid) {
  399.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  400.         return r + battler.xparam(paramid);
  401.     }, 0);
  402. };
  403.  
  404. Game_BattlerBase.prototype.avgxparam = function(paramid) {
  405.     var ary = this.friendsUnit().aliveMembers();
  406.     return ary.reduce(function(r, battler) {
  407.         return r + battler.xparam(paramid);
  408.     }, 0) / ary.length;
  409. };
  410.  
  411. Game_BattlerBase.prototype.entirexparam = function(paramid) {
  412.     return this.friendsUnit().members().reduce(function(r, battler) {
  413.         return r + battler.xparam(paramid);
  414.     }, 0);
  415. };
  416.  
  417. Game_BattlerBase.prototype.teamhit = function() {
  418.     return this.teamxparam(0);
  419. };
  420.  
  421. Game_BattlerBase.prototype.teameva = function() {
  422.     return this.teamxparam(1);
  423. };
  424.  
  425. Game_BattlerBase.prototype.teamcri = function() {
  426.     return this.teamxparam(2);
  427. };
  428.  
  429. Game_BattlerBase.prototype.teamcev = function() {
  430.     return this.teamxparam(3);
  431. };
  432.  
  433. Game_BattlerBase.prototype.teammev = function() {
  434.     return this.teamxparam(4);
  435. };
  436.  
  437. Game_BattlerBase.prototype.teammrf = function() {
  438.     return this.teamxparam(5);
  439. };
  440.  
  441. Game_BattlerBase.prototype.teamcnt = function() {
  442.     return this.teamxparam(6);
  443. };
  444.  
  445. Game_BattlerBase.prototype.teamhrg = function() {
  446.     return this.teamxparam(7);
  447. };
  448.  
  449. Game_BattlerBase.prototype.teammrg = function() {
  450.     return this.teamxparam(8);
  451. };
  452.  
  453. Game_BattlerBase.prototype.teamtrg = function() {
  454.     return this.teamxparam(9);
  455. };
  456.  
  457. Game_BattlerBase.prototype.avghit = function() {
  458.     return this.avgxparam(0);
  459. };
  460.  
  461. Game_BattlerBase.prototype.avgeva = function() {
  462.     return this.avgxparam(1);
  463. };
  464.  
  465. Game_BattlerBase.prototype.avgcri = function() {
  466.     return this.avgxparam(2);
  467. };
  468.  
  469. Game_BattlerBase.prototype.avgcev = function() {
  470.     return this.avgxparam(3);
  471. };
  472.  
  473. Game_BattlerBase.prototype.avgmev = function() {
  474.     return this.avgxparam(4);
  475. };
  476.  
  477. Game_BattlerBase.prototype.avgmrf = function() {
  478.     return this.avgxparam(5);
  479. };
  480.  
  481. Game_BattlerBase.prototype.avgcnt = function() {
  482.     return this.avgxparam(6);
  483. };
  484.  
  485. Game_BattlerBase.prototype.avghrg = function() {
  486.     return this.avgxparam(7);
  487. };
  488.  
  489. Game_BattlerBase.prototype.avgmrg = function() {
  490.     return this.avgxparam(8);
  491. };
  492.  
  493. Game_BattlerBase.prototype.avgtrg = function() {
  494.     return this.avgxparam(9);
  495. };
  496.  
  497. Game_BattlerBase.prototype.entirehit = function() {
  498.     return this.entirexparam(0);
  499. };
  500.  
  501. Game_BattlerBase.prototype.entireeva = function() {
  502.     return this.entirexparam(1);
  503. };
  504.  
  505. Game_BattlerBase.prototype.entirecri = function() {
  506.     return this.entirexparam(2);
  507. };
  508.  
  509. Game_BattlerBase.prototype.entirecev = function() {
  510.     return this.entirexparam(3);
  511. };
  512.  
  513. Game_BattlerBase.prototype.entiremev = function() {
  514.     return this.entirexparam(4);
  515. };
  516.  
  517. Game_BattlerBase.prototype.entiremrf = function() {
  518.     return this.entirexparam(5);
  519. };
  520.  
  521. Game_BattlerBase.prototype.entirecnt = function() {
  522.     return this.entirexparam(6);
  523. };
  524.  
  525. Game_BattlerBase.prototype.entirehrg = function() {
  526.     return this.entirexparam(7);
  527. };
  528.  
  529. Game_BattlerBase.prototype.entiremrg = function() {
  530.     return this.entirexparam(8);
  531. };
  532.  
  533. Game_BattlerBase.prototype.entiretrg = function() {
  534.     return this.entirexparam(9);
  535. };
  536.  
  537. Game_BattlerBase.prototype.teamsparam = function(paramid) {
  538.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  539.         return r + battler.sparam(paramid) - 1;
  540.     }, 1);
  541. };
  542.  
  543. Game_BattlerBase.prototype.avgsparam = function(paramid) {
  544.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  545.         return r * battler.sparam(paramid);
  546.     }, 1);
  547. };
  548.  
  549. Game_BattlerBase.prototype.entiresparam = function(paramid) {
  550.     return this.friendsUnit().members().reduce(function(r, battler) {
  551.         return r + battler.sparam(paramid) - 1;
  552.     }, 1);
  553. };
  554.  
  555. Game_BattlerBase.prototype.teamtgr = function() {
  556.     return this.teamsparam(0);
  557. };
  558.  
  559. Game_BattlerBase.prototype.teamgrd = function() {
  560.     return this.teamsparam(1);
  561. };
  562.  
  563. Game_BattlerBase.prototype.teamrec = function() {
  564.     return this.teamsparam(2);
  565. };
  566.  
  567. Game_BattlerBase.prototype.teampha = function() {
  568.     return this.teamsparam(3);
  569. };
  570.  
  571. Game_BattlerBase.prototype.teammcr = function() {
  572.     return this.teamsparam(4);
  573. };
  574.  
  575. Game_BattlerBase.prototype.teamtcr = function() {
  576.     return this.teamsparam(5);
  577. };
  578.  
  579. Game_BattlerBase.prototype.teampdr = function() {
  580.     return this.teamsparam(6);
  581. };
  582.  
  583. Game_BattlerBase.prototype.teammdr = function() {
  584.     return this.teamsparam(7);
  585. };
  586.  
  587. Game_BattlerBase.prototype.teamfdr = function() {
  588.     return this.teamsparam(8);
  589. };
  590.  
  591. Game_BattlerBase.prototype.teamexr = function() {
  592.     return this.teamsparam(9);
  593. };
  594.  
  595. Game_BattlerBase.prototype.avgtgr = function() {
  596.     return this.avgsparam(0);
  597. };
  598.  
  599. Game_BattlerBase.prototype.avggrd = function() {
  600.     return this.avgsparam(1);
  601. };
  602.  
  603. Game_BattlerBase.prototype.avgrec = function() {
  604.     return this.avgsparam(2);
  605. };
  606.  
  607. Game_BattlerBase.prototype.avgpha = function() {
  608.     return this.avgsparam(3);
  609. };
  610.  
  611. Game_BattlerBase.prototype.avgmcr = function() {
  612.     return this.avgsparam(4);
  613. };
  614.  
  615. Game_BattlerBase.prototype.avgtcr = function() {
  616.     return this.avgsparam(5);
  617. };
  618.  
  619. Game_BattlerBase.prototype.avgpdr = function() {
  620.     return this.avgsparam(6);
  621. };
  622.  
  623. Game_BattlerBase.prototype.avgmdr = function() {
  624.     return this.avgsparam(7);
  625. };
  626.  
  627. Game_BattlerBase.prototype.avgfdr = function() {
  628.     return this.avgsparam(8);
  629. };
  630.  
  631. Game_BattlerBase.prototype.avgexr = function() {
  632.     return this.avgsparam(9);
  633. };
  634.  
  635. Game_BattlerBase.prototype.entiretgr = function() {
  636.     return this.entiresparam(0);
  637. };
  638.  
  639. Game_BattlerBase.prototype.entiregrd = function() {
  640.     return this.entiresparam(1);
  641. };
  642.  
  643. Game_BattlerBase.prototype.entirerec = function() {
  644.     return this.entiresparam(2);
  645. };
  646.  
  647. Game_BattlerBase.prototype.entirepha = function() {
  648.     return this.entiresparam(3);
  649. };
  650.  
  651. Game_BattlerBase.prototype.entiremcr = function() {
  652.     return this.entiresparam(4);
  653. };
  654.  
  655. Game_BattlerBase.prototype.entiretcr = function() {
  656.     return this.entiresparam(5);
  657. };
  658.  
  659. Game_BattlerBase.prototype.entirepdr = function() {
  660.     return this.entiresparam(6);
  661. };
  662.  
  663. Game_BattlerBase.prototype.entiremdr = function() {
  664.     return this.entiresparam(7);
  665. };
  666.  
  667. Game_BattlerBase.prototype.entirefdr = function() {
  668.     return this.entiresparam(8);
  669. };
  670.  
  671. Game_BattlerBase.prototype.entireexr = function() {
  672.     return this.entiresparam(9);
  673. };
  674.  
  675. if (Imported.ICFSoft_ParamCore) {
  676.  
  677.     Game_BattlerBase.prototype.teamnparam = function(paramid) {
  678.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  679.         return r + battler.NParam(paramid);
  680.     }, 0);
  681.     };
  682.  
  683.     Game_BattlerBase.prototype.avgnparam = function(paramid) {
  684.     var ary = this.friendsUnit().aliveMembers();
  685.     return ary.reduce(function(r, battler) {
  686.         return r + battler.NParam(paramid);
  687.     }, 0) / ary.length;
  688.     };
  689.  
  690.     Game_BattlerBase.prototype.entirenparam = function(paramid) {
  691.     return this.friendsUnit().members().reduce(function(r, battler) {
  692.         return r + battler.NParam(paramid);
  693.     }, 0);
  694.     };
  695.  
  696.     Game_BattlerBase.prototype.teampparam = function(paramid) {
  697.     return this.friendsUnit().aliveMembers().reduce(function(r, battler) {
  698.         return r + battler.PParam(paramid);
  699.     }, 0);
  700.     };
  701.  
  702.     Game_BattlerBase.prototype.avgpparam = function(paramid) {
  703.     var ary = this.friendsUnit().aliveMembers();
  704.     return ary.reduce(function(r, battler) {
  705.         return r + battler.PParam(paramid);
  706.     }, 0) / ary.length;
  707.     };
  708.  
  709.     Game_BattlerBase.prototype.entirepparam = function(paramid) {
  710.     return this.friendsUnit().members().reduce(function(r, battler) {
  711.         return r + battler.PParam(paramid);
  712.     }, 0);
  713.     };
  714.  
  715.     for (var i = 0; i < 8; i++) {
  716.     if (ICF.Param.NParams[i].length > 0) {
  717.         eval("Game_BattlerBase.prototype.team" + ICF.Param.NParams[i] + " = function() { return this.teamnparam(" + i + ");};");
  718.         eval("Game_BattlerBase.prototype.avg" + ICF.Param.NParams[i] + " = function() { return this.avgnparam(" + i + ");};");
  719.         eval("Game_BattlerBase.prototype.entire" + ICF.Param.NParams[i] + " = function() { return this.entirenparam(" + i + ");};");
  720.     }
  721.     if (ICF.Param.PParams[i].length > 0) {
  722.         eval("Game_BattlerBase.prototype.team" + ICF.Param.PParams[i] + " = function() { return this.teampparam(" + i + ");};");
  723.         eval("Game_BattlerBase.prototype.avg" + ICF.Param.PParams[i] + " = function() { return this.avgpparam(" + i + ");};");
  724.         eval("Game_BattlerBase.prototype.entire" + ICF.Param.PParams[i] + " = function() { return this.entirepparam(" + i + ");};");
  725.     }
  726.     }
  727. }
  728.  
  729. //=============================================================================
  730. // End of File
  731. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement