Advertisement
ICF-Soft

ICF-Soft Main Utility RPG Maker MV

Aug 24th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Main Utility
  3. // ICFSoft_MainUtility.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_MainUtility = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.MainUtility = ICF.MainUtility || {};
  11.  
  12. ICF.MainUtility.Version = 100; // 1.00
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.00b A sdk plugin with a lot of utilities for game
  17.  * and plugin developers.
  18.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  19.  *
  20.  * @help
  21.  * ============================================================================
  22.  * Introduction
  23.  *
  24.  * This is a sdk plugin with a lot of utilities to script easier.
  25.  * It's needed for the mayority of my plugins to work.
  26.  *
  27.  * It includes:
  28.  *  -Special json feature to edit/add data fields.
  29.  *  -Special trait system allowing to add traits to non-trait data (skills
  30.  *      and items), add actor/enemy traits ingame plus a subtraits system.
  31.  *  -Selfswitches/selfvariables system.
  32.  *  -Extended features for some js built-in objects.
  33.  *
  34.  * ============================================================================
  35.  * How to use
  36.  * ============================================================================
  37.  *
  38.  * It uses notetags to add/alter data.
  39.  * For plugin developers it's recommended to show how to use these tags
  40.  * inside your plugins.
  41.  *
  42.  *
  43.  * Json master tag allow to alter data in a particular way. You
  44.  * can add new fields or edit out of field limits, it works in
  45.  * json notation, better than just meta-tags.
  46.  *
  47.  * Use every line between open and close tags to edit a field, first
  48.  * field name followed by a two dots symbol, then one space and the
  49.  * code in json format.
  50.  *
  51.  * Example:
  52.  *
  53.  * <JSON MASTER>
  54.  * gold: 50000000
  55.  * hands_power: [50,100]
  56.  * grade: 'F'
  57.  * </JSON MASTER>
  58.  *
  59.  *
  60.  * Traits master tag allow to add traits througth notebox.
  61.  * Every line between open and close tags are three numbers separated
  62.  * by spaces. It is recomended to use the three numbers even if specified
  63.  * trait uses only two, next inline place can be used for comments.
  64.  * You can use a name instead of first number (see readme for all names).
  65.  *
  66.  * Example:
  67.  *
  68.  * <TRAITS MASTER>
  69.  * elem_rate 1 1.5
  70.  * 21 1 2
  71.  * 31 2 0 -Attack element
  72.  * </TRAITS MASTER>
  73.  *
  74.  *
  75.  * Subtraits master tag allow to add more trait setups for different
  76.  * uses like subclass traits, random enemy/item/equipment traits,
  77.  * alter states tiers and so on. It works like traits master but you
  78.  * dont't need to close tag every time you open a new subtrait setup.
  79.  *
  80.  * Example:
  81.  *
  82.  * <SUBTRAITS MASTER> -Fire slime
  83.  * elem_rate 1 1.5
  84.  * 11 2 0.5
  85.  * 31 2 0 -Fire attack element
  86.  * <SUBTRAITS MASTER> -Cold slime
  87.  * elem_rate 1 1.5
  88.  * 11 2 2.1
  89.  * 31 3 0 -Cold attack element
  90.  * </SUBTRAITS MASTER>
  91.  *
  92.  * Note: More than one plugin can use subtraits in same data for different
  93.  * purposes so you must provide a way to use specific blocks, something
  94.  * like "<MyAmacingPluginSubtraits first last>" can be usefull.
  95.  *
  96.  * To access a subtrait setup use 'item.subtraits[i].traits' instead of
  97.  * 'item.traits', where 'i' is the index.
  98.  * And for trait items use 'item.subtraits[i]' instead of 'item'.
  99.  *
  100.  * ============================================================================
  101.  * Plugin Commands
  102.  * ============================================================================
  103.  *
  104.  * selfswitch x true/false
  105.  * mapswitch x true/false
  106.  * actorswitch actorid x true/false
  107.  *
  108.  *  - Turns on/off specified selfswitch or mapswitch.
  109.  *    You can also use an actorswitch.
  110.  *
  111.  * remoteswitch mapid eventid x true/false
  112.  *
  113.  *  - Turns on/off specified selfswitch or mapswitch remotely.
  114.  *    Use eventid 0 for a mapswitch.
  115.  *
  116.  * selfvariable x value
  117.  * mapvariable x value
  118.  * actorvariable actorid x value
  119.  *
  120.  *  - Changes value of specified selfvariable or mapvariable.
  121.  *    You can also use an actorvariable.
  122.  *
  123.  * remotevariable mapid eventid x value
  124.  *
  125.  *  - Changes value of specified selfvariable or mapvariable remotely.
  126.  *    Use eventid 0 for a mapvariable.
  127.  *
  128.  * actortraitadd actorid code id value
  129.  * partymembertraitadd actorpos code id value
  130.  * enemytraitadd enemy code id value
  131.  *
  132.  *  - Adds an ingame trait to specified actor, actor in party or
  133.  *    in battle enemy.
  134.  *    Doesn't check for repeated traits (same code and id).
  135.  *
  136.  * actortrait actorid code id value
  137.  * partymembertrait actorpos code id value
  138.  * enemytrait enemy code id value
  139.  *
  140.  *  - Ensures an ingame trait to specified actor, actor in party or
  141.  *    in battle enemy. If there isn't it'll be added, if there is at least
  142.  *    one it'll be replaced and all repeated traits will be removed.
  143.  *
  144.  * actortraitplus actorid code id value
  145.  * partymembertraitplus actorpos code id value
  146.  * enemytraitplus enemy code id value
  147.  *
  148.  *  - Increase existing ingame trait to specified actor, actor in party or
  149.  *    in battle enemy by a value. If there isn't it'll be added, and
  150.  *    every repeated trait will be merged togeder by sum.
  151.  *
  152.  * actortraitrate actorid code id value
  153.  * partymembertraitrate actorpos code id value
  154.  * enemytraitrate enemy code id value
  155.  *
  156.  *  - Multiply existing ingame trait to specified actor, actor in party or
  157.  *    in battle enemy by a value. If there isn't it'll be added, and
  158.  *    every repeated trait will be merged togeder by multiplication.
  159.  *
  160.  * removeactortrait actorid code id
  161.  * removepartymembertrait actorpos code id
  162.  * removeenemytraitenemy code id
  163.  *
  164.  *  - Remove all ingame traits with specified code and id to specified actor,
  165.  *    actor in party or in battle enemy.
  166.  *
  167.  * clearactortraits actorid
  168.  * clearpartymembertraits actorpos
  169.  * clearenemytraits enemy
  170.  *
  171.  *  - Remove all ingame traits to specified actor, actor in party or in
  172.  *    battle enemy.
  173.  *
  174.  * ============================================================================
  175.  * Incompatibilities
  176.  * ============================================================================
  177.  *
  178.  * There's no known incompatible plugins yet.
  179.  *
  180.  * ============================================================================
  181.  * Known isues
  182.  * ============================================================================
  183.  *
  184.  * Not yet.
  185.  *
  186.  * ============================================================================
  187.  *
  188.  * For commercial and non-commercial games.
  189.  * Credit to ICF-Soft.
  190.  * Any plugin that needs this to work must add a clausule to say that ICF-Soft
  191.  * must be included in credits page.
  192.  * This entire header and plugin readme files must be included with plugin.
  193.  *
  194.  * ============================================================================
  195. */
  196. //=============================================================================
  197.  /*:es
  198.  * @plugindesc v1.00b Librería sdk con muchas utilidades para desarrolladores
  199.  * de juegos y complementos.
  200.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  201.  *
  202.  * @help
  203.  * ============================================================================
  204.  * Introducción
  205.  * ============================================================================
  206.  *
  207.  * Este complemento es una librería sdk con un montón de utilidades para
  208.  * programar más fácil.
  209.  * Es necesario para la mayoría de mis complementos.
  210.  *
  211.  * Incluye:
  212.  *  -Sistema json para editar/añadir campos.
  213.  *  -sistema especial de características que permite añadir características
  214.  *      en datos que normalmente no tienen (habilidades y objetos), añadir
  215.  *      características a los personajes y enemigos durante el juego y un
  216.  *      sistema especial de subcaracterísticas.
  217.  *  -Sistema de auto interruptores y variables.
  218.  *  -Funciones extra para algunos objetos predefinidos de javascript.
  219.  *
  220.  * ============================================================================
  221.  * Uso
  222.  * ============================================================================
  223.  *
  224.  * Para añadir o editar datos se utilizan las etiquetas en las notas.
  225.  * Para desarrolladores de plugins se recomienda que se muestre cómo usarlas
  226.  * en sus plugins.
  227.  *
  228.  *
  229.  * La etiqueta 'Json master' permite alterar los datos de un modo particular.
  230.  * Puedes añadir nuevos campos o editarlos sin las restricciones predeterminadas,
  231.  * funciona en notación json, mejor que las simples etiquetas meta.
  232.  *
  233.  * Utiliza cada linea entre las etiquetas de abertura y cierre para editar
  234.  * un campo, primero el nombre del campo, luego dos puntos, un espacio y el
  235.  * código en formato json.
  236.  *
  237.  * Ejemplo:
  238.  *
  239.  * <JSON MASTER>
  240.  * gold: 50000000
  241.  * hands_power: [50,100]
  242.  * alias: 'Romistrugio'
  243.  * </JSON MASTER>
  244.  *
  245.  *
  246.  * La etiqueta 'Traits master' permite añadir características o rasgos.
  247.  * En cada linea entre las etiquetas de apertura y cierre van tres números
  248.  * separados por espacios. Se recomienda usar los tres aún cuando el rasgo
  249.  * solo necesite dos, puedes continuar la linea con comentarios.
  250.  * Puedes usar un nombre en lugar del primer número (en el archivo leeme
  251.  * puedes encontrar todos los disponibles).
  252.  *
  253.  * Ejemplo:
  254.  *
  255.  * <TRAITS MASTER>
  256.  * elem_rate 1 1.5
  257.  * 21 1 2
  258.  * 31 2 0 -Elemento de ataque
  259.  * </TRAITS MASTER>
  260.  *
  261.  *
  262.  * La etiqueta 'Subtraits master' permite añadir conjuntos de rasgos para
  263.  * diferentes usos tales como rasgos de subclase, rasgos aleatorios para
  264.  * enemigos/objetos/armas, fases de un estado alterado y más.
  265.  * Funciona como la etiqueta anterior pero no necesitas cerrar antes de abrir
  266.  * un nuevo subconjunto.
  267.  *
  268.  * Ejemplo:
  269.  *
  270.  * <SUBTRAITS MASTER> -Limo de fuego
  271.  * elem_rate 1 1.5
  272.  * 11 2 0.5
  273.  * 31 2 0 -Ataca con fuego
  274.  * <SUBTRAITS MASTER> -Limo de hielo
  275.  * elem_rate 1 1.5
  276.  * 11 2 2.1
  277.  * 31 3 0 -Ataca con hielo
  278.  * </SUBTRAITS MASTER>
  279.  *
  280.  * Nota: Varios complementos pueden usar subconjuntos para las mismas tablas
  281.  * de la base de datos para diferentes propósitos, de modo que debes
  282.  * proveer un modo de usar subconjuntos específicos, por ejemplo algo así
  283.  * como "<MiIncreiblePluginSubtraits primero ultimo>" podría ser útil.
  284.  *
  285.  * Para acceder a un subconjunto se utiliza 'item.subtraits[i].traits' en
  286.  * lugar de 'item.traits', donde 'i' es el índice.
  287.  * Y para el objeto del subconjunto usar 'item.subtraits[i]' en lugar de 'item'.
  288.  *
  289.  * ============================================================================
  290.  * Comandos de complemento
  291.  * ============================================================================
  292.  *
  293.  * selfswitch x true/false
  294.  * mapswitch x true/false
  295.  * actorswitch actorid x true/false
  296.  *
  297.  *  - Activa o desactiva el autointerruptor, interruptor de mapa
  298.  *    o de personaje.
  299.  *
  300.  * remoteswitch mapid eventid x true/false
  301.  *
  302.  *  - Activa o desactiva el autointerruptor o interruptor de mapa específico
  303.  *    de forma remota. Usar eventid 0 para interruptor de mapa.
  304.  *
  305.  * selfvariable x value
  306.  * mapvariable x value
  307.  * actorvariable actorid x value
  308.  *
  309.  *  - Cambia el valor de la variable de evento, mapa o personaje.
  310.  *
  311.  * remotevariable mapid eventid x value
  312.  *
  313.  *  - Cambia el valor de la variable de evento o mapa específico
  314.  *    de forma remota. Usar eventid 0 para interruptor de mapa.
  315.  *
  316.  * actortraitadd actorid code id value
  317.  * partymembertraitadd actorpos code id value
  318.  * enemytraitadd enemy code id value
  319.  *
  320.  *  - Añade un rasgo dentro del juego para el personaje, personaje del
  321.  *    grupo o enemigo.
  322.  *    No comprueba si existen repetidos (mismos code e id).
  323.  *
  324.  * actortrait actorid code id value
  325.  * partymembertrait actorpos code id value
  326.  * enemytrait enemy code id value
  327.  *
  328.  *  - Asegura un rasgo dentro del juego para el personaje, personaje del
  329.  *    grupo o enemigo. Si no hay se añade, si hay almenos uno se
  330.  *    sobreescribe y el resto se elimina.
  331.  *
  332.  * actortraitplus actorid code id value
  333.  * partymembertraitplus actorpos code id value
  334.  * enemytraitplus enemy code id value
  335.  *
  336.  *  - Incrementa un rasgo dentro del juego para el personaje, personaje del
  337.  *    grupo o enemigo. Si no hay se añade, si hay almenos uno se
  338.  *    todos los que tenga se combinan mediante suma.
  339.  *
  340.  * actortraitrate actorid code id value
  341.  * partymembertraitrate actorpos code id value
  342.  * enemytraitrate enemy code id value
  343.  *
  344.  *  - Multiplica un rasgo dentro del juego para el personaje, personaje del
  345.  *    grupo o enemigo. Si no hay se añade, si hay almenos uno se
  346.  *    todos los que tenga se combinan mediante multiplicación.
  347.  *
  348.  * removeactortrait actorid code id
  349.  * removepartymembertrait actorpos code id
  350.  * removeenemytraitenemy code id
  351.  *
  352.  *  - Elimina todos los rasgos dentro del juego con código e id específicos
  353.  *    del personaje, personaje del grupo o enemigo.
  354.  *
  355.  * clearactortraits actorid
  356.  * clearpartymembertraits actorpos
  357.  * clearenemytraits enemy
  358.  *
  359.  *  - Elimina todos los rasgos dentro del juego del personaje, personaje
  360.  *    del grupo o enemigo.
  361.  *
  362.  * ============================================================================
  363.  * Incompatibilidades
  364.  * ============================================================================
  365.  *
  366.  * No se conocen complementos que sean incompatibles hasta la fecha.
  367.  *
  368.  * ============================================================================
  369.  * Problemas conocidos
  370.  * ============================================================================
  371.  *
  372.  * Por el momento ninguno.
  373.  *
  374.  * ============================================================================
  375.  *
  376.  * Para juegos comerciales y no comerciales.
  377.  * Se debe incluir a ICF-Soft en los créditos.
  378.  * Cualquier plugin que necesite este para funcionar debe incluir una cláusula
  379.  * que indique que se debe incluir a ICF-Soft en los créditos.
  380.  * Esta cabecera y los archivos leeme del complemento deben incluirse
  381.  * íntegramente con el plugin.
  382.  *
  383.  * ============================================================================
  384. */
  385. //=============================================================================
  386.  
  387. //=============================================================================
  388. // Parameter Variables
  389. //=============================================================================
  390.  
  391. ICF.Parameters = PluginManager.parameters('ICFSoft_MainUtility');
  392. ICF.Param = ICF.Param || {};
  393.  
  394. //=============================================================================
  395. // Constants
  396. //=============================================================================
  397.  
  398. ICF.MainUtility.traittags = [
  399.     ['elem_rate', 11, 0],
  400.     ['debuffrate', 12, 0],
  401.     ['ndebuffrate', 12, 10],
  402.     ['state_rate', 13, 0],
  403.     ['state_resist', 14, 0],
  404.     ['skill_rate', 15, 0],
  405.     ['itemdamage_rate', 15, 2000],
  406.     ['weapon_rate', 16, 0],
  407.     ['elem_absorb', 17, 0],
  408.     ['elem_curse', 18, 0],
  409.     ['elem_reflect', 19, 0],
  410.     ['paramplus', 21, 10],
  411.     ['paramrate', 21, 0],
  412.     ['paramflat', 21, 20],
  413.     ['paramxrate', 21, 30],
  414.     ['xparamplus', 22, 0],
  415.     ['xparamrate', 22, 10],
  416.     ['xparamflat', 22, 20],
  417.     ['sparamplus', 23, 10],
  418.     ['sparamrate', 23, 0],
  419.     ['sparamflat', 23, 20],
  420.     ['nparamplus', 24, 0],
  421.     ['nparamrate', 24, 10],
  422.     ['nparamflat', 24, 20],
  423.     ['nparamxrate', 24, 30],
  424.     ['pparamplus', 25, 0],
  425.     ['pparamrate', 25, 10],
  426.     ['pparamflat', 25, 20],
  427.     ['attack_elem', 31, 0],
  428.     ['attack_state', 32, 0],
  429.     ['attack_speed', 33, 0],
  430.     ['attack_times', 34, 0],
  431.     ['attack_weapon', 35, 0],
  432.     ['elem_enhace', 36, 0],
  433.     ['skill_enhace', 36, 2000],
  434.     ['weapon_enhace', 36, 4000],
  435.     ['itemdamage_enhace', 36, 6000],
  436.     ['stypeadd', 41, 0],
  437.     ['stypeseal', 42, 0],
  438.     ['skilladd', 43, 0],
  439.     ['skillseal', 44, 0],
  440.     ['equipweapon', 51, 0],
  441.     ['equiparmor', 52, 0],
  442.     ['equiplock', 53, 0],
  443.     ['equipseal', 54, 0],
  444.     ['slot_type', 55, 0],
  445.     ['action_plus', 61, 0],
  446.     ['special_flag', 62, 0],
  447.     ['collapse_type', 63, 0],
  448.     ['party_ability', 64, 0]
  449. ];
  450.  
  451. var $gameSelfvariables    = null;
  452.  
  453. //=============================================================================
  454. // Game_SelfVariables
  455. //=============================================================================
  456.  
  457. function Game_SelfVariables() {
  458.     this.initialize.apply(this, arguments);
  459. }
  460.  
  461. Game_SelfVariables.prototype.initialize = function() {
  462.     this.clear();
  463. };
  464.  
  465. Game_SelfVariables.prototype.clear = function() {
  466.     this._data = {};
  467. };
  468.  
  469. Game_SelfVariables.prototype.value = function(key) {
  470.     return this._data[key] || 0;
  471. };
  472.  
  473. Game_SelfVariables.prototype.strictValue = function(key) {
  474.     var value = Number(this._data[key]);
  475.     return (isNaN(value))? 0 : Number(value);
  476. };
  477.  
  478. Game_SelfVariables.prototype.setValue = function(key, value) {
  479.     if (value) {
  480.         this._data[key] = (isNaN(Number(value))||Array.isArray(value))? value : Number(value);
  481.     } else {
  482.         delete this._data[key];
  483.     }
  484.     this.onChange();
  485. };
  486.  
  487. Game_SelfVariables.prototype.increaseValue = function(key, value) {
  488.     var val = Number(this._data[key] || 0);
  489.     if (isNaN(val)||isNaN(value)) return;
  490.     this._data[key] = Number(this._data[key] || 0) + Number(value);
  491.     this.onChange();
  492. };
  493.  
  494. Game_SelfVariables.prototype.multiplyValue = function(key, value) {
  495.     var val = Number(this._data[key] || 0);
  496.     if (isNaN(val)||isNaN(value)) return;
  497.     this._data[key] = Number(this._data[key] || 0) * Number(value);
  498.     this.onChange();
  499. };
  500.  
  501. Game_SelfVariables.prototype.divideValue = function(key, value) {
  502.     var val = Number(this._data[key] || 0);
  503.     if (isNaN(val)||isNaN(value)||value == 0) return;
  504.     this._data[key] = Number(this._data[key] || 0) / Number(value);
  505.     this.onChange();
  506. };
  507.  
  508. Game_SelfVariables.prototype.onChange = function() {
  509.     $gameMap.requestRefresh();
  510. };
  511.  
  512. //=============================================================================
  513. // DataManager
  514. //=============================================================================
  515.  
  516. ICF.MainUtility.extractMetadata = DataManager.extractMetadata;
  517. DataManager.extractMetadata = function(data) {
  518.     ICF.MainUtility.extractMetadata.call(this, data);
  519.     var note1 = /<(?:JSON MASTER)>/i;
  520.     var note2 = /<\/(?:JSON MASTER)>/i;
  521.     var note3 = /<(?:TRAITS MASTER)>/i;
  522.     var note4 = /<\/(?:TRAITS MASTER)>/i;
  523.     var note5 = /<(?:SUBTRAITS MASTER)>/i;
  524.     var note6 = /<\/(?:SUBTRAITS MASTER)>/i;
  525.  
  526.     var notedata = data.note.split(/[\r\n]+/);
  527.  
  528.     var flag1 = false;
  529.     var flag2 = false;
  530.     var flag3 = false;
  531.  
  532.     var subindex = -1;
  533.  
  534.     for (var i = 0; i < notedata.length; i++) {
  535.     var line = notedata[i].trim().replace(/\s+/g, ' ');
  536.     if (line.match(note1)) {
  537.         flag1 = true;
  538.     } else if (line.match(note2)) {
  539.         flag1 = false;
  540.     } else if (line.match(note3)) {
  541.         flag2 = true;
  542.         data.traits = data.traits || [];
  543.     } else if (line.match(note4)) {
  544.         flag2 = false;
  545.     } else if (line.match(note5)) {
  546.         flag3 = true;
  547.         subindex += 1;
  548.         data.subtraits = data.subtraits || [];
  549.         data.subtraits[subindex] = data.subtraits[subindex] || {};
  550.         data.subtraits[subindex].traits = data.subtraits[subindex].traits || [];
  551.     } else if (line.match(note6)) {
  552.         flag3 = false;
  553.     } else if (flag1) {
  554.         var field = line.split(":")[0];
  555.         line = line.substring(line.indexOf(':') + 1);
  556.         data[field] = JsonEx.parse(line);
  557.     } else if (flag2) {
  558.         line = line.split(" ").clean();
  559.         if (isNaN(Number(line[0]))) {line = ICF.MainUtility.gettfield(line);};
  560.         if (line[0] > -1) {data.traits.push({code:Number(line[0]), dataId:Number(line[1]), value:Number(line[2])});};
  561.     } else if (flag3) {
  562.         line = line.split(" ").clean();
  563.         if (isNaN(Number(line[0]))) {line = ICF.MainUtility.gettfield(line);};
  564.         if (line[0] > -1) {data.subtraits[subindex].traits.push({code:Number(line[0]), dataId:Number(line[1]), value:Number(line[2])});};
  565.     }
  566.  
  567.     }
  568. };
  569.  
  570. ICF.MainUtility.createGameObjects = DataManager.createGameObjects;
  571. DataManager.createGameObjects = function() {
  572.     ICF.MainUtility.createGameObjects.call(this);
  573.     $gameSelfVariables = new Game_SelfVariables();
  574. };
  575.  
  576. ICF.MainUtility.makeSaveContents = DataManager.makeSaveContents;
  577. DataManager.makeSaveContents = function() {
  578.     var contents = ICF.MainUtility.makeSaveContents.call(this);
  579.     contents.selfvariables = $gameSelfvariables;
  580.     return contents;
  581. };
  582.  
  583. ICF.MainUtility.extractSaveContents = DataManager.extractSaveContents;
  584. DataManager.extractSaveContents = function(contents) {
  585.     ICF.MainUtility.extractSaveContents.call(this, contents);
  586.     $gameSelfVariables = contents.selfVariables;
  587.     if (!$gameSelfVariables) $gameSelfVariables = new Game_SelfVariables();
  588. };
  589.  
  590. //=============================================================================
  591. // Game_BattlerBase
  592. //=============================================================================
  593.  
  594. ICF.MainUtility.traitObjects = Game_BattlerBase.prototype.traitObjects;
  595. Game_BattlerBase.prototype.traitObjects = function() {
  596.     if (!this._traitsObject) {
  597.     this._traitsObject = {};
  598.     this._traitsObject.traits = [];
  599.     }
  600.     return ICF.MainUtility.traitObjects.call(this).concat([this._traitsObject]);
  601. };
  602.  
  603. ICF.MainUtility.initMembers = Game_BattlerBase.prototype.initMembers;
  604. Game_BattlerBase.prototype.initMembers = function() {
  605.     ICF.MainUtility.initMembers.call(this);
  606.     this._traitsObject = {};
  607.     this._traitsObject.traits = [];
  608. };
  609.  
  610. Game_BattlerBase.prototype.clearTraits = function() {
  611.     this._traitsObject.traits = [];
  612. };
  613.  
  614. Game_BattlerBase.prototype.selfswitch = function(selfswitch) { return false;};
  615.  
  616. Game_BattlerBase.prototype.setselfswitch = function(selfswitch, value) { };
  617.  
  618. Game_BattlerBase.prototype.selfvariable = function(selfvariable) { return 0;};
  619.  
  620. Game_BattlerBase.prototype.strictselfvariable = function(selfvariable) { return 0;};
  621.  
  622. Game_BattlerBase.prototype.setselfvariable = function(selfvariable, value) { };
  623.  
  624. Game_BattlerBase.prototype.increaseselfvariable = function(selfvariable, value) { };
  625.  
  626. Game_BattlerBase.prototype.multiplyselfvariable = function(selfvariable, value) { };
  627.  
  628. Game_BattlerBase.prototype.divideselfvariable = function(selfvariable, value) { };
  629.  
  630. //=============================================================================
  631. // Game_Actor
  632. //=============================================================================
  633.  
  634. Game_Actor.prototype.selfswitch = function(selfswitch) {
  635.     var key = [0, this._actorId, selfswitch];
  636.     return $gameSelfSwitches.value(key);
  637. }
  638.  
  639. Game_Actor.prototype.setselfswitch = function(selfswitch, value) {
  640.     ICF.MainUtility.CustomSwitch(0, this._actorId, selfswitch, value);
  641. }
  642.  
  643. Game_Actor.prototype.selfvariable = function(selfvariable) {
  644.     var key = [0, this._actorId, selfvariable];
  645.     return $gameSelfVariables.value(key);
  646. }
  647.  
  648. Game_Actor.prototype.strictselfvariable = function(selfvariable) {
  649.     var key = [0, this._actorId, selfvariable];
  650.     return $gameSelfVariables.strictValue(key);
  651. }
  652.  
  653. Game_Actor.prototype.setselfvariable = function(selfvariable, value) {
  654.     ICF.MainUtility.CustomVariable(0, this._actorId, selfvariable, value);
  655. }
  656.  
  657. Game_Actor.prototype.increaseselfvariable = function(selfvariable, value) {
  658.     ICF.MainUtility.IncreaseCustomVariable(0, this._actorId, selfvariable, value);
  659. }
  660.  
  661. Game_Actor.prototype.multiplyselfvariable = function(selfvariable, value) {
  662.     ICF.MainUtility.MultiplyCustomVariable(0, this._actorId, selfvariable, value);
  663. }
  664.  
  665. Game_Actor.prototype.divideselfvariable = function(selfvariable, value) {
  666.     ICF.MainUtility.DivideCustomVariable(0, this._actorId, selfvariable, value);
  667. }
  668.  
  669. //=============================================================================
  670. // Game_Party
  671. //=============================================================================
  672.  
  673. Game_Party.prototype.selfswitch = function(selfswitch) {
  674.     this.allMembers().forEach(function(actor) {
  675.         if (actor.selfswitch(selfswitch)) {
  676.             return true;
  677.         }
  678.     });
  679.     return false;
  680. }
  681.  
  682. Game_Party.prototype.selfvariable = function(selfvariable) {
  683.     var value = 0;
  684.     this.allMembers().forEach(function(actor) {
  685.         value += actor.strictselfvariable(selfvariable);
  686.     });
  687.     return Math.floor(value);
  688. }
  689.  
  690. Game_Party.prototype.maxselfvariable = function(selfvariable) {
  691.     if (this.allMembers().length < 1) return 0;
  692.     var value = this.allMembers()[0].strictselfvariable(selfvariable);
  693.     this.allMembers().forEach(function(actor) {
  694.         value = Math.max(value, actor.strictselfvariable(selfvariable));
  695.     });
  696.     return Math.floor(value);
  697. }
  698.  
  699. Game_Party.prototype.minselfvariable = function(selfvariable) {
  700.     if (this.allMembers().length < 1) return 0;
  701.     var value = this.allMembers()[0].strictselfvariable(selfvariable);
  702.     this.allMembers().forEach(function(actor) {
  703.         value = Math.min(value, actor.strictselfvariable(selfvariable));
  704.     });
  705.     return Math.floor(value);
  706. }
  707.  
  708. Game_Party.prototype.avgselfvariable = function(selfvariable) {
  709.     if (this.allMembers().length < 1) return 0;
  710.     var value = 0;
  711.     this.allMembers().forEach(function(actor) {
  712.         value += actor.strictselfvariable(selfvariable);
  713.     });
  714.     return Math.floor(value / this.allMembers().length);
  715. }
  716.  
  717. //=============================================================================
  718. // Game_Event
  719. //=============================================================================
  720.  
  721. Game_Event.prototype.selfswitch = function(selfswitch) {
  722.     var key = [this._mapId, this._eventId, selfswitch];
  723.     return $gameSelfSwitches.value(key);
  724. }
  725.  
  726. Game_Event.prototype.setselfswitch = function(selfswitch, value) {
  727.     ICF.MainUtility.CustomSwitch(this._mapId, this._eventId, selfswitch, value);
  728. }
  729.  
  730. Game_Event.prototype.mapswitch = function(mapswitch) {
  731.     var key = [this._mapId, 0, mapswitch];
  732.     return $gameSelfSwitches.value(key);
  733. }
  734.  
  735. Game_Event.prototype.setmapswitch = function(mapswitch, value) {
  736.     ICF.MainUtility.CustomSwitch(this._mapId, 0, mapswitch, value);
  737. }
  738.  
  739. Game_Event.prototype.selfvariable = function(selfvariable) {
  740.     var key = [this._mapId, this._eventId, selfvariable];
  741.     return $gameSelfVariables.value(key);
  742. }
  743.  
  744. Game_Event.prototype.strictselfvariable = function(selfvariable) {
  745.     var key = [this._mapId, this._eventId, selfvariable];
  746.     return $gameSelfVariables.strictValue(key);
  747. }
  748.  
  749. Game_Event.prototype.setselfvariable = function(selfvariable, value) {
  750.     ICF.MainUtility.CustomVariable(this._mapId, this._eventId, selfvariable, value);
  751. }
  752.  
  753. Game_Event.prototype.increaseselfvariable = function(selfvariable, value) {
  754.     ICF.MainUtility.IncreaseCustomVariable(this._mapId, this._eventId, selfvariable, value);
  755. }
  756.  
  757. Game_Event.prototype.multiplyselfvariable = function(selfvariable, value) {
  758.     ICF.MainUtility.MultiplyCustomVariable(this._mapId, this._eventId, selfvariable, value);
  759. }
  760.  
  761. Game_Event.prototype.divideselfvariable = function(selfvariable, value) {
  762.     ICF.MainUtility.DivideCustomVariable(this._mapId, this._eventId, selfvariable, value);
  763. }
  764.  
  765. Game_Event.prototype.mapvariable = function(mapvariable) {
  766.     var key = [this._mapId, 0, mapvariable];
  767.     return $gameSelfVariables.value(key);
  768. }
  769.  
  770. Game_Event.prototype.strictmapvariable = function(mapvariable) {
  771.     var key = [this._mapId, 0, mapvariable];
  772.     return $gameSelfVariables.strictValue(key);
  773. }
  774.  
  775. Game_Event.prototype.setmapvariable = function(mapvariable, value) {
  776.     ICF.MainUtility.CustomVariable(this._mapId, 0, mapvariable, value);
  777. }
  778.  
  779. Game_Event.prototype.increasemapvariable = function(mapvariable, value) {
  780.     ICF.MainUtility.IncreaseCustomVariable(this._mapId, 0, mapvariable, value);
  781. }
  782.  
  783. Game_Event.prototype.multiplymapvariable = function(mapvariable, value) {
  784.     ICF.MainUtility.MultiplyCustomVariable(this._mapId, 0, mapvariable, value);
  785. }
  786.  
  787. Game_Event.prototype.dividemapvariable = function(mapvariable, value) {
  788.     ICF.MainUtility.DivideCustomVariable(this._mapId, 0, mapvariable, value);
  789. }
  790.  
  791. //=============================================================================
  792. // Game_Map
  793. //=============================================================================
  794.  
  795. Game_Map.prototype.mapswitch = function(mapswitch) {
  796.     var key = [this._mapId, 0, mapswitch];
  797.     return $gameSelfSwitches.value(key);
  798. }
  799.  
  800. Game_Map.prototype.setmapswitch = function(mapswitch, value) {
  801.     ICF.MainUtility.CustomSwitch(this._mapId, 0, mapswitch, value);
  802. }
  803.  
  804. Game_Map.prototype.mapvariable = function(mapvariable) {
  805.     var key = [this._mapId, 0, mapvariable];
  806.     return $gameSelfVariables.value(key);
  807. }
  808.  
  809. Game_Map.prototype.strictmapvariable = function(mapvariable) {
  810.     var key = [this._mapId, 0, mapvariable];
  811.     return $gameSelfVariables.strictValue(key);
  812. }
  813.  
  814. Game_Map.prototype.setmapvariable = function(mapvariable, value) {
  815.     ICF.MainUtility.CustomVariable(this._mapId, 0, mapvariable, value);
  816. }
  817.  
  818. Game_Map.prototype.increasemapvariable = function(mapvariable, value) {
  819.     ICF.MainUtility.IncreaseCustomVariable(this._mapId, 0, mapvariable, value);
  820. }
  821.  
  822. Game_Map.prototype.multiplymapvariable = function(mapvariable, value) {
  823.     ICF.MainUtility.MultiplyCustomVariable(this._mapId, 0, mapvariable, value);
  824. }
  825.  
  826. Game_Map.prototype.dividemapvariable = function(mapvariable, value) {
  827.     ICF.MainUtility.DivideCustomVariable(this._mapId, 0, mapvariable, value);
  828. }
  829.  
  830. //=============================================================================
  831. // Game_Item
  832. //=============================================================================
  833.  
  834. Game_Item.prototype.traitDataTypes = function(code) {
  835.     var data = this.object();
  836.     if ((data == null)||(!data.traits)) return [];
  837.     data = data.traits;
  838.     return data.reduce(function(r, obj) {
  839.         if (obj.code == code) return r.concat([obj.dataId]);
  840.         return r;
  841.     }, []).removeRepeated();
  842. }
  843.  
  844. Game_Item.prototype.traitDataTypesOffset = function(code, min, max) {
  845.     var data = this.object();
  846.     if ((data == null)||(!data.traits)) return [];
  847.     data = data.traits;
  848.     return data.reduce(function(r, obj) {
  849.         if ((obj.code == code)&&(obj.dataId >= min)&&(obj.dataId <= max)) return r.concat([obj.dataId - min]);
  850.         return r;
  851.     }, []).removeRepeated();
  852. }
  853.  
  854. Game_Item.prototype.traitDataTypesMod = function(code, mod) {
  855.     var data = this.object();
  856.     if ((data == null)||(!data.traits)) return [];
  857.     data = data.traits;
  858.     return data.reduce(function(r, obj) {
  859.         if (obj.code == code) return r.concat([obj.dataId % mod]);
  860.         return r;
  861.     }, []).removeRepeated();
  862. }
  863.  
  864. //=============================================================================
  865. // Game_Interpreter
  866. //=============================================================================
  867.  
  868. ICF.MainUtility.pluginCommand = Game_Interpreter.prototype.pluginCommand;
  869. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  870.         ICF.MainUtility.pluginCommand.call(this, command, args);
  871.     if (command.toLowerCase() == 'selfswitch') {
  872.         ICF.MainUtility.CustomSwitch(this._mapId, this._eventId, args[0], args[1]);
  873.     } else if (command.toLowerCase() == 'mapswitch') {
  874.         ICF.MainUtility.CustomSwitch(this._mapId, 0, args[0], args[1]);
  875.     } else if (command.toLowerCase() == 'remoteswitch') {
  876.         ICF.MainUtility.CustomSwitch(args[0], args[1], args[2], args[3]);
  877.     } else if (command.toLowerCase() == 'actorswitch') {
  878.         ICF.MainUtility.CustomSwitch(0, args[0], args[1], args[2]);
  879.     } else if (command.toLowerCase() == 'selfvariable') {
  880.         ICF.MainUtility.CustomVariable(this._mapId, this._eventId, args[0], args[1]);
  881.     } else if (command.toLowerCase() == 'mapvariable') {
  882.         ICF.MainUtility.CustomVariable(this._mapId, 0, args[0], args[1]);
  883.     } else if (command.toLowerCase() == 'remotevariable') {
  884.         ICF.MainUtility.CustomVariable(args[0], args[1], args[2], args[3]);
  885.     } else if (command.toLowerCase() == 'actorvariable') {
  886.         ICF.MainUtility.CustomVariable(0, args[0], args[1], args[2]);
  887.     } else if (command.toLowerCase().match(/((?:actor)|(?:enemy)|(?:partymember))(trait)((?:add)|(?:rate)|(?:plus))?/i)&&(RegExp.$1.length + RegExp.$2.length + RegExp.$3.length == command.length)) {
  888.         var data = (RegExp.$1 == "actor")? $gameActors.actor(args[0])._traitsObject : (RegExp.$1 == "enemy")? $gameTroop.members()[args[0]]._traitsObject : $gameParty.members()[args[0]]._traitsObject;
  889.         var mode = (RegExp.$3 == "add")? 0 : (RegExp.$3 == "plus")? 2 : (RegExp.$3 == "rate")? 3 : 1;
  890.         ICF.MainUtility.addTrait(data, mode, args[1], args[2], args[3]);
  891.     } else if (command.toLowerCase().match(/(remove)((?:actor)|(?:enemy)|(?:partymember))(trait)/i)&&(RegExp.$1.length + RegExp.$2.length + RegExp.$3.length == command.length)) {
  892.         var data = (RegExp.$2 == "actor")? $gameActors.actor(args[0])._traitsObject : (RegExp.$2 == "enemy")? $gameTroop.members()[args[0]]._traitsObject : $gameParty.members()[args[0]]._traitsObject;
  893.         ICF.MainUtility.removeTrait(data, args[1], args[2]);
  894.     } else if (command.toLowerCase().match(/(clear)((?:actor)|(?:enemy)|(?:partymember))(traits)/i)&&(RegExp.$1.length + RegExp.$2.length + RegExp.$3.length == command.length)) {
  895.         var data = (RegExp.$2 == "actor")? $gameActors.actor(args[0]) : (RegExp.$2 == "enemy")? $gameTroop.members()[args[0]] : $gameParty.members()[args[0]];
  896.         data.clearTraits();
  897.         }
  898. };
  899.  
  900. //=============================================================================
  901. // Utilities
  902. //=============================================================================
  903.  
  904. ICF.MainUtility.gettfield = function(array) {
  905.     for (var i = 0; i < ICF.MainUtility.traittags.length; i++) {
  906.         if (array[0].toLowerCase() == ICF.MainUtility.traittags[i][0]) {
  907.             array[0] = ICF.MainUtility.traittags[i][1];
  908.             array[1] = Number(array[1]) + ICF.MainUtility.traittags[i][2];
  909.             break;
  910.         }
  911.     }
  912.     if (isNaN(Number(array[0]))) {return [-1];}
  913.     return array;
  914. }
  915.  
  916. ICF.MainUtility.addTrait = function(data, mode, code, dataid, value) {
  917.     if (!data.traits) return;
  918.     var array = [code, Number(dataid), Number(value)];
  919.     if (isNaN(Number(array[0]))) {array = ICF.MainUtility.gettfield(array);};
  920.     if (array[0] < 0) {return;};
  921.     if (mode == 0) {data.traits.push({code:Number(array[0]), dataId:array[1], value:array[2]}); return;};
  922.     var ind = -1;
  923.     for (var i = 0; i < data.traits.length; i++) {
  924.         if ((data.traits[i].code == array[0])&&(data.traits[i].dataId == array[1])) {
  925.             ind = i;
  926.             break;
  927.         }
  928.     }
  929.     if (ind == -1) {data.traits.push({code:Number(array[0]), dataId:array[1], value:array[2]}); return;};
  930.     if (mode == 1) {
  931.         data.traits[ind].value = array[2];
  932.         for (var i = data.traits.length - 1; i > ind; i--) {
  933.             if ((data.traits[i].code == array[0])&&(data.traits[i].dataId == array[1])) {
  934.                 data.traits.splice(i, 1);
  935.             }
  936.         }
  937.     } else if (mode == 2){
  938.         data.traits[ind].value += array[2];
  939.         for (var i = data.traits.length - 1; i > ind; i--) {
  940.             if ((data.traits[i].code == array[0])&&(data.traits[i].dataId == array[1])) {
  941.                 data.traits[ind].value += data.traits[i].value;
  942.                 data.traits.splice(i, 1);
  943.             }
  944.         }
  945.     } else if (mode == 3){
  946.         data.traits[ind].value *= array[2];
  947.         for (var i = data.traits.length - 1; i > ind; i--) {
  948.             if ((data.traits[i].code == array[0])&&(data.traits[i].dataId == array[1])) {
  949.                 data.traits[ind].value *= data.traits[i].value;
  950.                 data.traits.splice(i, 1);
  951.             }
  952.         }
  953.     }
  954. }
  955.  
  956. ICF.MainUtility.removeTrait = function(data, code, dataid) {
  957.     if (!data.traits) return;
  958.     var array = [code, Number(dataid), 0];
  959.     if (isNaN(Number(array[0]))) {array = ICF.MainUtility.gettfield(array);};
  960.     if (array[0] < 0) {return;};
  961.     var ind = -1;
  962.     for (var i = data.traits.length - 1; i >= 0; i--) {
  963.         if ((data.traits[i].code == array[0])&&(data.traits[i].dataId == array[1])) {
  964.             data.traits.splice(i, 1);
  965.         }
  966.     }
  967. }
  968.  
  969. ICF.MainUtility.CustomVariable = function(mapid, evid, variablename, value) {
  970.     var _key = [mapid, evid, variablename];
  971.     $gameSelfVariables.setValue(_key, value);
  972. }
  973.  
  974. ICF.MainUtility.IncreaseCustomVariable = function(mapid, evid, variablename, value) {
  975.     var _key = [mapid, evid, variablename];
  976.     $gameSelfVariables.increaseValue(_key, value);
  977. }
  978.  
  979. ICF.MainUtility.MultiplyCustomVariable = function(mapid, evid, variablename, value) {
  980.     var _key = [mapid, evid, variablename];
  981.     $gameSelfVariables.multiplyValue(_key, value);
  982. }
  983.  
  984. ICF.MainUtility.DivideCustomVariable = function(mapid, evid, variablename, value) {
  985.     var _key = [mapid, evid, variablename];
  986.     $gameSelfVariables.divideValue(_key, value);
  987. }
  988.  
  989. ICF.MainUtility.CustomSwitch = function(mapid, evid, switchname, value) {
  990.     var _key = [mapid, evid, switchname];
  991.     var _value = (value.toLowerCase() === "true");
  992.     $gameSelfSwitches.setValue(_key, _value);
  993. }
  994.  
  995. Array.range = function() {
  996.     var args = arguments;
  997.     if (args.length < 1) return [];
  998.     var x = [];
  999.     if (args.length == 1) {
  1000.     if (args[0] == 0) return [0];
  1001.     if (args[0] > 0) for (var i = 1; i <= args[0]; i++) {
  1002.         x.push([i]);
  1003.     } else for (var i = -1; i >= args[0]; i--) {
  1004.         x.push([i]);
  1005.     }
  1006.     } else if (args.length == 2) {
  1007.     if (args[0] < args[1]) for (var i = args[0]; i <= args[1]; i++) {
  1008.         x.push([i]);
  1009.     } else for (var i = args[0]; i >= args[1]; i--) {
  1010.         x.push([i]);
  1011.     }
  1012.     } else {
  1013.     if (args[0] < args[1] && args[2] > 0) for (var i = args[0]; i <= args[1]; i += args[2]) {
  1014.         x.push([i]);
  1015.     } else if (args[0] > args[1] && args[2] < 0) for (var i = args[0]; i >= args[1]; i += args[2]) {
  1016.         x.push([i]);
  1017.     }
  1018.     }
  1019.     return x;
  1020. };
  1021.  
  1022. Array.coincidences = function() {
  1023.     var args = arguments;
  1024.     if (args.length < 1) return [];
  1025.     if (args.length == 1) return args[0];
  1026.     var x = [];
  1027.     for (var i = 0; i < args[0].length; i++) {
  1028.     if (args[1].indexOf(args[0][i]) > -1) x.push(args[0][i]);
  1029.     }
  1030.     if (args.length == 2) return x.removeRepeated();
  1031.     for (var i = x.length - 1; i >= 0; i--) {
  1032.     for (var il = 2; il < args.length; il++) {
  1033.         if (args[il].indexOf(x[i]) == -1) {
  1034.             x.splice(i,1);
  1035.             break;
  1036.         }
  1037.     }
  1038.     }
  1039.     return x.removeRepeated();
  1040. };
  1041.  
  1042. Array.prototype.removeRepeated = function() {
  1043.     this.sort(function(a, b) { return a - b;});
  1044.     for (var i = this.length - 1; i > 0; i--) {
  1045.        if (this[i] == this[i - 1]) this.splice(i,1);
  1046.     }
  1047.     return this;
  1048. };
  1049.  
  1050. Array.prototype.clean = function() {
  1051.     for (var i = this.length - 1; i >= 0; i -= 1) {
  1052.     if (this[i] == null) this.splice(i,1);
  1053.     if (String(this[i]).length == 0) this.splice(i,1);
  1054.     }
  1055.     return this;
  1056. };
  1057.  
  1058. Array.prototype.cleanAll = function() {
  1059.     for (var i = this.length - 1; i >= 0; i -= 1) {
  1060.     if (this[i] == null) this.splice(i,1);
  1061.     if (String(this[i]).length == 0) this.splice(i,1);
  1062.     if (Array.isArray(this[i])) this[i].cleanAll();
  1063.     }
  1064.     return this;
  1065. };
  1066.  
  1067. Array.prototype.cleaned = function() {
  1068.     var x = [];
  1069.     for (var i = 0; i < this.length; i++) {
  1070.     if (this[i] != null) x.push(this[i]);
  1071.     }
  1072.     return x;
  1073. };
  1074.  
  1075. Array.prototype.cleanedAll = function() {
  1076.     var x = [];
  1077.     var y = [];
  1078.     for (var i = 0; i < this.length; i++) {
  1079.     if (Array.isArray(this[i])) {
  1080.         y = this[i].cleanedAll();
  1081.         if (y.length > 0) x.push(y);
  1082.     } else if (this[i] != null) x.push(this[i]);
  1083.     }
  1084.     return x;
  1085. };
  1086.  
  1087. Array.prototype.extend = function() {
  1088.     this.clean();
  1089.     for (var i = this.length - 2; i > 0; i -= 1) {
  1090.     if ((String(this[i]).match(/(?:to)|(?:a)|(?:hasta)/))&&(RegExp.$1.length == String(this[i]).length)) {
  1091.         eval("this.splice(this.length,0," + Array.range(this[i - 1], this[i + 1]).join() + ")");
  1092.         i--;
  1093.         this.splice(i,3);
  1094.     }
  1095.     }
  1096.     return this;
  1097. };
  1098.  
  1099. Array.prototype.fixedBlocks = function(block) {
  1100.     if ((this.length % block)  > 0) {
  1101.     eval("this.splice(this.length,0," + new Array(block - this.length % block).join() + ")");
  1102.     }
  1103. };
  1104.  
  1105. Array.prototype.leaveNumbers = function() {
  1106.     for (var i = this.length - 1; i >= 0; i -= 1) {
  1107.     if (isNaN(Number(this[i]))) this.splice(i,1);
  1108.     else this[i] = Number(this[i]);
  1109.     }
  1110.     return this;
  1111. };
  1112.  
  1113. Array.prototype.numbers = function() {
  1114.     var x = [];
  1115.     for (var i = 0; i < this.length; i++) {
  1116.     if (!isNaN(Number(this[i]))) x.push(Number(this[i]));
  1117.     }
  1118.     return x;
  1119. };
  1120.  
  1121. Array.prototype.reduceToFit = function() {
  1122.     var args = arguments;
  1123.     if (args.length < 1) return this;
  1124.     for (var i = 0; i < args.length; i++) {
  1125.     if ((Array.isArray(args[i]))&&(args[i].length < this.length)) this.splice(args[i].length, this.length - args[i].length);
  1126.     }
  1127.     return this;
  1128. };
  1129.  
  1130. Date.prototype.getMonthAndDay = function() {
  1131.     return this.getMonth() * 100 + this.getDate() + 100;
  1132. };
  1133.  
  1134. Date.prototype.getHourAndMinute = function() {
  1135.     return this.getHours() * 100 + this.getMinutes();
  1136. };
  1137.  
  1138. Date.prototype.getDayMinutes = function() {
  1139.     return this.getHours() * 60 + this.getMinutes();
  1140. };
  1141.  
  1142. Date.prototype.increaseMinutes = function(minutes) {
  1143.     this.setMinutes(this.getMinutes() + minutes);
  1144. };
  1145.  
  1146. //=============================================================================
  1147. // End of File
  1148. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement