Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Olivia Engine - Weapon Swap - for RPG Maker MV version 1.6.1
  3. // Olivia_WeaponSwap.js
  4. //=============================================================================
  5.  /*:
  6.  * @plugindesc <WeaponSwap> for RPG Maker MV version 1.6.1.
  7.  * @author Fallen Angel Olivia
  8.  *
  9.  * @help
  10.  * This is a RPG Maker MV plugin that will give your game's actors the function
  11.  * to swap weapons in the middle of the fight. Up to one of each weapon type
  12.  * can be equipped at a time and they can be switched out each turn. Swapping
  13.  * weapons can let the player team adapt to certain situations better or giving
  14.  * them the ability to hit certain weapon weaknesses in battle.
  15.  *
  16.  * This plugin changes both something inside battle and outside of battle.
  17.  * The Attack command option can now have the weapon being used swapped by
  18.  * pressing left or right (if that option is turned on). Some skills can also
  19.  * automatically switch to a weapon when it starts being used.
  20.  *
  21.  * The other change is in the Equip menu. Instead of having only a single
  22.  * weapon slot, there is now one weapon slot for each of the weapon types.
  23.  * Each actor can equip a weapon of that type into those slots if they can use
  24.  * those weapon types.
  25.  *
  26.  * There will be a warning though. This feature does not work with the
  27.  * Dual Wield system so it is disabled in order to be able to swap weapons.
  28.  *
  29.  * Some plugin parameters require your attention. Please read through and
  30.  * configure them to customize weapon swapping for your game.
  31.  *
  32.  * -----------------
  33.  * Plugin Parameters
  34.  * -----------------
  35.  *
  36.  * Battle Control:
  37.  *
  38.  * Swap Command: How command for how Weapon Swap is displayed
  39.  *
  40.  * Show Command?: Show the Weapon Swap Command in the Actor Command Window?
  41.  * Turn this on if you are making your game for mouse control because there
  42.  * is no other way to switch weapons without using the arrow keys.
  43.  *
  44.  * Use Arrow Swapping?: Use Arrow Keys to control weapon swapping? If on,
  45.  * then pressing left or right will switch the weapon currently equipped
  46.  * in the order of the Weapon Types list in the Database's Types tab.
  47.  *
  48.  * Show Swap Arrows?: Shows arrow sprites next to the Attack command to tell
  49.  * the player that pressing Left or Right here can have an effect.
  50.  *
  51.  * Battle Test Weapons: During battle test, equip each party member with one of
  52.  * each weapon type. The weapon selected will be the first available one in the
  53.  * database unless they already have that weapon equipped.
  54.  *
  55.  * Visuals:
  56.  *
  57.  * Show Battle Icons: Show icons of currently equipped weapons in battle?
  58.  * This will show the icon next to the Attack command, making it easier for
  59.  * the player to know which weapon the actor has currently equipped.
  60.  *
  61.  * Show Battle Action: Show animation of actor switching weapons? This is
  62.  * for sideview only. When weapon switching is done during Attack switching,
  63.  * the actor will perform an attack motion to display the weapon it is
  64.  * currently equipped with.
  65.  *
  66.  * Extend Equip Stat Window: If you are using Yanfly's Equip Core, this will
  67.  * extend the stat compare window to have Hit Accuracy, Evasion, and Critical.
  68.  *
  69.  *
  70.  *
  71.  * --------
  72.  * Notetags
  73.  * --------
  74.  *
  75.  * Skill and Item Notetags:
  76.  *
  77.  * <Switch to Weapon: x>
  78.  * <Switch to Weapon: text>
  79.  * When the actor uses this skill or item, the actor will switch to this
  80.  * weapon if it is equipped when the skill cost is paid. x is the weapon
  81.  * type ID and text is the weapon name. If you use the weapon name, type
  82.  * it out exactly since it is case sensitive. This notetag does not make
  83.  * the weapon a requirement. To make it a requirement, use the database's
  84.  * "Required Weapon" dropdown lists to enforce the requirement.
  85.  *
  86.  *
  87.  *
  88.  * Skill Notetags:
  89.  *
  90.  * <Require Any Weapon>
  91.  * Requires any kind of weapon to be equipped in order to use it.
  92.  *
  93.  * <Require Weapon Types: x>
  94.  * <Require Weapon Types: x, x, x>
  95.  * Insert multiple x to add more weapon types. All of the weapon types must
  96.  * be equipped in order for this skill to be used.
  97.  *
  98.  *
  99.  *
  100.  * ---------------
  101.  * Action Sequence
  102.  * ---------------
  103.  *
  104.  * If you are using YEP Battle Engine Core, there is an action sequence that
  105.  * lets you switch weapons for the actor in the middle of an action sequence:
  106.  *
  107.  * Weapon Swap: targets, x
  108.  * or
  109.  * Weapon Swap: targets, text
  110.  * or
  111.  * Swap Weapon: targets, x
  112.  * or
  113.  * Swap Weapon: targets, text
  114.  *
  115.  * Use x with the weapon type ID in the Database Type tab. Or use text and
  116.  * replace it with the name of the weapon type. If you use the name of the
  117.  * weapon type, type it out exactly as it is spelled because it is case
  118.  * sensitive.
  119.  *
  120.  *
  121.  *
  122.  * -------------------
  123.  * W A R N I N G ! ! !
  124.  * -------------------
  125.  *
  126.  * This plugin is made for RPG Maker MV versions 1.6.1 and below. If you update
  127.  * RPG Maker MV past that and this plugin breaks, I am NOT responsible for it.
  128.  *
  129.  * -------------
  130.  * Compatibility
  131.  * -------------
  132.  *
  133.  * This plugin is compatible with the following plugins:
  134.  *
  135.  * - YEP Core Engine
  136.  * - YEP Battle Engine Core
  137.  * - YEP Action Sequence Packs 1, 2, 3
  138.  * - YEP Animated Sideview Enemies
  139.  * - YEP Buffs & States Core
  140.  * - YEP Damage Core
  141.  * - YEP Element Core
  142.  * - YEP Item Core
  143.  * - YEP Equip Core
  144.  *
  145.  * Place this plugin under those in the Plugin Manager list.
  146.  *
  147.  * ------------
  148.  * Terms of Use
  149.  * ------------
  150.  *
  151.  * 1. These plugins may be used in free or commercial games.
  152.  * 2. 'Fallen Angel Olivia' must be given credit in your games.
  153.  * 3. You are allowed to edit the code.
  154.  * 4. Do NOT change the filename, parameters, and information of the plugin.
  155.  * 5. You are NOT allowed to redistribute these Plugins.
  156.  * 6. You may NOT take code for your own released Plugins without credit.
  157.  *
  158.  * -------
  159.  * Credits
  160.  * -------
  161.  *
  162.  * If you are using this plugin, credit the following people:
  163.  *
  164.  * - Fallen Angel Olivia
  165.  *
  166.  * @param
  167.  * @param
  168.  * @param ATTENTION!!!
  169.  * @default READ THE HELP FILE
  170.  * @param
  171.  * @param
  172.  *
  173.  * @param Weapon Swap Battle Control
  174.  * @text Battle Control
  175.  * @parent Weapon Swap System
  176.  *
  177.  * @param Weapon Swap Command
  178.  * @text Swap Command
  179.  * @parent Weapon Swap Battle Control
  180.  * @desc How command for how Weapon Swap is displayed
  181.  * @default WpnSwap
  182.  *
  183.  * @param Weapon Swap Show Command
  184.  * @text Show Command?
  185.  * @parent Weapon Swap Command
  186.  * @type boolean
  187.  * @on On
  188.  * @off Off
  189.  * @desc Show the Weapon Swap Command in the Actor Command Window?
  190.  * @default false
  191.  *
  192.  * @param Weapon Swap Arrow Buttons
  193.  * @text Use Arrow Swapping?
  194.  * @parent Weapon Swap Battle Control
  195.  * @type boolean
  196.  * @on On
  197.  * @off Off
  198.  * @desc Use Arrow Keys to control weapon swapping?
  199.  * @default true
  200.  *
  201.  * @param Weapon Swap Show Arrows
  202.  * @text Show Swap Arrows?
  203.  * @parent Weapon Swap Battle Control
  204.  * @type boolean
  205.  * @on On
  206.  * @off Off
  207.  * @desc Show arrows on the attack command?
  208.  * @default true
  209.  *
  210.  * @param Weapon Swap Battle Test
  211.  * @text Battle Test Weapons
  212.  * @parent Weapon Swap Battle Control
  213.  * @type boolean
  214.  * @on On
  215.  * @off Off
  216.  * @desc In battle test, give all party members a copy of each weapon?
  217.  * @default true
  218.  *
  219.  * @param Weapon Swap Visual
  220.  * @text Visuals
  221.  * @parent  Weapon Swap System
  222.  *
  223.  * @param Weapon Swap Battle Icons
  224.  * @text Show Battle Icons
  225.  * @parent Weapon Swap Visual
  226.  * @type boolean
  227.  * @on On
  228.  * @off Off
  229.  * @desc Show icons of currently equipped weapons in battle?
  230.  * @default true
  231.  *
  232.  * @param Weapon Swap Battle Action
  233.  * @text Show Battle Action
  234.  * @parent Weapon Swap Visual
  235.  * @type boolean
  236.  * @on On
  237.  * @off Off
  238.  * @desc Show animation of actor switching weapons? Sideview only
  239.  * @default true
  240.  *
  241.  * @param Weapon Swap Equip Core Window
  242.  * @text Extend Equip Stat Window
  243.  * @parent Weapon Swap Visual
  244.  * @type boolean
  245.  * @on On
  246.  * @off Off
  247.  * @desc Require Yanfly's Equip Core. Extend the stat compare window
  248.  * @default true
  249.  *
  250.  * @param Weapon Swap Text Hit
  251.  * @text Text Hit Rate
  252.  * @parent Weapon Swap Equip Core Window
  253.  * @desc How to display this extra parameter
  254.  * @default ACC
  255.  *
  256.  * @param Weapon Swap Text Evasion
  257.  * @text Text Evasion
  258.  * @parent Weapon Swap Equip Core Window
  259.  * @desc How to display this extra parameter
  260.  * @default EVA
  261.  *
  262.  * @param Weapon Swap Text Critical
  263.  * @text Text Critical
  264.  * @parent Weapon Swap Equip Core Window
  265.  * @desc How to display this extra parameter
  266.  * @default CRI
  267.  *
  268.  * @param
  269.  * @param
  270.  *
  271.  */
  272. //=============================================================================
  273.  
  274. var Imported = Imported || {};
  275. Imported.Olivia_OctoBattle = true;
  276.  
  277. var Olivia = Olivia || {};
  278. Olivia.OctoBattle = Olivia.OctoBattle || {};
  279.  
  280. var parameters = $plugins.filter(function(p) { return p.description.contains('<WeaponSwap>') })[0].parameters;
  281.  
  282. Olivia.OctoBattle.WeaponSwap = {
  283.     Enabled: eval(parameters['Weapon Swap System']),
  284.     // Battle Control
  285.     WpnSwapCmd:    String(parameters['Weapon Swap Command']),
  286.     WpnSwapShow:   eval(parameters['Weapon Swap Show Command']),
  287.     WpnSwapArrows: eval(parameters['Weapon Swap Arrow Buttons']),
  288.     ShowArrows:    eval(parameters['Weapon Swap Show Arrows'] || 'true'),
  289.     WpnBattleTest: eval(parameters['Weapon Swap Battle Test'] || 'true'),
  290.     // Visuals
  291.     ShowIcons:    eval(parameters['Weapon Swap Battle Icons']),
  292.     BattleAction: eval(parameters['Weapon Swap Battle Action']),
  293.     ExtraLines:   eval(parameters['Weapon Swap Equip Core Window'] || 'true'),
  294.     TextHit:      String(parameters['Weapon Swap Text Hit'] || 'ACC'),
  295.     TextEva:      String(parameters['Weapon Swap Text Evasion'] || 'EVA'),
  296.     TextCri:      String(parameters['Weapon Swap Text Critical'] || 'CRI')
  297. };
  298.  
  299. Olivia.OctoBattle.Weapon = Olivia.OctoBattle.Weapon || {};
  300.  
  301. //-----------------------------------------------------------------------------
  302. // BattleManager
  303. //
  304. // The static class that manages battle progress.
  305.  
  306. if (Imported.YEP_BattleEngineCore) {
  307.  
  308. Olivia.OctoBattle.Weapon.___BattleManager_processActionSequence___ = BattleManager.processActionSequence;
  309. BattleManager.processActionSequence = function(actionName, actionArgs) {
  310.     if (actionName === 'WEAPON SWAP' || actionName === 'SWAP WEAPON') {
  311.       return this.actionWeaponSwap(actionArgs);
  312.     }
  313.     return Olivia.OctoBattle.Weapon.___BattleManager_processActionSequence___.call(this, actionName, actionArgs);
  314. }
  315.  
  316. BattleManager.actionWeaponSwap = function(actionArgs) {
  317.     var targets =
  318.       this.makeActionTargets(actionArgs[0]).filter(Yanfly.Util.onlyUnique);
  319.     var weapon = actionArgs[1];
  320.     if ($dataSystem.weaponTypes.contains(weapon)) {
  321.         var wType = $dataSystem.weaponTypes.indexOf(weapon);
  322.     } else {
  323.         var wType = parseInt(weapon);
  324.     }
  325.     for (var i = 0; i < targets.length; i++) {
  326.         var target = targets[i];
  327.         if (!!target && target.isActor()) {
  328.             target.switchToWeaponType(wType);
  329.         }
  330.     }
  331. };
  332.  
  333. }
  334.  
  335. //-----------------------------------------------------------------------------
  336. // Game_BattlerBase
  337. //
  338. // The superclass of Game_Battler. It mainly contains parameters calculation.
  339.  
  340. Olivia.OctoBattle.Weapon.___Game_BattlerBase_paySkillCost___ = Game_BattlerBase.prototype.paySkillCost;
  341. Game_BattlerBase.prototype.paySkillCost = function(skill) {
  342.     Olivia.OctoBattle.Weapon.___Game_BattlerBase_paySkillCost___.call(this, skill);
  343.     if (this.isActor()) {
  344.         this.applyWeaponSwapOnCost(skill);
  345.     }
  346. };
  347.  
  348. Olivia.OctoBattle.Weapon.___Game_BattlerBase_meetsSkillConditions___ = Game_BattlerBase.prototype.meetsSkillConditions;
  349. Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
  350.     if (this.failsToMeetSkillConditionRequireAnyWeapon(skill)) {
  351.         return false;
  352.     } else if (this.failsToMeetSkillConditionRequireWeaponTypes(skill)) {
  353.         return false;
  354.     } else {
  355.         return Olivia.OctoBattle.Weapon.___Game_BattlerBase_meetsSkillConditions___.call(this, skill);
  356.     }
  357. };
  358.  
  359. Game_BattlerBase.prototype.failsToMeetSkillConditionRequireAnyWeapon = function(skill) {
  360.     return skill.note.match(/<Require Any Weapon>/i) && this.isActor() && !this.equips()[0];
  361. };
  362.  
  363. Game_BattlerBase.prototype.failsToMeetSkillConditionRequireWeaponTypes = function(skill) {
  364.     if (this.isEnemy()) {
  365.         return false;
  366.     } else if (Olivia.OctoBattle.WeaponSwap.Enabled) {
  367.         if (skill.note.match(/<Require Weapon Types:[ ]*(\d+(?:\s*,\s*\d+)*)>/i)) {
  368.             var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
  369.             for (var i = 0; i < array.length; i++) {
  370.                 var wtypeId = array[i];
  371.                 if (!this.isWtypeEquipped(wtypeId)) {
  372.                     return true;
  373.                 }
  374.             }
  375.         }
  376.     }
  377.     return false;
  378. };
  379.  
  380. //-----------------------------------------------------------------------------
  381. // Game_Actor
  382. //
  383. // The game object class for an actor.
  384.  
  385. Olivia.OctoBattle.Weapon.___Game_Actor_initEquips___ = Game_Actor.prototype.initEquips;
  386. Game_Actor.prototype.initEquips = function(equips) {
  387.     Olivia.OctoBattle.Weapon.___Game_Actor_initEquips___.call(this, equips);
  388.     this.initializeWeaponSwap();
  389. };
  390.  
  391. Game_Actor.prototype.initializeWeaponSwap = function() {
  392.     this._usedWeaponSlot = 0;
  393.     this._swapWeapons = [];
  394.     for (var i = 0; i < $dataSystem.weaponTypes.length; i++) {
  395.         if (this.isEquipWtypeOk(i)) {
  396.             this._usedWeaponSlot = this._usedWeaponSlot || i;
  397.         }
  398.         this._swapWeapons.push(0);
  399.     }
  400.     var weapon = this.weapons()[0];
  401.     if (!!weapon) {
  402.         var index = weapon.wtypeId;
  403.         this._swapWeapons[index] = weapon.id;
  404.     }
  405. };
  406.  
  407. Game_Actor.prototype.isDualWield = function() {
  408.     return false;
  409. };
  410.  
  411. Game_Actor.prototype.isWtypeEquipped = function(wtypeId) {
  412.     if (this._swapWeapons === undefined) {
  413.         this.initializeWeaponSwap();
  414.     }
  415.     return this._swapWeapons[wtypeId] > 0;
  416. };
  417.  
  418. Game_Actor.prototype.getSwapWeapons = function() {
  419.     if (this._swapWeapons === undefined) {
  420.         this.initializeWeaponSwap();
  421.     }
  422.     var weapons = [];
  423.     for (var i = 1; i < this._swapWeapons.length; i++) {
  424.         weaponId = this._swapWeapons[i];
  425.         weapons.push($dataWeapons[weaponId]);
  426.     }
  427.     return weapons;
  428. };
  429.  
  430. Game_Actor.prototype.getFirstSwapWeapon = function() {
  431.     if (this._swapWeapons === undefined) {
  432.         this.initializeWeaponSwap();
  433.     }
  434.     for (var i = 1; i < this._swapWeapons.length; i++) {
  435.         weaponId = this._swapWeapons[i];
  436.         if (weaponId > 0) {
  437.             return $dataWeapons[weaponId];
  438.         }
  439.     }
  440.     return null;
  441. };
  442.  
  443. Game_Actor.prototype.setSwapWeaponSlot = function(index, id) {
  444.     if (this._swapWeapons === undefined) {
  445.         this.initializeWeaponSwap();
  446.     }
  447.     this._swapWeapons[index] = id;
  448. };
  449.  
  450. Olivia.OctoBattle.Weapon.___Game_Actor_changeEquip___ = Game_Actor.prototype.changeEquip;
  451. Game_Actor.prototype.changeEquip = function(slotId, item) {
  452.     if (slotId === 0) {
  453.         this.changeWeapon(item);
  454.     } else {
  455.         Olivia.OctoBattle.Weapon.___Game_Actor_changeEquip___.call(this, slotId, item);
  456.     }
  457. };
  458.  
  459. Game_Actor.prototype.changeWeapon = function(weapon) {
  460.     var currentWeapon = this.weapons()[0];
  461.     if (!!weapon) {
  462.         this.switchToWeaponType(weapon.wtypeId, false);
  463.         currentWeapon = this.weapons()[0];
  464.         var index = weapon.wtypeId;
  465.         if (!!currentWeapon && currentWeapon.wtypeId === weapon.wtypeId) {
  466.             this.tradeItemWithParty(weapon, currentWeapon);
  467.         } else {
  468.             this.tradeItemWithParty(weapon, null);
  469.         }
  470.         this.setSwapWeaponSlot(index, weapon.id);
  471.         this._usedWeaponSlot = index;
  472.         this._equips[0].setObject(weapon);
  473.     } else if (!!currentWeapon) {
  474.         var index = currentWeapon.wtypeId;
  475.         this.setSwapWeaponSlot(index, 0);
  476.         this.tradeItemWithParty(null, currentWeapon);
  477.         this._equips[0].setObject(null);
  478.         var firstSwapWeapon = this.getFirstSwapWeapon();
  479.         if (firstSwapWeapon) {
  480.             this._usedWeaponSlot = firstSwapWeapon.wtypeId;
  481.         } else {
  482.             this._usedWeaponSlot = 1;
  483.         }
  484.     }
  485.     this.refresh();
  486. };
  487.  
  488. Game_Actor.prototype.switchToWeaponType = function(wtype, animation) {
  489.     var weapon = $dataWeapons[this._swapWeapons[wtype]];
  490.     this._equips[0].setObject(weapon);
  491.     this._usedWeaponSlot = wtype;
  492.     this.refresh();
  493.     if ($gameParty.inBattle() && animation && Olivia.OctoBattle.WeaponSwap.BattleAction) {
  494.         this.performAttack();
  495.     }
  496. };
  497.  
  498. Game_Actor.prototype.swapWeaponBattle = function(direction) {
  499.     if (this._swapWeapons === undefined) {
  500.         this.initializeWeaponSwap();
  501.     }
  502.     var slot = this._usedWeaponSlot;
  503.     while (true) {
  504.         if (direction === 'right') {
  505.             slot += 1;
  506.             if (slot >= $dataSystem.weaponTypes.length) {
  507.                 slot = 1;
  508.             }
  509.         } else {
  510.             slot -= 1;
  511.             if (slot <= 0) {
  512.               slot = $dataSystem.weaponTypes.length - 1;
  513.             }
  514.         }
  515.         if (this._swapWeapons[slot] > 0) {
  516.             this._usedWeaponSlot = slot;
  517.             this.switchToWeaponType(slot, true)
  518.             break;
  519.         }
  520.         if (slot === this._usedWeaponSlot) {
  521.             break;
  522.         }
  523.     }
  524. };
  525.  
  526. Game_Actor.prototype.applyWeaponSwapOnCost = function(skill) {
  527.     if (skill.note.match(/<Switch to Weapon: (\d+)>/i)) {
  528.         var wtype = parseInt(RegExp.$1).clamp(1, $dataSystem.weaponTypes.length - 1);
  529.     } else if (skill.note.match(/<Switch to Weapon: (.*)>/i)) {
  530.         var name = String(RegExp.$1);
  531.         var wtype = $dataSystem.weaponTypes.indexOf(name)
  532.         if (wtype > 0) {
  533.             this.switchToWeaponType(wtype);
  534.         }
  535.     }
  536. };
  537.  
  538. Olivia.OctoBattle.Weapon.___Game_Actor_releaseUnequippableItems___ = Game_Actor.prototype.releaseUnequippableItems;
  539. Game_Actor.prototype.releaseUnequippableItems = function(forcing) {
  540.     if (this._swapWeapons === undefined) {
  541.         this.initializeWeaponSwap();
  542.     }
  543.     Olivia.OctoBattle.Weapon.___Game_Actor_releaseUnequippableItems___.call(this, forcing);
  544.     for (var i = 1; i < this._swapWeapons.length; i++) {
  545.         var weaponId = this._swapWeapons[i];
  546.         if (weaponId > 0) {
  547.             var weapon = $dataWeapons[weaponId];
  548.             if (!this.canEquip(weapon)) {
  549.                 if (!forcing) {
  550.                     this.tradeItemWithParty(null, weapon);
  551.                 }
  552.                 this._swapWeapons[i] = 0;
  553.             }
  554.         }
  555.     }
  556. };
  557.  
  558. Game_Actor.prototype.optimizeEquipments = function() {
  559.     var maxSlots = this.equipSlots().length;
  560.     this.clearEquipments();
  561.     for (var i = 1; i < maxSlots; i++) {
  562.         if (this.isEquipChangeOk(i)) {
  563.             this.changeEquip(i, this.bestEquipItem(i));
  564.         }
  565.     }
  566.     this.optimizeWeapons();
  567. };
  568.  
  569. Game_Actor.prototype.optimizeWeapons = function() {
  570.     var currentWeaponSlot = this._usedWeaponSlot;
  571.     for (var wtypeId = 1; wtypeId < $dataSystem.weaponTypes.length; wtypeId++) {
  572.         if (this.isEquipWtypeOk(wtypeId)) {
  573.             this.changeWeapon(this.bestEquipWeapon(wtypeId));
  574.         }
  575.     }
  576.     this._usedWeaponSlot = currentWeaponSlot;
  577. };
  578.  
  579. Game_Actor.prototype.bestEquipWeapon = function(wtypeId) {
  580.     var items = $gameParty.weapons().filter(function(weapon) {
  581.         return weapon.wtypeId === wtypeId && this.isEquipWtypeOk(wtypeId);
  582.     }, this);
  583.     var bestItem = null;
  584.     var bestPerformance = -1000;
  585.     for (var i = 0; i < items.length; i++) {
  586.         var performance = this.calcEquipItemPerformance(items[i]);
  587.         if (performance > bestPerformance) {
  588.             bestPerformance = performance;
  589.             bestItem = items[i];
  590.         }
  591.     }
  592.     return bestItem;
  593. };
  594.  
  595. Game_Actor.prototype.clearEquipments = function() {
  596.     var maxSlots = this.equipSlots().length;
  597.     for (var i = 1; i < maxSlots; i++) {
  598.         if (this.isEquipChangeOk(i)) {
  599.             this.changeEquip(i, null);
  600.         }
  601.     }
  602.     this.clearWeapons();
  603. };
  604.  
  605. Game_Actor.prototype.clearWeapons = function() {
  606.     if (Imported.YEP_EquipCore && Yanfly.Param.EquipNonRemove.contains(1)) {
  607.         return;
  608.     }
  609.     var slotId = 0;
  610.     for (var wtypeId = 1; wtypeId < $dataSystem.weaponTypes.length; wtypeId++) {
  611.         if (this.isEquipWtypeOk(wtypeId)) {
  612.             slotId = slotId || wtypeId;
  613.             this.switchToWeaponType(wtypeId, false);
  614.             this.changeWeapon(null);
  615.         }
  616.     }
  617.     this._usedWeaponSlot = slotId;
  618. };
  619.  
  620. //-----------------------------------------------------------------------------
  621. // Game_Party
  622. //
  623. // The game object class for the party. Information such as gold and items is
  624. // included.
  625.  
  626. if (Olivia.OctoBattle.WeaponSwap.WpnBattleTest) {
  627.  
  628. Olivia.OctoBattle.Weapon.___Game_Party_setupBattleTestMembers___ = Game_Party.prototype.setupBattleTestMembers;
  629. Game_Party.prototype.setupBattleTestMembers = function() {
  630.     Olivia.OctoBattle.Weapon.___Game_Party_setupBattleTestMembers___.call(this);
  631.     var weapons = this.createBattleTestWeaponTypes();
  632.     var members = this.members();
  633.     for (var i = 0; i < members.length; i++) {
  634.         member = members[i];
  635.         if (!!member) {
  636.             for (var w = 1; w < weapons.length; w++) {
  637.                 if (!member.isWtypeEquipped(w)) {
  638.                     member.changeEquip(0, weapons[w]);
  639.                 }
  640.             }
  641.             if (!!member.getFirstSwapWeapon()) {
  642.                 member.switchToWeaponType(member.getFirstSwapWeapon().wtypeId, false);
  643.             } else {
  644.                 member.switchToWeaponType(0, false);
  645.             }
  646.         }
  647.     }
  648. };
  649.  
  650. Game_Party.prototype.createBattleTestWeaponTypes = function() {
  651.     var weapons = [null];
  652.     for (var wtypeId = 1; wtypeId < $dataSystem.weaponTypes.length; wtypeId++) {
  653.         weapons.push(this.battleTestGetFirstOfWtype(wtypeId));
  654.     }
  655.     return weapons;
  656. };
  657.  
  658. Game_Party.prototype.battleTestGetFirstOfWtype = function(wtypeId) {
  659.     for (var id = 1; id < $dataWeapons.length; id++) {
  660.         var weapon = $dataWeapons[id];
  661.         if (!!weapon && weapon.wtypeId === wtypeId) {
  662.             return weapon;
  663.         }
  664.     }
  665.     var message = 'You do not have a weapon made for weapon type ' + wtypeId;
  666.     SceneManager.stop();
  667.     Graphics.printError('Weapon Swap Error', message);
  668.     return null;
  669. };
  670.  
  671. }
  672.  
  673. //-----------------------------------------------------------------------------
  674. // Scene_Equip
  675. //
  676. // The scene class of the equipment screen.
  677.  
  678. Olivia.OctoBattle.Weapon.___Scene_Equip_onSlotOk___ = Scene_Equip.prototype.onSlotOk;
  679. Scene_Equip.prototype.onSlotOk = function() {
  680.     if (Imported.YEP_EquipCore) {
  681.         this._itemWindow._slotId = -1;
  682.         var slotId = this._slotWindow.index();
  683.         this._itemWindow.setSlotId(slotId);
  684.         Yanfly.Equip.Scene_Equip_onSlotOk.call(this);
  685.         this._itemWindow.show();
  686.     } else {
  687.         Olivia.OctoBattle.Weapon.___Scene_Equip_onSlotOk___.call(this);
  688.     }
  689. };
  690.  
  691. Scene_Equip.prototype.onItemOk = function() {
  692.     SoundManager.playEquip();
  693.     var slotId = this._slotWindow.index();
  694.     if (slotId < $dataSystem.weaponTypes.length - 1) {
  695.         slotId = 0;
  696.     } else {
  697.         slotId -= $dataSystem.weaponTypes.length - 2;
  698.     }
  699.     this.actor().changeEquip(slotId, this._itemWindow.item());
  700.     this._slotWindow.activate();
  701.     this._slotWindow.refresh();
  702.     this._itemWindow.deselect();
  703.     this._itemWindow.refresh();
  704.     this._statusWindow.refresh();
  705.     if (Imported.YEP_EquipCore) {
  706.         this._itemWindow.hide();
  707.         this._statusWindow.refresh();
  708.     }
  709. };
  710.  
  711. //-----------------------------------------------------------------------------
  712. // Scene_Battle
  713. //
  714. // The scene class of the battle screen.
  715.  
  716. Olivia.OctoBattle.Weapon.___Scene_Battle_createActorCommandWindow___ = Scene_Battle.prototype.createActorCommandWindow;
  717. Scene_Battle.prototype.createActorCommandWindow = function() {
  718.     Olivia.OctoBattle.Weapon.___Scene_Battle_createActorCommandWindow___.call(this);
  719.     this._actorCommandWindow.setHandler('weaponSwap', this.commandWeaponSlot.bind(this));
  720. };
  721.  
  722. Scene_Battle.prototype.commandWeaponSlot = function() {
  723.     BattleManager.actor().swapWeaponBattle('right');
  724.     this._actorCommandWindow.refresh();
  725.     this._actorCommandWindow.activate();
  726. };
  727.  
  728. //-----------------------------------------------------------------------------
  729. // Sprite_WindowArrow
  730. //
  731. // The sprite class with a feature which displays animations.
  732.  
  733. function Sprite_WindowArrow() {
  734.     this.initialize.apply(this, arguments);
  735. }
  736.  
  737. Sprite_WindowArrow.prototype = Object.create(Sprite.prototype);
  738. Sprite_WindowArrow.prototype.constructor = Sprite_WindowArrow;
  739.  
  740. Sprite_WindowArrow.prototype.initialize = function(parent, direction) {
  741.     this._parent = parent;
  742.     this._direction = direction;
  743.     Sprite.prototype.initialize.call(this);
  744.     this.createBitmap();
  745. };
  746.  
  747. Sprite_WindowArrow.prototype.createBitmap = function() {
  748.     this.bitmap = ImageManager.loadSystem('Window');
  749.     this.bitmap.addLoadListener(this.setupBitmap.bind(this));
  750. };
  751.  
  752. Sprite_WindowArrow.prototype.setupBitmap = function() {
  753.     if (this._direction === 'left') {
  754.         this.setFrame(120, 36, 24, 24);
  755.         this.anchor.x = -0.1;
  756.         this.x = 0;
  757.     } else {
  758.         this.setFrame(144, 36, 24, 24);
  759.         this.anchor.x = 1.1;
  760.         this.x = this._parent.width;
  761.     }
  762.     this.anchor.y = 0.5;
  763. };
  764.  
  765. Sprite_WindowArrow.prototype.update = function() {
  766.     Sprite.prototype.update.call(this);
  767.     this.updateOpacity();
  768. };
  769.  
  770. Sprite_WindowArrow.prototype.updateOpacity = function() {
  771.     if (!this._parent.visible || this._parent.contentsOpacity < 255 || this._parent.openness < 255) {
  772.         this.opacity = 0;
  773.         this._currentIndex = -1;
  774.     } else if (this._currentIndex !== this._parent.index()) {
  775.         this._currentIndex = this._parent.index();
  776.         var rect = this._parent.itemRect(this._parent.findSymbol('attack'));
  777.         var y = rect.y + this._parent.standardPadding();
  778.         if (y > 0 && y < (this._parent.height - this._parent.standardPadding() * 2)) {
  779.             y += Math.round(this._parent.lineHeight() / 2);
  780.             this.opacity = 255;
  781.             this.y = y;
  782.         } else {
  783.             this.opacity = 0;
  784.         }
  785.     }
  786. };
  787.  
  788. //-----------------------------------------------------------------------------
  789. // Window_EquipSlot
  790. //
  791. // The window for selecting an equipment slot on the equipment screen.
  792.  
  793. Window_EquipSlot.prototype.maxItems = function() {
  794.     if (!!this._actor) {
  795.         var slots = this._actor.equipSlots().length - 1;
  796.         slots += $dataSystem.weaponTypes.length - 1;
  797.         return slots;
  798.     } else {
  799.         return 0;
  800.     }
  801. };
  802.  
  803. Olivia.OctoBattle.Weapon.___Window_EquipSlot_slotName___ = Window_EquipSlot.prototype.slotName;
  804. Window_EquipSlot.prototype.slotName = function(index) {
  805.     if (index < $dataSystem.weaponTypes.length - 1) {
  806.         return $dataSystem.weaponTypes[index + 1];
  807.     } else {
  808.         index -= $dataSystem.weaponTypes.length - 2;
  809.     }
  810.     return Olivia.OctoBattle.Weapon.___Window_EquipSlot_slotName___.call(this, index);
  811. };
  812.  
  813. Olivia.OctoBattle.Weapon.___Window_EquipSlot_isEnabled___ = Window_EquipSlot.prototype.isEnabled;
  814. Window_EquipSlot.prototype.isEnabled = function(index) {
  815.     if (index < $dataSystem.weaponTypes.length - 1) {
  816.         index += 1;
  817.         return this._actor.isEquipWtypeOk(index);
  818.     } else {
  819.         index -= $dataSystem.weaponTypes.length - 2;
  820.         return Olivia.OctoBattle.Weapon.___Window_EquipSlot_isEnabled___.call(this, index);
  821.     }
  822. };
  823.  
  824. Window_EquipSlot.prototype.item = function() {
  825.     if (!!this._actor) {
  826.         var index = this.index();
  827.         return this.getItemFromIndex(index);
  828.     } else {
  829.         return null;
  830.     }
  831.     return this._actor ? this._actor.equips()[this.index()] : null;
  832. };
  833.  
  834. Window_EquipSlot.prototype.drawItem = function(index) {
  835.     if (Imported.YEP_EquipCore) {
  836.         this.drawItemWeaponSwapEquipCore(index);
  837.     } else {
  838.         this.drawItemWeaponSwapBase(index);
  839.     }
  840. };
  841.  
  842. Window_EquipSlot.prototype.getItemFromIndex = function(index) {
  843.     if (index < $dataSystem.weaponTypes.length - 1) {
  844.         return this._actor.getSwapWeapons()[index];
  845.     } else {
  846.         index -= $dataSystem.weaponTypes.length - 2;
  847.         return this._actor.equips()[index];
  848.     }
  849. }
  850.  
  851. Window_EquipSlot.prototype.drawItemWeaponSwapEquipCore = function(index) {
  852.     if (!this._actor) return;
  853.     var rect = this.itemRectForText(index);
  854.     this.changeTextColor(this.systemColor());
  855.     this.changePaintOpacity(this.isEnabled(index));
  856.     var ww1 = this._nameWidth;
  857.     this.drawText(this.slotName(index), rect.x, rect.y, ww1);
  858.     var ww2 = rect.width - ww1;
  859.     var item = this.getItemFromIndex(index)
  860.     if (item) {
  861.         this.drawItemName(item, rect.x + ww1, rect.y, ww2);
  862.     } else if (this.isEnabled(index)) {
  863.         this.drawEmptySlot(rect.x + ww1, rect.y, ww2);
  864.     }
  865.     this.changePaintOpacity(true);
  866. };
  867.  
  868. Window_EquipSlot.prototype.drawItemWeaponSwapBase = function(index) {
  869.     if (this._actor) {
  870.         var rect = this.itemRectForText(index);
  871.         this.changeTextColor(this.systemColor());
  872.         this.changePaintOpacity(this.isEnabled(index));
  873.         this.drawText(this.slotName(index), rect.x, rect.y, 138, this.lineHeight());
  874.         this.drawItemName(this.getItemFromIndex(index), rect.x + 138, rect.y);
  875.         this.changePaintOpacity(true);
  876.     }
  877. };
  878.  
  879. Olivia.OctoBattle.Weapon.___Window_EquipSlot_updateHelp___ = Window_EquipSlot.prototype.updateHelp;
  880. Window_EquipSlot.prototype.updateHelp = function() {
  881.     if (this._statusWindow) {
  882.         var actor = JsonEx.makeDeepCopy(this._actor);
  883.         if (this.index() < $dataSystem.weaponTypes.length - 1) {
  884.             var item = this._actor.getSwapWeapons()[this.index()];
  885.         } else {
  886.             var item = null;
  887.         }
  888.         actor.forceChangeEquip(0, item);
  889.         this._statusWindow.setActor(actor);
  890.     }
  891.     Olivia.OctoBattle.Weapon.___Window_EquipSlot_updateHelp___.call(this);
  892.     if (this._statusWindow) {
  893.         this._statusWindow.setTempActor(null);
  894.     }
  895. };
  896.  
  897. //-----------------------------------------------------------------------------
  898. // Window_EquipItem
  899. //
  900. // The window for selecting an equipment item on the equipment screen.
  901.  
  902. Olivia.OctoBattle.Weapon.___Window_EquipItem_initialize___ = Window_EquipItem.prototype.initialize;
  903. Window_EquipItem.prototype.initialize = function(x, y, width, height) {
  904.     this._weaponTypeId = 0;
  905.     Olivia.OctoBattle.Weapon.___Window_EquipItem_initialize___.call(this, x, y, width, height);
  906. };
  907.  
  908. Olivia.OctoBattle.Weapon.___Window_EquipItem_setSlotId___ = Window_EquipItem.prototype.setSlotId;
  909. Window_EquipItem.prototype.setSlotId = function(slotId) {
  910.     if (slotId < $dataSystem.weaponTypes.length - 1) {
  911.         weaponTypeId = slotId + 1;
  912.         slotId = 0;
  913.         if (this._weaponTypeId !== weaponTypeId) {
  914.             this._slotId = 0;
  915.             this._weaponTypeId = weaponTypeId;
  916.             this.refresh();
  917.             this.resetScroll();
  918.             return;
  919.         }
  920.     } else {
  921.         slotId -= $dataSystem.weaponTypes.length - 2;
  922.         this._weaponTypeId = 0;
  923.     }
  924.     if (Imported.YEP_EquipCore) {
  925.         Yanfly.Equip.Window_EquipItem_setSlotId.call(this, slotId);
  926.     } else {
  927.         Olivia.OctoBattle.Weapon.___Window_EquipItem_setSlotId___.call(this, slotId);
  928.     }
  929. };
  930.  
  931. Olivia.OctoBattle.Weapon.___Window_EquipItem_includes___ = Window_EquipItem.prototype.includes;
  932. Window_EquipItem.prototype.includes = function(item) {
  933.     if (Olivia.OctoBattle.Weapon.___Window_EquipItem_includes___.call(this, item)) {
  934.         if (!!item && this._slotId <= 0) {
  935.             return this._weaponTypeId === item.wtypeId;
  936.         } else {
  937.             return true;
  938.         }
  939.     } else {
  940.         return false;
  941.     }
  942. };
  943.  
  944. Window_EquipItem.prototype.updateHelp = function() {
  945.     Window_ItemList.prototype.updateHelp.call(this);
  946.     if (!!this._actor && this._statusWindow) {
  947.         var actor = JsonEx.makeDeepCopy(this._statusWindow._actor);
  948.         actor.forceChangeEquip(this._slotId, this.item());
  949.         this._statusWindow.setTempActor(actor);
  950.     }
  951. };
  952.  
  953. //-----------------------------------------------------------------------------
  954. // Window_ActorCommand
  955. //
  956. // The window for selecting an actor's action on the battle screen.
  957.  
  958. Olivia.OctoBattle.Weapon.___Window_ActorCommand_initialize___ = Window_ActorCommand.prototype.initialize;
  959. Window_ActorCommand.prototype.initialize = function() {
  960.     Olivia.OctoBattle.Weapon.___Window_ActorCommand_initialize___.call(this);
  961.     if (Olivia.OctoBattle.WeaponSwap.ShowArrows) {
  962.         this.createWeaponArrowSprites();
  963.     }
  964. };
  965.  
  966. Window_ActorCommand.prototype.createWeaponArrowSprites = function() {
  967.     this._weaponLeftArrowSprite = new Sprite_WindowArrow(this, 'left');
  968.     this.addChild(this._weaponLeftArrowSprite);
  969.     this._weaponRightArrowSprite = new Sprite_WindowArrow(this, 'right');
  970.     this.addChild(this._weaponRightArrowSprite);
  971. };
  972.  
  973. Olivia.OctoBattle.Weapon.___Window_ActorCommand_addAttackCommand___ = Window_ActorCommand.prototype.addAttackCommand;
  974. Window_ActorCommand.prototype.addAttackCommand = function() {
  975.     Olivia.OctoBattle.Weapon.___Window_ActorCommand_addAttackCommand___.call(this);
  976.     if (Olivia.OctoBattle.WeaponSwap.WpnSwapShow) {
  977.         this.addWeaponSwapCommand();
  978.     }
  979. };
  980.  
  981. Window_ActorCommand.prototype.addWeaponSwapCommand = function() {
  982.     var name = Olivia.OctoBattle.WeaponSwap.WpnSwapCmd;
  983.     this.addCommand(name, 'weaponSwap', this.isWeaponSwapEnabled());
  984. };
  985.  
  986. Window_ActorCommand.prototype.isWeaponSwapEnabled = function() {
  987.     if (this._actor.getFirstSwapWeapon()) {
  988.         var count = 0;
  989.         var weapons = this._actor.getSwapWeapons();
  990.         for (var i = 0; i < weapons.length; i++) {
  991.             var weapon = weapons[i];
  992.             if (!!weapon) {
  993.                 count += 1;
  994.                 if (count >= 2) {
  995.                     return true;
  996.                 }
  997.             }
  998.         }
  999.     }
  1000.     return false;
  1001. };
  1002.  
  1003. Window_ActorCommand.prototype.drawItem = function(index) {
  1004.     if (Olivia.OctoBattle.WeaponSwap.ShowIcons) {
  1005.         this.drawWeaponIcon(index);
  1006.     }
  1007.     Window_Command.prototype.drawItem.call(this, index);
  1008. };
  1009.  
  1010. Window_ActorCommand.prototype.drawWeaponIcon = function(index) {
  1011.     if (this._list[index].symbol === 'attack') {
  1012.         var rect = this.itemRect(index);
  1013.         if (this.itemTextAlign() === 'left') {
  1014.             var x = rect.width - Window_Base._iconWidth - 2;
  1015.         } else {
  1016.             var x = rect.x + 2;
  1017.         }
  1018.         var weapon = this._actor.weapons()[0];
  1019.         if (!!weapon) {
  1020.             var icon = weapon.iconIndex;
  1021.         } else {
  1022.             var icon = 77;
  1023.         }
  1024.         this.drawIcon(icon, x, rect.y + 2);
  1025.     }
  1026. };
  1027.  
  1028. if (Olivia.OctoBattle.WeaponSwap.WpnSwapArrows) {
  1029.  
  1030. Window_ActorCommand.prototype.processCursorMove = function() {
  1031.     if (this.active && Input.isRepeated('right') && this.currentSymbol() === 'attack') {
  1032.         this._actor.swapWeaponBattle('right');
  1033.         SoundManager.playEquip();
  1034.         this.refresh();
  1035.     } else if (this.active && Input.isRepeated('left') && this.currentSymbol() === 'attack') {
  1036.         this._actor.swapWeaponBattle('left');
  1037.         SoundManager.playEquip();
  1038.         this.refresh();
  1039.     } else {
  1040.         Window_Command.prototype.processCursorMove.call(this);
  1041.     }
  1042. };
  1043.  
  1044. }
  1045.  
  1046. Window_ActorCommand.prototype.playOkSound = function() {
  1047.     if (this.currentSymbol() === 'weaponSwap') {
  1048.         SoundManager.playEquip();
  1049.     } else {
  1050.         Window_Command.prototype.playOkSound.call(this);
  1051.     }
  1052. };
  1053.  
  1054. //-----------------------------------------------------------------------------
  1055. // Window_ActorCommand
  1056. //
  1057. // From Yanfly's Equip Core
  1058.  
  1059. if (Imported.YEP_EquipCore && Olivia.OctoBattle.WeaponSwap.ExtraLines) {
  1060.  
  1061. Olivia.OctoBattle.Weapon.___Window_StatCompare_refresh___ = Window_StatCompare.prototype.refresh;
  1062. Window_StatCompare.prototype.refresh = function() {
  1063.     Olivia.OctoBattle.Weapon.___Window_StatCompare_refresh___.call(this);
  1064.     if (!!this._actor) {
  1065.         this.drawExtraParameters();
  1066.     }
  1067. };
  1068.  
  1069. Window_StatCompare.prototype.drawExtraParameters = function() {
  1070.     this.drawExtraParamItem('hit', 0, this.lineHeight() * 8);
  1071.     this.drawExtraParamItem('eva', 0, this.lineHeight() * 9);
  1072.     this.drawExtraParamItem('cri', 0, this.lineHeight() * 10);
  1073. };
  1074.  
  1075. Window_StatCompare.prototype.drawExtraParamItem = function(param, x, y) {
  1076.     this.drawDarkRect(x, y, this.contents.width, this.lineHeight());
  1077.     this.drawExtraParamItemName(y, param)
  1078.     this.drawCurrentExtraParam(y, param);
  1079.     this.drawRightArrow(y);
  1080.     if (this._tempActor) {
  1081.         this.drawNewExtraParam(y, param);
  1082.         this.drawExtraParamDifference(y, param);
  1083.     }
  1084. };
  1085.  
  1086. Window_StatCompare.prototype.drawExtraParamItemName = function(y, param) {
  1087.     if (param === 'hit') {
  1088.         var name = Olivia.OctoBattle.WeaponSwap.TextHit;
  1089.     } else if (param === 'eva') {
  1090.         var name = Olivia.OctoBattle.WeaponSwap.TextEva;
  1091.     } else if (param === 'cri') {
  1092.         var name = Olivia.OctoBattle.WeaponSwap.TextCri;
  1093.     }
  1094.     var x = this.textPadding();
  1095.     this.changeTextColor(this.systemColor());
  1096.     this.drawText(name, x, y, this._paramNameWidth);
  1097. };
  1098.  
  1099. Window_StatCompare.prototype.drawCurrentExtraParam = function(y, param) {
  1100.     if (param === 'hit') {
  1101.         var actorparam = Math.round(this._actor.hit * 100) + '%';
  1102.     } else if (param === 'eva') {
  1103.         var actorparam = Math.round(this._actor.eva * 100) + '%';
  1104.     } else if (param === 'cri') {
  1105.         var actorparam = Math.round(this._actor.cri * 100) + '%';
  1106.     }
  1107.     var x = this.contents.width - this.textPadding();
  1108.     x -= this._paramValueWidth * 2 + this._arrowWidth + this._bonusValueWidth;
  1109.     this.resetTextColor();
  1110.     this.drawText(actorparam, x, y, this._paramValueWidth, 'right');
  1111. };
  1112.  
  1113. Window_StatCompare.prototype.drawNewExtraParam = function(y, param) {
  1114.     if (param === 'hit') {
  1115.         var newValue = Math.round(this._tempActor.hit * 100);
  1116.         var diffvalue = newValue - Math.round(this._actor.hit * 100);
  1117.     } else if (param === 'eva') {
  1118.         var newValue = Math.round(this._tempActor.eva * 100);
  1119.         var diffvalue = newValue - Math.round(this._actor.eva * 100);
  1120.     } else if (param === 'cri') {
  1121.         var newValue = Math.round(this._tempActor.cri * 100);
  1122.         var diffvalue = newValue - Math.round(this._actor.cri * 100);
  1123.     }
  1124.     var x = this.contents.width - this.textPadding();
  1125.     x -= this._paramValueWidth + this._bonusValueWidth;
  1126.     var actorparam = newValue + '%';
  1127.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1128.     this.drawText(actorparam, x, y, this._paramValueWidth, 'right');
  1129. };
  1130.  
  1131. Window_StatCompare.prototype.drawExtraParamDifference = function(y, param) {
  1132.     var x = this.contents.width - this.textPadding();
  1133.     x -= this._bonusValueWidth;
  1134.     if (param === 'hit') {
  1135.         var newValue = Math.round(this._tempActor.hit * 100);
  1136.         var diffvalue = newValue - Math.round(this._actor.hit * 100);
  1137.     } else if (param === 'eva') {
  1138.         var newValue = Math.round(this._tempActor.eva * 100);
  1139.         var diffvalue = newValue - Math.round(this._actor.eva * 100);
  1140.     } else if (param === 'cri') {
  1141.         var newValue = Math.round(this._tempActor.cri * 100);
  1142.         var diffvalue = newValue - Math.round(this._actor.cri * 100);
  1143.     }
  1144.     if (diffvalue === 0) return;
  1145.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1146.     var text = diffvalue + '%';
  1147.     if (diffvalue > 0) {
  1148.       text = ' (+' + text + ')';
  1149.     } else {
  1150.       text = ' (' + text + ')';
  1151.     }
  1152.     this.drawText(text, x, y, this._bonusValueWidth, 'left');
  1153. };
  1154.  
  1155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement