查看: 694|回复: 0

[有事请教] 请教VE_CooperationSkills 合作技插件的错误如何修复

[复制链接]
梦石
0
星屑
7850
在线时间
869 小时
注册时间
2021-8-28
回帖
93
发表于 2022-1-26 23:45:27 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 Rose_shadows 于 2022-1-27 07:24 编辑

插件在此:

这是前置插件:
  1. /*
  2. * ==============================================================================
  3. * ** Victor Engine MV - Basic Module
  4. * ------------------------------------------------------------------------------
  5. *  VE_BasicModule.js
  6. * ==============================================================================
  7. */

  8. var Imported = Imported || {};
  9. Imported['VE - Basic Module'] = '1.23';

  10. var VictorEngine = VictorEngine || {};
  11. VictorEngine.BasicModule = VictorEngine.BasicModule || {};

  12. (function() {

  13.     VictorEngine.BasicModule.loadDatabase = DataManager.loadDatabase;
  14.     DataManager.loadDatabase = function() {
  15.         VictorEngine.BasicModule.loadDatabase.call(this);
  16.         PluginManager.requiredPlugin.call(PluginManager, 'VE - Basic Module');
  17.     };

  18.     PluginManager.requiredPlugin = function(name, required, version) {
  19.         VictorEngine.BasicModule.checkPlugins(name, required, version);
  20.     };

  21. })();

  22. /*:
  23. * ==============================================================================
  24. * @plugindesc v1.23 - Plugin with base code required for all Victor Engine plugins.
  25. * @author Victor Sant
  26. *
  27. * @param == Trait Names ==
  28. *
  29. * @param Hit Rate Name
  30. * @desc 'Hit Rate' Ex-Parameter name shown on windows.
  31. * @default Hit
  32. *
  33. * @param Evasion Rate Name
  34. * @desc 'Evasion Rate' Ex-Parameter name shown on windows.
  35. * @default Evasion
  36. *
  37. * @param Critical Rate Name
  38. * @desc 'Critical Rate' Ex-Parameter name shown on windows.
  39. * @default Critical
  40. *
  41. * @param Critical Evasion Name
  42. * @desc 'Critical Evasion' Ex-Parameter name shown on windows.
  43. * @default C. Evasion
  44. *
  45. * @param Magic Evasion Name
  46. * @desc 'Magic Evasion' Ex-Parameter name shown on windows.
  47. * @default M. Evasion
  48. *
  49. * @param Magic Reflection Name
  50. * @desc 'Magic Reflection' Ex-Parameter name shown on windows.
  51. * @default M. Reflection
  52. *
  53. * @param Counter Attack Name
  54. * @desc 'Counter Attack' Ex-Parameter name shown on windows.
  55. * @default Counter
  56. *
  57. * @param HP Regeneration Name
  58. * @desc 'HP Regeneration' Ex-Parameter name shown on windows.
  59. * @default HP Regen
  60. *
  61. * @param MP Regeneration Name
  62. * @desc 'MP Regeneration' Ex-Parameter name shown on windows.
  63. * @default MP Regen
  64. *
  65. * @param TP Regeneration Name
  66. * @desc 'TP Regeneration' Ex-Parameter name shown on windows.
  67. * @default TP Regen
  68. *
  69. * @param Target Rate Name
  70. * @desc 'Target Rate' Sp-Parameter name shown on windows.
  71. * @default Target Rate
  72. *
  73. * @param Guard Rate Name
  74. * @desc 'Guard Rate' Sp-Parameter name shown on windows.
  75. * @default Guard Rate
  76. *
  77. * @param Recovery Effect Name
  78. * @desc 'Recovery Effect' Sp-Parameter name shown on windows.
  79. * @default Recovery
  80. *
  81. * @param Pharmacology Name
  82. * @desc 'Pharmacology' Sp-Parameter name shown on windows.
  83. * @default Pharmacology
  84. *
  85. * @param MP Cost Rate Name
  86. * @desc 'MP Cost Rate' Sp-Parameter name shown on windows.
  87. * @default MP Cost
  88. *
  89. * @param TP Charge Rate Name
  90. * @desc 'TP Charge Rate' Sp-Parameter name shown on windows.
  91. * @default TP Charge
  92. *
  93. * @param Physical Damage Name
  94. * @desc 'Physical Damage' Sp-Parameter name shown on windows.
  95. * @default Physical Damage
  96. *
  97. * @param Magical Damage Name
  98. * @desc 'Magical Damage' Sp-Parameter name shown on windows.
  99. * @default Magical Damage
  100. *
  101. * @param Floor Damage Name
  102. * @desc 'Floor Damage' Sp-Parameter name shown on windows.
  103. * @default Floor Damage
  104. *
  105. * @param Experience Rate Name
  106. * @desc 'Experience Rate' Sp-Parameter name shown on windows.
  107. * @default Exp. Rate
  108. *
  109. * ==============================================================================
  110. * @help
  111. * ==============================================================================
  112. * Install this plugin above any other Victor Engine plugin.
  113. * ==============================================================================
  114. *
  115. * ==============================================================================
  116. *  Version History:
  117. * ------------------------------------------------------------------------------
  118. *  v 1.00 - 2015.11.26 > First release.
  119. *  v 1.01 - 2015.11.29 > Added function to get database objects.
  120. *  v 1.02 - 2015.12.07 > Added function to get multiples elements.
  121. *                      > Added check for plugin correct order.
  122. *  v 1.03 - 2015.12.13 > Added function to get page comments.
  123. *  v 1.04 - 2015.12.21 > Added function to check only relevant objects.
  124. *  v 1.05 - 2015.12.25 > Added check to wait bitmap loading.
  125. *  v 1.06 - 2015.12.31 > Added rgb to hex and hex to rgb functions.
  126. *                      > Added function to get plugins parameters.     
  127. *  v 1.07 - 2016.01.07 > Fixed issue with plugin order checks.
  128. *  v 1.08 - 2016.01.17 > Added function to get BattleLog method index.
  129. *                      > Added function to insert methods on BattleLog.
  130. *  v 1.09 - 2016.01.24 > Added function to set wait for animations.
  131. *  v 1.10 - 2016.02.05 > Added function to get values from regex.
  132. *  v 1.11 - 2016.02.10 > Added function to capitalize texts.
  133. *                      > Added Plugin Parameter to set trait display names.
  134. *  v 1.12 - 2016.02.18 > Added function to get parameter names.
  135. *  v 1.13 - 2016.02.26 > Added functions to setup battler direction.
  136. *  v 1.14 - 2016.03.15 > Added functions to check opponents.
  137. *  v 1.15 - 2016.03.18 > Added function for compatibility with YEP.
  138. *  v 1.16 - 2016.03.23 > Added function to replace mathods.
  139. *                        Added functions for dynamic motions.
  140. *  v 1.17 - 2016.04.01 > Fixed issue with battler sprite check.
  141. *  v 1.18 - 2016.04.21 > Fixed issue with damage popup on action user.
  142. *  v 1.19 - 2016.04.30 > Added function to get evaluated font color.
  143. *  v 1.20 - 2016.05.12 > Added function to get width of text with escape codes.
  144. *  v 1.21 - 2016.05.31 > Improved method stack for dynamic motions.
  145. *                      > Added functions for compatibility with Battle Motions.
  146. *  v 1.22 - 2016.06.26 > Added functions for escape command.
  147. *  v 1.23 - 2017.05.25 > Added functions for damage formula.
  148. * ===============================================================================
  149. */

  150. (function() {

  151.     //=============================================================================
  152.     // Parameters
  153.     //=============================================================================

  154.     VictorEngine.getPluginParameters = function() {
  155.         var script = document.currentScript || (function() {
  156.             var scripts = document.getElementsByTagName('script');
  157.             return scripts[scripts.length - 1];
  158.         })();
  159.         var start = script.src.lastIndexOf('/') + 1;
  160.         var end = script.src.indexOf('.js');
  161.         return PluginManager.parameters(script.src.substring(start, end));
  162.     }

  163.     var parameters = VictorEngine.getPluginParameters();
  164.     VictorEngine.Parameters = VictorEngine.Parameters || {};
  165.     VictorEngine.Parameters.BasicModule = {};
  166.     VictorEngine.Parameters.BasicModule.hit = String(parameters["Hit Rate Name"]).trim();
  167.     VictorEngine.Parameters.BasicModule.eva = String(parameters["Evasion Rate Name"]).trim();
  168.     VictorEngine.Parameters.BasicModule.cri = String(parameters["Critical Rate Name"]).trim();
  169.     VictorEngine.Parameters.BasicModule.cev = String(parameters["Critical Evasion Name"]).trim();
  170.     VictorEngine.Parameters.BasicModule.hev = String(parameters["Magic Evasion Name"]).trim();
  171.     VictorEngine.Parameters.BasicModule.mrf = String(parameters["Magic Reflection Name"]).trim();
  172.     VictorEngine.Parameters.BasicModule.cnt = String(parameters["Counter Attack Name"]).trim();
  173.     VictorEngine.Parameters.BasicModule.hrg = String(parameters["HP Regeneration Name"]).trim();
  174.     VictorEngine.Parameters.BasicModule.mrg = String(parameters["MP Regeneration Name"]).trim();
  175.     VictorEngine.Parameters.BasicModule.trg = String(parameters["TP Regeneration Name"]).trim();
  176.     VictorEngine.Parameters.BasicModule.tgr = String(parameters["Target Rate Name"]).trim();
  177.     VictorEngine.Parameters.BasicModule.grd = String(parameters["Guard Rate Name"]).trim();
  178.     VictorEngine.Parameters.BasicModule.rec = String(parameters["Recovery Effect Name"]).trim();
  179.     VictorEngine.Parameters.BasicModule.pha = String(parameters["Pharmacology Name"]).trim();
  180.     VictorEngine.Parameters.BasicModule.mcr = String(parameters["MP Cost Rate Name"]).trim();
  181.     VictorEngine.Parameters.BasicModule.tcr = String(parameters["TP Charge Rate Name"]).trim();
  182.     VictorEngine.Parameters.BasicModule.pdr = String(parameters["Physical Damage Name"]).trim();
  183.     VictorEngine.Parameters.BasicModule.mdr = String(parameters["Magical Damage Name"]).trim();
  184.     VictorEngine.Parameters.BasicModule.fdr = String(parameters["Floor Damage"]).trim();
  185.     VictorEngine.Parameters.BasicModule.ext = String(parameters["Experience"]).trim();

  186.     //=============================================================================
  187.     // DataManager
  188.     //=============================================================================

  189.     VictorEngine.BasicModule.isDatabaseLoaded = DataManager.isDatabaseLoaded;
  190.     DataManager.isDatabaseLoaded = function() {
  191.         if (!VictorEngine.BasicModule.isDatabaseLoaded.call(this)) return false;
  192.         VictorEngine.loadParameters();
  193.         VictorEngine.loadNotetags();
  194.         return ImageManager.isReady();
  195.     };

  196.     //=============================================================================
  197.     // VictorEngine
  198.     //=============================================================================

  199.     VictorEngine.BasicModule.checkPlugins = function(name, req, ver) {
  200.         var msg = '';
  201.         this.loadedPlugins = this.loadedPlugins || {};
  202.         if (ver && req && (!Imported[req] || Number(Imported[req]) < Number(ver))) {
  203.             msg += 'The plugin ' + name + ' requires the plugin ' + req;
  204.             msg += ' v' + ver + ' or higher installed to work properly'
  205.             if (Number(Imported[req]) < Number(ver)) {
  206.                 msg += '. Your current version is v' + Imported[req];
  207.             }
  208.             msg += '. Go to [url]http://victorenginescripts.wordpress.com/'[/url]
  209.             msg += ' to download the updated plugin.';
  210.             throw msg;
  211.         } else if (!ver && req && this.loadedPlugins[req] === true) {
  212.             msg += 'The plugin ' + name + ' requires the plugin ' + req;
  213.             msg += ' to be placed bellow it. Open the Plugin Manager and place';
  214.             msg += ' the plugins in the correct order.';
  215.             throw msg;
  216.         } else if (req && Imported['VE - Basic Module'] && !this.loadedPlugins['VE - Basic Module']) {
  217.             msg += 'The plugin ' + name + ' must be placed bellow the plugin ' + req;
  218.             msg += '. Open the Plugin Manager and place';
  219.             msg += ' the plugins in the correct order.';
  220.             throw msg;
  221.         } else {
  222.             this.loadedPlugins[name] = true
  223.         }
  224.     };

  225.     VictorEngine.loadNotetags = function() {
  226.         if (VictorEngine.BasicModule.loaded) return;
  227.         VictorEngine.BasicModule.loaded = true;
  228.         var list = [$dataActors, $dataClasses, $dataSkills, $dataItems, $dataWeapons,
  229.             $dataArmors, $dataEnemies, $dataStates
  230.         ];
  231.         list.forEach(function(objects, index) {
  232.             this.processNotetags(objects, index)
  233.         }, this);
  234.     };

  235.     VictorEngine.processNotetags = function(objects, index) {
  236.         objects.forEach(function(data) {
  237.             if (data) {
  238.                 this.loadNotetagsValues(data, index);
  239.             }
  240.         }, this);
  241.     };

  242.     VictorEngine.objectSelection = function(index, list) {
  243.         var objects = ['actor', 'class', 'skill', 'item', 'weapon', 'armor', 'enemy', 'state'];
  244.         return list.contains(objects[index]);
  245.     };

  246.     VictorEngine.loadNotetagsValues = function(data, index) {};

  247.     VictorEngine.loadParameters = function() {};

  248.     VictorEngine.getNotesValues = function(value1, value2) {
  249.         value2 = value2 || value1;
  250.         return new RegExp('<' + value1 + '>([\\s\\S]*?)<\\/' + value2 + '>', 'gi');
  251.     };

  252.     VictorEngine.getPageNotes = function(event) {
  253.         var result = (event instanceof Game_CommonEvent) || event.page();
  254.         if (!result || !event.list()) {
  255.             return "";
  256.         }
  257.         return event.list().reduce(function(r, cmd) {
  258.             var valid = (cmd.code === 108 || cmd.code === 408);
  259.             var comment = valid ? cmd.parameters[0] + "\r\n" : "";
  260.             return r + comment;
  261.         }, "");
  262.     };

  263.     VictorEngine.getAllElements = function(subject, action) {
  264.         if (action.item().damage.elementId < 0) {
  265.             return subject.attackElements();
  266.         } else {
  267.             return [action.item().damage.elementId];
  268.         }
  269.     };

  270.     VictorEngine.getAllStates = function(subject, item) {
  271.         var result;
  272.         return item.effects.reduce(function(r, effect) {
  273.             if (effect.code === 21) {
  274.                 if (effect.dataId === 0) {
  275.                     result = subject.attackStates();
  276.                 } else {
  277.                     result = [effect.dataId];
  278.                 };
  279.             } else {
  280.                 result = [];
  281.             };
  282.             return r.concat(result);
  283.         }, []);
  284.     };

  285.     VictorEngine.getDamageFormula = function(action) {
  286.                 return action.item().damage.formula;
  287.     };

  288.     VictorEngine.getNumberValue = function(match, type, base) {
  289.         var regex = new RegExp(type + '[ ]*:[ ]*([+-.\\d]+)', 'gi');
  290.         var value = regex.exec(match);
  291.         return value ? Number(value[1]) : base;
  292.     };

  293.     VictorEngine.getStringValue = function(match, type, base) {
  294.         var regex = new RegExp(type + "[ ]*:[ ]*([\\w ]+)", 'gi');
  295.         var value = regex.exec(match);
  296.         return value ? value[1].trim() : base;
  297.     };

  298.     VictorEngine.getAnyValue = function(match, type, base) {
  299.         var regex = new RegExp(type + "[ ]*:[ ]*('[^\']+'|"[^"]+")", 'gi');
  300.         var value = regex.exec(match);
  301.         return value ? value[1].slice(1, -1) : base;
  302.     };

  303.     VictorEngine.getNumberValues = function(match, type) {
  304.         var regex = new RegExp(type + '[ ]*:[ ]*((?:[+-.\\d]+[ ]*,?[ ]*)+)', 'gi');
  305.         var value = regex.exec(match);
  306.         var result = value ? value[1].match(/\d+/gi) : [];
  307.         return result.map(function(id) {
  308.             return Number(id)
  309.         });
  310.     };

  311.     VictorEngine.getStringValues = function(match, type) {
  312.         var regex = new RegExp(type + '[ ]*:[ ]*((?:[\\w ]+[ ]*,?[ ]*)+)', 'gi');
  313.         var value = regex.exec(match);
  314.         var result = value ? value[1].match(/\d+/gi) : [];
  315.         return result.map(function(id) {
  316.             return value[1].trim()
  317.         });
  318.     };

  319.     VictorEngine.captalizeText = function(text) {
  320.         return text.replace(/(?:^|\s)\S/g, function(a) {
  321.             return a.toUpperCase();
  322.         });
  323.     };

  324.     VictorEngine.replaceZeros = function(text, value) {
  325.         value = value || '';
  326.         return text.replace(/\b(0(?!\b))+/g, function(a) {
  327.             return a.replace(/0/g, value);
  328.         });
  329.     };

  330.     VictorEngine.rgbToHex = function(r, g, b) {
  331.         r = Math.floor(r).toString(16).padZero(2);
  332.         g = Math.floor(g).toString(16).padZero(2);
  333.         b = Math.floor(b).toString(16).padZero(2);
  334.         return '#' + r + g + b;
  335.     }

  336.     VictorEngine.hexToRgb = function(hex) {
  337.         var r = parseInt(hex[1] + hex[2], 16);
  338.         var g = parseInt(hex[3] + hex[4], 16);
  339.         var b = parseInt(hex[5] + hex[6], 16);
  340.         return [r, g, b];
  341.     }

  342.     VictorEngine.methodIndex = function(methods, name) {
  343.         for (var i = 0; i < methods.length; i++) {
  344.             if (methods[i] && methods[i].name === name) {
  345.                 return i;
  346.             }
  347.         }
  348.         return null;
  349.     }

  350.     VictorEngine.removeMethod = function(methods, name) {
  351.         var index = this.methodIndex(methods, name);
  352.         if (index || index === 0) {
  353.             methods.splice(index, 1);
  354.         }
  355.     }

  356.     VictorEngine.insertMethod = function(methods, index, name, params) {
  357.         if (index || index === 0) {
  358.             methods.splice(index, 0, {
  359.                 name: name,
  360.                 params: params
  361.             });
  362.         }
  363.     }

  364.     VictorEngine.replaceMethod = function(methods, index, name, params) {
  365.         if (index || index === 0) {
  366.             methods.splice(index, 1, {
  367.                 name: name,
  368.                 params: params
  369.             });
  370.         }
  371.     }

  372.     VictorEngine.waitAnimation = function(animationId) {
  373.         var animation = $dataAnimations[animationId];
  374.         return animation ? animation.frames.length * 4 + 1 : 0;
  375.     };

  376.     VictorEngine.params = function() {
  377.         return ['hp', 'mp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk'];
  378.     };

  379.     VictorEngine.xparams = function() {
  380.         return ['hit', 'eva', 'cri', 'cev', 'mev', 'mrf', 'cnt', 'hrg', 'mrg', 'trg'];
  381.     };

  382.     VictorEngine.sparams = function() {
  383.         return ['tgr', 'grd', 'rec', 'pha', 'mcr', 'tcr', 'prd', 'mrd', 'frd', 'exr'];
  384.     };

  385.     VictorEngine.allParams = function() {
  386.         return this.params().concat(this.xparams(), this.sparams())
  387.     };

  388.     VictorEngine.paramName = function(paramId) {
  389.         return this.params()[paramId];
  390.     };

  391.     VictorEngine.xparamName = function(xparamId) {
  392.         return this.xparams()[xparamId];
  393.     };

  394.     VictorEngine.sparamName = function(sparamId) {
  395.         return this.sparams()[sparamId];
  396.     };

  397.     VictorEngine.paramId = function(paramName) {
  398.         return this.params().indexOf(paramName.toLowerCase());
  399.     };

  400.     VictorEngine.paramText = function(name) {
  401.         switch (name.toLowerCase()) {
  402.             case 'hit':
  403.             case 'eva':
  404.             case 'cri':
  405.             case 'cev':
  406.             case 'mev':
  407.             case 'mrf':
  408.             case 'cnt':
  409.             case 'hrg':
  410.             case 'mrg':
  411.             case 'trg':
  412.             case 'tgr':
  413.             case 'grd':
  414.             case 'rec':
  415.             case 'pha':
  416.             case 'mcr':
  417.             case 'tcr':
  418.             case 'pdr':
  419.             case 'mdr':
  420.             case 'fdr':
  421.             case 'ext':
  422.                 return this.Parameters.BasicModule[name.toLowerCase()];
  423.             case 'hp':
  424.             case 'atk':
  425.             case 'def':
  426.             case 'agi':
  427.             case 'mp':
  428.             case 'mat':
  429.             case 'mdf':
  430.             case 'luk':
  431.                 var paramId = this.params().indexOf(name.toLowerCase());
  432.                 return TextManager.param(paramId)
  433.             default:
  434.                 return this.captalizeText(name.toLowerCase());
  435.         }
  436.     };

  437.     VictorEngine.battlerIndex = function(battler) {
  438.         if (battler && battler.isActor() && $gameParty.members().contains(battler)) {
  439.             return 1 + $gameParty.members().indexOf(battler);
  440.         } else if (battler && battler.isEnemy() && $gameTroop.members().contains(battler)) {
  441.             return 1 + $gameParty.maxBattleMembers() + $gameTroop.members().indexOf(battler);
  442.         } else {
  443.             return 0;
  444.         }
  445.     };

  446.     VictorEngine.battleSprites = function(spriteId) {
  447.         return this._battleSprites[spriteId];
  448.     };

  449.     VictorEngine.addBattleSprite = function(spriteId, sprite) {
  450.         this._battleSprites = this._battleSprites || {};
  451.         this._battleSprites[spriteId] = sprite;
  452.     };

  453.     //=============================================================================
  454.     // BattleManager
  455.     //=============================================================================

  456.     BattleManager.updateStackAction = function(index, subject, target) {
  457.         this._logWindow.saveMethodsStack(index);
  458.         this.clearTargets(target);
  459.         this.invokeAction(subject, target);
  460.         this._logWindow.restoreMethodsStack(index);
  461.     };

  462.     BattleManager.clearTargets = function(target) {
  463.         for (var i = 0; i < this._targets.length; i++) {
  464.             if (this._targets[i] === target) {
  465.                 this._targets.splice(i, 1);
  466.                 i--;
  467.             }
  468.         }
  469.     };

  470.     BattleManager.clearActionTargets = function() {
  471.         this._targets = [];
  472.     };

  473.     BattleManager.prepareAction = function(subject, action, targets, skip) {
  474.         this._phase = 'action';
  475.         this._subject = subject;
  476.         this._action = action;
  477.         this._targets = targets;
  478.         if (skip) {
  479.             subject.useItem(action.item());
  480.         }
  481.         this._action.applyGlobal();
  482.         this.refreshStatus();
  483.     };

  484.     BattleManager.startCounterAction = function(subject, target, targets, action) {
  485.         if (targets.length > 0) {
  486.             this._isCounterAttack = true;
  487.             this._counterSubject = subject;
  488.             this._counterTarget = target;
  489.             this.prepareAction(subject, action, targets);
  490.             this._logWindow.startCounterAction(subject, action, targets);
  491.         }
  492.     };

  493.     BattleManager.averageTargetsPositions = function(targets) {
  494.         var x = targets.reduce(function(r, member) {
  495.             return r + member.screenX();
  496.         }, 0) / targets.length;
  497.         var y = targets.reduce(function(r, member) {
  498.             return r + member.screenX();
  499.         }, 0) / targets.length;
  500.         return {
  501.             x: x,
  502.             y: y
  503.         };
  504.     };

  505.     BattleManager.isSurprise = function() {
  506.         return this._surprise;
  507.     };

  508.     BattleManager.isPreemptive = function() {
  509.         return this._preemptive;
  510.     };

  511.     //=============================================================================
  512.     // SceneManager
  513.     //=============================================================================

  514.     SceneManager.sceneSpriteset = function() {
  515.         return this._scene ? this._scene._spriteset : null;
  516.     };

  517.     //=============================================================================
  518.     // Window_Base
  519.     //=============================================================================

  520.     Window_Base.prototype.getFontColor = function(color) {
  521.         if (color.match(/^\#[abcdef\d]{6}/i)) {
  522.             return '"' + color + '"';
  523.         } else {
  524.             return color;
  525.         }
  526.     };

  527.     //=============================================================================
  528.     // Game_Action
  529.     //=============================================================================

  530.     Game_Action.prototype.setEscape = function() {
  531.         var action = {
  532.             name: TextManager.escape,
  533.             speed: 9999,
  534.             escape: true
  535.         };
  536.         this._escapeAction = action;
  537.     };

  538.     Game_Action.prototype.isEscape = function() {
  539.         return !!this._escapeAction;
  540.     };

  541.     //=============================================================================
  542.     // Game_Unit
  543.     //=============================================================================

  544.     Game_Unit.prototype.averageX = function() {
  545.         return this.aliveMembers().reduce(function(r, member) {
  546.             return r + member.screenX();
  547.         }, 0) / this.aliveMembers().length;
  548.     };

  549.     Game_Unit.prototype.averageY = function() {
  550.         return this.aliveMembers().reduce(function(r, member) {
  551.             return r + member.screenY();
  552.         }, 0) / this.aliveMembers().length;
  553.     };

  554.     //=============================================================================
  555.     // Game_Player
  556.     //=============================================================================

  557.     Game_Player.prototype.follower = function(index) {
  558.         return index === 0 ? this : this.followers().follower(index - 1);
  559.     };

  560.     //=============================================================================
  561.     // Game_BattlerBase
  562.     //=============================================================================

  563.     Game_BattlerBase.prototype.screenX = function() {
  564.         return this.spriteScreenX() || this._screenX || 0;
  565.     };

  566.     Game_BattlerBase.prototype.screenY = function() {
  567.         return this.spriteScreenY() || this._screenY || 0;
  568.     };

  569.     Game_BattlerBase.prototype.homeX = function() {
  570.         return this.battleSprite() ? this.battleSprite().homeX() : 0;
  571.     };

  572.     Game_BattlerBase.prototype.homeY = function() {
  573.         return this.battleSprite() ? this.battleSprite().homeY() : 0;
  574.     };

  575.     Game_BattlerBase.prototype.spriteScreenX = function() {
  576.         return this.battleSprite() ? this.battleSprite().screenX() : 0;
  577.     };

  578.     Game_BattlerBase.prototype.spriteScreenY = function() {
  579.         return this.battleSprite() ? this.battleSprite().screenY() : 0;
  580.     };

  581.     Game_BattlerBase.prototype.mainSprite = function() {
  582.         return this.battleSprite() ? this.battleSprite().mainSprite() : null;
  583.     };

  584.     Game_BattlerBase.prototype.friends = function() {
  585.         return this.isActor() ? $gameParty : $gameTroop;
  586.     };

  587.     Game_BattlerBase.prototype.opponents = function() {
  588.         return this.isEnemy() ? $gameParty : $gameTroop;
  589.     };

  590.     Game_BattlerBase.prototype.isOpponent = function(battler) {
  591.         return this.isEnemy() === !battler.isEnemy();
  592.     };

  593.     Game_BattlerBase.prototype.idleMotions = function() {
  594.         return ['wait', 'idle', 'dying', 'abnormal', 'guard', 'chant', 'sleep', 'victory', 'dead'];
  595.     };

  596.     Game_BattlerBase.prototype.isIdleMotion = function(motionType) {
  597.         return this.idleMotions().contains(motionType);
  598.     };

  599.     Game_BattlerBase.prototype.isFacingDown = function() {
  600.         return this.battlerDirection() === 'down';
  601.     };

  602.     Game_BattlerBase.prototype.isFacingLeft = function() {
  603.         return this.battlerDirection() === 'left';
  604.     };

  605.     Game_BattlerBase.prototype.isFacingRight = function() {
  606.         return this.battlerDirection() === 'right';
  607.     };

  608.     Game_BattlerBase.prototype.isFacingUp = function() {
  609.         return this.battlerDirection() === 'up';
  610.     };

  611.     Game_BattlerBase.prototype.isFacingHorizontal = function() {
  612.         return this.isFacingLeft() || this.isFacingRight();
  613.     };

  614.     Game_BattlerBase.prototype.isFacingVertical = function() {
  615.         return this.isFacingDown() || this.isFacingUp();
  616.     };

  617.     Game_BattlerBase.prototype.turnDown = function() {
  618.         this._battlerDirection = 'down';
  619.     };

  620.     Game_BattlerBase.prototype.turnLeft = function() {
  621.         this._battlerDirection = 'left';
  622.     };

  623.     Game_BattlerBase.prototype.turnRight = function() {
  624.         this._battlerDirection = 'right';
  625.     };

  626.     Game_BattlerBase.prototype.turnUp = function() {
  627.         this._battlerDirection = 'up';
  628.     };

  629.     Game_BattlerBase.prototype.turnBack = function() {
  630.         if (this.isFacingLeft()) {
  631.             this.turnRight();
  632.         } else if (this.isFacingRight()) {
  633.             this.turnLeft();
  634.         }
  635.     };

  636.     Game_BattlerBase.prototype.turnTowardCenter = function() {
  637.         this.turnTowardPosition(Graphics.boxWidth / 2, Graphics.boxHeight / 2);
  638.     };

  639.     Game_BattlerBase.prototype.turnAwayFromCenter = function() {
  640.         this.turnAwayFromPosition(Graphics.boxWidth / 2, Graphics.boxHeight / 2);
  641.     };

  642.     Game_BattlerBase.prototype.turnTowardOpponents = function() {
  643.         this.turnTowardPosition(this.opponents().averageX(), this.opponents().averageY());
  644.     };

  645.     Game_BattlerBase.prototype.turnAwayFromOpponents = function() {
  646.         this.turnAwayFromPosition(this.opponents().averageX(), this.opponents().averageY);
  647.     };

  648.     Game_BattlerBase.prototype.turnTowardTargets = function(targets) {
  649.         var position = BattleManager.averageTargetsPositions(targets);
  650.         this.turnTowardPosition(position.x, position.y);
  651.     };

  652.     Game_BattlerBase.prototype.turnAwayFromTargets = function(targets) {
  653.         var position = BattleManager.averageTargetsPositions(targets);
  654.         this.turnAwayFromPosition(position.x, position);
  655.     };

  656.     Game_BattlerBase.prototype.turnTowardPosition = function(positionX, positionY) {
  657.         if (this.screenX() < positionX) {
  658.             this.turnRight();
  659.         } else if (this.screenX() > positionX) {
  660.             this.turnLeft();
  661.         }
  662.     };

  663.     Game_BattlerBase.prototype.turnAwayFromPosition = function(positionX, positionY) {
  664.         if (this.screenX() < positionX) {
  665.             this.turnLeft();
  666.         } else if (this.screenX() > positionX) {
  667.             this.turnRight();
  668.         }
  669.     };

  670.     Game_BattlerBase.prototype.isBehind = function(target) {
  671.         return (target.isFacingRight() && this.screenX() < target.screenX()) ||
  672.             (target.isFacingLeft() && this.screenX() > target.screenX());
  673.     };

  674.     Game_BattlerBase.prototype.isSpriteEffecting = function() {
  675.         return this.battleSprite() && this.battleSprite().isEffecting();
  676.     };

  677.     Game_BattlerBase.prototype.isSpriteMoving = function() {
  678.         return this.battleSprite() && this.battleSprite().isMoving();
  679.     };

  680.     Game_BattlerBase.prototype.isSpriteAnimation = function() {
  681.         return this.battleSprite() && this.battleSprite().isAnimationPlaying();
  682.     };

  683.     Game_BattlerBase.prototype.isAnimatedBattler = function() {
  684.         return this.battleSprite() && this.battleSprite().isAnimatedBattler();
  685.     };

  686.     Game_BattlerBase.prototype.isStaticBattler = function() {
  687.         return this.battleSprite() && this.battleSprite().isStaticBattler();
  688.     };

  689.     Game_BattlerBase.prototype.inHomePosition = function() {
  690.         return this.battleSprite() && this.battleSprite().inHomePosition();
  691.     };

  692.     Game_BattlerBase.prototype.notIinHomePosition = function() {
  693.         return !this.inHomePosition();
  694.     };

  695.     Game_BattlerBase.prototype.isCounterAttack = function() {
  696.         return this._counterAttack;
  697.     };

  698.     Game_BattlerBase.prototype.startCounterAttack = function() {
  699.         this._counterAttack = true;
  700.     };

  701.     Game_BattlerBase.prototype.endCounterAttack = function() {
  702.         this._counterAttack = false;
  703.     };

  704.     Game_BattlerBase.prototype.battleSprite = function() {
  705.         return VictorEngine.battleSprites(this.spriteId());
  706.     };

  707.     Game_BattlerBase.prototype.setBattleSprite = function(sprite) {
  708.         VictorEngine.addBattleSprite(this.spriteId(), sprite);
  709.     };

  710.     Game_BattlerBase.prototype.clearBattleSprite = function() {
  711.         VictorEngine.addBattleSprite(this.spriteId(), null);
  712.     };

  713.     Game_BattlerBase.prototype.addNewAction = function(action) {
  714.         this._actions.unshift(action);
  715.     };

  716.     Game_BattlerBase.prototype.startEscapeCommand = function() {
  717.         this._isEscapeCommand = true;
  718.     };
  719.     Game_BattlerBase.prototype.endEscapeCommand = function() {
  720.         this._isEscapeCommand = false;
  721.     };
  722.     Game_BattlerBase.prototype.isEscapeCommand = function() {
  723.         return this._isEscapeCommand;
  724.     };

  725.     //=============================================================================
  726.     // Game_Battler
  727.     //=============================================================================

  728.     VictorEngine.BasicModule.onBattleEnd = Game_Battler.prototype.onBattleEnd;
  729.     Game_Battler.prototype.onBattleEnd = function() {
  730.         VictorEngine.BasicModule.onBattleEnd.call(this);
  731.         this.clearBattleSprite();
  732.     };

  733.     //=============================================================================
  734.     // Game_Actor
  735.     //=============================================================================

  736.     Game_Actor.prototype.battlerDirection = function() {
  737.         return this._battlerDirection || 'left';
  738.     };

  739.     Game_Actor.prototype.spriteId = function() {
  740.         return 'actor ' + String(this.actorId());
  741.     };

  742.     //=============================================================================
  743.     // Game_Enemy
  744.     //=============================================================================

  745.     Game_Enemy.prototype.battlerDirection = function() {
  746.         return this._battlerDirection || ($gameSystem.isSideView() ? 'right' : 'left');
  747.     };

  748.     Game_Enemy.prototype.attackAnimationId1 = function() {
  749.         return 0;
  750.     };

  751.     Game_Enemy.prototype.attackAnimationId2 = function() {
  752.         return 0;
  753.     };

  754.     Game_Enemy.prototype.spriteId = function() {
  755.         return 'enemy ' + String(this.index());
  756.     };

  757.     //=============================================================================
  758.     // Sprite_Battler
  759.     //=============================================================================

  760.     Object.defineProperties(Sprite_Battler.prototype, {
  761.         z: {
  762.             get: function() {
  763.                 return 3;
  764.             },
  765.             configurable: true
  766.         },
  767.         h: {
  768.             get: function() {
  769.                 return this.spriteZ();
  770.             },
  771.             configurable: true
  772.         }
  773.     });

  774.     Sprite_Battler.prototype.isEnemy = function() {
  775.         return this._battler && this._battler.isEnemy();
  776.     };

  777.     Sprite_Battler.prototype.isVisible = function() {
  778.         return this.visible && this.opacity > 0;
  779.     };

  780.     Sprite_Battler.prototype.isDamagePopup = function() {
  781.         return this._damages.length > 0;
  782.     };

  783.     Sprite_Battler.prototype.isDisabledMotion = function() {
  784.         var motion = Sprite_Actor.MOTIONS;
  785.         return this._motion === motion['dead'] || this._motion === motion['sleep'];
  786.     };

  787.     Sprite_Battler.prototype.isAnimatedBattler = function() {
  788.         return false;
  789.     };

  790.     Sprite_Battler.prototype.isStaticBattler = function() {
  791.         return false;
  792.     };

  793.     Sprite_Battler.prototype.spriteZ = function() {
  794.         return this.screenY();
  795.     };

  796.     Sprite_Battler.prototype.screenX = function() {
  797.         return this._homeX + this._offsetX;
  798.     };

  799.     Sprite_Battler.prototype.screenY = function() {
  800.         return this._homeY + this._offsetY;
  801.     };

  802.     Sprite_Battler.prototype.homeX = function() {
  803.         return this._homeX;
  804.     };

  805.     Sprite_Battler.prototype.homeY = function() {
  806.         return this._homeY;
  807.     };

  808.     Sprite_Battler.prototype.mainSprite = function() {
  809.         return this._mainSprite;
  810.     };

  811.     Sprite_Battler.prototype.noEntryMove = function() {
  812.         return this._battler && !this._battler.canMove();
  813.     };

  814.     Sprite_Battler.prototype.center = function() {
  815.         var sprite = this._mainSprite ? this._mainSprite : this;
  816.         var x = sprite._frame.width / 2 || 0;
  817.         var y = sprite._frame.height / 2 || 0;
  818.         return {
  819.             x: x,
  820.             y: y
  821.         };
  822.     };

  823.     //=============================================================================
  824.     // Sprite_Actor
  825.     //=============================================================================

  826.     Sprite_Actor.prototype.updateBattlerDirection = function() {
  827.         if (this._battler && !this.isDisabledMotion()) {
  828.             if ((this._battler.isFacingLeft() && this.scale.x < 0) ||
  829.                 (this._battler.isFacingRight() && this.scale.x > 0)) {
  830.                 this.scale.x *= -1;
  831.             }
  832.         }
  833.     };

  834.     //=============================================================================
  835.     // Sprite_Enemy
  836.     //=============================================================================

  837.     Sprite_Enemy.prototype.updateBattlerDirection = function() {
  838.         if (this._battler && !this.isDisabledMotion()) {
  839.             if ((this._battler.isFacingLeft() && this.scale.x > 0) ||
  840.                 (this._battler.isFacingRight() && this.scale.x < 0)) {
  841.                 this.scale.x *= -1;
  842.             }
  843.         }
  844.     };

  845.     Sprite_Enemy.prototype.isStaticBattler = function() {
  846.         return true;
  847.     };

  848.     //=============================================================================
  849.     // Sprite_Damage
  850.     //=============================================================================

  851.     Object.defineProperties(Sprite_Damage.prototype, {
  852.         z: {
  853.             get: function() {
  854.                 return 10;
  855.             },
  856.             configurable: true
  857.         }
  858.     });

  859.     //=============================================================================
  860.     // Spriteset_Battle
  861.     //=============================================================================

  862.     VictorEngine.BasicModule.setBattler = Sprite_Battler.prototype.setBattler;
  863.     Sprite_Battler.prototype.setBattler = function(battler) {
  864.         VictorEngine.BasicModule.setBattler.call(this, battler);
  865.         if (battler) {
  866.             battler.setBattleSprite(this);
  867.         }
  868.     };

  869.     Spriteset_Battle.prototype.sortBattleSprites = function() {
  870.         if (this._sortChildrenFrame !== Graphics.frameCount) {
  871.             this._battleField.children.sort(this.compareBattleSprites.bind(this));
  872.             this._sortChildrenFrame = Graphics.frameCount;
  873.         }
  874.     };

  875.     Spriteset_Battle.prototype.compareBattleSprites = function(a, b) {
  876.         if ((a.z || 0) !== (b.z || 0)) {
  877.             return (a.z || 0) - (b.z || 0);
  878.         } else if ((a.h || 0) !== (b.h || 0)) {
  879.             return (a.h || 0) - (b.h || 0);
  880.         } else if ((a.y || 0) !== (b.y || 0)) {
  881.             return (a.y || 0) - (b.y || 0);
  882.         } else {
  883.             return a.spriteId - b.spriteId;
  884.         }
  885.     };

  886.     //=============================================================================
  887.     // Window_Base
  888.     //=============================================================================

  889.     Window_Base.prototype.textWidthEx = function(text) {
  890.         if (text) {
  891.             var state = {
  892.                 index: 0,
  893.                 x: 0
  894.             };
  895.             state.text = this.convertEscapeCharacters(text);
  896.             while (state.index < state.text.length) {
  897.                 this.processCharacter(state)
  898.             };
  899.             return state.x;
  900.         } else {
  901.             return 0;
  902.         }
  903.     };

  904.     //=============================================================================
  905.     // Window_BattleLog
  906.     //=============================================================================

  907.     Window_BattleLog.prototype.waitForBattleAnimation = function(animationId, speed) {
  908.         var speed = Math.max(speed, 1) || 1;
  909.         this.waitForTime(VictorEngine.waitAnimation(animationId) / speed);
  910.     };

  911.     Window_BattleLog.prototype.startCounterAction = function(subject, action, targets) {
  912.         this.push('addText', TextManager.counterAttack.format(subject.name()));
  913.         this.startAction(subject, action, targets);
  914.     };

  915.     Window_BattleLog.prototype.waitForTime = function(time) {
  916.         this._waitCount = time;
  917.     };

  918.     Window_BattleLog.prototype.setupStartAction = function(subject, action, targets) {
  919.         if (this._setupStartActionFrame !== Graphics.frameCount) {
  920.             VictorEngine.removeMethod(this._methods, 'showAnimation');
  921.             VictorEngine.removeMethod(this._methods, 'waitForBattleAnimation');
  922.             this.push('prepareAction', subject, action, targets);
  923.             this._setupStartActionFrame = Graphics.frameCount;
  924.         }
  925.     };

  926.     Window_BattleLog.prototype.initializeMethodsStack = function() {
  927.         this._stackWaitCount = [];
  928.         this._stackWaitMode = [];
  929.         this._methodsStack = [];
  930.         this._stackIndex = 0;
  931.     };

  932.     Window_BattleLog.prototype.prepareAction = function(subject, action, targets) {
  933.         this.uniqueTargets(targets).forEach(function(unique) {
  934.             this._stackIndex = VictorEngine.battlerIndex(unique.target);
  935.             this.prepareUniqueAction(subject, action, unique.target, unique.repeat)
  936.         }, this)
  937.         this._stackIndex = 0;
  938.     };

  939.     Window_BattleLog.prototype.prepareUniqueAction = function(subject, action, target, repeat) {
  940.         this.prepareUniqueActionStep1(subject, action, target, repeat);
  941.         this.prepareUniqueActionStep2(subject, action, target, repeat);
  942.         this.prepareUniqueActionStep3(subject, action, target, repeat);
  943.     };

  944.     Window_BattleLog.prototype.prepareUniqueActionStep1 = function(subject, action, target, repeat) {
  945.         var item = action.item();
  946.         this.push('showAnimation', subject, [target], item.animationId);
  947.     };

  948.     Window_BattleLog.prototype.prepareUniqueActionStep2 = function(subject, action, target, repeat) {
  949.         var item = action.item();
  950.         var animId = this.uniqueActionAnimationId(subject, item)
  951.         this.push('waitForBattleAnimation', animId);
  952.     };

  953.     Window_BattleLog.prototype.prepareUniqueActionStep3 = function(subject, action, target, repeat) {
  954.         for (var i = 0; i < repeat; i++) {
  955.             if (i > 0) {
  956.                 this.push('waitForTime', 1);
  957.             }
  958.             this.push('updateStackAction', this._stackIndex, subject, target);
  959.         }
  960.     };

  961.     Window_BattleLog.prototype.uniqueActionAnimationId = function(subject, item) {
  962.         if (item.animationId < 0) {
  963.             return subject.attackAnimationId1();
  964.         } else {
  965.             return item.animationId;
  966.         }
  967.     }

  968.     Window_BattleLog.prototype.uniqueTargets = function(targets) {
  969.         var repeats = [];
  970.         targets.forEach(function(target, i) {
  971.             var index = targets.indexOf(target);
  972.             if (index === i) {
  973.                 repeats[index] = {
  974.                     target: target,
  975.                     repeat: 1
  976.                 };
  977.             } else {
  978.                 repeats[index].repeat++;
  979.             }
  980.         })
  981.         return repeats.filter(function(repeat) {
  982.             return !!repeat
  983.         });
  984.     }

  985.     Window_BattleLog.prototype.updateMethodsStack = function() {
  986.         var methods = this._methodsStack;
  987.         for (var i = 0; i < methods.length; i++) {
  988.             if (methods[i] && methods[i].length > 0) {
  989.                 while (methods[i].length > 0 && !this.updateStackWait(i)) {
  990.                     this.callNextStackMethod(i);
  991.                 }
  992.             }
  993.         }
  994.         if (this.isStackEmpty()) {
  995.             this._methodsStack = [];
  996.         }
  997.     };

  998.     Window_BattleLog.prototype.isStackEmpty = function() {
  999.         return this._methodsStack.every(function(methods) {
  1000.             return !methods || methods.length === 0;
  1001.         })
  1002.     };

  1003.     Window_BattleLog.prototype.stackBattler = function(index) {
  1004.         if (index > 0) {
  1005.             var max = $gameParty.maxBattleMembers();
  1006.             if (index > max) {
  1007.                 return $gameTroop.members()[index - max - 1];
  1008.             } else {
  1009.                 return $gameParty.members()[index - 1];
  1010.             }
  1011.         } else {
  1012.             return null;
  1013.         }
  1014.     };

  1015.     Window_BattleLog.prototype.callNextStackMethod = function(index) {
  1016.         var method = this._methodsStack[index].shift();
  1017.         if (method.name && this[method.name]) {
  1018.             this[method.name].apply(this, method.params);
  1019.         } else {
  1020.             throw new Error('Method not found: ' + method.name);
  1021.         }
  1022.     };

  1023.     Window_BattleLog.prototype.saveMethodsStack = function(index) {
  1024.         this._saveStackIndex = this._stackIndex;
  1025.         this._saveMethodsStack = this._methodsStack[index].clone();
  1026.         this._stackIndex = index;
  1027.         this._methodsStack[index] = [];
  1028.     };

  1029.     Window_BattleLog.prototype.restoreMethodsStack = function(index) {
  1030.         this._methodsStack[index] = this._methodsStack[index].concat(this._saveMethodsStack);
  1031.         this._stackIndex = this._saveStackIndex;
  1032.     };

  1033.     Window_BattleLog.prototype.methodStackActive = function() {
  1034.         return this._methodsStack.length > 0;
  1035.     };

  1036.     Window_BattleLog.prototype.updateStackAction = function(index, subject, target) {
  1037.         BattleManager.updateStackAction(index, subject, target);
  1038.     };

  1039.     Window_BattleLog.prototype.pushMethodsStack = function(methodName) {
  1040.         var index = this._stackIndex || 0;
  1041.         var methodArgs = Array.prototype.slice.call(arguments, 1);
  1042.         if (methodName === 'wait') {
  1043.             methodName = 'stackWait';
  1044.             methodArgs.unshift(index);
  1045.         } else if (methodName === 'waitForTime') {
  1046.             methodName = 'stackWaitForTime';
  1047.             methodArgs.unshift(index);
  1048.         } else if (methodName === 'waitForBattleAnimation') {
  1049.             methodName = 'stackWaitFoAnimation';
  1050.             methodArgs.unshift(index);
  1051.         } else if (methodName === 'updateWaitMode') {
  1052.             methodName = 'updateStackWaitMode';
  1053.             methodArgs.unshift(index);
  1054.         } else if (methodName === 'setWaitMode') {
  1055.             methodName = 'setStackWaitMode';
  1056.             methodArgs.unshift(index);
  1057.         }
  1058.         this._methodsStack[index] = this._methodsStack[index] || [];
  1059.         this._methodsStack[index].push({
  1060.             name: methodName,
  1061.             params: methodArgs
  1062.         });
  1063.     };

  1064.     Window_BattleLog.prototype.updateStackWait = function(index) {
  1065.         return this.updateStackWaitCount(index) || this.updateStackWaitMode(index);
  1066.     };

  1067.     Window_BattleLog.prototype.updateStackWaitCount = function(index) {
  1068.         if (this._stackWaitCount[index] && this._stackWaitCount[index] > 0) {
  1069.             this._stackWaitCount[index]--;
  1070.             return true;
  1071.         }
  1072.         return false;
  1073.     };

  1074.     Window_BattleLog.prototype.stackWait = function(index) {
  1075.         this.stackWaitForTime(index, this.messageSpeed());
  1076.     };

  1077.     Window_BattleLog.prototype.stackWaitFoAnimation = function(index, animationId, speed) {
  1078.         var speed = Math.max(speed, 1) || 1;
  1079.         this.stackWaitForTime(index, VictorEngine.waitAnimation(animationId) / speed);
  1080.     };

  1081.     Window_BattleLog.prototype.stackWaitForTime = function(index, time) {
  1082.         this._stackWaitCount[index] = time;
  1083.     };

  1084.     Window_BattleLog.prototype.updateStackWaitMode = function(index) {
  1085.         var battler = this.stackBattler(index);
  1086.         var waitMode = this._stackWaitMode[index] || [];
  1087.         if (waitMode.contains('effect')) {
  1088.             var waiting = battler ? battler.isSpriteEffecting() : this._spriteset.isEffecting();
  1089.             if (waiting) {
  1090.                 return true;
  1091.             } else {
  1092.                 this.removeWaitMode(index, 'effect');
  1093.             }
  1094.         }
  1095.         if (waitMode.contains('movement')) {
  1096.             var waiting = battler ? battler.isSpriteMoving() : this._spriteset.isAnyoneMoving();
  1097.             if (waiting) {
  1098.                 return true;
  1099.             } else {
  1100.                 this.removeWaitMode(index, 'movement');
  1101.             }
  1102.         }
  1103.         this._stackWaitMode[index] = [];
  1104.         return false;
  1105.     };

  1106.     Window_BattleLog.prototype.setStackWaitMode = function(index, waitMode) {
  1107.         this._stackWaitMode[index] = this._stackWaitMode[index] || [];
  1108.         if (!this._stackWaitMode[index].contains(waitMode)) {
  1109.             this._stackWaitMode[index].push(waitMode);
  1110.         }
  1111.     };

  1112.     Window_BattleLog.prototype.removeWaitMode = function(index, waitMode) {
  1113.         this._stackWaitMode[index] = this._stackWaitMode[index] || [];
  1114.         var waitIndex = this._stackWaitMode[index].indexOf(waitMode);
  1115.         this._stackWaitMode[index].splice(waitIndex, 1);
  1116.     };

  1117.     Window_BattleLog.prototype.startEscape = function(subject, action) {
  1118.         subject._isEscapeCommand = true;
  1119.     };

  1120.     Window_BattleLog.prototype.performEscape = function(subject) {
  1121.         $gameParty._skipClear = true;
  1122.         BattleManager.processEscape();
  1123.         $gameParty._skipClear = false;
  1124.     };

  1125.     Window_BattleLog.prototype.setupCurrentAction = function(subject, action, targets) {};

  1126. })();
复制代码


这是本体插件:(我自己稍微汉化了一下)
  1. /*
  2. /*
  3. * ==============================================================================
  4. * ** Victor Engine MV - Cooperation Skills
  5. * ------------------------------------------------------------------------------
  6. *  CooperationSkills.js
  7. * ==============================================================================
  8. */

  9. var Imported = Imported || {};
  10. Imported['VE - Cooperation Skills'] = '1.00';

  11. var VictorEngine = VictorEngine || {};
  12. VictorEngine.CooperationSkills = VictorEngine.CooperationSkills || {};

  13. (function() {

  14.     VictorEngine.CooperationSkills.loadDatabase = DataManager.loadDatabase;
  15.     DataManager.loadDatabase = function() {
  16.         VictorEngine.CooperationSkills.loadDatabase.call(this);
  17.         PluginManager.requiredPlugin.call(PluginManager, 'VE - Cooperation Skills', 'VE - Basic Module', '1.22');
  18.         PluginManager.requiredPlugin.call(PluginManager, 'VE - Cooperation Skills', 'VE - Skip Battle Log');
  19.     };

  20.     VictorEngine.CooperationSkills.requiredPlugin = PluginManager.requiredPlugin;
  21.     PluginManager.requiredPlugin = function(name, required, version) {
  22.         if (!VictorEngine.BasicModule) {
  23.             var msg = '插件 ' + name + ' 需要基础插件 ' + required;
  24.             msg += ' 版本' + version + ' 或以上才能生效。';
  25.             msg += ' 去 [url]http://victorenginescripts.wordpress.com/[/url] 下载插件。';
  26.             throw new Error(msg);
  27.         } else if (Imported.YEP_BattleEngineCore) {
  28.             var msg = '插件 ' + name + " 与";
  29.             msg += ' 插件 YEP Battle Engine Core不兼容。';
  30.             throw new Error(msg);
  31.         } else {
  32.             VictorEngine.CooperationSkills.requiredPlugin.call(this, name, required, version);
  33.         };
  34.     };

  35. })();

  36. /*:
  37. * ==============================================================================
  38. * @plugindesc v1.00 - 合作技
  39. * 战斗者可以一同做出行动。
  40. * @author Victor Sant
  41. *
  42. * ==============================================================================
  43. * @help
  44. * ==============================================================================
  45. * 角色、职业、敌人、武器、防具和状态注释:
  46. * ==============================================================================
  47. *
  48. * ==============================================================================
  49. *  联合技(技能注释)
  50. * ------------------------------------------------------------------------------
  51. *  <unite skill: X[, X...]>
  52. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  53. *  特定的角色一同发动该技能。
  54. *    x: 角色ID
  55. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  56. *  例.: <unite skill: 1, 2>
  57. *       <unite skill: 3, 6, 4>
  58. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  59. *  注:
  60. *  - 你放置id的顺序与伤害公式相关,如果你使用插件'VE -战斗动作'的动
  61. *    作序列。
  62. * ==============================================================================
  63. *
  64. * ==============================================================================
  65. *  融合技 (技能注释)
  66. * ------------------------------------------------------------------------------
  67. *  <fusion skill: X[, X...]>
  68. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  69. *  当战斗人员使用同一回合列出的特定技能时,他们将加入执行该技能。
  70. *    x : 技能ID
  71. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  72. *  例: <fusion skill: 10, 12>
  73. *       <fusion skill: 8, 8, 8>
  74. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  75. *  NOTES:
  76. *  - 你放置id的顺序与伤害公式相关,如果你使用插件'VE -战斗动作'的动
  77. *    作序列。
  78. *  - 多次使用相同的id意味着不止一名战士必须使用相同的技能。
  79. * ==============================================================================
  80. *
  81. * ==============================================================================
  82. *  组合技 (技能注释)
  83. * ------------------------------------------------------------------------------
  84. *  <combination skill: X>
  85. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  86. *  要执行此技能,必须有多个战士在同一回合使用此技能。
  87. *    x : 所需的战斗者数量
  88. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  89. *  例.: <combination skill: 3>
  90. * ==============================================================================
  91. *
  92. * ==============================================================================
  93. * 另外的信息:
  94. * ------------------------------------------------------------------------------
  95. *  
  96. *  合作技设置是在回合开始时完成的,即在所有输入完成之后。所以,如
  97. *  果作为组合的一部分的战斗人员无法使用该技能,那么该组合就会失败,
  98. *  所有参与其中的战斗人员都将失去该回合。
  99. *
  100. *  组合行动的时间是基于最慢的战斗者所涉及的速度。
  101. *
  102. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  103. *
  104. *  - 联合技
  105. *  “联合类型”要求所有角色都有技能学习和可用。当您为第一个角色选择技
  106. *  能时,所需的所有其他角色将自动选择相同的技能。统一技能只适用于角
  107. *  色。
  108. *
  109. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  110. *
  111. *  - 融合技
  112. *  “融合类型”是基于所使用的技能,如果所有所需的技能都被选中,使用这
  113. *  些技能的战斗人员的行动将被融合技能取代。动作是在所有命令被选择后
  114. *  ,在回合开始前设置的。战斗人员不需要学习技能就能使用。
  115. *
  116. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  117. *
  118. *  - 组合技
  119. *  “组合类型”是基于使用该技能的战斗人员的数量。如果达到了所需的战斗
  120. *  人员数量,就会使用该技能。不同于联合技能,每个战士单独选择技能。
  121. *
  122. * ==============================================================================
  123. *
  124. * ==============================================================================
  125. *  合作技和伤害公式:
  126. * ------------------------------------------------------------------------------
  127. *  当使用动作时,只会考虑当前激活的战斗者(即调用合作技时激活的战斗
  128. *  者)的参数。若想在伤害公式中使用其他战斗者的参数,你可以使用 cp[X]
  129. *  来引用参数,其中X是合作注释中战斗者的位置(对于联合技来说基于
  130. *  角色的ID,对于融合技来说基于战斗者所使用的技能ID,对于组合技来
  131. *  说基于选择动作的顺序)
  132. *
  133. *  例如,设置了以下注释:
  134. *  <unite skill: 3, 6, 4>
  135. *  - 使用cp[1]来引用第一个角色(角色#3)
  136. *  - 使用cp[2]来引用第二个角色(角色#6)
  137. *  - 使用cp[3]来引用第二个角色(角色#4)
  138. *  
  139. *  例如,伤害公式可以这样写:
  140. *  (cp[1].atk + cp[2].atk + cp[3].atk) * 4 - b.def * 2
  141. *  
  142. * ==============================================================================
  143. *
  144. * ===============================================================================
  145. *  合作技与即时战斗:
  146. * -------------------------------------------------------------------------------
  147. *  如果使用插件'VE - Active Time Battle',只有联合类型的合作技会
  148. *  生效。还要注意的是,所有必要的战斗都必须让ATB栏是满的,如
  149. *  果你使用“满等待”和“半等待”的更新模式,可能会更难设置组合,
  150. *  因为在选择动作时ATB会被冻结。因此,建议只使用“半激活”和
  151. *  “完全激活”模式。

  152. * ==============================================================================
  153. *
  154. * ===============================================================================
  155. *  合作技和战斗动作:
  156. * -------------------------------------------------------------------------------
  157. *  If using the plugin 'VE - Battle Motions', you can use new [subject] values
  158. *  of the motions for cooperation skills.
  159. *
  160. * ------------------------------------------------------------------------------
  161. *  Here are all possible [subjects] values:
  162. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  163. *   cooperation X   : the Xth battler participating on the cooperation skill.
  164. *   all cooperation : all battlers participating on the cooperation skill.
  165. * ------------------------------------------------------------------------------
  166. *
  167. * -----------------------------------------------------------------------------
  168. *  - Motion Subjects: Combination X
  169. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  170. *  This subject value will choose one of the combination battlers, based on the
  171. *  type of cooperation and the order of the values on the notetag (similar to
  172. *  how the damage formula choose the battlers)
  173. *  
  174. *  For example. you have the following notetag:
  175. *  <unite skill: 3, 6, 4>
  176. *  if you use motion 'move: cooperation 2, close to target, 12, 80;'
  177. *  the second cooperation member (the actor Id 6) will move close to the target
  178. * ==============================================================================
  179. *
  180. * ==============================================================================
  181. * 兼容性:
  182. * ------------------------------------------------------------------------------
  183. * To be used together with this plugin, the following plugins must be placed
  184. * bellow this plugin:
  185. *    VE - Skip Battle Log
  186. * ==============================================================================
  187. *
  188. * ==============================================================================
  189. *  版本历史:
  190. * ------------------------------------------------------------------------------
  191. *  v 1.00 - 2016.07.20 > First release.
  192. * ==============================================================================
  193. */

  194. (function() {

  195.     //=============================================================================
  196.     // Parameters
  197.     //=============================================================================

  198.     if (Imported['VE - Basic Module']) {
  199.         var parameters = VictorEngine.getPluginParameters();
  200.         VictorEngine.Parameters = VictorEngine.Parameters || {};
  201.         VictorEngine.Parameters.CooperationSkills = {};
  202.         VictorEngine.Parameters.CooperationSkills.PluginParameter = Number(parameters["Plugin Parameter"]) || 0;
  203.         VictorEngine.Parameters.CooperationSkills.PluginParameter = String(parameters["Plugin Parameter"]).trim();
  204.         VictorEngine.Parameters.CooperationSkills.PluginParameter = eval(parameters["Plugin Parameter"]);
  205.     }

  206.     //=============================================================================
  207.     // VictorEngine
  208.     //=============================================================================

  209.     VictorEngine.CooperationSkills.loadNotetagsValues = VictorEngine.loadNotetagsValues;
  210.     VictorEngine.loadNotetagsValues = function(data, index) {
  211.         VictorEngine.CooperationSkills.loadNotetagsValues.call(this, data, index);
  212.         if (this.objectSelection(index, ['skill'])) {
  213.             VictorEngine.CooperationSkills.loadNotes(data);
  214.         }
  215.     };

  216.     VictorEngine.CooperationSkills.loadNotes = function(data) {
  217.         data.cooperationSkill = data.cooperationSkill || {};
  218.         this.processNotes(data);
  219.     };

  220.     VictorEngine.CooperationSkills.processNotes = function(data, type) {
  221.         var match;
  222.         var regex1 = new RegExp('<unite skill:[ ]*((?:\\d+[ ]*,?[ ]*)+)[ ]*>', 'gi');
  223.         var regex2 = new RegExp('<fusion skill:[ ]*((?:\\d+[ ]*,?[ ]*)+)[ ]*>', 'gi');
  224.         var regex3 = new RegExp('<combination skill:[ ]*(\\d+)[ ]*>', 'gi');
  225.         while (match = regex1.exec(data.note)) {
  226.             data.cooperationSkill.unite = this.processValues(data, match);
  227.         };
  228.         while (match = regex2.exec(data.note)) {
  229.             data.cooperationSkill.fusion = this.processValues(data, match);
  230.         };
  231.         while (match = regex3.exec(data.note)) {
  232.             data.cooperationSkill.combination = Number(match[1]);
  233.         };
  234.         var skill = data.cooperationSkill;
  235.         var isUnite = skill.unite && skill.unite.length > 1;
  236.         var isFusion = skill.fusion && skill.fusion.length > 1;
  237.         var isCombination = skill.combination && skill.combination > 1;
  238.         data.isCooperation = isUnite || isFusion || isCombination;
  239.     };

  240.     VictorEngine.CooperationSkills.processValues = function(data, match) {
  241.         return match[1].split(/[ ]*,[ ]*/gi).map(function(value) {
  242.             return Number(value);
  243.         });
  244.     };

  245.     //=============================================================================
  246.     // BattleManager
  247.     //=============================================================================

  248.     VictorEngine.CooperationSkills.startTurn = BattleManager.startTurn;
  249.     BattleManager.startTurn = function() {
  250.         if (!Imported['VE - Active Time Battle']) {
  251.             this.prepareCombinationActions();
  252.         }
  253.         VictorEngine.CooperationSkills.startTurn.call(this);
  254.     };

  255.     VictorEngine.CooperationSkills.startAction = BattleManager.startAction;
  256.     BattleManager.startAction = function() {
  257.         if (Imported['VE - Active Time Battle']) {
  258.             this.setupUnionSkills();
  259.         }
  260.         VictorEngine.CooperationSkills.startAction.call(this);
  261.     };

  262.     BattleManager.prepareCombinationActions = function() {
  263.         this.setupUnionSkills();
  264.         this.setupFusionSkills();
  265.         this.setupCombinationSkills();
  266.     };

  267.     BattleManager.setupUnionSkills = function() {
  268.         $gameParty.members().forEach(function(member) {
  269.             if (member.uniteLeaderSkill()) {
  270.                 member.setupUniteBaltters();
  271.             }
  272.         });
  273.     };

  274.     BattleManager.setupFusionSkills = function() {
  275.         for (var i = 1; i < $dataSkills.length; i++) {
  276.             var skill = $dataSkills[i]
  277.             if (skill.cooperationSkill.fusion) {
  278.                 this.setupFusionBattlers(skill, $gameParty.members());
  279.                 this.setupFusionBattlers(skill, $gameTroop.members());
  280.             }
  281.         };
  282.         this.allBattleMembers().forEach(function(member) {
  283.             if (member.fusionLeaderSkill()) {
  284.                 member.setupFusionBaltters();
  285.             }
  286.         });
  287.     };

  288.     BattleManager.setupCombinationSkills = function() {
  289.         for (var i = 1; i < $dataSkills.length; i++) {
  290.             var skill = $dataSkills[i]
  291.             if (skill.cooperationSkill.combination) {
  292.                 this.setupCombinationBattlers(skill, $gameParty.members());
  293.                 this.setupCombinationBattlers(skill, $gameTroop.members());
  294.             }
  295.         };
  296.         this.allBattleMembers().forEach(function(member) {
  297.             if (member.combinationLeaderSkill()) {
  298.                 member.setupCombinationBaltters();
  299.             }
  300.         });
  301.     };

  302.     BattleManager.setupFusionBattlers = function(skill, members) {
  303.         for (var i = 0; i < members.length; i++) {
  304.             var fusion = this.getFusionList(skill, members);
  305.             if (fusion.length === skill.cooperationSkill.fusion.length) {
  306.                 fusion[0].member.setFusionLeader(skill, fusion[0].id);
  307.                 for (var j = 1; j < fusion.length; j++) {
  308.                     fusion[j].member.setFusionMember(fusion[0].member, fusion[j].id);
  309.                 };
  310.             }
  311.         }
  312.     };

  313.     BattleManager.getFusionList = function(skill, members) {
  314.         var fusion = [];
  315.         var skills = skill.cooperationSkill.fusion;
  316.         for (var i = 0; i < skills.length; i++) {
  317.             var id = skills[i];
  318.             var member = this.getFusionMember(members, fusion, id);
  319.             if (member) {
  320.                 fusion.push({
  321.                     member: member,
  322.                     id: id
  323.                 });
  324.             }
  325.         };
  326.         return fusion;
  327.     };

  328.     BattleManager.getFusionMember = function(members, fusion, id) {
  329.         for (var i = 0; i < members.length; i++) {
  330.             var member = members[i];
  331.             if (this.notFusionMember(fusion, member) && member.isUsingFusion(id)) {
  332.                 return member;
  333.             }
  334.         };
  335.         return null;
  336.     };

  337.     BattleManager.notFusionMember = function(fusions, member) {
  338.         return fusions.every(function(fusion) {
  339.             return fusion.member !== member;
  340.         })
  341.     };

  342.     BattleManager.setupCombinationBattlers = function(skill, members) {
  343.         for (var i = 0; i < members.length; i++) {
  344.             var combination = this.getCombinationList(skill, members);
  345.             if (combination.length === skill.cooperationSkill.combination) {
  346.                 combination[0].setCombinationLeader(skill);
  347.                 for (var j = 1; j < combination.length; j++) {
  348.                     combination[j].setCombinationMember(combination[0]);
  349.                 };
  350.             }
  351.         };
  352.     };

  353.     BattleManager.getCombinationList = function(skill, members) {
  354.         var combination = [];
  355.         var skills = skill.cooperationSkill.combination;
  356.         for (var i = 0; i < skills; i++) {
  357.             var member = this.getCombinationMember(members, combination, skill.id);
  358.             if (member) {
  359.                 combination.push(member);
  360.             }
  361.         };
  362.         return combination;
  363.     };

  364.     BattleManager.getCombinationMember = function(members, combination, id) {
  365.         for (var i = 0; i < members.length; i++) {
  366.             var member = members[i];
  367.             if (!combination.contains(member) && member.isUsingCombination(id)) {
  368.                 return member;
  369.             }
  370.         };
  371.         return null;
  372.     };

  373.     //=============================================================================
  374.     // Game_Action
  375.     //=============================================================================

  376.     /* Overwritten function */
  377.     Game_Action.prototype.evalDamageFormula = function(target) {
  378.         try {
  379.             var item = this.item();
  380.             var a = this.subject();
  381.             var b = target;
  382.             var v = $gameVariables._data;
  383.             var cp = this.cooperationBattlersFormula();
  384.             var formula = VictorEngine.getDamageFormula(this);
  385.             var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
  386.             return (Math.max(eval(formula), 0) * sign) || 0;
  387.         } catch (e) {
  388.             return 0;
  389.         }
  390.     };

  391.     VictorEngine.CooperationSkills.isValid = Game_Action.prototype.isValid;
  392.     Game_Action.prototype.isValid = function() {
  393.         return VictorEngine.CooperationSkills.isValid.call(this) && !this.subject().cooperationMember() &&
  394.             this.isCombinationOk();
  395.     };

  396.     Game_Action.prototype.setCooperationBattlers = function() {
  397.         this._cooperationBattlers = this.cooperationActionBattlers();
  398.     };

  399.     Game_Action.prototype.cooperationBattlers = function() {
  400.         return this._cooperationBattlers || [];
  401.     };

  402.     Game_Action.prototype.cooperationBattlersFormula = function() {
  403.         return this.isCooperation() ? [{}].concat(this.cooperationBattlers()) : [];
  404.     };

  405.     Game_Action.prototype.isCooperation = function() {
  406.         return this.item() && this.item().isCooperation;
  407.     };

  408.     Game_Action.prototype.isUniteAction = function() {
  409.         return this.isCooperation() && this.item().cooperationSkill.unite;
  410.     };

  411.     Game_Action.prototype.isFusionAction = function() {
  412.         return this.isCooperation() && this.item().cooperationSkill.fusion;
  413.     };

  414.     Game_Action.prototype.isCombinationAction = function() {
  415.         return this.isCooperation() && this.item().cooperationSkill.combination;
  416.     };

  417.     Game_Action.prototype.cooperationActionBattlers = function() {
  418.         if (this.isUniteAction()) {
  419.             return this.uniteActionBattlers();
  420.         } else if (this.isFusionAction()) {
  421.             return this.fusionActionBattlers();
  422.         } else if (this.isCombinationAction()) {
  423.             return this.combinationActionBattlers();
  424.         }
  425.         return [];
  426.     };

  427.     Game_Action.prototype.cooperationLength = function() {
  428.         if (this.isUniteAction()) {
  429.             return this.item().cooperationSkill.unite.length;
  430.         } else if (this.isFusionAction()) {
  431.             return this.item().cooperationSkill.fusion.length;
  432.         } else if (this.isCombinationAction()) {
  433.             return this.item().cooperationSkill.combination;
  434.         }
  435.         return 0;
  436.     };

  437.     Game_Action.prototype.uniteActionBattlers = function() {
  438.         return this.item().cooperationSkill.unite.map(function(id) {
  439.             return $gameActors.actor(id);
  440.         });
  441.     };

  442.     Game_Action.prototype.fusionActionBattlers = function() {
  443.         var object = this;
  444.         var leader = this.subject();
  445.         var skills = this.item().cooperationSkill.fusion;
  446.         var fusion = [leader];
  447.         for (var i = 1; i < skills.length; i++) {
  448.             var id = skills[i];
  449.             var member = this.getFusionBattler(leader, id, fusion);
  450.             if (member) {
  451.                 fusion.push(member);
  452.             }
  453.         }
  454.         return fusion;
  455.     };

  456.     Game_Action.prototype.getFusionBattler = function(leader, id, fusion) {
  457.         var members = BattleManager.allBattleMembers();
  458.         for (var i = 0; i < members.length; i++) {
  459.             var member = members[i];
  460.             if (member.isOriginalFusionSkill(id) && member.fusionLeader() === leader &&
  461.                 !fusion.contains(member)) {
  462.                 return member;
  463.             }
  464.         }
  465.         return null;
  466.     };

  467.     Game_Action.prototype.combinationActionBattlers = function() {
  468.         var object = this;
  469.         var leader = this.subject();
  470.         var combination = [leader];
  471.         for (var i = 1; i < this.item().cooperationSkill.combination; i++) {
  472.             var member = this.getCombinationBattler(leader, combination);
  473.             if (member) {
  474.                 combination.push(member);
  475.             }
  476.         }
  477.         return combination;
  478.     };

  479.     Game_Action.prototype.getCombinationBattler = function(leader, combination) {
  480.         var members = BattleManager.allBattleMembers();
  481.         for (var i = 0; i < members.length; i++) {
  482.             var member = members[i];
  483.             if (member.combinationLeader() === leader && !combination.contains(member)) {
  484.                 return member;
  485.             }
  486.         }
  487.         return null;
  488.     };

  489.     Game_Action.prototype.isCombinationOk = function() {
  490.         if (this.isCombinationAction()) {
  491.             if (this.subject().combinationLeaderSkill()) {
  492.                 return this.combinationMembersOk();
  493.             } else {
  494.                 return false;
  495.             }
  496.         } else {
  497.             return true;
  498.         };
  499.     };

  500.     Game_Action.prototype.combinationMembersOk = function() {
  501.         var skill = this.item();
  502.         return this.cooperationBattlers().every(function(member) {
  503.             return member.canUse(skill);
  504.         })
  505.     };

  506.     //=============================================================================
  507.     // Game_BattlerBase
  508.     //=============================================================================

  509.     VictorEngine.CooperationSkills.paySkillCost = Game_BattlerBase.prototype.paySkillCost;
  510.     Game_BattlerBase.prototype.paySkillCost = function(skill) {
  511.         VictorEngine.CooperationSkills.paySkillCost.call(this, skill);
  512.         if (skill.isCooperation && this.isCooperationSkill(skill)) {
  513.             var user = this;
  514.             this.cooperationBattlers(skill).forEach(function(battler) {
  515.                 if (battler !== user) {
  516.                     battler.payCooperationSkillCost(skill);
  517.                 }
  518.             });
  519.         }
  520.     };

  521.     VictorEngine.CooperationSkills.canInput = Game_BattlerBase.prototype.canInput;
  522.     Game_BattlerBase.prototype.canInput = function() {
  523.         return VictorEngine.CooperationSkills.canInput.call(this) && !this.uniteLeader();
  524.     };

  525.     VictorEngine.CooperationSkills.meetsSkillConditions = Game_BattlerBase.prototype.meetsSkillConditions;
  526.     Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
  527.         return (VictorEngine.CooperationSkills.meetsSkillConditions.call(this, skill) &&
  528.             this.isSkillCooperationOk(skill));
  529.     };

  530.     Game_BattlerBase.prototype.isSkillCooperationOk = function(skill) {
  531.         return !skill.isCooperation || this.isCooperationOk(skill);
  532.     };

  533.     Game_BattlerBase.prototype.isCooperationOk = function(skill) {
  534.         return this.isUniteOk(skill) || this.isFusionOk(skill) || this.isCombinationOk(skill);
  535.     };

  536.     Game_BattlerBase.prototype.isUniteOk = function(skill) {
  537.         if (this.isEnemy() || !skill.cooperationSkill.unite) {
  538.             return false;
  539.         }
  540.         return this.uniteBattlers(skill).every(function(actor) {
  541.             return actor.isUniteMemberOk(skill) && !actor.isUsingNonUnite() &&
  542.                 (!Imported['VE - Active Time Battle'] || actor.atbFull());
  543.         });
  544.     };

  545.     Game_BattlerBase.prototype.isFusionOk = function(skill) {
  546.         if (!$gameParty.inBattle() || !skill.cooperationSkill.fusion) {
  547.             return false;
  548.         }
  549.         return this.fusionBattlers(skill).every(function(actor) {
  550.             return actor.isFusionMemberOk(actor.originalFusionSkill());
  551.         });
  552.     };

  553.     Game_BattlerBase.prototype.isCombinationOk = function(skill) {
  554.         if (!$gameParty.inBattle() || !skill.cooperationSkill.combination) {
  555.             return false;
  556.         } else {
  557.             return true;
  558.         }
  559.     };

  560.     Game_BattlerBase.prototype.isUniteMemberOk = function(skill) {
  561.         return $gameParty.members().contains(this) && this.hasSkill(skill.id) &&
  562.             VictorEngine.CooperationSkills.meetsSkillConditions.call(this, skill);
  563.     };

  564.     Game_BattlerBase.prototype.isFusionMemberOk = function(skill) {
  565.         return VictorEngine.CooperationSkills.meetsSkillConditions.call(this, skill);
  566.     };

  567.     Game_BattlerBase.prototype.cooperationBattlers = function(skill) {
  568.         if (skill.cooperationSkill.unite) {
  569.             return this.uniteBattlers(skill);
  570.         } else if (skill.cooperationSkill.fusion) {
  571.             return this.fusionBattlers(skill);
  572.         } else if (skill.cooperationSkill.combination) {
  573.             return this.combinationBattlers(skill);
  574.         }
  575.         return [];
  576.     };

  577.     Game_BattlerBase.prototype.uniteBattlers = function(skill) {
  578.         return skill.cooperationSkill.unite.map(function(id) {
  579.             return $gameActors.actor(id);
  580.         });
  581.     };

  582.     Game_BattlerBase.prototype.fusionBattlers = function(skill) {
  583.         if (this.fusionLeaderSkill() === skill) {
  584.             return this.fusionMembersList(this);
  585.         } else if (this.fusionLeader() && this.fusionLeader().fusionLeaderSkill() === skill) {
  586.             return this.fusionMembersList(this.fusionLeader());
  587.         } else {
  588.             return [];
  589.         }
  590.     };

  591.     Game_BattlerBase.prototype.combinationBattlers = function(skill) {
  592.         if (this.combinationLeaderSkill() === skill) {
  593.             return this.combinationMembersList(this);
  594.         } else if (this.combinationLeader() && this.combinationLeader().combinationLeaderSkill() === skill) {
  595.             return this.combinationMembersList(this.combinationLeader());
  596.         } else {
  597.             return [];
  598.         }
  599.     };

  600.     Game_BattlerBase.prototype.fusionMembersList = function(leader) {
  601.         return BattleManager.allBattleMembers().filter(function(member) {
  602.             return member.fusionLeader() === leader || member === leader;
  603.         });
  604.     };

  605.     Game_BattlerBase.prototype.combinationMembersList = function(leader) {
  606.         return BattleManager.allBattleMembers().filter(function(member) {
  607.             return member.combinationLeader() === leader || member === leader;
  608.         });
  609.     };

  610.     Game_BattlerBase.prototype.cooperationMember = function() {
  611.         return this._uniteLeader || this._fusionLeader;
  612.     };

  613.     Game_BattlerBase.prototype.cooperationLeader = function(skill) {
  614.         if (skill.cooperationSkill.unite) {
  615.             return this.uniteLeader();
  616.         } else if (skill.cooperationSkill.fusion) {
  617.             return this.fusionLeader();
  618.         } else if (skill.cooperationSkill.combination) {
  619.             return this.combinationLeader();
  620.         } else {
  621.             return null;
  622.         };
  623.     };

  624.     Game_BattlerBase.prototype.isCooperationSkill = function(skill) {
  625.         return skill.cooperationSkill.unite || skill.cooperationSkill.fusion || skill.cooperationSkill.combination;
  626.     };

  627.     Game_BattlerBase.prototype.payCooperationSkillCost = function(skill) {
  628.         if (skill.cooperationSkill.fusion) {
  629.             if (this.originalFusionSkill()) {
  630.                 VictorEngine.CooperationSkills.paySkillCost.call(this, this.originalFusionSkill());
  631.             }
  632.         } else {
  633.             VictorEngine.CooperationSkills.paySkillCost.call(this, skill);
  634.         }
  635.     };

  636.     Game_BattlerBase.prototype.cooperationName = function(skill) {
  637.         var text = ''
  638.         var names = this.cooperationBattlers(skill).map(function(battler) {
  639.             return battler.name();
  640.         });
  641.         for (var i = 0; i < names.length; i++) {
  642.             var name = names[i]
  643.             if (i === 0) {
  644.                 text = name;
  645.             } else if (i > 0 && i < names.length - 1) {
  646.                 text += ', ' + name;
  647.             } else if (i === names.length - 1) {
  648.                 text += ' and ' + name;
  649.             }
  650.         }
  651.         return text;
  652.     };

  653.     Game_BattlerBase.prototype.uniteLeader = function() {
  654.         return this._uniteLeader;
  655.     };

  656.     Game_BattlerBase.prototype.uniteLeaderSkill = function() {
  657.         return this._uniteLeaderSkill;
  658.     };

  659.     Game_BattlerBase.prototype.isUsingNonUnite = function() {
  660.         return this._isUsingNonUnite;
  661.     };

  662.     Game_BattlerBase.prototype.setUniteLeader = function(leader) {
  663.         this._uniteLeader = leader;
  664.     };

  665.     Game_BattlerBase.prototype.setUniteLeaderSkill = function(skill) {
  666.         this._uniteLeaderSkill = skill;
  667.     };

  668.     Game_BattlerBase.prototype.setUsingNonUnite = function() {
  669.         if (this.notUsingUnite()) {
  670.             this._isUsingNonUnite = true;
  671.         }
  672.     };

  673.     Game_BattlerBase.prototype.clearUniteSetup = function() {
  674.         this._uniteLeader = null;
  675.         this._uniteLeaderSkill = null;
  676.         this._isUsingNonUnite = false;
  677.     };

  678.     Game_BattlerBase.prototype.notUsingUnite = function() {
  679.         return this._actions.every(function(action) {
  680.             return !action.isUniteAction();
  681.         })
  682.     };

  683.     Game_BattlerBase.prototype.setupUniteBaltters = function() {
  684.         this._actions.forEach(function(action) {
  685.             if (action.isUniteAction()) {
  686.                 action.setCooperationBattlers();
  687.             }
  688.         })
  689.     };

  690.     /* FUSION */
  691.     Game_BattlerBase.prototype.isUsingFusion = function(id) {
  692.         var battler = this;
  693.         return this._actions.some(function(action) {
  694.             return action.item() && action.isSkill() && action.item().id === id && !battler.originalFusionSkill();
  695.         })
  696.     };

  697.     Game_BattlerBase.prototype.fusionLeader = function() {
  698.         return this._fusionLeader;
  699.     };

  700.     Game_BattlerBase.prototype.fusionLeaderSkill = function() {
  701.         return this._fusionLeaderSkill;
  702.     };

  703.     Game_BattlerBase.prototype.originalFusionSkill = function() {
  704.         return this._originalFusionSkill;
  705.     };

  706.     Game_BattlerBase.prototype.isOriginalFusionSkill = function(id) {
  707.         return this._originalFusionSkill && this._originalFusionSkill.id === id;
  708.     };

  709.     Game_BattlerBase.prototype.clearFusionSetup = function() {
  710.         this._fusionLeader = null;
  711.         this._fusionLeaderSkill = null;
  712.         this._originalFusionSkill = null;
  713.     };

  714.     Game_BattlerBase.prototype.setFusionLeader = function(skill, id) {
  715.         this._fusionLeaderSkill = skill;
  716.         this.setFusionAction(skill, id);
  717.     };

  718.     Game_BattlerBase.prototype.setFusionMember = function(leader, id) {
  719.         this._fusionLeader = leader;
  720.         this.setFusionAction(leader.fusionLeaderSkill(), id);
  721.     };

  722.     Game_BattlerBase.prototype.setFusionAction = function(skill, id) {
  723.         var index = this.setFusionActionIndex(id);
  724.         var action = new Game_Action(this);
  725.         action.setSkill(skill.id);
  726.         action.setTarget(this._actions[index]._targetIndex);
  727.         this._actions.splice(index, 1, action);
  728.         this._originalFusionSkill = $dataSkills[id];
  729.     };

  730.     Game_BattlerBase.prototype.setFusionActionIndex = function(id) {
  731.         for (var i = 1; i < this._actions.length; i++) {
  732.             var action = this._actions[i];
  733.             if (action.item() && action.isSkill() && action.item().id === id) {
  734.                 return i;
  735.             }
  736.         }
  737.         return 0;
  738.     };

  739.     Game_BattlerBase.prototype.setupFusionBaltters = function() {
  740.         this._actions.forEach(function(action) {
  741.             if (action.isFusionAction()) {
  742.                 action.setCooperationBattlers();
  743.             }
  744.         })
  745.     };

  746.     /* Combination */
  747.     Game_BattlerBase.prototype.isUsingCombination = function(id) {
  748.         var battler = this;
  749.         return this._actions.some(function(action) {
  750.             return action.item() && action.isSkill() && action.item().id === id && !battler.isCombinationSkill();
  751.         })
  752.     };

  753.     Game_BattlerBase.prototype.combinationLeader = function() {
  754.         return this._combinationLeader;
  755.     };

  756.     Game_BattlerBase.prototype.combinationLeaderSkill = function() {
  757.         return this._combinationLeaderSkill;
  758.     };

  759.     Game_BattlerBase.prototype.isCombinationSkill = function() {
  760.         return this.combinationLeader() || this.combinationLeaderSkill();
  761.     };

  762.     Game_BattlerBase.prototype.clearCombinationSetup = function() {
  763.         this._combinationLeader = null;
  764.         this._combinationLeaderSkill = null;
  765.     };

  766.     Game_BattlerBase.prototype.setCombinationLeader = function(skill) {
  767.         this._combinationLeaderSkill = skill;
  768.     };

  769.     Game_BattlerBase.prototype.setCombinationMember = function(leader) {
  770.         this._combinationLeader = leader;
  771.     };

  772.     Game_BattlerBase.prototype.setupCombinationBaltters = function() {
  773.         this._actions.forEach(function(action) {
  774.             if (action.isCombinationAction()) {
  775.                 action.setCooperationBattlers();
  776.             }
  777.         })
  778.     };

  779.     //=============================================================================
  780.     // Game_Battler
  781.     //=============================================================================

  782.     VictorEngine.CooperationSkills.performActionStart = Game_Battler.prototype.performActionStart;
  783.     Game_Battler.prototype.performActionStart = function(action) {
  784.         if (this.uniteLeaderSkill()) {
  785.             this.clearUniteAction();
  786.         }
  787.         if (this.fusionLeaderSkill()) {
  788.             this.clearFusionAction();
  789.         }
  790.         if (this.combinationLeaderSkill()) {
  791.             this.clearCombinationAction();
  792.         }
  793.         VictorEngine.CooperationSkills.performActionStart.call(this, action);
  794.     };

  795.     VictorEngine.CooperationSkills.onAllActionsEnd = Game_Battler.prototype.onAllActionsEnd;
  796.     Game_Battler.prototype.onAllActionsEnd = function() {
  797.         VictorEngine.CooperationSkills.onAllActionsEnd.call(this);
  798.         if (this.uniteLeaderSkill()) {
  799.             if (Imported['VE - Active Time Battle']) {
  800.                 this.resetAtbUnion();
  801.             }
  802.             this.resetUniteAction(true);
  803.         }
  804.         if (this.fusionLeaderSkill()) {
  805.             this.resetFusionAction(true);
  806.         }
  807.         if (this.combinationLeaderSkill()) {
  808.             this.resetCombinationAction(true);
  809.         }
  810.     };

  811.     VictorEngine.CooperationSkills.speed = Game_Battler.prototype.speed;
  812.     Game_Battler.prototype.speed = function() {
  813.         var battlers = this.allCooperationBattlers()
  814.         if (this.uniteLeaderSkill() || this.fusionLeaderSkill() && battlers.length > 0) {
  815.             return this.cooperationActionSpeed(battlers);
  816.         } else if (this.uniteLeader() || this.fusionLeader()) {
  817.             return -9999;
  818.         } else {
  819.             return VictorEngine.CooperationSkills.speed.call(this);
  820.         }
  821.     };

  822.     Game_Battler.prototype.cooperationActionSpeed = function(battlers) {
  823.         return Math.min.apply(null, battlers.map(function(member) {
  824.             return VictorEngine.CooperationSkills.speed.call(member);
  825.         })) || 0;
  826.     };

  827.     Game_Battler.prototype.allCooperationBattlers = function() {
  828.         var battlers = []
  829.         this._actions.forEach(function(action) {
  830.             if (action.isCooperation()) {
  831.                 battlers = battlers.concat(action.cooperationBattlers());
  832.             }
  833.         })
  834.         return battlers;
  835.     };

  836.     Game_Battler.prototype.resetUniteAction = function(turnEnd) {
  837.         var leader = this;
  838.         this.clearUniteSetup();
  839.         $gameParty.members().forEach(function(member) {
  840.             if (member.uniteLeader() === leader) {
  841.                 member.makeActions();
  842.                 member.clearUniteSetup();
  843.             }
  844.         })
  845.     };

  846.     Game_Battler.prototype.resetFusionAction = function(turnEnd) {
  847.         var leader = this;
  848.         this.clearFusionSetup();
  849.         BattleManager.allBattleMembers().forEach(function(member) {
  850.             if (member.fusionLeader() === leader) {
  851.                 member.makeActions();
  852.                 member.clearFusionSetup();
  853.             }
  854.         })
  855.     };

  856.     Game_Battler.prototype.resetCombinationAction = function(turnEnd) {
  857.         var leader = this;
  858.         this.clearCombinationSetup();
  859.         BattleManager.allBattleMembers().forEach(function(member) {
  860.             if (member.combinationLeader() === leader) {
  861.                 member.makeActions();
  862.                 member.clearCombinationSetup();
  863.             }
  864.         })
  865.     };

  866.     Game_Battler.prototype.clearUniteAction = function() {
  867.         var leader = this;
  868.         BattleManager.allBattleMembers().forEach(function(member) {
  869.             if (member.uniteLeader() === leader) {
  870.                 member.clearActions();
  871.                 member.setActionState('acting');
  872.             }
  873.         })
  874.     };

  875.     Game_Battler.prototype.clearFusionAction = function() {
  876.         var leader = this;
  877.         BattleManager.allBattleMembers().forEach(function(member) {
  878.             if (member.fusionLeader() === leader) {
  879.                 member.clearActions();
  880.                 member.setActionState('acting');
  881.             }
  882.         })
  883.     };

  884.     Game_Battler.prototype.clearCombinationAction = function() {
  885.         var leader = this;
  886.         BattleManager.allBattleMembers().forEach(function(member) {
  887.             if (member.combinationLeader() === leader) {
  888.                 member.clearActions();
  889.                 member.setActionState('acting');
  890.             }
  891.         })
  892.     };

  893.     VictorEngine.CooperationSkills.onBattleStart = Game_Battler.prototype.onBattleStart;
  894.     Game_Battler.prototype.onBattleStart = function() {
  895.         VictorEngine.CooperationSkills.onBattleStart.call(this);
  896.         this.clearUniteSetup();
  897.         this.clearFusionSetup();
  898.         this.clearCombinationSetup();
  899.     };

  900.     VictorEngine.CooperationSkills.onTurnEnd = Game_Battler.prototype.onTurnEnd;
  901.     Game_Battler.prototype.onTurnEnd = function() {
  902.         VictorEngine.CooperationSkills.onTurnEnd.call(this);
  903.         this.clearUniteSetup();
  904.         this.clearFusionSetup();
  905.     };

  906.     VictorEngine.CooperationSkills.onBattleEnd = Game_Battler.prototype.onBattleEnd;
  907.     Game_Battler.prototype.onBattleEnd = function() {
  908.         VictorEngine.CooperationSkills.onBattleEnd.call(this);
  909.         this.clearUniteSetup();
  910.         this.clearFusionSetup();
  911.         this.clearCombinationSetup();
  912.     };

  913.     Game_Battler.prototype.resetAtbUnion = function() {
  914.         var leader = this;
  915.         $gameParty.members().forEach(function(member) {
  916.             if (member.uniteLeader() === leader) {
  917.                 member.clearAtb();
  918.             }
  919.         })
  920.     };

  921.     //=============================================================================
  922.     // Scene_Battle
  923.     //=============================================================================

  924.     VictorEngine.CooperationSkills.onSelectAction = Scene_Battle.prototype.onSelectAction;
  925.     Scene_Battle.prototype.onSelectAction = function() {
  926.         var action = BattleManager.inputtingAction();
  927.         VictorEngine.CooperationSkills.onSelectAction.call(this);
  928.         if (!action.needsSelection()) {
  929.             this.setUniteSkill();
  930.         }
  931.     };

  932.     VictorEngine.CooperationSkills.onActorOk = Scene_Battle.prototype.onActorOk;
  933.     Scene_Battle.prototype.onActorOk = function() {
  934.         this.setUniteSkill();
  935.         VictorEngine.CooperationSkills.onActorOk.call(this);
  936.     };

  937.     VictorEngine.CooperationSkills.onEnemyOk = Scene_Battle.prototype.onEnemyOk;
  938.     Scene_Battle.prototype.onEnemyOk = function() {
  939.         this.setUniteSkill();
  940.         VictorEngine.CooperationSkills.onEnemyOk.call(this);
  941.     };

  942.     VictorEngine.CooperationSkills.startActorCommandSelection = Scene_Battle.prototype.startActorCommandSelection;
  943.     Scene_Battle.prototype.startActorCommandSelection = function() {
  944.         var actor = BattleManager.actor();
  945.         actor.resetUniteAction();
  946.         VictorEngine.CooperationSkills.startActorCommandSelection.call(this);
  947.     };

  948.     Scene_Battle.prototype.setUniteSkill = function() {
  949.         var actor = BattleManager.actor();
  950.         if (actor && this._actorCommandWindow.currentSymbol() === 'skill') {
  951.             var skill = this._skillWindow.item();
  952.             if (skill.cooperationSkill.unite) {
  953.                 this.setUniteLeader(skill);
  954.             } else {
  955.                 actor.setUsingNonUnite();
  956.             }
  957.         } else {
  958.             if (actor) {
  959.                 actor.setUsingNonUnite();
  960.             }
  961.         }
  962.     };

  963.     Scene_Battle.prototype.setUniteLeader = function(skill) {
  964.         var leader = BattleManager.actor();
  965.         var current = BattleManager.inputtingAction();
  966.         return skill.cooperationSkill.unite.forEach(function(id) {
  967.             var actor = $gameActors.actor(id);
  968.             if (actor === leader) {
  969.                 actor.setUniteLeaderSkill(skill);
  970.             } else {
  971.                 var action = new Game_Action(actor);
  972.                 action.setSkill(skill.id);
  973.                 action.setTarget(current._targetIndex);
  974.                 actor._actions.push(action);
  975.                 actor.setUniteLeader(leader);
  976.             }
  977.         });
  978.     };

  979.     //=============================================================================
  980.     // Window_BattleLog
  981.     //=============================================================================

  982.     VictorEngine.CooperationSkills.startActionWindowBattleLog = Window_BattleLog.prototype.startAction;
  983.     Window_BattleLog.prototype.startAction = function(subject, action, targets) {
  984.         this._cooperationSkill = action;
  985.         VictorEngine.CooperationSkills.startActionWindowBattleLog.call(this, subject, action, targets);
  986.     };

  987.     VictorEngine.CooperationSkills.performActionStartWindowBattleLog = Window_BattleLog.prototype.performActionStart;
  988.     Window_BattleLog.prototype.performActionStart = function(subject, action) {
  989.         VictorEngine.CooperationSkills.performActionStartWindowBattleLog.call(this, subject, action);
  990.         if (this.isCooperationSkill(subject)) {
  991.             this.performActionStartCooperation(subject, action);
  992.         }
  993.     };

  994.     VictorEngine.CooperationSkills.performAction = Window_BattleLog.prototype.performAction;
  995.     Window_BattleLog.prototype.performAction = function(subject, action, targets) {
  996.         VictorEngine.CooperationSkills.performAction.call(this, subject, action, targets);
  997.         if (this.isCooperationSkill(subject)) {
  998.             this.performActionCooperation(subject, action, targets);
  999.         }
  1000.     };

  1001.     VictorEngine.CooperationSkills.performActionEnd = Window_BattleLog.prototype.performActionEnd;
  1002.     Window_BattleLog.prototype.performActionEnd = function(subject, action) {
  1003.         VictorEngine.CooperationSkills.performActionEnd.call(this, subject, action);
  1004.         if (this.isCooperationSkill(subject)) {
  1005.             this.performActionEndCooperation(subject, this._cooperationSkill);
  1006.         }
  1007.     };

  1008.     VictorEngine.CooperationSkills.displayAction = Window_BattleLog.prototype.displayAction;
  1009.     Window_BattleLog.prototype.displayAction = function(subject, item) {
  1010.         if (DataManager.isSkill(item) && item.isCooperation) {
  1011.             var numMethods = this._methods.length;
  1012.             if (DataManager.isSkill(item)) {
  1013.                 if (item.message1) {
  1014.                     this.push('addText', subject.cooperationName(item) + item.message1.format(item.name));
  1015.                 }
  1016.                 if (item.message2) {
  1017.                     this.push('addText', item.message2.format(item.name));
  1018.                 }
  1019.             }
  1020.             if (this._methods.length === numMethods) {
  1021.                 this.push('wait');
  1022.             }
  1023.         } else {
  1024.             VictorEngine.CooperationSkills.displayAction.call(this, subject, item);
  1025.         }
  1026.     };

  1027.     VictorEngine.CooperationSkills.performActionAnimation = Window_BattleLog.prototype.performActionAnimation;
  1028.     Window_BattleLog.prototype.performActionAnimation = function(subject, animationId) {
  1029.         VictorEngine.CooperationSkills.performActionAnimation.call(this, subject, animationId);
  1030.         if (this.isCooperationSkill(subject)) {
  1031.             this.performActionAnimationCooperation(subject, animationId, this._cooperationSkill);
  1032.         }
  1033.     };

  1034.     VictorEngine.CooperationSkills.performCastAnimation = Window_BattleLog.prototype.performCastAnimation;
  1035.     Window_BattleLog.prototype.performCastAnimation = function(subject, animationId) {
  1036.         VictorEngine.CooperationSkills.performCastAnimation.call(this, subject, animationId);
  1037.         if (this.isCooperationSkill(subject)) {
  1038.             this.performCastAnimationCooperation(subject, animationId, this._cooperationSkill);
  1039.         }
  1040.     };

  1041.     Window_BattleLog.prototype.isCooperationSkill = function(subject) {
  1042.         return (!Imported['VE - Battle Motions'] && this._cooperationSkill &&
  1043.             subject.isCooperationSkill(this._cooperationSkill.item()));
  1044.     };

  1045.     Window_BattleLog.prototype.performActionStartCooperation = function(subject, action) {
  1046.         var object = this;
  1047.         BattleManager.allBattleMembers().forEach(function(member) {
  1048.             if (member.cooperationLeader(action.item()) === subject) {
  1049.                 VictorEngine.CooperationSkills.performActionStartWindowBattleLog.call(object, member, action);
  1050.             }
  1051.         })
  1052.     };

  1053.     Window_BattleLog.prototype.performActionCooperation = function(subject, action, targets) {
  1054.         var object = this;
  1055.         BattleManager.allBattleMembers().forEach(function(member) {
  1056.             if (member.cooperationLeader(action.item()) === subject) {
  1057.                 VictorEngine.CooperationSkills.performAction.call(object, member, action, targets);
  1058.             }
  1059.         })
  1060.     };

  1061.     Window_BattleLog.prototype.performActionEndCooperation = function(subject, action) {
  1062.         var object = this;
  1063.         BattleManager.allBattleMembers().forEach(function(member) {
  1064.             if (member.cooperationLeader(action.item()) === subject) {
  1065.                 VictorEngine.CooperationSkills.performActionEndWindowBattleLog.call(object, member, action);
  1066.             }
  1067.         })
  1068.     };

  1069.     Window_BattleLog.prototype.performActionAnimationCooperation = function(subject, animationId, action) {
  1070.         var object = this;
  1071.         BattleManager.allBattleMembers().forEach(function(member) {
  1072.             if (member.cooperationLeader(action.item()) === subject) {
  1073.                 VictorEngine.CooperationSkills.performActionAnimation.call(object, member, animationId);
  1074.             }
  1075.         })
  1076.     };

  1077.     Window_BattleLog.prototype.performCastAnimationCooperation = function(subject, animationId, action) {
  1078.         var object = this;
  1079.         BattleManager.allBattleMembers().forEach(function(member) {
  1080.             if (member.cooperationLeader(action.item()) === subject) {
  1081.                 VictorEngine.CooperationSkills.performCastAnimation.call(object, member, animationId);
  1082.             }
  1083.         })
  1084.     };

  1085.     VictorEngine.CooperationSkills.defaultMotionMovement = Window_BattleLog.prototype.defaultMotionMovement;
  1086.     Window_BattleLog.prototype.defaultMotionMovement = function(subject, action) {
  1087.         if (action.isCooperation()) {
  1088.             var motion = '';
  1089.             if (action && !action.isGuard()) {
  1090.                 for (var i = 0; i < action.cooperationLength(); i++) {
  1091.                     if (action.isStepForward()) {
  1092.                         motion += 'motion: cooperation ' + String(i + 1) + ', walk;';
  1093.                         motion += 'move: cooperation ' + String(i + 1) + ', forward, 30, 48;';
  1094.                     } else {
  1095.                         motion += 'direction: cooperation ' + String(i + 1) + ', targets;';
  1096.                         motion += 'motion: cooperation ' + String(i + 1) + ', walk;';
  1097.                         motion += 'move: cooperation ' + String(i + 1) + ', close to target, 12, 80;';
  1098.                     }
  1099.                 }
  1100.                 for (var i = 0; i < action.cooperationLength(); i++) {
  1101.                     motion += 'wait: cooperation ' + String(i + 1) + ', move;';
  1102.                     motion += 'motion: cooperation ' + String(i + 1) + ', reset;';
  1103.                 }
  1104.             }
  1105.             return motion;
  1106.         } else {
  1107.             return VictorEngine.CooperationSkills.defaultMotionMovement.call(this, subject, action);
  1108.         }
  1109.     };

  1110.     VictorEngine.CooperationSkills.defaultMotionExecute = Window_BattleLog.prototype.defaultMotionExecute;
  1111.     Window_BattleLog.prototype.defaultMotionExecute = function(subject, action) {
  1112.         if (action.isCooperation()) {
  1113.             var motion = '';
  1114.             motion += 'wait: all cooperation, move;';
  1115.             for (var i = 0; i < action.cooperationLength(); i++) {
  1116.                 motion += 'motion: cooperation ' + String(i + 1) + ', action;';
  1117.             }
  1118.             for (var i = 0; i < action.cooperationLength(); i++) {
  1119.                 motion += 'wait: cooperation ' + String(i + 1) + ', 8;';
  1120.             }
  1121.             motion += 'action: all targets, effect;';
  1122.             motion += 'wait: all targets, action;';
  1123.             return motion;
  1124.         } else {
  1125.             return VictorEngine.CooperationSkills.defaultMotionExecute.call(this, subject, action);
  1126.         }
  1127.     };

  1128.     VictorEngine.CooperationSkills.defaultMotionReturn = Window_BattleLog.prototype.defaultMotionReturn;
  1129.     Window_BattleLog.prototype.defaultMotionReturn = function(subject, action) {
  1130.         if (action.isCooperation()) {
  1131.             var motion = '';
  1132.             for (var i = 0; i < action.cooperationLength(); i++) {
  1133.                 motion += 'motion: cooperation ' + String(i + 1) + ', return;';
  1134.                 motion += 'move: cooperation ' + String(i + 1) + ', to home, 12;';
  1135.             }
  1136.             for (var i = 0; i < action.cooperationLength(); i++) {
  1137.                 motion += 'wait: cooperation ' + String(i + 1) + ', move;';
  1138.                 motion += 'motion: cooperation ' + String(i + 1) + ', reset;';
  1139.             }
  1140.             motion += 'wait: all cooperation, move;';
  1141.             return motion;
  1142.         } else {
  1143.             return VictorEngine.CooperationSkills.defaultMotionReturn.call(this, subject, action);
  1144.         }
  1145.     };

  1146.     VictorEngine.CooperationSkills.getMotionSubjects = Window_BattleLog.prototype.getMotionSubjects;
  1147.     Window_BattleLog.prototype.getMotionSubjects = function(type, user, targets, target, index) {
  1148.         if (this.isCooperation()) {
  1149.             type = type.toLowerCase().trim();
  1150.             var battlers = this._currentAction.action.cooperationBattlers();
  1151.             if (type === 'all cooperation') {
  1152.                 return battlers;
  1153.             }
  1154.             var match = (/cooperation[ ]*(\d+)/gi).exec(type);
  1155.             if (match) {
  1156.                 var battler = battlers[Number(match[1]) - 1]
  1157.                 return battler ? [battler] : [];
  1158.             }
  1159.         }
  1160.         return VictorEngine.CooperationSkills.getMotionSubjects.call(this, type, user, targets, target, index);
  1161.     }

  1162.     Window_BattleLog.prototype.isCooperation = function() {
  1163.         return this._currentAction && this._currentAction.action && this._currentAction.action.isCooperation();
  1164.     }

  1165. })();
复制代码



在工程中,当执行完合作技后,出现了以下错误:
TypeError : Cannot read property 'call' of undefined

我在工程中只用了这两个插件,但还是得到了这个错误。我的版本是1.6.1。

(不知道为什么发不了图片和附件,见谅)

我是脚本小白,望各位大神不吝赐教,提前先谢谢各位了!!!
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部