Advertisement
ICF-Soft

ICF-Soft Enemies Core RPG Maker MV

Nov 22nd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Enemies Core
  3. // ICFSoft_EnemiesCore.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_EnemiesCore = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.EnemiesCore = ICF.EnemiesCore || {};
  11.  
  12. ICF.EnemiesCore.Version = 100; // 1.00
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.00b This plugin adds new features to enemies like classes,
  17.  * variations and actions for them.
  18.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  19.  *
  20.  * @help
  21.  * ============================================================================
  22.  * Introduction
  23.  *
  24.  * With this plugin you can add different variations to enemies that can
  25.  * affect traits, hue, image, exp, gold, name, etc.
  26.  * You can also add classes for them with traits.
  27.  *
  28.  * Plus you can give more conditions to enemy actions and add actions to
  29.  * classes and variations for them.
  30.  *
  31.  * ============================================================================
  32.  * How to use
  33.  * ============================================================================
  34.  *
  35.  * Like other plugins it works with notetags.
  36.  * There are current enemy notetags:
  37.  *
  38.  * <ENEMY CLASSES: x x x x>
  39.  * <ENEMY CLASSES: x to y>
  40.  *
  41.  *  - Add random classes. Enemy will get one of these classes.
  42.  *    You can add 0 for a chance of no class.
  43.  *
  44.  * <ENEMY ACTION skillId rating>
  45.  * <ENEMY ACTION skillId rating condition>
  46.  *
  47.  *  - Add an action to an enemy. You can give special conditions:
  48.  *    Turn n x
  49.  *    HP min max (there are rates)
  50.  *    MP min max (there are rates)
  51.  *    State x
  52.  *    Partylevel level
  53.  *    Switch x
  54.  *    [BATTLE|ENEMY|TROOP|PARTY|PARTYBATTLE]Switch x
  55.  *    Var [equal|dif|high|min|less|max] x
  56.  *    [BATTLE|ENEMY|TROOP|PARTY|PARTYBATTLE]Var x
  57.  *    [TROOP|PARTY|PARTYBATTLE]Var[MIN|MAX|AVG] x
  58.  *
  59.  *    You can use battleswitchs, enemybattleswitchs, etc.
  60.  *    You can use battlesvariables, enemybattlevariables, etc.
  61.  *    Troop, party and partybattlebattle variables can check sum, min,
  62.  *    max or average.
  63.  *    Every variable type allow to check for equal, different, higher,
  64.  *    minimum, lower or maximun to a value.
  65.  *
  66.  * To add enemy variations you can use these notetags:
  67.  *
  68.  * <ENEMY VARIATION>
  69.  * </ENEMY VARIATION>
  70.  *
  71.  * You can use these commands between tags:
  72.  *
  73.  * classes x x x
  74.  *
  75.  *  - Variation will use one of these classes avoiding default.
  76.  *
  77.  * prefix word
  78.  *
  79.  *  - Add a prefix to name.
  80.  *
  81.  * sufix word
  82.  *
  83.  *  - Add a sufix to name.
  84.  *
  85.  * action skillId rating
  86.  * action skillId rating condition
  87.  *
  88.  *  - Add actions for this variation. Will be combined with default list.
  89.  *    Same special conditions as usual.
  90.  *
  91.  * exp number
  92.  * gold number
  93.  * battlerhue number
  94.  * battlername path
  95.  *
  96.  *  - Changes default values.
  97.  *
  98.  * traits x
  99.  *
  100.  *  - Add a subtrait set taken from main utility notation.
  101.  *    Refer to main utility readme file. Example:
  102.  *    <SUBTRAITS MASTER> -Fire
  103.  *    elem_rate 1 1.5
  104.  *    11 2 0.5
  105.  *    31 2 0 -Fire attack element
  106.  *    <SUBTRAITS MASTER> -Cold
  107.  *    elem_rate 1 1.5
  108.  *    11 2 2.1
  109.  *    31 3 0 -Cold attack element
  110.  *    </SUBTRAITS MASTER>
  111.  *
  112.  * Enemy variations example:
  113.  *
  114.  * <ENEMY VARIATION>
  115.  * classes 2 3 5
  116.  * exp 500
  117.  * battlerhue 100
  118.  * traits 0
  119.  * prefix Fire
  120.  * action 5 3 battleswitch iscold
  121.  * <ENEMY VARIATION>
  122.  * traits 1
  123.  * prefix Cold
  124.  * action 7 3
  125.  * </ENEMY VARIATION>
  126.  *
  127.  *
  128.  * To add enemy class variations you can use these notetags:
  129.  *
  130.  * <CLASS VARIATION classId>
  131.  * </CLASS VARIATION>
  132.  *
  133.  * You can use this commands between tags:
  134.  *
  135.  * action skillId rating
  136.  * action skillId rating condition
  137.  *
  138.  *  - Add actions for this class variation. Will be combined with default list.
  139.  *    Same special conditions as usual.
  140.  *
  141.  *
  142.  * Class variations example:
  143.  *
  144.  * <CLASS VARIATION 2>
  145.  * action 1 3
  146.  * action 2 4 hp 0.1 0.5
  147.  * <CLASS VARIATION 3>
  148.  * action 10 5 mp 0.9 1
  149.  * </CLASS VARIATION>
  150.  *
  151.  * ============================================================================
  152.  * Incompatibilities
  153.  * ============================================================================
  154.  *
  155.  * There's no known incompatible plugins yet.
  156.  *
  157.  * ============================================================================
  158.  * Known isues
  159.  * ============================================================================
  160.  *
  161.  * Not yet.
  162.  *
  163.  * ============================================================================
  164.  *
  165.  * For commercial and non-commercial games.
  166.  * Credit to ICF-Soft.
  167.  * This entire header must be included with plugin.
  168.  *
  169.  * ============================================================================
  170. */
  171. //=============================================================================
  172.  /*:es
  173.  * @plugindesc v1.00b Este complemento añade nuevas características a los
  174.  * enemigos tales como clases, variaciones y acciones.
  175.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  176.  *
  177.  * @help
  178.  * ============================================================================
  179.  * Introducción
  180.  * ============================================================================
  181.  *
  182.  * Con este complemento puedes añadir variaciones diferente a los enemigos
  183.  * afectando los rasgos, experiencia, oro, nombre, etc.
  184.  * Añade incluso clases con sus rasgos.
  185.  *
  186.  * Además puedes darles más condiciones a las acciones de los enemigos y
  187.  * acciones para variaciones y clases específicas.
  188.  *
  189.  * ============================================================================
  190.  * Uso
  191.  * ============================================================================
  192.  *
  193.  * Igual que otros complementos funciona con etiquetas en las notas.
  194.  * Las hay para enemigos:
  195.  *
  196.  * <ENEMY CLASSES: x x x x>
  197.  * <ENEMY CLASSES: x hasta y>
  198.  *
  199.  *  - Añade una lista de clases. El enemigo será de una de ellas.
  200.  *    Puedes usar el 0 para que puede no tener ninguna.
  201.  *
  202.  * <ENEMY ACTION skillId rating>
  203.  * <ENEMY ACTION skillId rating condition>
  204.  *
  205.  *  - Añade una acción. Puedes usar condiciones especiales:
  206.  *    Turn n x
  207.  *    HP min max (valores entre 0 y 1)
  208.  *    MP min max (valores entre 0 y 1)
  209.  *    State x
  210.  *    Partylevel nivel
  211.  *    Switch x
  212.  *    [BATTLE|ENEMY|TROOP|PARTY|PARTYBATTLE]Switch x
  213.  *    Var [equal|dif|high|min|less|max] x
  214.  *    [BATTLE|ENEMY|TROOP|PARTY|PARTYBATTLE]Var x
  215.  *    [TROOP|PARTY|PARTYBATTLE]Var[MIN|MAX|AVG] x
  216.  *
  217.  *    Puedes usar interruptores de batalla, de enemigos, etc.
  218.  *    Puedes usar variables de batalla, de enemigos, etc.
  219.  *    Para las variables de grupos puedes comprobar la suma, el
  220.  *    mínimo, máximo o la media.
  221.  *    Todos los tipos de variable admiten las comprobaciones de
  222.  *    igual a, distinto a, mayor que, valor mínimo, menor que,
  223.  *    o valor máximo.
  224.  *
  225.  * Para añadir variaciones se usan las siguientes etiquetas:
  226.  *
  227.  * <ENEMY VARIATION>
  228.  * </ENEMY VARIATION>
  229.  *
  230.  * Y usar los siguientes comandos:
  231.  *
  232.  * classes x x x
  233.  *
  234.  *  - Se escogerá una de esas clases en lugar de las habituales.
  235.  *
  236.  * prefix word
  237.  *
  238.  *  - Añade un prefijo al nombre.
  239.  *
  240.  * sufix word
  241.  *
  242.  *  - Añade un sufijo al nombre.
  243.  *
  244.  * action skillId rating
  245.  * action skillId rating condition
  246.  *
  247.  *  - Añade acciones para esa variación. Se combina con las normales.
  248.  *    Se usa el mismo tipo de condición que en las normales.
  249.  *
  250.  * exp número
  251.  * gold número
  252.  * battlerhue número
  253.  * battlername archivo
  254.  *
  255.  *  - Cambia los valores.
  256.  *
  257.  * traits x
  258.  *
  259.  *  - Añade un conjunto de subrasgos de los que se crean con el main utility.
  260.  *    Puedes revisar el archivo léeme del main utility. Ejemplo:
  261.  *    <SUBTRAITS MASTER> -Fuego
  262.  *    elem_rate 1 1.5
  263.  *    11 2 0.5
  264.  *    31 2 0 -Ataque de fuego
  265.  *    <SUBTRAITS MASTER> -Frío
  266.  *    elem_rate 1 1.5
  267.  *    11 2 2.1
  268.  *    31 3 0 -Ataque de hielo
  269.  *    </SUBTRAITS MASTER>
  270.  *
  271.  * Ejemplo de variaciones:
  272.  *
  273.  * <ENEMY VARIATION>
  274.  * classes 2 3 5
  275.  * exp 500
  276.  * battlerhue 100
  277.  * traits 0
  278.  * prefix Fire
  279.  * action 5 3 battleswitch hace-frio
  280.  * <ENEMY VARIATION>
  281.  * traits 1
  282.  * prefix Cold
  283.  * action 7 3
  284.  * </ENEMY VARIATION>
  285.  *
  286.  *
  287.  * Para añadir variaciones en función de la clase usar las etiquetas:
  288.  *
  289.  * <CLASS VARIATION classId>
  290.  * </CLASS VARIATION>
  291.  *
  292.  * Sólo hay un tipo de comando actualmente:
  293.  *
  294.  * action skillId rating
  295.  * action skillId rating condition
  296.  *
  297.  *  - Añade acciones para esa clase. Se combina con el resto.
  298.  *    Se usa el mismo tipo de condición que en las normales.
  299.  *
  300.  *
  301.  * Ejemplo de variantes de clases:
  302.  *
  303.  * <CLASS VARIATION 2>
  304.  * action 1 3
  305.  * action 2 4 hp 0.1 0.5
  306.  * <CLASS VARIATION 3>
  307.  * action 10 5 mp 0.9 1
  308.  * </CLASS VARIATION>
  309.  *
  310.  * ============================================================================
  311.  * Incompatibilidades
  312.  * ============================================================================
  313.  *
  314.  * No se conocen complementos que sean incompatibles hasta la fecha.
  315.  *
  316.  * ============================================================================
  317.  * Problemas conocidos
  318.  * ============================================================================
  319.  *
  320.  * Por el momento ninguno.
  321.  *
  322.  * ============================================================================
  323.  *
  324.  * Para juegos comerciales y no comerciales.
  325.  * Se debe incluir a ICF-Soft en los créditos.
  326.  * Esta cabecera debe incluirse íntegramente con el plugin.
  327.  *
  328.  * ============================================================================
  329. */
  330. //=============================================================================
  331.  
  332. //=============================================================================
  333. // Parameter Variables
  334. //=============================================================================
  335.  
  336. ICF.Parameters = PluginManager.parameters('ICFSoft_EnemiesCore');
  337. ICF.Param = ICF.Param || {};
  338.  
  339. if (!Imported.ICFSoft_MainUtility) {throw new Error('This plugin requires ICF-Soft Main Utility plugin version 1.01 to work.\nYou can download it at icfsoft.blogspot.com inside plugins section.');}
  340. if (ICF.MainUtility.Version < 101) {throw new Error('This plugin requires ICF-Soft Main Utility plugin version 1.01 to work.\nYou can download it at icfsoft.blogspot.com inside plugins section.');}
  341.  
  342. //=============================================================================
  343. // DataManager
  344. //=============================================================================
  345.  
  346. ICF.EnemiesCore.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  347. DataManager.isDatabaseLoaded = function() {
  348.     if (!ICF.EnemiesCore.DataManager_isDatabaseLoaded.call(this)) return false;
  349.     if (!ICF.EnemiesCore.Procesed) {
  350.     this.processEnemyCoreNotetags($dataEnemies);
  351.     ICF.EnemiesCore.Procesed = true;
  352.     }
  353.     return true;
  354. };
  355.  
  356. DataManager.processEnemyCoreNotetags = function(group) {
  357.   var note1 = /<(?:ENEMY VARIATION)>/i;
  358.   var note1b = /<\/(?:ENEMY VARIATION)>/i;
  359.   var note2 = /<(?:CLASS VARIATION )(\d+)>/i;
  360.   var note2b = /<\/(?:CLASS VARIATION)>/i;
  361.   var note3 = /<(?:ENEMY CLASSES):[ ]*(\w+(?:\s+\w+)*)[ ]*>/i;
  362.   var note4 = /<(?:ENEMY ACTION )(\d+) (\d+)(?: ((?:BATTLE)|(?:ENEMY)|(?:TROOP)|(?:PARTY)|(?:PARTYBATTLE))?((?:TURN)|(?:HP)|(?:MP)|(?:STATE)|(?:PARTYLEVEL)|(?:SWITCH)|(?:VAR))((?:MIN)|(?:MAX)|(?:AVG))? (\w+(?:.\d+)?(?:\s+\w+(?:.\d+)?)*)(?:\s*))?>/i;
  363.   var note4b = /((?:BATTLE)|(?:ENEMY)|(?:TROOP)|(?:PARTY)|(?:PARTYBATTLE))?((?:TURN)|(?:HP)|(?:MP)|(?:STATE)|(?:PARTYLEVEL)|(?:SWITCH)|(?:VAR))((?:MIN)|(?:MAX)|(?:AVG))?/i;
  364.  
  365.   for (var n = 1; n < group.length; n++) {
  366.     var obj = group[n];
  367.     var notedata = obj.note.split(/[\r\n]+/);
  368.  
  369.     obj.enemyVariations = [];
  370.     obj.enemyClasses = [];
  371.     obj.enemyClassVariations = {};
  372.  
  373.     var ecFlag = false;
  374.     var ecFlag2 = false;
  375.  
  376.     var varIndex = -1;
  377.     var clsIndex = -1;
  378.  
  379.       for (var i = 0; i < notedata.length; i++) {
  380.         var line = notedata[i];
  381.         if (line.match(note1)) {
  382.             ecFlag = true;
  383.             varIndex++;
  384.             obj.enemyVariations[varIndex] = {};
  385.             obj.enemyVariations[varIndex].actions = [];
  386.         } else if (line.match(note1b)) {
  387.             ecFlag = false;
  388.         } else if (line.match(note2)) {
  389.             ecFlag2 = true;
  390.             clsIndex = RegExp.$1;
  391.             obj.enemyClassVariations[clsIndex] = {};
  392.             obj.enemyClassVariations[clsIndex].actions = [];
  393.         } else if (line.match(note2b)) {
  394.             ecFlag2 = false;
  395.         } else if (line.match(note3)) {
  396.             obj.enemyClasses = obj.enemyClasses.concat(RegExp.$1.trim().split(/\s+/).extend().leaveNumbers());
  397.         } else if (line.match(note4)) {
  398.             var action = {skillId:Number(RegExp.$1), rating:Number(RegExp.$2)};
  399.             var condition = ["turn","hp","mp","state","partylevel","switch","var"].indexOf(RegExp.$4.toLowerCase()) + 1;
  400.             var conditionpf = ["battle","enemy","troop","party","partybattle"].indexOf(RegExp.$3.toLowerCase()) + 1;
  401.             var conditionsf = ["min","max","avg"].indexOf(RegExp.$5.toLowerCase());
  402.             var array = RegExp.$6.split(' ');
  403.             if (condition > -1 && condition < 6) {
  404.                 action.conditionType = condition;
  405.                 action.conditionParam1 = Number(array[0]);
  406.                 action.conditionParam2 = Number(array[1]);
  407.             } else if (condition == 6) {
  408.                 action.conditionType = 6;
  409.                 action.conditionParam1 = array[0];
  410.                 action.conditionParam2 = conditionpf;
  411.             } else if (condition == 7) {
  412.                 action.conditionType = 7;
  413.                 action.conditionParam1 = array[0];
  414.                 action.conditionParam2 = (conditionpf < 3)? conditionpf : (conditionpf - 3) * 4 + 4 + conditionsf;
  415.                 action.conditionParam3 = (array.length == 2)? 3 : (!isNaN(Number(array[1])))? Number(array[1]) : ["equal","dif","high","min","less","max"].indexOf(array[1]);
  416.                 action.conditionParam4 = (array.length == 2)? array[1] : array[2];
  417.             }
  418.             obj.actions.push(action);
  419.         } else if (ecFlag) {
  420.             line = line.trim().split(/\s+/);
  421.             if (line.length > 0) {
  422.                 var command = line.shift().toLowerCase();
  423.                 if (command == "classes") {
  424.                     obj.enemyVariations[varIndex].classes = line.extend().leaveNumbers();
  425.                 } else if (command == "prefix") {
  426.                     obj.enemyVariations[varIndex].prefix = line.join(' ') + ' ';
  427.                 } else if (command == "sufix") {
  428.                     obj.enemyVariations[varIndex].sufix = ' ' + line.join(' ');
  429.                 } else if (command == "action" && line.length > 1) {
  430.                     var action = {skillId:Number(line[0]), rating:Number(line[1])};
  431.                     if (line[2] && line[2].match(note4b)) {
  432.                         var condition = ["turn","hp","mp","state","partylevel","switch","var"].indexOf(RegExp.$2.toLowerCase()) + 1;
  433.                         var conditionpf = ["battle","enemy","troop","party","partybattle"].indexOf(RegExp.$1.toLowerCase()) + 1;
  434.                         var conditionsf = ["min","max","avg"].indexOf(RegExp.$3.toLowerCase());
  435.                         if (condition > -1 && condition < 6) {
  436.                             action.conditionType = condition;
  437.                             action.conditionParam1 = Number(line[3]);
  438.                             action.conditionParam2 = Number(line[4]);
  439.                         } else if (condition == 6) {
  440.                             action.conditionType = 6;
  441.                             action.conditionParam1 = Number(line[3]);
  442.                             action.conditionParam2 = conditionpf;
  443.                         } else if (condition == 7) {
  444.                             action.conditionType = 7;
  445.                             action.conditionParam1 = Number(line[3]);
  446.                             action.conditionParam2 = (conditionpf < 3)? conditionpf : (conditionpf - 3) * 4 + 4 + conditionsf;
  447.                             action.conditionParam3 = (line.length == 5)? 3 : (!isNaN(Number(line[4])))? Number(line[4]) : ["equal","dif","high","min","less","max"].indexOf(line[4]);
  448.                             action.conditionParam4 = (line.length == 5)? line[4] : line[5];
  449.                         }
  450.                     }
  451.                     obj.enemyVariations[varIndex].actions.push(action);
  452.                 } else if (line.length > 0) {
  453.                     obj.enemyVariations[varIndex][command] = line[0];
  454.                 } else if (["exp","gold","battlername","battlerhue","traits"].indexOf(command) < 0) {
  455.                     obj.enemyVariations[varIndex][command] = true;
  456.                 }
  457.             }
  458.         } else if (ecFlag2) {
  459.             line = line.trim().split(/\s+/);
  460.             if (line.length > 0) {
  461.                 var command = line.shift().toLowerCase();
  462.                 if (command == "action" && line.length > 1) {
  463.                     var action = {skillId:Number(line[0]), rating:Number(line[1])};
  464.                     if (line[2] && line[2].match(note4b)) {
  465.                         var condition = ["turn","hp","mp","state","partylevel","switch","var"].indexOf(RegExp.$2.toLowerCase()) + 1;
  466.                         var conditionpf = ["battle","enemy","troop","party","partybattle"].indexOf(RegExp.$1.toLowerCase()) + 1;
  467.                         var conditionsf = ["min","max","avg"].indexOf(RegExp.$3.toLowerCase());
  468.                         if (condition > -1 && condition < 6) {
  469.                             action.conditionType = condition;
  470.                             action.conditionParam1 = Number(line[3]);
  471.                             action.conditionParam2 = Number(line[4]);
  472.                         } else if (condition == 6) {
  473.                             action.conditionType = 6;
  474.                             action.conditionParam1 = Number(line[3]);
  475.                             action.conditionParam2 = conditionpf;
  476.                         } else if (condition == 7) {
  477.                             action.conditionType = 7;
  478.                             action.conditionParam1 = Number(line[3]);
  479.                             action.conditionParam2 = (conditionpf < 3)? conditionpf : (conditionpf - 3) * 4 + 4 + conditionsf;
  480.                             action.conditionParam3 = (line.length == 5)? 3 : (!isNaN(Number(line[4])))? Number(line[4]) : ["equal","dif","high","min","less","max"].indexOf(line[4]);
  481.                             action.conditionParam4 = (line.length == 5)? line[4] : line[5];
  482.                         }
  483.                     }
  484.                     obj.enemyClassVariations[clsIndex].actions.push(action);
  485.                 } else if (line.length > 0) {
  486.                     obj.enemyClassVariations[clsIndex][command] = line[0];
  487.                 } else {
  488.                     obj.enemyClassVariations[clsIndex][command] = true;
  489.                 }
  490.             }
  491.         }
  492.  
  493.       }
  494.       for (var i = 0; i < obj.enemyVariations.length; i++) {
  495.         if (!isNaN(Number(obj.enemyVariations[i].traits))) obj.enemyVariations[i].traits = obj.subtraits[obj.enemyVariations[i].traits].traits || [];
  496.         else if (!Array.isArray(obj.enemyVariations[i].traits)) obj.enemyVariations[i].traits = [];
  497.       }
  498.   }
  499. };
  500.  
  501. //=============================================================================
  502. // Game_Enemy
  503. //=============================================================================
  504.  
  505. ICF.EnemiesCore.initEnemy = Game_Enemy.prototype.initMembers;
  506. Game_Enemy.prototype.initMembers = function() {
  507.     ICF.EnemiesCore.initEnemy.call(this);
  508.     this._classId = 0;
  509.     this._variation = {};
  510. };
  511.  
  512. ICF.EnemiesCore.setupEnemy = Game_Enemy.prototype.setup;
  513. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  514.     var variations = $dataEnemies[enemyId].enemyVariations;
  515.     if (variations.length > 0) this._variation = variations[Math.floor(Math.random() * variations.length)];
  516.     var classes = this._variation.clasess || $dataEnemies[enemyId].enemyClasses;
  517.     if (classes.length > 0) this._classId = classes[Math.floor(Math.random() * classes.length)];
  518.     ICF.EnemiesCore.setupEnemy.call(this, enemyId, x, y);
  519. };
  520.  
  521. Game_Enemy.prototype.currentClass = function() {
  522.     return $dataClasses[this._classId];
  523. };
  524.  
  525. Game_Enemy.prototype.variation = function() {
  526.     return this._variation;
  527. };
  528.  
  529. Game_Enemy.prototype.classVariation = function() {
  530.     return $dataEnemies[this._enemyId].enemyClassVariations[this._classId];
  531. };
  532.  
  533. ICF.EnemiesCore.enemyTraits = Game_Enemy.prototype.traitObjects;
  534. Game_Enemy.prototype.traitObjects = function() {
  535.     return ICF.EnemiesCore.enemyTraits.call(this).concat(this._variation).concat((this._classId > 0)? $dataClasses[this._classId] : []);
  536. };
  537.  
  538. Game_Enemy.prototype.exp = function() {
  539.     return this._variation.exp || this.enemy().exp;
  540. };
  541.  
  542. Game_Enemy.prototype.gold = function() {
  543.     return this._variation.gold || this.enemy().gold;
  544. };
  545.  
  546. Game_Enemy.prototype.battlerName = function() {
  547.     return this._variation.battlername || this.enemy().battlerName;
  548. };
  549.  
  550. Game_Enemy.prototype.battlerHue = function() {
  551.     return this._variation.battlerhue || this.enemy().battlerHue;
  552. };
  553.  
  554. Game_Enemy.prototype.originalName = function() {
  555.     return (this._variation.prefix ? this._variation.prefix : '') + this.enemy().name + (this._variation.sufix ? this._variation.sufix : '');
  556. };
  557.  
  558. Game_Enemy.prototype.name = function() {
  559.     return this.originalName() + (this._plural ? ' ' + this._letter : '');
  560. };
  561.  
  562. Game_Enemy.prototype.meetsCondition = function(action) {
  563.     var param1 = action.conditionParam1;
  564.     var param2 = action.conditionParam2;
  565.     var param3 = action.conditionParam3;
  566.     var param4 = action.conditionParam4;
  567.     switch (action.conditionType) {
  568.     case 1:
  569.         return this.meetsTurnCondition(param1, param2);
  570.     case 2:
  571.         return this.meetsHpCondition(param1, param2);
  572.     case 3:
  573.         return this.meetsMpCondition(param1, param2);
  574.     case 4:
  575.         return this.meetsStateCondition(param1);
  576.     case 5:
  577.         return this.meetsPartyLevelCondition(param1);
  578.     case 6:
  579.         return this.meetsSwitchCondition(param1, param2);
  580.     case 7:
  581.         return this.meetsVariableCondition(param1, param2, param3, param4);
  582.     default:
  583.         return true;
  584.     }
  585. };
  586.  
  587. Game_Enemy.prototype.meetsSwitchCondition = function(param1, param2) {
  588.     switch (param2) {
  589.     case 1:
  590.         return $gameBattleSwitches.value([0, 0, param1]);
  591.     case 2:
  592.         return this.battleswitch(param1);
  593.     case 3:
  594.         return $gameTroop.battleswitch(param1);
  595.     case 4:
  596.         return $gameParty.selfswitch(param1);
  597.     case 5:
  598.         return $gameParty.battleswitch(param1);
  599.     default:
  600.         return $gameSwitches.value(param1);
  601.     }
  602. };
  603.  
  604. Game_Enemy.prototype.meetsVariableCondition = function(param1, param2, param3, param4) {
  605.     switch (param2) {
  606.     case 1:
  607.         return ICF.EnemiesCore.CheckVar(param3, $gameBattleVariables.strictValue([0, 0, param1]), param4);
  608.     case 2:
  609.         return ICF.EnemiesCore.CheckVar(param3, this.strictbattlevariable(param1), param4);
  610.     case 3:
  611.         return ICF.EnemiesCore.CheckVar(param3, $gameTroop.battlevariable(param1), param4);
  612.     case 4:
  613.         return ICF.EnemiesCore.CheckVar(param3, $gameTroop.minbattlevariable(param1), param4);
  614.     case 5:
  615.         return ICF.EnemiesCore.CheckVar(param3, $gameTroop.maxbattlevariable(param1), param4);
  616.     case 6:
  617.         return ICF.EnemiesCore.CheckVar(param3, $gameTroop.avgbattlevariable(param1), param4);
  618.     case 7:
  619.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.selfvariable(param1), param4);
  620.     case 8:
  621.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.minselfvariable(param1), param4);
  622.     case 9:
  623.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.maxselfvariable(param1), param4);
  624.     case 10:
  625.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.avgselfvariable(param1), param4);
  626.     case 11:
  627.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.battlevariable(param1), param4);
  628.     case 12:
  629.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.minbattlevariable(param1), param4);
  630.     case 13:
  631.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.maxbattlevariable(param1), param4);
  632.     case 14:
  633.         return ICF.EnemiesCore.CheckVar(param3, $gameParty.avgbattlevariable(param1), param4);
  634.     default:
  635.         return ICF.EnemiesCore.CheckVar(param3, $gameVariables.value(param1), param4);
  636.     }
  637. };
  638.  
  639. Game_Enemy.prototype.actionList = function() {
  640.     return this.enemy().actions.concat(this._variation.actions).concat((this.classVariation())? this.classVariation().actions : []);
  641. };
  642.  
  643. Game_Enemy.prototype.makeActions = function() {
  644.     Game_Battler.prototype.makeActions.call(this);
  645.     if (this.numActions() > 0) {
  646.         var actionList = this.actionList().filter(function(a) {
  647.             return this.isActionValid(a);
  648.         }, this);
  649.         if (actionList.length > 0) {
  650.             this.selectAllActions(actionList);
  651.         }
  652.     }
  653.     this.setActionState('waiting');
  654. };
  655.  
  656. //=============================================================================
  657. // Enemies Utilities
  658. //=============================================================================
  659.  
  660. ICF.EnemiesCore.CheckVar = function(code, value1, value2) {
  661.     switch (code) {
  662.         case 0:
  663.             return (value1 == value2); break;
  664.         case 1:
  665.             return (value1 !== value2); break;
  666.         case 2:
  667.             return (value1 > value2); break;
  668.         case 3:
  669.             return (value1 >= value2); break;
  670.         case 4:
  671.             return (value1 < value2); break;
  672.         case 5:
  673.             return (value1 <= value2); break;
  674.         default:
  675.             return false;
  676.     }
  677. }
  678.  
  679. //=============================================================================
  680. // End of File
  681. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement