Advertisement
nio_kasgami

Moogle X plugin fix

Feb 2nd, 2016
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Equipment Learning by Moogle_X
  3. // Moogle_X_EquipmentLearning.js
  4. // Created on: January 3rd 2016
  5. //=============================================================================
  6.  
  7. var Imported = Imported || {};
  8. Imported.Moogle_X_EQL = true;
  9.  
  10. var Moogle_X = Moogle_X || {};
  11. Moogle_X.EQL = Moogle_X.EQL || {};
  12.  
  13. //=============================================================================
  14. /*:
  15.  * @plugindesc v1.21 Allows actors to learn skill from equipment.
  16.  * @author Moogle_X
  17.  *
  18.  * @param Allows Instant Mastery
  19.  * @desc Actor can use equipment's skills instantly when equipped? 1:Yes 0:No
  20.  * @default 1
  21.  *
  22.  * @param All Skills Learnable
  23.  * @desc Actor can learn all skills from equipment by default? 1:Yes 0:No
  24.  * @default 1
  25.  *
  26.  * @param AP Text
  27.  * @desc This is the text vocab for AP.
  28.  * @default AP
  29.  *
  30.  * @param AP Gain Per Action
  31.  * @desc This is the AP gain for each battle action.
  32.  * @default 1
  33.  *
  34.  * @param No AP Gain Skill List
  35.  * @desc This is the list of skill id(s) that won't trigger AP Gain. Example: 1 2 48 59
  36.  * @default 0
  37.  *
  38.  * @param Default AP Requirement
  39.  * @desc This is the default AP needed to learn skill from equipment.
  40.  * @default 100
  41.  *
  42.  * @param Default Enemy AP
  43.  * @desc This is the default AP gain from defeating an enemy.
  44.  * @default 10
  45.  *
  46.  * @param Display AP Gain After Battle
  47.  * @desc Display AP gain messages after battle (without Victory Aftermath)? 1:Yes 0:No
  48.  * @default 1
  49.  *
  50.  * @param AP Gain Text In Battle
  51.  * @desc Adjusts how the AP gain text is shown after battle (without Victory Aftermath).
  52.  * %1 - Actor     %2 Value     %3 AP
  53.  * @default %1 gains %2%3!
  54.  *
  55.  * @param ---Window Ability List---
  56.  * @default
  57.  *
  58.  * @param Display Added Skills
  59.  * @desc Equipment also display in the window all added skills from traits? 1:Yes 0:No
  60.  * @default 1
  61.  *
  62.  * @param Ability Title
  63.  * @desc This is the text for "Ability" at the top of Window Ability List.
  64.  * @default Ability
  65.  *
  66.  * @param Ability Title Alignment
  67.  * @desc This is the text alignment for "Ability" at the top of Window Ability List. (left center right)
  68.  * @default center
  69.  *
  70.  * @param No Ability Text
  71.  * @desc This is the text for "- None -" in Window Ability List.
  72.  * @default - None -
  73.  *
  74.  * @param No Ability Text Alignment
  75.  * @desc This is the text alignment for "- None -" in Window Ability List. (left center right)
  76.  * @default left
  77.  *
  78.  * @param Skill's Font Name
  79.  * @desc This is the font name for skills in Window Ability List.
  80.  * @default GameFont
  81.  *
  82.  * @param Skill's Font Size
  83.  * @desc This is the font size for skills in Window Ability List.
  84.  * @default 28
  85.  *
  86.  * @param Skill Name Offset X
  87.  * @desc Change the offset X value of skill name. (Positive: right; Negative: left)
  88.  * @default 0
  89.  *
  90.  * @param Skill Name Offset Y
  91.  * @desc Change the offset Y value of skill name. (Positive: down; Negative: up)
  92.  * @default 0
  93.  *
  94.  * @param AP Text Color
  95.  * @desc This is the text color for "AP" in Window Ability List.
  96.  * @default 2
  97.  *
  98.  * @param AP Text Offset X
  99.  * @desc Change the offset X value of "AP" in Window Ability List. (Positive: right; Negative: left)
  100.  * @default 0
  101.  *
  102.  * @param AP Gauge Color 1
  103.  * @desc This is the first gauge color for "AP Gauge" in Window Ability List.
  104.  * @default 17
  105.  *
  106.  * @param AP Gauge Color 2
  107.  * @desc This is the second gauge color for "AP Gauge" in Window Ability List.
  108.  * @default 14
  109.  *
  110.  * @param AP Gauge Offset X
  111.  * @desc Change the offset X value of "AP Gauge" in Window Ability List. (Positive: right; Negative: left)
  112.  * @default 180
  113.  *
  114.  * @param Mastery Icon
  115.  * @desc This is the icon index for "Mastered Skill" in Window Ability List.
  116.  * @default 87
  117.  *
  118.  * @param Show Skill Icon
  119.  * @desc Do you want to show skill icon in Window Ability List? 1:Yes 0:No
  120.  * @default 1
  121.  *
  122.  * @param Window opacity
  123.  * @desc Permit to edit the Window Opacity of the skill.
  124.  * @default 255
  125.  *
  126.  * @param ---Victory Aftermath---
  127.  * @default
  128.  *
  129.  * @param Display Aftermath
  130.  * @desc Display Victory Aftermath AP window after battle? 1:Yes 0:No
  131.  * @default 1
  132.  *
  133.  * @param Aftermath Top Text
  134.  * @desc This is the text at the top of Aftermath Window.
  135.  * @default AP Earned
  136.  *
  137.  * @param Aftermath AP Format
  138.  * @desc This is AP gain text format in the Victory Aftermath.
  139.  * %1 - Value     %2 - AP
  140.  * @default \C[0]+%1\C[2]%2
  141.  *
  142.  * @param Aftermath AP Gain Text
  143.  * @desc Describes how much AP is earned per actor.
  144.  * @default AP Earned in Battle
  145.  *
  146.  * @param Show Aftermath New Skill
  147.  * @desc Display new learned skills in Victory Aftermath AP window? 1:Yes 0:No
  148.  * @default 1
  149.  *
  150.  * @param ---Custom Scroll Images---
  151.  * @default
  152.  *
  153.  * @param Use Custom Scroll Images
  154.  * @desc Enable custom left and right scroll images? 1:Yes 0:No
  155.  * @default 0
  156.  *
  157.  * @param Left Scroll Offset X
  158.  * @desc Change the offset X value of Left Scroll Image. (Positive: right; Negative: left)
  159.  * @default 0
  160.  *
  161.  * @param Left Scroll Offset Y
  162.  * @desc Change the offset Y value of Left Scroll Image. (Positive: down; Negative: up)
  163.  * @default 0
  164.  *
  165.  * @param Right Scroll Offset X
  166.  * @desc Change the offset X value of Right Scroll Image. (Positive: right; Negative: left)
  167.  * @default 0
  168.  *
  169.  * @param Right Scroll Offset Y
  170.  * @desc Change the offset Y value of Right Scroll Image. (Positive: down; Negative: up)
  171.  * @default 0
  172.  *
  173.  * @help
  174.  * ============================================================================
  175.  * Introduction
  176.  * ============================================================================
  177.  * This plugin gives actors the ability to learn new skills from equipment.
  178.  * Each weapons and armors now possess innate ability/skills that can be
  179.  * learned to any actors who equip it.
  180.  *
  181.  * Each weapons and armors contains specific innate ability. Each ability
  182.  * requires certain amount of Ability Point (AP) in order to be learned or
  183.  * mastered.
  184.  *
  185.  * Actors can gain Ability Point (AP) in battle. Each AP gained will be
  186.  * automatically distributed to all innate abilities from the actor's equipment
  187.  * list. Once the required AP is fulfilled, the ability will be permanently
  188.  * learned.
  189.  *
  190.  * ============================================================================
  191.  * How to Set Up Weapons and Armors
  192.  * ============================================================================
  193.  * In order to make a certain weapon or armor hold innate ability, you need
  194.  * to insert this notetag into the weapon/armor's notebox:
  195.  *
  196.  * <EQL Skill: n>                 // This equipment contains skill n.
  197.  *
  198.  * Example:
  199.  * <EQL Skill: 23>                // This equipment contains skill with id 23.
  200.  *
  201.  * If you want to give more than 1 ability, you simply replace the above
  202.  * notetag with this:
  203.  *
  204.  * <EQL Skill: n1, n2, n3>        // This equipment contains skills n1, n2, n3.
  205.  *
  206.  * Example:
  207.  * <EQL Skill: 4, 7, 12>          // This equipment contains skills 4, 7, 12.
  208.  * <EQL Skill: 3, 28, 39, 44, 52> // This equipment contains skills 3, 28, 39,
  209.  *                                // 44, 52.
  210.  *
  211.  * ============================================================================
  212.  * How to Set Up Skill's AP Requirement
  213.  * ============================================================================
  214.  * Every skill will require a certain amount of AP in order to be learned.
  215.  * You can change the default AP requirement by editing "Default AP Requirement"
  216.  * parameter in the plugin configurations.
  217.  *
  218.  * To assign a custom AP requirement, you just need to insert this notetag into
  219.  * the skill's notebox:
  220.  *
  221.  * <EQL AP: x>                    // This skill requires x amount of AP.
  222.  *
  223.  * Example:
  224.  * <EQL AP: 120>                  // This skill requires 120 AP to be learned.
  225.  *
  226.  * NEW Feature! Actor Specific AP Requirement!
  227.  *
  228.  * You can alter how much AP requirement is needed for each actor.
  229.  * You can make certain actor to learn the same skill faster/slower compared to
  230.  * other actors.
  231.  *
  232.  * To do this, just insert this notetag into the actor's notebox:
  233.  *
  234.  * <EQL AP Change x: y%>          // This actor's AP requirement for skill x
  235.  *                                // is multiplied by y%.
  236.  *
  237.  * Example:
  238.  * <EQL AP Change 12: 50%>        // AP requirement for skill 12 will be half
  239.  *                                // the standard amount.
  240.  *
  241.  * <EQL AP Change 18: 200%>       // AP requirement for skill 18 will be twice
  242.  *                                // the standard amount.
  243.  *
  244.  * ============================================================================
  245.  * How to Set Up Enemies' AP "Drop"
  246.  * ============================================================================
  247.  * Actors gain AP by defeating enemy in battle. Each enemy gives a certain
  248.  * amount of AP. You can change the default enemy AP by editing "Default Enemy
  249.  * AP" parameter in the plugin configurations.
  250.  *
  251.  * To assign custom AP "drop" for enemy, insert this notetag into the enemy's
  252.  * notebox:
  253.  *
  254.  * <EQL AP: x>                    // This enemy gives x amount of AP.
  255.  *
  256.  * Example:
  257.  * <EQL AP: 25>                   // This enemy gives 25 AP when defeated.
  258.  *
  259.  * ============================================================================
  260.  * How to Set Up Actors Starting AP
  261.  * ============================================================================
  262.  * You can make certain actor to have initial amount of AP from the start.
  263.  * By default, all actors possess 0 AP in all skills. If you want to give the
  264.  * actor a set amount of starting AP, simply insert this notetag into the
  265.  * actor's notebox:
  266.  *
  267.  * <EQL Starting AP x: y>       // This actor has y AP in skill x.
  268.  *
  269.  * Example:
  270.  * <EQL Starting AP 23: 100>    // This actor starts with 100 AP already
  271.  *                              // "learned" in skill with id 23.
  272.  *
  273.  * ============================================================================
  274.  * NEW Trait! AP Boost
  275.  * ============================================================================
  276.  * This plugin introduces new trait for actors. This trait is called "AP Boost".
  277.  *
  278.  * Any actors that possess this trait will gain extra amount of AP every time
  279.  * they receive AP. This trait can be inserted into Actors, Classes, Weapons,
  280.  * Armors, and States.
  281.  *
  282.  * Just insert this notetag into Actors, Classes, Weapons, Armors, and/or
  283.  * States notebox:
  284.  *
  285.  * <EQL AP Boost: x%>         // AP gain will be multiplied by x%.
  286.  *
  287.  * Example:
  288.  * <EQL AP Boost: 120%>       // AP gain will be increased by 20%.
  289.  * <EQL AP Boost: 50%>        // AP gain will be halved.
  290.  * <EQL AP Boost: 200%>       // Double AP gain!
  291.  *
  292.  * Multiple of this trait will stack. Please use this new trait wisely.
  293.  *
  294.  * ============================================================================
  295.  * Actors and Classes Skills Learning Restriction
  296.  * ============================================================================
  297.  * By default, all actors can learn every skills inside their equipment.
  298.  * You can apply limitation on which skills any actors/classes can learn from
  299.  * their equipment.
  300.  *
  301.  * First, you MUST turn off "All Skills Learnable" parameter in the plugin
  302.  * configurations (just insert "0").
  303.  *
  304.  * Next, insert this notetag into actors and/or classes noteboxes:
  305.  *
  306.  * <EQL Learn Skills: x, y, z>        // This actor/class can learn skill x, y,
  307.  *                                    // and z from equipment.
  308.  *
  309.  * Example:
  310.  * <EQL Learn Skills: 23, 24, 50, 68> // This actor/class can learn skill with
  311.  *                                    // id 23, 24, 50, and 68 from equipment.
  312.  *
  313.  * ============================================================================
  314.  * Miscellaneous - <EQL No Aftermath> Skills Notetag
  315.  * ============================================================================
  316.  * Inserting <EQL No Aftermath> notetag inside skill's notebox will prevent
  317.  * that skill to "show up" in Victory Aftermath and default battle victory
  318.  * "new skills announcement".
  319.  *
  320.  * Use this notetag as you see fit.
  321.  *
  322.  * ============================================================================
  323.  * Miscellaneous - <EQL Show Switch: x> Skills Notetag
  324.  * ============================================================================
  325.  * You can bind the "visibility" of certain skill in Window Ability List with
  326.  * an in-game switch.
  327.  *
  328.  * For example, skill "Heal" that contains notetag <EQL Show Switch: 2> will
  329.  * be hidden/disappear in Window Ability List whenever in-game switch 2 is OFF.
  330.  * Skill "Heal" will reappear again in the Window when switch 2 is ON.
  331.  *
  332.  * ============================================================================
  333.  * Miscellaneous - <EQL AP Gain Eval> Skills Notetag
  334.  * ============================================================================
  335.  * Another miscellaneous feature. You can assign any custom effects to occur
  336.  * whenever an actor gain AP in specific skill.
  337.  *
  338.  * Just insert these notetags inside the skill's notebox:
  339.  *
  340.  * <EQL AP Gain Eval>
  341.  *
  342.  * // Insert your code here...
  343.  *
  344.  * </EQL AP Gain Eval>
  345.  *
  346.  * Tips: "this" will refer to the actor who gain the AP.
  347.  * (I'm not responsible for any destruction these notetags cause to your
  348.  * project. Use them at your own risk.)
  349.  *
  350.  * ============================================================================
  351.  * Miscellaneous - Custom Scroll Images
  352.  * ============================================================================
  353.  * If you wish to disable left and right horizontal arrows and instead use
  354.  * custom scroll images at the left and right bottom corners of the windows,
  355.  * please turn on the parameter "Use Custom Scroll Images" in the Plugin
  356.  * configurations.
  357.  *
  358.  * You will need to put 2 png files named "eqlLeftScroll" and "eqlRightScroll"
  359.  * inside '(Project Folder)/img/system' directory.
  360.  *
  361.  * You can adjust the offset X and offset Y value of both images in the Plugin
  362.  * configurations.
  363.  *
  364.  * ============================================================================
  365.  * Notetags and Plugin Commands List
  366.  * ============================================================================
  367.  * Actors Notetag:
  368.  * <EQL Starting AP x: y>
  369.  * <EQL AP Change x: y%>
  370.  *
  371.  * Actors and Classes Notetags:
  372.  * <EQL Learn Skills: x, y, z>
  373.  *
  374.  * Weapons and Armors Notetags:
  375.  * <EQL Skill: n>
  376.  * <EQL Skill: n1, n2, n3>
  377.  *
  378.  * Skills Notetag:
  379.  * <EQL AP: x>
  380.  * <EQL No Aftermath>
  381.  * <EQL Show Switch: x>
  382.  * <EQL AP Gain Eval>
  383.  * </EQL AP Gain Eval>
  384.  *
  385.  * Enemies Notetag:
  386.  * <EQL AP: x>
  387.  *
  388.  * Actors, Classes, Weapons, Armors, and States Notetag:
  389.  * <EQL AP Boost: x%>
  390.  *
  391.  * Plugin Command:
  392.  * EQL AP Gain x Actor y        // Actor y will gain x amount of AP.
  393.  *
  394.  * Example:
  395.  * EQL AP Gain 1000 Actor 3     // Actor 3 will receive 1000 AP.
  396.  *
  397.  * ============================================================================
  398.  * Compatibility
  399.  * ============================================================================
  400.  * This plugin must be positioned BELOW any of these plugins:
  401.  *
  402.  * YEP_VictoryAftermath
  403.  * YEP_ItemCore
  404.  * YEP_ShopMenuCore
  405.  * YEP_EquipCore
  406.  * YEP_AutoPassiveStates
  407.  * Moogle_X_EquipSkillSystem
  408.  * Moogle_X_PassiveSkill
  409.  *
  410.  * If you use any of the above plugins, please make sure to position Equipment
  411.  * Learning plugin under those plugins.
  412.  *
  413.  * ============================================================================
  414.  * Terms of Use
  415.  * ============================================================================
  416.  * Free to use in both commercial and non-commercial project as long as credit
  417.  * is given.
  418.  *
  419.  * ============================================================================
  420.  * Change Log
  421.  * ============================================================================
  422.  * Version 1.21:
  423.  * - Added "Display Added Skills" parameter.
  424.  * - Added "No AP Gain Skill List" parameter.
  425.  *
  426.  * Version 1.2:
  427.  * - Added Custom Scroll Images feature.
  428.  * - Change the drawing order of ability list. Skill name is now drawn last.
  429.  * - Added option to disable/enable skill icon in Window Ability List.
  430.  * - Added offset X and offset Y parameters for skill name in Window Ability List.
  431.  * - Added offset X parameter for "AP" text in Window Ability List.
  432.  *
  433.  * Version 1.13:
  434.  * - Added <EQL AP Change x: y%> actors notetag.
  435.  *
  436.  * Version 1.12:
  437.  * - Fixed Equip Skill System bug (actor can equip "unlearnable" skills).
  438.  * - Fixed Passive Skills bug (added "unlearnable" skills check).
  439.  * - Fixed Yanfly's Auto Passive States bug (added "unlearnable" skills check).
  440.  * - Fixed incorrect icon opacity in Window Ability List.
  441.  *
  442.  * Version 1.1:
  443.  * - Added option to change skill's font name and size in Window Ability List.
  444.  * - Added actors and classes skills learning restriction.
  445.  * - Added <EQL No Aftermath> skills notetag.
  446.  * - Added <EQL Show Switch: x> skills notetag.
  447.  * - Added <EQL AP Gain Eval> skills notetag.
  448.  *
  449.  * Version 1.0:
  450.  * - Completed plugin.
  451.  *
  452.  */
  453. //=============================================================================
  454.  
  455. (function() { // IIFE
  456.  
  457. //=============================================================================
  458. // Parameter Variables
  459. //=============================================================================
  460.  
  461. Moogle_X.EQL.parameters = PluginManager.parameters('Moogle_X_EquipmentLearning');
  462. Moogle_X.EQL.instantMastery = Number(Moogle_X.EQL.parameters['Allows Instant Mastery']) != 0;
  463. Moogle_X.EQL.defApReq = Number(Moogle_X.EQL.parameters['Default AP Requirement'] || 0);
  464. Moogle_X.EQL.defEnemyAp = Number(Moogle_X.EQL.parameters['Default Enemy AP'] || 0);
  465. Moogle_X.EQL.apVocab = String(Moogle_X.EQL.parameters['AP Text'] || '');
  466. Moogle_X.EQL.apPerAction = Number(Moogle_X.EQL.parameters['AP Gain Per Action'] || 0);
  467. Moogle_X.EQL.postBattleMsg = Number(Moogle_X.EQL.parameters['Display AP Gain After Battle']) != 0;
  468. Moogle_X.EQL.battleApFmt = String(Moogle_X.EQL.parameters['AP Gain Text In Battle'] || '');
  469. Moogle_X.EQL.useAft = Number(Moogle_X.EQL.parameters['Display Aftermath']) != 0;
  470. Moogle_X.EQL.aftTopText = String(Moogle_X.EQL.parameters['Aftermath Top Text'] || '');
  471. Moogle_X.EQL.aftApFmt = String(Moogle_X.EQL.parameters['Aftermath AP Format'] || '');
  472. Moogle_X.EQL.aftApGainText = String(Moogle_X.EQL.parameters['Aftermath AP Gain Text'] || '');
  473. Moogle_X.EQL.showAftNewSkill = Number(Moogle_X.EQL.parameters['Show Aftermath New Skill']) != 0;
  474. Moogle_X.EQL.ablTitle = String(Moogle_X.EQL.parameters['Ability Title'] || '');
  475. Moogle_X.EQL.ablTitleAlign = String(Moogle_X.EQL.parameters['Ability Title Alignment'] || 'center');
  476. Moogle_X.EQL.noAblText = String(Moogle_X.EQL.parameters['No Ability Text'] || '');
  477. Moogle_X.EQL.noAblTextAlign = String(Moogle_X.EQL.parameters['No Ability Text Alignment'] || 'left');
  478. Moogle_X.EQL.apTextColor = Number(Moogle_X.EQL.parameters['AP Text Color'] || '0');
  479. Moogle_X.EQL.apColor1 = Number(Moogle_X.EQL.parameters['AP Gauge Color 1'] || '17');
  480. Moogle_X.EQL.apColor2 = Number(Moogle_X.EQL.parameters['AP Gauge Color 2'] || '14');
  481. Moogle_X.EQL.apOffsetX = Number(Moogle_X.EQL.parameters['AP Gauge Offset X'] || '0');
  482. Moogle_X.EQL.masteryIcon = Number(Moogle_X.EQL.parameters['Mastery Icon'] || '0');
  483. Moogle_X.EQL.sklFontName = String(Moogle_X.EQL.parameters["Skill's Font Name"] || 'GameFont');
  484. Moogle_X.EQL.sklFontSize = Number(Moogle_X.EQL.parameters["Skill's Font Size"] || 28);
  485. Moogle_X.EQL.allSklLearn = Number(Moogle_X.EQL.parameters['All Skills Learnable']) != 0;
  486. Moogle_X.EQL.useScrollImages = Number(Moogle_X.EQL.parameters['Use Custom Scroll Images']) != 0;
  487. Moogle_X.EQL.leftScrollX = Number(Moogle_X.EQL.parameters['Left Scroll Offset X'] || 0);
  488. Moogle_X.EQL.leftScrollY = Number(Moogle_X.EQL.parameters['Left Scroll Offset Y'] || 0);
  489. Moogle_X.EQL.rightScrollX = Number(Moogle_X.EQL.parameters['Right Scroll Offset X'] || 0);
  490. Moogle_X.EQL.rightScrollY = Number(Moogle_X.EQL.parameters['Right Scroll Offset Y'] || 0);
  491. Moogle_X.EQL.showSkillIcon = Number(Moogle_X.EQL.parameters['Show Skill Icon']) != 0;
  492. Moogle_X.EQL.skillNameX = Number(Moogle_X.EQL.parameters['Skill Name Offset X'] || 0);
  493. Moogle_X.EQL.skillNameY = Number(Moogle_X.EQL.parameters['Skill Name Offset Y'] || 0);
  494. Moogle_X.EQL.apTextOffsetX = Number(Moogle_X.EQL.parameters['AP Text Offset X'] || 0);
  495. Moogle_X.EQL.showAddedSkills = Number(Moogle_X.EQL.parameters['Display Added Skills']) != 0;
  496. Moogle_X.EQL.noApGainList = String(Moogle_X.EQL.parameters['No AP Gain Skill List'] || 0);
  497. Moogle_X.EQL.windowOpacity = Number(Moogle_X.EQL.parameters['Window opacity']);
  498.  
  499. var noApSkillIds = Moogle_X.EQL.noApGainList.split(' ');
  500. Moogle_X.EQL.noApGainList = [];
  501. for (var i = 0; i < noApSkillIds.length; i++) {
  502.     Moogle_X.EQL.noApGainList.push(Number(noApSkillIds[i]));
  503. }
  504.  
  505. //=============================================================================
  506. // Moogle_X - Window Horizontal Arrows (START)
  507. //=============================================================================
  508.  
  509. Moogle_X.hArrows = Moogle_X.hArrows || {};
  510.  
  511. if (!Moogle_X.hArrows.active) {
  512. Moogle_X.hArrows.active = true;
  513.  
  514. //=============================================================================
  515. // Window
  516. //=============================================================================
  517.  
  518. Moogle_X.hArrows.Window_initialize = Window.prototype.initialize;
  519. Window.prototype.initialize = function() {
  520.     this._Moogle_X_leftArrowVisible = false;
  521.     this._Moogle_X_rightArrowVisible = false;
  522.     Moogle_X.hArrows.Window_initialize.call(this);
  523. };
  524.  
  525. Moogle_X.hArrows.Window_createAllParts = Window.prototype._createAllParts;
  526. Window.prototype._createAllParts = function() {
  527.     Moogle_X.hArrows.Window_createAllParts.call(this);
  528.     this._Moogle_X_leftArrowSprite = new Sprite();
  529.     this._Moogle_X_rightArrowSprite = new Sprite();
  530.     this.addChild(this._Moogle_X_leftArrowSprite);
  531.     this.addChild(this._Moogle_X_rightArrowSprite);
  532. };
  533.  
  534. Moogle_X.hArrows.Window_refreshArrows = Window.prototype._refreshArrows;
  535. Window.prototype._refreshArrows = function() {
  536.     Moogle_X.hArrows.Window_refreshArrows.call(this);
  537.     if (Moogle_X.EQL.useScrollImages) {
  538.         var w = this._width;
  539.         var h = this._height;
  540.         var p = 24;
  541.         var q = p/2;
  542.         var leftOffsetX = Moogle_X.EQL.leftScrollX;
  543.         var leftOffsetY = Moogle_X.EQL.leftScrollY;
  544.         var rightOffsetX = Moogle_X.EQL.rightScrollX;
  545.         var rightOffsetY = Moogle_X.EQL.rightScrollY;
  546.         var leftScroll = Bitmap.load('img/system/eqlLeftScroll.png');
  547.         var rightScroll = Bitmap.load('img/system/eqlRightScroll.png');
  548.  
  549.         this._Moogle_X_leftArrowSprite.bitmap = leftScroll;
  550.         this._Moogle_X_leftArrowSprite.move(q + leftOffsetX, h-q-29 + leftOffsetY);
  551.  
  552.         this._Moogle_X_rightArrowSprite.bitmap = rightScroll;
  553.         this._Moogle_X_rightArrowSprite.move(w-q-98 + rightOffsetX, h-q-29 + rightOffsetY);
  554.  
  555.     } else {
  556.         var w = this._width;
  557.         var h = this._height;
  558.         var p = 24;
  559.         var q = p/2;
  560.         var sx = 96+p;
  561.         var sy = 0+p;
  562.         this._Moogle_X_leftArrowSprite.bitmap = this._windowskin;
  563.         this._Moogle_X_leftArrowSprite.anchor.x = 0.5;
  564.         this._Moogle_X_leftArrowSprite.anchor.y = 0.5;
  565.         this._Moogle_X_leftArrowSprite.setFrame(sx, sy+q, q, p);
  566.         this._Moogle_X_leftArrowSprite.move(q, h/2);
  567.         this._Moogle_X_rightArrowSprite.bitmap = this._windowskin;
  568.         this._Moogle_X_rightArrowSprite.anchor.x = 0.5;
  569.         this._Moogle_X_rightArrowSprite.anchor.y = 0.5;
  570.         this._Moogle_X_rightArrowSprite.setFrame(sx+p+q, sy+q, q, p);
  571.         this._Moogle_X_rightArrowSprite.move(w-q, h/2);
  572.     }
  573.  
  574. };
  575.  
  576. Moogle_X.hArrows.Window_updateArrows = Window.prototype._updateArrows;
  577. Window.prototype._updateArrows = function() {
  578.     Moogle_X.hArrows.Window_updateArrows.call(this);
  579.     this._Moogle_X_leftArrowSprite.visible =
  580.         this.isOpen() && this._Moogle_X_leftArrowVisible;
  581.     this._Moogle_X_rightArrowSprite.visible =
  582.         this.isOpen() && this._Moogle_X_rightArrowVisible;
  583. };
  584.  
  585. //=============================================================================
  586. // Window_Base
  587. //=============================================================================
  588.  
  589. Moogle_X.hArrows.Window_Base_initialize = Window_Base.prototype.initialize;
  590. Window_Base.prototype.initialize = function(x, y, width, height) {
  591.     Moogle_X.hArrows.Window_Base_initialize.call(this, x, y, width, height);
  592.     this._Moogle_X_hArrowsActive = false;
  593.     this._Moogle_X_hPageNumber = 0;
  594. };
  595.  
  596. Window_Base.prototype.MoogleXhArrowsActive = function() {
  597.     return this._Moogle_X_hArrowsActive;
  598. };
  599.  
  600. Window_Base.prototype.MoogleXhPageNumber = function() {
  601.     return this._Moogle_X_hPageNumber;
  602. };
  603.  
  604. Window_Base.prototype.setMoogleXhPageNumber = function(hPages) {
  605.     this._Moogle_X_hPageNumber = hPages + 1;
  606.     this._Moogle_X_hArrowsActive = true;
  607. };
  608.  
  609. Window_Base.prototype.updateMoogleXhArrows = function(sceneIndex, scenePages) {
  610.     this._Moogle_X_leftArrowVisible = this.MoogleXhArrowsActive() &&
  611.         this.MoogleXleftArrowVisible(sceneIndex, scenePages);
  612.     this._Moogle_X_rightArrowVisible = this.MoogleXhArrowsActive() &&
  613.         this.MoogleXrightArrowVisible(sceneIndex, scenePages);
  614. };
  615.  
  616. Window_Base.prototype.MoogleXleftArrowVisible = function(sceneIndex, scenePages) {
  617.     if (this.customMoogleXhArrowsHide()) return false;
  618.     if (!scenePages) return false;
  619.     if (scenePages === 1) return false;
  620.     if (sceneIndex > 1) return true;
  621.     return false;
  622. };
  623.  
  624. Window_Base.prototype.MoogleXrightArrowVisible = function(sceneIndex, scenePages) {
  625.     if (this.customMoogleXhArrowsHide()) return false;
  626.     if (!scenePages) return false;
  627.     if (scenePages === 1) return false;
  628.     if (sceneIndex < scenePages) return true;
  629.     return false;
  630. };
  631.  
  632. Window_Base.prototype.updateMoogleXhVisible = function(sceneIndex, scenePages) {
  633.     if (!this.MoogleXhPageNumber()) return;
  634.     if (this.MoogleXhArrowsActive()) {
  635.         if (!sceneIndex) {
  636.             this.visible = false;
  637.             return;
  638.         }
  639.         if (scenePages === 1) {
  640.             this.visible = true;
  641.             return;
  642.         }
  643.         if (sceneIndex === this.MoogleXhPageNumber()) {
  644.             this.visible = true;
  645.         } else if (sceneIndex !== this.MoogleXhPageNumber()) {
  646.             this.visible = false;
  647.         }
  648.     }
  649. };
  650.  
  651. Window_Base.prototype.customMoogleXhArrowsHide = function() {
  652.     return false;
  653. };
  654.  
  655. //=============================================================================
  656. // Window_Selectable
  657. //=============================================================================
  658.  
  659. Moogle_X.hArrows.Window_Selectable_cursorRight =
  660.     Window_Selectable.prototype.cursorRight;
  661. Window_Selectable.prototype.cursorRight = function(wrap) {
  662.     Moogle_X.hArrows.Window_Selectable_cursorRight.call(this, wrap);
  663.     if (SceneManager._scene) {
  664.         if (!SceneManager._scene.MoogleXhRestrict()) {
  665.             SceneManager._scene.goRightMoogleXhPages();
  666.         }
  667.     }
  668. };
  669.  
  670. Moogle_X.hArrows.Window_Selectable_cursorLeft =
  671.     Window_Selectable.prototype.cursorLeft;
  672. Window_Selectable.prototype.cursorLeft = function(wrap) {
  673.     Moogle_X.hArrows.Window_Selectable_cursorLeft.call(this, wrap);
  674.     if (SceneManager._scene) {
  675.         if (!SceneManager._scene.MoogleXhRestrict()) {
  676.             SceneManager._scene.goLeftMoogleXhPages();
  677.         }
  678.     }
  679. };
  680.  
  681. //=============================================================================
  682. // Scene_Base
  683. //=============================================================================
  684.  
  685. Moogle_X.hArrows.Scene_Base_initialize = Scene_Base.prototype.initialize;
  686. Scene_Base.prototype.initialize = function() {
  687.     Moogle_X.hArrows.Scene_Base_initialize.call(this);
  688.     this._Moogle_X_hPages = 0;
  689.     this._Moogle_X_hIndex = 0;
  690.     this._Moogle_X_hWindows = [];
  691.     this._Moogle_X_hRestrict = false;
  692. };
  693.  
  694. Scene_Base.prototype.MoogleXhPages = function() {
  695.     return this._Moogle_X_hPages;
  696. };
  697.  
  698. Scene_Base.prototype.MoogleXhIndex = function() {
  699.     return this._Moogle_X_hIndex;
  700. };
  701.  
  702. Scene_Base.prototype.MoogleXhWindows = function() {
  703.     return this._Moogle_X_hWindows;
  704. };
  705.  
  706. Scene_Base.prototype.MoogleXhRestrict = function() {
  707.     return this._Moogle_X_hRestrict;
  708. };
  709.  
  710. Scene_Base.prototype.registerMoogleXhWindow = function(hWindow) {
  711.     if (this.MoogleXhWindows().contains(hWindow)) return;
  712.     hWindow.setMoogleXhPageNumber(this.MoogleXhPages());
  713.     this.addMoogleXhPage();
  714.     this._Moogle_X_hWindows.push(hWindow);
  715. };
  716.  
  717. Scene_Base.prototype.addMoogleXhPage = function() {
  718.     this._Moogle_X_hPages += 1;
  719. };
  720.  
  721. Scene_Base.prototype.goLeftMoogleXhPages = function() {
  722.     if (this.MoogleXhIndex() <= 1) return;
  723.     SoundManager.playCursor();
  724.     this._Moogle_X_hIndex -= 1;
  725. };
  726.  
  727. Scene_Base.prototype.goRightMoogleXhPages = function() {
  728.     if (!this.MoogleXhIndex()) return;
  729.     if (this.MoogleXhIndex() >= this.MoogleXhPages()) return;
  730.     SoundManager.playCursor();
  731.     this._Moogle_X_hIndex += 1;
  732. };
  733.  
  734. Moogle_X.hArrows.Scene_Base_update = Scene_Base.prototype.update;
  735. Scene_Base.prototype.update = function() {
  736.     Moogle_X.hArrows.Scene_Base_update.call(this);
  737.     this.updateMoogleXhArrows();
  738. };
  739.  
  740. Scene_Base.prototype.updateMoogleXhArrows = function() {
  741.     if (!this.MoogleXhWindows()) return;
  742.     if (this.MoogleXhWindows().length > 0) {
  743.         this.MoogleXhWindows().forEach(function(hWindow) {
  744.             hWindow.updateMoogleXhArrows(this.MoogleXhIndex(),
  745.                 this.MoogleXhPages());
  746.             hWindow.updateMoogleXhVisible(this.MoogleXhIndex(),
  747.                 this.MoogleXhPages());
  748.         }, this);
  749.     }
  750. };
  751.  
  752. } // !Moogle_X.hArrows.active
  753.  
  754. //=============================================================================
  755. // Moogle_X - Window Horizontal Arrows (END)
  756. //=============================================================================
  757.  
  758. //=============================================================================
  759. // Constant Declaration
  760. //=============================================================================
  761. Game_BattlerBase.TRAIT_EQL_AP_BOOST = 114; // New trait code.
  762.  
  763. //=============================================================================
  764. // DataManager
  765. //=============================================================================
  766.  
  767. Moogle_X.EQL.DatabaseLoaded = false;
  768. Moogle_X.EQL.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  769. DataManager.isDatabaseLoaded = function() {
  770.     if (!Moogle_X.EQL.DataManager_isDatabaseLoaded.call(this)) return false;
  771.     if (!Moogle_X.EQL.DatabaseLoaded) {
  772.         DataManager.readNotetags_EQL1($dataActors);
  773.         DataManager.readNotetags_EQL2($dataWeapons);
  774.         DataManager.readNotetags_EQL2($dataArmors);
  775.         DataManager.readNotetags_EQL3($dataSkills);
  776.         DataManager.readNotetags_EQL4($dataEnemies);
  777.         DataManager.readNotetags_EQL5($dataActors);
  778.         DataManager.readNotetags_EQL5($dataClasses);
  779.         DataManager.readNotetags_EQL5($dataWeapons);
  780.         DataManager.readNotetags_EQL5($dataArmors);
  781.         DataManager.readNotetags_EQL5($dataStates);
  782.         DataManager.readNotetags_EQL6($dataActors);
  783.         DataManager.readNotetags_EQL6($dataClasses);
  784.         Moogle_X.EQL.DatabaseLoaded = true;
  785.     }
  786.         return true;
  787. };
  788.  
  789. DataManager.readNotetags_EQL1 = function(group) {
  790.     var note1 = /<(?:EQL STARTING AP)[ ](\d+):[ ](\d+)>/i;
  791.     var note2 = /<(?:EQL AP CHANGE)[ ](\d+):[ ](\d+)\%>/i;
  792.  
  793.       for (var n = 1; n < group.length; n++) {
  794.             var obj = group[n];
  795.             var notedata = obj.note.split(/[\r\n]+/);
  796.  
  797.         obj.eqlStartingAp = {};
  798.         obj.eqlApChange = {};
  799.  
  800.             for (var i = 0; i < notedata.length; i++) {
  801.                   var line = notedata[i];
  802.                   if (line.match(note1)) {
  803.                 var skill  = Number(RegExp.$1);
  804.                 var initAp = Number(RegExp.$2);
  805.                 obj.eqlStartingAp[skill] = initAp;
  806.             } else if (line.match(note2)) {
  807.                 var skillId = Number(RegExp.$1);
  808.                 var apChange = Number(RegExp.$2) / 100;
  809.                 obj.eqlApChange[skillId] = apChange;
  810.             }
  811.             }
  812.       }
  813. };
  814.  
  815. DataManager.readNotetags_EQL2 = function(group) {
  816.     var note = /<(?:EQL SKILL):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
  817.  
  818.       for (var n = 1; n < group.length; n++) {
  819.             var obj = group[n];
  820.             var notedata = obj.note.split(/[\r\n]+/);
  821.  
  822.         obj.eqlSkill = [];
  823.  
  824.             for (var i = 0; i < notedata.length; i++) {
  825.                   var line = notedata[i];
  826.                   if (line.match(note)) {
  827.                 var list = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
  828.                 obj.eqlSkill = list;
  829.             }
  830.             }
  831.       }
  832. };
  833.  
  834. DataManager.readNotetags_EQL3 = function(group) {
  835.     var note1 = /<(?:EQL AP):[ ](\d+)>/i;
  836.     var note2 = /<(?:EQL NO AFTERMATH)>/i;
  837.     var note3 = /<(?:EQL SHOW SWITCH):[ ](\d+)>/i;
  838.     var note4a = /<(?:EQL AP GAIN EVAL)>/i;
  839.     var note4b = /<\/(?:EQL AP GAIN EVAL)>/i;
  840.  
  841.       for (var n = 1; n < group.length; n++) {
  842.             var obj = group[n];
  843.             var notedata = obj.note.split(/[\r\n]+/);
  844.  
  845.         obj.eqlAp = Moogle_X.EQL.defApReq;
  846.         obj.eqlNoAft = false;
  847.         obj.eqlShowSwitch = 0;
  848.         obj.eqlApGainEval = '';
  849.         var evalMode = 'none';
  850.  
  851.             for (var i = 0; i < notedata.length; i++) {
  852.                   var line = notedata[i];
  853.                   if (line.match(note1)) {
  854.                 var apNeeded  = Number(RegExp.$1);
  855.                 obj.eqlAp = apNeeded;
  856.             } else if (line.match(note2)) {
  857.                 obj.eqlNoAft = true;
  858.             } else if (line.match(note3)) {
  859.                 obj.eqlShowSwitch = Number(RegExp.$1);
  860.             } else if (line.match(note4a)) {
  861.                 evalMode = 'ap gain eval';
  862.             } else if (line.match(note4b)) {
  863.                 evalMode = 'none';
  864.             } else if (evalMode === 'ap gain eval') {
  865.                 obj.eqlApGainEval = obj.eqlApGainEval + line + '\n';
  866.             }
  867.             }
  868.       }
  869. };
  870.  
  871. DataManager.readNotetags_EQL4 = function(group) {
  872.     var note = /<(?:EQL AP):[ ](\d+)>/i;
  873.  
  874.       for (var n = 1; n < group.length; n++) {
  875.             var obj = group[n];
  876.             var notedata = obj.note.split(/[\r\n]+/);
  877.  
  878.         obj.eqlAp = Moogle_X.EQL.defEnemyAp;
  879.  
  880.             for (var i = 0; i < notedata.length; i++) {
  881.                   var line = notedata[i];
  882.                   if (line.match(note)) {
  883.                 var apDrop  = Number(RegExp.$1);
  884.                 obj.eqlAp = apDrop;
  885.             }
  886.             }
  887.       }
  888. };
  889.  
  890. DataManager.readNotetags_EQL5 = function(group) {
  891.     var note = /<(?:EQL AP BOOST):[ ](\d+)\%>/i;
  892.     var code = Game_BattlerBase.TRAIT_EQL_AP_BOOST;
  893.  
  894.       for (var n = 1; n < group.length; n++) {
  895.             var obj = group[n];
  896.             var notedata = obj.note.split(/[\r\n]+/);
  897.  
  898.             for (var i = 0; i < notedata.length; i++) {
  899.                   var line = notedata[i];
  900.                   if (line.match(note)) {
  901.                 var boostValue = Number(RegExp.$1) / 100;
  902.                 var apTrait = [{"code":code,"dataId":0,"value":boostValue}];
  903.                 obj.traits = obj.traits.concat(apTrait);
  904.             }
  905.             }
  906.       }
  907. };
  908.  
  909. DataManager.readNotetags_EQL6 = function(group) {
  910.     var note = /<(?:EQL LEARN SKILLS):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
  911.  
  912.       for (var n = 1; n < group.length; n++) {
  913.             var obj = group[n];
  914.             var notedata = obj.note.split(/[\r\n]+/);
  915.  
  916.         obj.eqlLearnSkills = [];
  917.  
  918.             for (var i = 0; i < notedata.length; i++) {
  919.                   var line = notedata[i];
  920.                   if (line.match(note)) {
  921.                 var list = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
  922.                 obj.eqlLearnSkills = list;
  923.             }
  924.             }
  925.       }
  926. };
  927.  
  928.  
  929. //=============================================================================
  930. // Game_BattlerBase
  931. //=============================================================================
  932.  
  933. Game_BattlerBase.prototype.eqlApBoost = function() {
  934.     return this.traitsPi(Game_BattlerBase.TRAIT_EQL_AP_BOOST, 0);
  935. };
  936.  
  937. //=============================================================================
  938. // Game_Actor
  939. //=============================================================================
  940.  
  941. Moogle_X.EQL.Game_Actor_initMembers = Game_Actor.prototype.initMembers;
  942. Game_Actor.prototype.initMembers = function() {
  943.     Moogle_X.EQL.Game_Actor_initMembers.call(this);
  944.     this._eqlAp = {};
  945.     this._eqlBattleAp = 0;
  946.     this._eqlNewSkill = [];
  947. };
  948.  
  949. Moogle_X.EQL.Game_Actor_setup = Game_Actor.prototype.setup;
  950. Game_Actor.prototype.setup = function(actorId) {
  951.     Moogle_X.EQL.Game_Actor_setup.call(this, actorId);
  952.     this.initEqlSetup();
  953. };
  954.  
  955. Game_Actor.prototype.initEqlSetup = function() {
  956.     for (var i = 1; i < $dataSkills.length; i++) {
  957.         this._eqlAp[i] = 0;
  958.         if (this.actor().eqlStartingAp[i]) {
  959.             this._eqlAp[i] += this.actor().eqlStartingAp[i];
  960.             this.eqlCheckMastery(i);
  961.         }
  962.     }
  963. };
  964.  
  965. Game_Actor.prototype.eqlApNeeded = function(skill) {
  966.     if (!skill) return Moogle_X.EQL.defApReq;
  967.     var baseAp = skill.eqlAp;
  968.     var rate = this.actor().eqlApChange[skill.id] || 1;
  969.     var finalAp = Math.round(baseAp * rate);
  970.     return finalAp;
  971. };
  972.  
  973. Game_Actor.prototype.eqlCheckMastery = function(skillId) {
  974.     var apNeeded = this.eqlApNeeded($dataSkills[skillId]);
  975.     if (!this._eqlAp[skillId]) {
  976.         this._eqlAp[skillId] = 0;
  977.     }
  978.  
  979.     var checkSkillPrev = this.isLearnedSkill(skillId);
  980.  
  981.     if (this.eqlIsMastered(skillId)) {
  982.         this._eqlAp[skillId] = apNeeded;
  983.         this.learnSkill(skillId);
  984.     }
  985.  
  986.     if ($gameParty.inBattle()) {
  987.         if (this.isLearnedSkill(skillId) && !checkSkillPrev) {
  988.             if (!this._eqlNewSkill.contains(skillId) && !$dataSkills[skillId].eqlNoAft) {
  989.                 this._eqlNewSkill.push(skillId);
  990.             }
  991.         }
  992.     }
  993. };
  994.  
  995. Game_Actor.prototype.eqlGainAp = function(value) {
  996.     var total = value * this.eqlApBoost();
  997.     total = Math.round(total);
  998.     if ($gameParty.inBattle()) {
  999.         this._eqlBattleAp += total;
  1000.     }
  1001.     this.equips().forEach(function(eq) {
  1002.         if (eq) {
  1003.             eq.eqlSkill.forEach(function(skillId) {
  1004.                 if (!this._eqlAp[skillId]) this._eqlAp[skillId] = 0;
  1005.  
  1006.                 // Danger Zone (START)
  1007.                 if (!this.eqlCantLearnSkill($dataSkills[skillId])) {
  1008.                     this._eqlAp[skillId] += total; // Original code.
  1009.                     this.eqlCheckMastery(skillId); // Original code.
  1010.                     eval($dataSkills[skillId].eqlApGainEval);
  1011.                 }
  1012.                 // Danger Zone (END)
  1013.  
  1014.             }, this);
  1015.         }
  1016.     }, this);
  1017. };
  1018.  
  1019. Game_Actor.prototype.eqlBattleAp = function() {
  1020.         return this._eqlBattleAp;
  1021. };
  1022.  
  1023. Game_Actor.prototype.eqlNewSkill = function() {
  1024.     return this._eqlNewSkill;
  1025. };
  1026.  
  1027. Game_Actor.prototype.eqlIsMastered = function(skillId) {
  1028.     var apNeeded = this.eqlApNeeded($dataSkills[skillId]);
  1029.     return this._eqlAp[skillId] >= apNeeded || this.isLearnedSkill(skillId);
  1030. };
  1031.  
  1032. Moogle_X.EQL.Game_Actor_forgetSkill = Game_Actor.prototype.forgetSkill;
  1033. Game_Actor.prototype.forgetSkill = function(skillId) {
  1034.     Moogle_X.EQL.Game_Actor_forgetSkill.call(this, skillId);
  1035.     this.eqlForgetSkill(skillId);
  1036. };
  1037.  
  1038. Game_Actor.prototype.eqlForgetSkill = function(skillId) {
  1039.     this._eqlAp[skillId] = 0;
  1040. };
  1041.  
  1042. Moogle_X.EQL.Game_Actor_skills = Game_Actor.prototype.skills;
  1043. Game_Actor.prototype.skills = function() {
  1044.     var list = Moogle_X.EQL.Game_Actor_skills.call(this);
  1045.     if (Moogle_X.EQL.instantMastery) {
  1046.         var array = this.getEqlObjects();
  1047.         array = array.filter(function(skill) {
  1048.             return !this.eqlCantLearnSkill(skill);
  1049.         }, this);
  1050.         if (Imported.Moogle_X_EQS) {
  1051.             array = array.filter(function(skill) {
  1052.                 return skill.isEqsIgnore === true;
  1053.             });
  1054.         }
  1055.         array.forEach(function(skill) {
  1056.             if (!list.contains(skill)) {
  1057.                 list.push(skill);
  1058.             }
  1059.         });
  1060.     }
  1061.     return list;
  1062. };
  1063.  
  1064. Game_Actor.prototype.getEqlObjects = function() {
  1065.     var list = [];
  1066.     this.equips().forEach(function(eq) {
  1067.         if (eq && eq.eqlSkill.length > 0) {
  1068.             eq.eqlSkill.forEach(function(skillId) {
  1069.                 if (!list.contains($dataSkills[skillId])) {
  1070.                     list.push($dataSkills[skillId]);
  1071.                 }
  1072.             });
  1073.         }
  1074.     });
  1075.     return list;
  1076. };
  1077.  
  1078. Game_Actor.prototype.eqlApRate = function(skill) {
  1079.     if (this.eqlIsMastered(skill.id)) return 1;
  1080.     return this._eqlAp[skill.id] / this.eqlApNeeded(skill);
  1081. };
  1082.  
  1083. Game_Actor.prototype.eqlCantLearnSkill = function(skill) {
  1084.     if (Moogle_X.EQL.allSklLearn) return false;
  1085.     if (!skill) return false;
  1086.     if (this.actor().eqlLearnSkills) {
  1087.         if (!this.actor().eqlLearnSkills.contains(skill.id)) var actorCant = true;
  1088.     }
  1089.     if (this.currentClass().eqlLearnSkills) {
  1090.         if (!this.currentClass().eqlLearnSkills.contains(skill.id)) var classCant = true;
  1091.     }
  1092.     if (actorCant && classCant) {
  1093.         return true;
  1094.     }
  1095.     return false;
  1096. };
  1097.  
  1098. // Compatibility with Moogle_X_EquipSkillSystem.
  1099. if (Imported.Moogle_X_EQS) {
  1100.     Moogle_X.EQL.Game_Actor_getSkillPool = Game_Actor.prototype.getSkillPool;
  1101.     Game_Actor.prototype.getSkillPool = function(typeId) {
  1102.         var array = Moogle_X.EQL.Game_Actor_getSkillPool.call(this, typeId);
  1103.         if (Moogle_X.EQL.instantMastery) {
  1104.             var list = this.getEqlObjects();
  1105.  
  1106.             list = list.filter(function(skill) {
  1107.                 return skill.eqsType === typeId;
  1108.             });
  1109.  
  1110.             list = list.filter(function(skill) {
  1111.                 return skill.isEqsIgnore === false;
  1112.             });
  1113.  
  1114.             list = list.filter(function(skill) {
  1115.                 return !this.eqlCantLearnSkill(skill);
  1116.             }, this);
  1117.  
  1118.             list.forEach(function(skill) {
  1119.                 if (!array.contains(skill)) {
  1120.                     array.push(skill);
  1121.                 }
  1122.             });
  1123.         }
  1124.  
  1125.         return array;
  1126.     };
  1127.  
  1128.     Moogle_X.EQL.Game_Actor_eqsIsLearnedSkill = Game_Actor.prototype.eqsIsLearnedSkill;
  1129.     Game_Actor.prototype.eqsIsLearnedSkill = function(skillId) {
  1130.         return Moogle_X.EQL.Game_Actor_eqsIsLearnedSkill.call(this, skillId) ||
  1131.             (Moogle_X.EQL.instantMastery &&
  1132.             this.getEqlObjects().contains($dataSkills[skillId]));
  1133.     };
  1134.  
  1135. } // Imported.Moogle_X_EQS
  1136.  
  1137. // Compatibility with Moogle_X_PassiveSkill.
  1138. if (Imported.Moogle_X_PsvSkl) {
  1139.     Moogle_X.EQL.Game_Actor_getPsvSkillList = Game_Actor.prototype.getPsvSkillList;
  1140.     Game_Actor.prototype.getPsvSkillList = function() {
  1141.         var array = Moogle_X.EQL.Game_Actor_getPsvSkillList.call(this);
  1142.         if (Moogle_X.EQL.instantMastery) {
  1143.             var list = this.getEqlObjects();
  1144.             list = list.filter(function(skill) {
  1145.                 return !this.eqlCantLearnSkill(skill);
  1146.             }, this);
  1147.  
  1148.             if (Imported.Moogle_X_EQS) {
  1149.                 list = list.filter(function(skill) {
  1150.                     return skill.isEqsIgnore === true;
  1151.                 });
  1152.             };
  1153.  
  1154.             list = list.filter(function(skill) {
  1155.                 return skill.isPassive === true;
  1156.             });
  1157.             list = list.map(function(skill) {
  1158.                 return skill.id;
  1159.             });
  1160.             list.forEach(function(skillId) {
  1161.                 if (!array.contains(skillId)) {
  1162.                     array.push(skillId);
  1163.                 }
  1164.             });
  1165.         }
  1166.         return array;
  1167.     };
  1168.  
  1169. } // Imported.Moogle_X_PsvSkl
  1170.  
  1171. // Compatibility with YEP_AutoPassiveStates v1.05a.
  1172. if (Imported.YEP_AutoPassiveStates) {
  1173.     Game_Actor.prototype.passiveStatesRaw = function() {
  1174.         if (this._passiveStatesRaw !== undefined) return this._passiveStatesRaw;
  1175.         var array = Game_BattlerBase.prototype.passiveStatesRaw.call(this);
  1176.         array = array.concat(this.getPassiveStateData(this.actor()));
  1177.         array = array.concat(this.getPassiveStateData(this.currentClass()));
  1178.         for (var i = 0; i < this.equips().length; ++i) {
  1179.             var equip = this.equips()[i];
  1180.             array = array.concat(this.getPassiveStateData(equip));
  1181.         }
  1182.  
  1183.         //for (var i = 0; i < this._skills.length; ++i) {
  1184.         //    var skill = $dataSkills[this._skills[i]];
  1185.         //    array = array.concat(this.getPassiveStateData(skill));
  1186.         //}
  1187.  
  1188.         if (Imported.Moogle_X_EQS) {
  1189.             var eqsSkills = this.getEqsArray();
  1190.             var eqsIgnored = this._skills.filter(function(skillId) {
  1191.                 return $dataSkills[skillId].isEqsIgnore === true;
  1192.             });
  1193.             eqsSkills = eqsSkills.concat(eqsIgnored);
  1194.  
  1195.             if (Moogle_X.EQL.instantMastery) {
  1196.                 var eqlSkills = this.getEqlObjects();
  1197.                 eqlSkills = eqlSkills.filter(function(skill) {
  1198.                     return !this.eqlCantLearnSkill(skill);
  1199.                 }, this);
  1200.                 eqlSkills = eqlSkills.filter(function(skill) {
  1201.                     return skill.isEqsIgnore === true;
  1202.                 });
  1203.                 eqlSkills = eqlSkills.map(function(skill) {
  1204.                     return skill.id;
  1205.                 });
  1206.                 eqsSkills = eqsSkills.concat(eqlSkills);
  1207.             }
  1208.  
  1209.             for (var i = 0; i < eqsSkills.length; ++i) {
  1210.                 var skill = $dataSkills[eqsSkills[i]];
  1211.                 array = array.concat(this.getPassiveStateData(skill));
  1212.             }
  1213.         } else {
  1214.             var defaultSkills = this._skills;
  1215.             if (Moogle_X.EQL.instantMastery) {
  1216.                 var eqlSkills = this.getEqlObjects();
  1217.                 eqlSkills = eqlSkills.filter(function(skill) {
  1218.                     return !this.eqlCantLearnSkill(skill);
  1219.                 }, this);
  1220.                 eqlSkills = eqlSkills.map(function(skill) {
  1221.                     return skill.id;
  1222.                 });
  1223.                 defaultSkills = defaultSkills.concat(eqlSkills);
  1224.             }
  1225.  
  1226.             for (var i = 0; i < defaultSkills.length; ++i) {
  1227.                 var skill = $dataSkills[defaultSkills[i]];
  1228.                 array = array.concat(this.getPassiveStateData(skill));
  1229.             }
  1230.         }
  1231.  
  1232.         this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique)
  1233.         return this._passiveStatesRaw;
  1234.     };
  1235.  
  1236. } // Imported.YEP_AutoPassiveStates
  1237.  
  1238. //=============================================================================
  1239. // Game_Battler
  1240. //=============================================================================
  1241.  
  1242. Moogle_X.EQL.Game_Battler_useItem = Game_Battler.prototype.useItem;
  1243. Game_Battler.prototype.useItem = function(item) {
  1244.     Moogle_X.EQL.Game_Battler_useItem.call(this, item);
  1245.     if (!$gameParty.inBattle()) return;
  1246.     if (this.isActor() && item === $dataSkills[item.id]) {
  1247.         if (Moogle_X.EQL.noApGainList.contains(item.id)) {
  1248.             return;
  1249.         }
  1250.     }
  1251.     if (this.isActor()) this.eqlGainAp(Moogle_X.EQL.apPerAction);
  1252. };
  1253.  
  1254. Moogle_X.EQL.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
  1255. Game_Battler.prototype.onBattleStart = function() {
  1256.     Moogle_X.EQL.Game_Battler_onBattleStart.call(this);
  1257.         this._eqlBattleAp = 0;
  1258.     this._eqlNewSkill = [];
  1259. };
  1260.  
  1261. //=============================================================================
  1262. // BattleManager
  1263. //=============================================================================
  1264.  
  1265. Moogle_X.EQL.BattleManager_makeRewards = BattleManager.makeRewards;
  1266. BattleManager.makeRewards = function() {
  1267.     Moogle_X.EQL.BattleManager_makeRewards.call(this);
  1268.     this._rewards.eqlAp = $gameTroop.eqlApTotal();
  1269.     this.eqlGainAp();
  1270. };
  1271.  
  1272. BattleManager.eqlGainAp = function() {
  1273.         var ap = $gameTroop.eqlApTotal();
  1274.         $gameParty.members().forEach(function(actor) {
  1275.             actor.eqlGainAp(ap);
  1276.         });
  1277. };
  1278.  
  1279. Moogle_X.EQL.BattleManager_displayRewards = BattleManager.displayRewards;
  1280. BattleManager.displayRewards = function() {
  1281.     Moogle_X.EQL.BattleManager_displayRewards.call(this);
  1282.     if (Moogle_X.EQL.postBattleMsg) {
  1283.         this.eqlDisplayApGain();
  1284.         this.eqlDisplayNewMastery();
  1285.     }
  1286. };
  1287.  
  1288. BattleManager.eqlDisplayApGain = function() {
  1289.     var ap = $gameTroop.eqlApTotal();
  1290.     $gameMessage.newPage();
  1291.     $gameParty.members().forEach(function(actor) {
  1292.               var fmt = Moogle_X.EQL.battleApFmt;
  1293.               var text = fmt.format(actor.name(), actor.eqlBattleAp(), Moogle_X.EQL.apVocab);
  1294.               $gameMessage.add('\\.' + text);
  1295.         });
  1296. };
  1297.  
  1298. BattleManager.eqlDisplayNewMastery = function() {
  1299.     var anyNewSkill = $gameParty.members().some(function(actor) {
  1300.         return actor.eqlNewSkill().length > 0;
  1301.     });
  1302.     if (!anyNewSkill) return;
  1303.     $gameMessage.newPage();
  1304.     $gameParty.members().forEach(function(actor) {
  1305.               var newSkills = actor.eqlNewSkill();
  1306.         newSkills.forEach(function(skillId) {
  1307.             $gameMessage.add(TextManager.obtainSkill.format($dataSkills[skillId].name));
  1308.         });
  1309.         });
  1310. };
  1311.  
  1312. //=============================================================================
  1313. // Game_Troop
  1314. //=============================================================================
  1315.  
  1316. Game_Troop.prototype.eqlApTotal = function() {
  1317.     return this.deadMembers().reduce(function(r, enemy) {
  1318.         return r + enemy.eqlAp();
  1319.     }, 0);
  1320. };
  1321.  
  1322. //=============================================================================
  1323. // Game_Enemy
  1324. //=============================================================================
  1325.  
  1326. Game_Enemy.prototype.eqlAp = function() {
  1327.     return this.enemy().eqlAp;
  1328. };
  1329.  
  1330. //=============================================================================
  1331. // Window_EqlVictoryAp
  1332. //=============================================================================
  1333.  
  1334. if (Imported.YEP_VictoryAftermath && Moogle_X.EQL.useAft) {
  1335.  
  1336. function Window_EqlVictoryAp() {
  1337.     this.initialize.apply(this, arguments);
  1338. }
  1339.  
  1340. Window_EqlVictoryAp.prototype = Object.create(Window_VictoryExp.prototype);
  1341. Window_EqlVictoryAp.prototype.constructor = Window_EqlVictoryAp;
  1342.  
  1343. Window_EqlVictoryAp.prototype.drawActorGauge = function(actor, index) {
  1344.     this.clearGaugeRect(index);
  1345.     var rect = this.gaugeRect(index);
  1346.     this.changeTextColor(this.normalColor());
  1347.     this.drawActorName(actor, rect.x + 2, rect.y);
  1348.     this.drawLevel(actor, rect);
  1349.     this.drawApGained(actor, rect);
  1350.     this.drawGainedSkills(actor, rect);
  1351. };
  1352.  
  1353. Window_EqlVictoryAp.prototype.drawApGained = function(actor, rect) {
  1354.     var wy = rect.y + this.lineHeight() * 1;
  1355.     this.changeTextColor(this.systemColor());
  1356.     this.drawText(Moogle_X.EQL.aftApGainText, rect.x + 2, wy, rect.width - 4,
  1357.         'left');
  1358.     var bonusAp = 1.0 * actor.eqlBattleAp() * this._tick /
  1359.         Yanfly.Param.VAGaugeTicks;
  1360.     var value = Yanfly.Util.toGroup(parseInt(bonusAp));
  1361.     var fmt = Moogle_X.EQL.aftApFmt;
  1362.     var apText = fmt.format(value, Moogle_X.EQL.apVocab);
  1363.     this.changeTextColor(this.normalColor());
  1364.     wx = rect.x + rect.width - this.textWidthEx(apText);
  1365.     this.drawTextEx(apText, wx, wy);
  1366. };
  1367.  
  1368. Window_EqlVictoryAp.prototype.drawGainedSkills = function(actor, rect) {
  1369.     if (actor.eqlNewSkill().length <= 0) return;
  1370.     if (!this.meetDrawGainedSkillsCondition(actor)) return;
  1371.     var wy = rect.y;
  1372.     for (var i = 0; i < actor.eqlNewSkill().length; ++i) {
  1373.         if (wy + this.lineHeight() > rect.y + rect.height) break;
  1374.         var skillId = actor.eqlNewSkill()[i];
  1375.         var skill = $dataSkills[skillId];
  1376.         if (!skill) continue;
  1377.         var text = '\\i[' + skill.iconIndex + ']' + skill.name;
  1378.         text = TextManager.obtainSkill.format(text);
  1379.         var ww = this.textWidthEx(text);
  1380.         var wx = rect.x + (rect.width - ww) / 2;
  1381.         this.drawTextEx(text, wx, wy);
  1382.         wy += this.lineHeight();
  1383.     }
  1384. };
  1385.  
  1386. Window_EqlVictoryAp.prototype.meetDrawGainedSkillsCondition = function(actor) {
  1387.     if (!Moogle_X.EQL.showAftNewSkill) return false;
  1388.     var bonusAp = 1.0 * actor.eqlBattleAp() * this._tick /
  1389.         Yanfly.Param.VAGaugeTicks;
  1390.     var fullAp = actor.eqlBattleAp();
  1391.     if (bonusAp >= fullAp) {
  1392.         return true;
  1393.     } else {
  1394.         return false;
  1395.     }
  1396. };
  1397.  
  1398. //=============================================================================
  1399. // Scene_Battle
  1400. //=============================================================================
  1401.  
  1402. Moogle_X.EQL.Scene_Battle_addCustomVictorySteps =
  1403.     Scene_Battle.prototype.addCustomVictorySteps;
  1404. Scene_Battle.prototype.addCustomVictorySteps = function(array) {
  1405.     array = Moogle_X.EQL.Scene_Battle_addCustomVictorySteps.call(this, array);
  1406.     if (!array.contains('EQL')) array.push('EQL');
  1407.     return array;
  1408. };
  1409.  
  1410. Moogle_X.EQL.Scene_Battle_updateVictorySteps =
  1411.     Scene_Battle.prototype.updateVictorySteps;
  1412. Scene_Battle.prototype.updateVictorySteps = function() {
  1413.     Moogle_X.EQL.Scene_Battle_updateVictorySteps.call(this);
  1414.     if (this.isVictoryStep('EQL')) this.eqlUpdateVictoryAp();
  1415. };
  1416.  
  1417. Scene_Battle.prototype.eqlUpdateVictoryAp = function() {
  1418.     if (!this._eqlVictoryApWindow) {
  1419.       this.eqlCreateVictoryAp();
  1420.     } else if (this._eqlVictoryApWindow.isReady()) {
  1421.       if (this.victoryTriggerContinue()) this.eqlFinishVictoryAp();
  1422.     }
  1423. };
  1424.  
  1425. Scene_Battle.prototype.eqlCreateVictoryAp = function() {
  1426.     this._victoryTitleWindow.refresh(Moogle_X.EQL.aftTopText);
  1427.     this._eqlVictoryApWindow = new Window_EqlVictoryAp();
  1428.     this.addWindow(this._eqlVictoryApWindow);
  1429.     this._eqlVictoryApWindow.open();
  1430. };
  1431.  
  1432. Scene_Battle.prototype.eqlFinishVictoryAp = function() {
  1433.     SoundManager.playOk();
  1434.     this._eqlVictoryApWindow.close();
  1435.     this.processNextVictoryStep();
  1436. };
  1437.  
  1438. }; // Imported.YEP_VictoryAftermath
  1439.  
  1440. //=============================================================================
  1441. // Scene_Item
  1442. //=============================================================================
  1443.  
  1444. Moogle_X.EQL.Scene_Item_createItemWindow = Scene_Item.prototype.createItemWindow;
  1445. Scene_Item.prototype.createItemWindow = function() {
  1446.     Moogle_X.EQL.Scene_Item_createItemWindow.call(this);
  1447.     this.eqlCreateAbilityWindow();
  1448. };
  1449.  
  1450. Scene_Item.prototype.eqlCreateAbilityWindow = function() {
  1451.     var x = Graphics.boxWidth / 2;
  1452.     var y = this._itemWindow.y;
  1453.     var w = Graphics.boxWidth / 2;
  1454.     var h = this._itemWindow.height;
  1455.     this._eqlAbilityWindow = new Window_EqlAbilityList(x, y, w, h);
  1456.     this.registerMoogleXhWindow(this._eqlAbilityWindow);
  1457.     this._itemWindow.eqlSetAbilityWindow(this._eqlAbilityWindow);
  1458.     this.addChild(this._eqlAbilityWindow);
  1459. };
  1460.  
  1461. Moogle_X.EQL.Scene_Item_onItemCancel = Scene_Item.prototype.onItemCancel;
  1462. Scene_Item.prototype.onItemCancel = function() {
  1463.     Moogle_X.EQL.Scene_Item_onItemCancel.call(this);
  1464.     if (this._eqlAbilityWindow) {
  1465.         this._eqlAbilityWindow.eqlSetItem(null);
  1466.     }
  1467.     if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1468.         this._Moogle_X_hRestrict = true;
  1469.         if (this._infoWindow) this._infoWindow._hArrowsHide = true;
  1470.         if (this._eqlAbilityWindow) this._eqlAbilityWindow._hArrowsHide = true;
  1471.     }
  1472.  
  1473. };
  1474.  
  1475. // Yanfly Item Core compatibility.
  1476. if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1477.     Moogle_X.EQL.Scene_Item_create = Scene_Item.prototype.create;
  1478.     Scene_Item.prototype.create = function() {
  1479.         Moogle_X.EQL.Scene_Item_create.call(this);
  1480.         this._Moogle_X_hRestrict = true;
  1481.     };
  1482.  
  1483.     Moogle_X.EQL.Scene_Item_createInfoWindow =
  1484.         Scene_Item.prototype.createInfoWindow;
  1485.     Scene_Item.prototype.createInfoWindow = function() {
  1486.         Moogle_X.EQL.Scene_Item_createInfoWindow.call(this);
  1487.         this.registerMoogleXhWindow(this._infoWindow);
  1488.     };
  1489.  
  1490.     Moogle_X.EQL.Scene_Item_onCategoryOk = Scene_Item.prototype.onCategoryOk;
  1491.     Scene_Item.prototype.onCategoryOk = function() {
  1492.         Moogle_X.EQL.Scene_Item_onCategoryOk.call(this);
  1493.         if (this._infoWindow) {
  1494.             this._infoWindow._Moogle_X_hArrowsActive = true;
  1495.             this._infoWindow._hArrowsHide = false;
  1496.         }
  1497.         if (this._eqlAbilityWindow) this._eqlAbilityWindow._hArrowsHide = false;
  1498.         this._Moogle_X_hIndex = this._Moogle_X_hIndex || 1;
  1499.         this._Moogle_X_hRestrict = false;
  1500.     };
  1501.  
  1502. //=============================================================================
  1503. // Window_ItemInfo
  1504. //=============================================================================
  1505.  
  1506. Moogle_X.EQL.Window_ItemInfo_initialize = Window_ItemInfo.prototype.initialize;
  1507. Window_ItemInfo.prototype.initialize = function(x, y, width, height) {
  1508.     Moogle_X.EQL.Window_ItemInfo_initialize.call(this, x, y, width, height);
  1509.     this._hArrowsHide = false;
  1510. };
  1511.  
  1512. Window_ItemInfo.prototype.customMoogleXhArrowsHide = function() {
  1513.     return this._hArrowsHide;
  1514. };
  1515.  
  1516. } // Yanfly Item Core compatibility.
  1517.  
  1518.  
  1519.  
  1520. //=============================================================================
  1521. // Window_ItemList
  1522. //=============================================================================
  1523.  
  1524. Moogle_X.EQL.Window_ItemList_initialize = Window_ItemList.prototype.initialize;
  1525. Window_ItemList.prototype.initialize = function(x, y, width, height) {
  1526.     Moogle_X.EQL.Window_ItemList_initialize.call(this, x, y, width, height);
  1527.     this._eqlMode = false;
  1528. };
  1529.  
  1530. Window_ItemList.prototype.eqlMode = function() {
  1531.     return this._eqlMode;
  1532. };
  1533.  
  1534. Moogle_X.EQL.Window_ItemList_maxCols = Window_ItemList.prototype.maxCols;
  1535. Window_ItemList.prototype.maxCols = function() {
  1536.     if (SceneManager._scene instanceof Scene_Item) {
  1537.         if (this.eqlMode()) return 1;
  1538.     }
  1539.     return Moogle_X.EQL.Window_ItemList_maxCols.call(this);
  1540. };
  1541.  
  1542. Moogle_X.EQL.Window_ItemList_setCategory = Window_ItemList.prototype.setCategory;
  1543. Window_ItemList.prototype.setCategory = function(category) {
  1544.     if (SceneManager._scene instanceof Scene_Item) { // Just to be safe.
  1545.  
  1546.         // Yanfly Item Core scenario.
  1547.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1548.             //this._eqlMode = true;
  1549.             //this.width = Graphics.boxWidth / 2;
  1550.             if (category === 'weapon' || category === 'armor') {
  1551.                 /*
  1552.                 if (SceneManager._scene._infoWindow) {
  1553.                     SceneManager._scene._infoWindow._Moogle_X_hArrowsActive = true;
  1554.                 }
  1555.                 SceneManager._scene._Moogle_X_hIndex =
  1556.                     SceneManager._scene._Moogle_X_hIndex || 1;
  1557.                 */
  1558.  
  1559.             } else {
  1560.                 if (SceneManager._scene._infoWindow) {
  1561.                     SceneManager._scene._infoWindow._Moogle_X_hArrowsActive = false;
  1562.                     SceneManager._scene._infoWindow.visible = true;
  1563.                 }
  1564.                 SceneManager._scene._Moogle_X_hIndex = 0;
  1565.             }
  1566.  
  1567.  
  1568.         } else {
  1569.             // Non-Item Core scenario.
  1570.             if (category === 'weapon' || category === 'armor') {
  1571.                 this._eqlMode = true;
  1572.                 this.width = Graphics.boxWidth / 2;
  1573.                 SceneManager._scene._Moogle_X_hIndex =
  1574.                     SceneManager._scene._Moogle_X_hIndex || 1;
  1575.             } else {
  1576.                 this._eqlMode = false;
  1577.                 this.width = Graphics.boxWidth;
  1578.                 SceneManager._scene._Moogle_X_hIndex = 0;
  1579.             }
  1580.         }
  1581.     }
  1582.     Moogle_X.EQL.Window_ItemList_setCategory.call(this, category);
  1583. };
  1584.  
  1585. Window_ItemList.prototype.eqlSetAbilityWindow = function(abilityWindow) {
  1586.     this._eqlAbilityWindow = abilityWindow;
  1587.     this.update();
  1588. };
  1589.  
  1590. Moogle_X.EQL.Window_ItemList_updateHelp = Window_ItemList.prototype.updateHelp;
  1591. Window_ItemList.prototype.updateHelp = function() {
  1592.     Moogle_X.EQL.Window_ItemList_updateHelp.call(this);
  1593.     if (this._eqlAbilityWindow) {
  1594.         this._eqlAbilityWindow.eqlSetItem(this.item());
  1595.     }
  1596. };
  1597.  
  1598. //=============================================================================
  1599. // Scene_Equip
  1600. //=============================================================================
  1601.  
  1602. Moogle_X.EQL.Scene_Equip_create = Scene_Equip.prototype.create;
  1603. Scene_Equip.prototype.create = function() {
  1604.     Moogle_X.EQL.Scene_Equip_create.call(this);
  1605.     this.eqlCreateAbilityWindow();
  1606.     this.refreshActor();
  1607. };
  1608.  
  1609. Scene_Equip.prototype.eqlCreateAbilityWindow = function() {
  1610.     var x = Graphics.boxWidth / 2;
  1611.     var y = this._itemWindow.y;
  1612.     var w = Graphics.boxWidth / 2;
  1613.     var h = this._itemWindow.height;
  1614.     this._eqlAbilityWindow = new Window_EqlAbilityList(x, y, w, h);
  1615.     if (Imported.YEP_EquipCore) {
  1616.         this.registerMoogleXhWindow(this._compareWindow);
  1617.         this._Moogle_X_hIndex = 1;
  1618.         this._Moogle_X_hRestrict = true;
  1619.         this._compareWindow._hArrowsHide = true;
  1620.         this._eqlAbilityWindow._hArrowsHide = true;
  1621.     }
  1622.     this.registerMoogleXhWindow(this._eqlAbilityWindow);
  1623.     this._slotWindow.eqlSetAbilityWindow(this._eqlAbilityWindow);
  1624.     this._itemWindow.eqlSetAbilityWindow(this._eqlAbilityWindow);
  1625.     this.addChild(this._eqlAbilityWindow);
  1626. };
  1627.  
  1628. Moogle_X.EQL.Scene_Equip_refreshActor = Scene_Equip.prototype.refreshActor;
  1629. Scene_Equip.prototype.refreshActor = function() {
  1630.     Moogle_X.EQL.Scene_Equip_refreshActor.call(this);
  1631.     var actor = this.actor();
  1632.     if (this._eqlAbilityWindow) {
  1633.         this._eqlAbilityWindow.eqlSetActor(actor);
  1634.     }
  1635. };
  1636.  
  1637. Moogle_X.EQL.Scene_Equip_commandEquip = Scene_Equip.prototype.commandEquip;
  1638. Scene_Equip.prototype.commandEquip = function() {
  1639.     this._itemWindow.width = Graphics.boxWidth / 2;
  1640.     this._Moogle_X_hIndex = this._Moogle_X_hIndex || 1;
  1641.     if (Imported.YEP_EquipCore) {
  1642.         this._Moogle_X_hIndex = 1;
  1643.         this._compareWindow._hArrowsHide = false;
  1644.         this._eqlAbilityWindow._hArrowsHide = false;
  1645.         this._Moogle_X_hRestrict = false;
  1646.     }
  1647.     Moogle_X.EQL.Scene_Equip_commandEquip.call(this);
  1648. };
  1649.  
  1650. Moogle_X.EQL.Scene_Equip_onSlotCancel = Scene_Equip.prototype.onSlotCancel;
  1651. Scene_Equip.prototype.onSlotCancel = function() {
  1652.     this._itemWindow.width = Graphics.boxWidth;
  1653.     this._Moogle_X_hIndex = 0;
  1654.     if (Imported.YEP_EquipCore) {
  1655.         this._Moogle_X_hIndex = 1;
  1656.         this._compareWindow._hArrowsHide = true;
  1657.         this._eqlAbilityWindow._hArrowsHide = true;
  1658.         this._Moogle_X_hRestrict = true;
  1659.     }
  1660.     Moogle_X.EQL.Scene_Equip_onSlotCancel.call(this);
  1661. };
  1662.  
  1663. //=============================================================================
  1664. // Window_EquipItem
  1665. //=============================================================================
  1666.  
  1667. Window_EquipItem.prototype.maxCols = function() {
  1668.     return 1;
  1669. };
  1670.  
  1671. //=============================================================================
  1672. // Window_EquipSlot
  1673. //=============================================================================
  1674.  
  1675. Window_EquipSlot.prototype.eqlSetAbilityWindow = function(abilityWindow) {
  1676.     this._eqlAbilityWindow = abilityWindow;
  1677.     this.update();
  1678. };
  1679.  
  1680. Moogle_X.EQL.Window_EquipSlot_updateHelp = Window_EquipSlot.prototype.updateHelp;
  1681. Window_EquipSlot.prototype.updateHelp = function() {
  1682.     Moogle_X.EQL.Window_EquipSlot_updateHelp.call(this);
  1683.     if (this._eqlAbilityWindow) {
  1684.         this._eqlAbilityWindow.eqlSetItem(this.item());
  1685.     }
  1686. };
  1687.  
  1688. // Yanfly Equip Core compatibility.
  1689.  
  1690. if (Imported.YEP_EquipCore) {
  1691.  
  1692. //=============================================================================
  1693. // Window_StatCompare
  1694. //=============================================================================
  1695.  
  1696. Moogle_X.EQL.Window_StatCompare_initialize =
  1697.     Window_StatCompare.prototype.initialize;
  1698. Window_StatCompare.prototype.initialize = function(wx, wy, ww, wh) {
  1699.     Moogle_X.EQL.Window_StatCompare_initialize.call(this, wx, wy, ww, wh);
  1700.     this._hArrowsHide = false;
  1701. };
  1702.  
  1703. Window_StatCompare.prototype.customMoogleXhArrowsHide = function() {
  1704.     return this._hArrowsHide;
  1705. };
  1706.  
  1707. } // Imported.YEP_EquipCore
  1708.  
  1709. // Yanfly Shop Menu Core compatibility.
  1710.  
  1711. if (Imported.YEP_ShopMenuCore) {
  1712.  
  1713. //=============================================================================
  1714. // Window_ShopStatus
  1715. //=============================================================================
  1716.  
  1717. Moogle_X.EQL.Window_ShopStatus_initialize =
  1718.     Window_ShopStatus.prototype.initialize;
  1719. Window_ShopStatus.prototype.initialize = function(x, y, width, height) {
  1720.     Moogle_X.EQL.Window_ShopStatus_initialize.call(this, x, y, width, height);
  1721.     this._maxActorIndex = this._maxActorIndex + 1;
  1722.     this._eqlIndex = this._maxActorIndex;
  1723. };
  1724.  
  1725. Moogle_X.EQL.Window_ShopStatus_drawActorDisplayed =
  1726.     Window_ShopStatus.prototype.drawActorDisplayed;
  1727. Window_ShopStatus.prototype.drawActorDisplayed = function(actor) {
  1728.     if (this._actorIndex === this._eqlIndex) {
  1729.         var text = Moogle_X.EQL.ablTitle;
  1730.         this.changePaintOpacity(true);
  1731.         this.changeTextColor(this.systemColor());
  1732.         this.drawText(text, 0, this.lineHeight(), this.contents.width, 'center');
  1733.         var text = '<<';
  1734.         this.drawText(text, 0, this.lineHeight(), this.contents.width, 'left');
  1735.         var text = '>>';
  1736.         this.drawText(text, 0, this.lineHeight(), this.contents.width, 'right');
  1737.     } else {
  1738.         Moogle_X.EQL.Window_ShopStatus_drawActorDisplayed.call(this, actor);
  1739.     }
  1740. };
  1741.  
  1742. Moogle_X.EQL.Window_ShopStatus_drawDarkRectEntries =
  1743.     Window_ShopStatus.prototype.drawDarkRectEntries;
  1744. Window_ShopStatus.prototype.drawDarkRectEntries = function() {
  1745.     if (this._actorIndex === this._eqlIndex) return;
  1746.     Moogle_X.EQL.Window_ShopStatus_drawDarkRectEntries.call(this);
  1747. };
  1748.  
  1749. Moogle_X.EQL.Window_ShopStatus_drawActorStatInfo =
  1750.     Window_ShopStatus.prototype.drawActorStatInfo;
  1751. Window_ShopStatus.prototype.drawActorStatInfo = function(actor) {
  1752.     if (this._actorIndex === this._eqlIndex) {
  1753.         var y = this.lineHeight() * 2;
  1754.         var w = this.contents.width;
  1755.  
  1756.         var skillList = this._item.eqlSkill;
  1757.         if (skillList) {
  1758.             skillList = skillList.filter(function(id) {
  1759.                 if ($dataSkills[id] && $dataSkills[id].eqlShowSwitch > 0) {
  1760.                     return $gameSwitches.value($dataSkills[id].eqlShowSwitch);
  1761.                 } else {
  1762.                     return true;
  1763.                 }
  1764.             });
  1765.         }
  1766.  
  1767.         // Display added skills feature.
  1768.         if (Moogle_X.EQL.showAddedSkills) {
  1769.             var addedSkills = this.getAddedSkills(this._item);
  1770.             skillList = addedSkills.concat(skillList);
  1771.         }
  1772.  
  1773.         if (skillList && skillList.length > 0) {
  1774.             this.eqlDrawAbilityList(this._item, 0, y, w);
  1775.         } else {
  1776.             this.eqlDrawNoAbility(0, y, w);
  1777.         }
  1778.     } else {
  1779.         Moogle_X.EQL.Window_ShopStatus_drawActorStatInfo.call(this, actor);
  1780.     }
  1781. };
  1782.  
  1783. Window_ShopStatus.prototype.eqlDrawAbilityList = function(item, x, y, w) {
  1784.     var iconWidth = Window_Base._iconWidth + 4;
  1785.     this.changeTextColor(this.normalColor());
  1786.     this.changePaintOpacity(true);
  1787.  
  1788.     var skillList = item.eqlSkill;
  1789.     if (skillList) {
  1790.         skillList = skillList.filter(function(id) {
  1791.             if ($dataSkills[id] && $dataSkills[id].eqlShowSwitch > 0) {
  1792.                 return $gameSwitches.value($dataSkills[id].eqlShowSwitch);
  1793.             } else {
  1794.                 return true;
  1795.             }
  1796.         });
  1797.     }
  1798.  
  1799.     // Display added skills feature.
  1800.     if (Moogle_X.EQL.showAddedSkills) {
  1801.         var addedSkills = this.getAddedSkills(item);
  1802.         skillList = addedSkills.concat(skillList);
  1803.     }
  1804.  
  1805.     var offsetX = Moogle_X.EQL.skillNameX;
  1806.     var offsetY = Moogle_X.EQL.skillNameY;
  1807.  
  1808.     for (var i = 0; i < skillList.length; i++) {
  1809.         var dy = y + this.lineHeight() * i;
  1810.         var ability = $dataSkills[skillList[i]];
  1811.         if (ability) {
  1812.             if (Moogle_X.EQL.showSkillIcon) this.drawIcon(ability.iconIndex, x, dy + 2);
  1813.             this.resetFontSettings();
  1814.             this.eqlDrawApGauge(ability, x, dy, w);
  1815.             this.contents.fontFace = Moogle_X.EQL.sklFontName;
  1816.             this.contents.fontSize = Moogle_X.EQL.sklFontSize;
  1817.             this.drawText(ability.name, x + iconWidth + offsetX, dy + offsetY,
  1818.                 w, 'left');
  1819.             this.resetFontSettings();
  1820.         }
  1821.     }
  1822. };
  1823.  
  1824. Window_ShopStatus.prototype.eqlDrawNoAbility = function(x, y, w) {
  1825.     this.changePaintOpacity(false);
  1826.     this.resetTextColor();
  1827.     this.drawText(Moogle_X.EQL.noAblText, x, y, w, Moogle_X.EQL.noAblTextAlign);
  1828.     this.changePaintOpacity(true);
  1829. };
  1830.  
  1831. Window_ShopStatus.prototype.eqlDrawApGauge = function(ability, x, y, width) {
  1832.     this.changePaintOpacity(true);
  1833.  
  1834.     // Display added skills feature.
  1835.     if (Moogle_X.EQL.showAddedSkills) {
  1836.         var addedSkills = this.getAddedSkills(this._item);
  1837.         if (addedSkills.contains(ability.id)) {
  1838.             return;
  1839.         }
  1840.     }
  1841.  
  1842.     var dx = x + Moogle_X.EQL.apOffsetX;
  1843.     var iconWidth = Window_Base._iconWidth + 4;
  1844.     var color1 = this.textColor(Moogle_X.EQL.apColor1);
  1845.     var color2 = this.textColor(Moogle_X.EQL.apColor2);
  1846.     var rate = 0;
  1847.     this.drawGauge(dx, y, width - dx - iconWidth - 2, rate, color1, color2);
  1848.     this.changeTextColor(this.textColor(Moogle_X.EQL.apTextColor));
  1849.     this.drawText(Moogle_X.EQL.apVocab, dx + Moogle_X.EQL.apTextOffsetX, y, width);
  1850.     this.changeTextColor(this.normalColor());
  1851.     this.eqlDrawApNumbers(ability, dx, y, width - dx - iconWidth - 2);
  1852. };
  1853.  
  1854. Window_ShopStatus.prototype.eqlDrawApNumbers = function(ability, x, y, width) {
  1855.     var baseAp = 0;
  1856.     var maxAp = ability.eqlAp;
  1857.     if (Imported.YEP_CoreEngine) {
  1858.         maxAp = Yanfly.Util.toGroup(maxAp);
  1859.     }
  1860.     var text = baseAp + "/" + maxAp;
  1861.     this.drawText(text, x, y, width, 'right');
  1862. };
  1863.  
  1864. Window_ShopStatus.prototype.getAddedSkills = function(item) {
  1865.     var list = [];
  1866.     if (!item) return list;
  1867.     if (!item.traits) return list;
  1868.     var traits = item.traits;
  1869.     traits = traits.filter(function(trait) {
  1870.         return trait.code === Game_BattlerBase.TRAIT_SKILL_ADD;
  1871.     });
  1872.  
  1873.     traits = traits.reduce(function(r, trait) {
  1874.         return r.concat(trait.dataId);
  1875.     }, []);
  1876.  
  1877.     return traits;
  1878. };
  1879.  
  1880. } // Imported.YEP_ShopMenuCore
  1881.  
  1882. })(); // IIFE
  1883.  
  1884. //=============================================================================
  1885. // Window_EqlAbilityList
  1886. //=============================================================================
  1887.  
  1888. function Window_EqlAbilityList() {
  1889.     this.initialize.apply(this, arguments);
  1890. }
  1891.  
  1892. Window_EqlAbilityList.prototype = Object.create(Window_Base.prototype);
  1893. Window_EqlAbilityList.prototype.constructor = Window_EqlAbilityList;
  1894.  
  1895. Window_EqlAbilityList.prototype.initialize = function(x, y, width, height) {
  1896.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  1897.     this._eqlItem = null;
  1898.     this._actor = null;
  1899.     this._hArrowsHide = false;
  1900.     this.refresh();
  1901.     this.opacity = Moogle_X.EQL.windowOpacity;
  1902. };
  1903.  
  1904. Window_EqlAbilityList.prototype.eqlSetItem = function(item) {
  1905.     this._eqlItem = item;
  1906.     this.refresh();
  1907. };
  1908.  
  1909. Window_EqlAbilityList.prototype.eqlSetActor = function(actor) {
  1910.     this._actor = actor;
  1911.     this.refresh();
  1912. };
  1913.  
  1914. Window_EqlAbilityList.prototype.item = function() {
  1915.     return this._eqlItem;
  1916. };
  1917.  
  1918. Window_EqlAbilityList.prototype.actor = function() {
  1919.     return this._actor;
  1920. };
  1921.  
  1922. Window_EqlAbilityList.prototype.refresh = function() {
  1923.     if (this.contents) {
  1924.         this.contents.clear();
  1925.         this.drawAllItems();
  1926.     }
  1927. };
  1928.  
  1929. Window_EqlAbilityList.prototype.drawAllItems = function() {
  1930.     if (!this.item()) return;
  1931.     this.resetFontSettings();
  1932.     var x = 0;
  1933.     var y = this.lineHeight();
  1934.     var w = this.contentsWidth();
  1935.     this.changeTextColor(this.systemColor());
  1936.     this.changePaintOpacity(true);
  1937.     this.drawText(Moogle_X.EQL.ablTitle, 0, 0, w, Moogle_X.EQL.ablTitleAlign);
  1938.     this.preDrawAbilityList(this.item(), x, y, w);
  1939. };
  1940.  
  1941. Window_EqlAbilityList.prototype.preDrawAbilityList = function(item, x, y, w) {
  1942.     if (item) {
  1943.         var skillList = item.eqlSkill;
  1944.         if (skillList) {
  1945.             skillList = skillList.filter(function(id) {
  1946.                 if ($dataSkills[id] && $dataSkills[id].eqlShowSwitch > 0) {
  1947.                     return $gameSwitches.value($dataSkills[id].eqlShowSwitch);
  1948.                 } else {
  1949.                     return true;
  1950.                 }
  1951.             });
  1952.         }
  1953.  
  1954.         // Display added skills feature.
  1955.         if (Moogle_X.EQL.showAddedSkills) {
  1956.             var addedSkills = this.getAddedSkills(item);
  1957.             skillList = addedSkills.concat(skillList);
  1958.         }
  1959.  
  1960.         if (skillList && skillList.length > 0) {
  1961.             this.drawAbilityList(item, x, y, w);
  1962.         } else {
  1963.             this.drawNoAbility(x, y, w);
  1964.         }
  1965.     } else {
  1966.         this.drawNoAbility(x, y, w);
  1967.     }
  1968. };
  1969.  
  1970. Window_EqlAbilityList.prototype.getAddedSkills = function(item) {
  1971.     var list = [];
  1972.     if (!item) return list;
  1973.     if (!item.traits) return list;
  1974.     var traits = item.traits;
  1975.     traits = traits.filter(function(trait) {
  1976.         return trait.code === Game_BattlerBase.TRAIT_SKILL_ADD;
  1977.     });
  1978.  
  1979.     traits = traits.reduce(function(r, trait) {
  1980.         return r.concat(trait.dataId);
  1981.     }, []);
  1982.  
  1983.     return traits;
  1984. };
  1985.  
  1986. Window_EqlAbilityList.prototype.drawAbilityList = function(item, x, y, w) {
  1987.     var iconWidth = Window_Base._iconWidth + 4;
  1988.     this.changeTextColor(this.normalColor());
  1989.     this.changePaintOpacity(true);
  1990.  
  1991.     var skillList = item.eqlSkill;
  1992.     if (skillList) {
  1993.         skillList = skillList.filter(function(id) {
  1994.             if ($dataSkills[id] && $dataSkills[id].eqlShowSwitch > 0) {
  1995.                 return $gameSwitches.value($dataSkills[id].eqlShowSwitch);
  1996.             } else {
  1997.                 return true;
  1998.             }
  1999.         });
  2000.     }
  2001.  
  2002.     // Display added skills feature.
  2003.     if (Moogle_X.EQL.showAddedSkills) {
  2004.         var addedSkills = this.getAddedSkills(item);
  2005.         skillList = addedSkills.concat(skillList);
  2006.     }
  2007.  
  2008.     var offsetX = Moogle_X.EQL.skillNameX;
  2009.     var offsetY = Moogle_X.EQL.skillNameY;
  2010.  
  2011.     for (var i = 0; i < skillList.length; i++) {
  2012.         var dy = y + y * i;
  2013.         var ability = $dataSkills[skillList[i]];
  2014.         if (ability) {
  2015.             this.eqlDrawIcon(ability, x, dy + 2);
  2016.             this.drawApGauge(ability, x, dy, w);
  2017.             this.eqlDrawAbilityName(ability, x + iconWidth + offsetX,
  2018.                 dy + offsetY, w, 'left');
  2019.         }
  2020.     }
  2021. };
  2022.  
  2023. Window_EqlAbilityList.prototype.eqlDrawIcon = function(ability, x, y) {
  2024.     if (!Moogle_X.EQL.showSkillIcon) return;
  2025.     this.changePaintOpacity(true);
  2026.     var eqlActor = this.actor();
  2027.     eqlActor = this.eqlAdjustMasteryYanflyItemCore(eqlActor);
  2028.     if (eqlActor && eqlActor.eqlCantLearnSkill(ability)) {
  2029.         this.changePaintOpacity(false);
  2030.     }
  2031.  
  2032.     // Display added skills feature.
  2033.     if (Moogle_X.EQL.showAddedSkills) {
  2034.         var addedSkills = this.getAddedSkills(this.item());
  2035.         if (addedSkills.contains(ability.id)) {
  2036.             this.changePaintOpacity(true);
  2037.         }
  2038.     }
  2039.  
  2040.     this.drawIcon(ability.iconIndex, x, y);
  2041. };
  2042.  
  2043. Window_EqlAbilityList.prototype.eqlDrawAbilityName = function(ability, x, y, w, align) {
  2044.     this.changePaintOpacity(true);
  2045.     this.contents.fontFace = Moogle_X.EQL.sklFontName;
  2046.     this.contents.fontSize = Moogle_X.EQL.sklFontSize;
  2047.     var eqlActor = this.actor();
  2048.     eqlActor = this.eqlAdjustMasteryYanflyItemCore(eqlActor);
  2049.     if (eqlActor && eqlActor.eqlCantLearnSkill(ability)) {
  2050.         this.changePaintOpacity(false);
  2051.     }
  2052.  
  2053.     // Display added skills feature.
  2054.     if (Moogle_X.EQL.showAddedSkills) {
  2055.         var addedSkills = this.getAddedSkills(this.item());
  2056.         if (addedSkills.contains(ability.id)) {
  2057.             this.changePaintOpacity(true);
  2058.         }
  2059.     }
  2060.  
  2061.     this.drawText(ability.name, x, y, w, align);
  2062.     this.resetFontSettings();
  2063.  
  2064. };
  2065.  
  2066. Window_EqlAbilityList.prototype.drawNoAbility = function(x, y, w) {
  2067.     this.changePaintOpacity(false);
  2068.     this.resetTextColor();
  2069.     this.drawText(Moogle_X.EQL.noAblText, x, y, w, Moogle_X.EQL.noAblTextAlign);
  2070. };
  2071.  
  2072. Window_EqlAbilityList.prototype.drawApGauge = function(ability, x, y, width) {
  2073.     if (this.actor() && this.actor().eqlCantLearnSkill(ability)) return;
  2074.  
  2075.     // Display added skills feature.
  2076.     if (Moogle_X.EQL.showAddedSkills) {
  2077.         var addedSkills = this.getAddedSkills(this.item());
  2078.         if (addedSkills.contains(ability.id)) {
  2079.             return;
  2080.         }
  2081.     }
  2082.  
  2083.     var eqlActor = this.actor();
  2084.     eqlActor = this.eqlAdjustMasteryYanflyItemCore(eqlActor);
  2085.     if (eqlActor && eqlActor.eqlCantLearnSkill(ability)) {
  2086.         return;
  2087.     }
  2088.     this.changePaintOpacity(true);
  2089.     var dx = x + Moogle_X.EQL.apOffsetX;
  2090.     var iconWidth = Window_Base._iconWidth + 4;
  2091.     var color1 = this.textColor(Moogle_X.EQL.apColor1);
  2092.     var color2 = this.textColor(Moogle_X.EQL.apColor2);
  2093.     var rate = this.actor() ? this.actor().eqlApRate(ability) : 0;
  2094.  
  2095.     rate = this.eqlAdjustRateYanflyItemCore(rate, ability);
  2096.  
  2097.     this.drawGauge(dx, y, width - dx - iconWidth - 2, rate, color1, color2);
  2098.     this.changeTextColor(this.textColor(Moogle_X.EQL.apTextColor));
  2099.     this.drawText(Moogle_X.EQL.apVocab, dx + Moogle_X.EQL.apTextOffsetX, y, width);
  2100.     this.changeTextColor(this.normalColor());
  2101.     this.drawApNumbers(ability, dx, y, width - dx - iconWidth - 2);
  2102.     this.drawMasteryIcon(ability, width - iconWidth + 2, y + 2);
  2103. };
  2104.  
  2105. Window_EqlAbilityList.prototype.drawApNumbers = function(ability, x, y, width) {
  2106.     var baseAp = this.actor() ? this.actor()._eqlAp[ability.id] : 0;
  2107.     baseAp = this.eqlAdjustBaseApIfLearned(baseAp, ability, this.actor());
  2108.     baseAp = this.eqlAdjustBaseApYanflyItemCore(baseAp, ability);
  2109.     var maxAp = this.actor() ? this.actor().eqlApNeeded(ability) : ability.eqlAp;
  2110.     maxAp = this.eqlAdjustMaxApYanflyItemCore(maxAp, ability);
  2111.     if (Imported.YEP_CoreEngine) {
  2112.         baseAp = Yanfly.Util.toGroup(baseAp);
  2113.         maxAp = Yanfly.Util.toGroup(maxAp);
  2114.     }
  2115.     var text = baseAp + "/" + maxAp;
  2116.     this.drawText(text, x, y, width, 'right');
  2117. };
  2118.  
  2119. Window_EqlAbilityList.prototype.drawMasteryIcon = function(ability, x, y) {
  2120.     var actor = this.actor();
  2121.     actor = this.eqlAdjustMasteryYanflyItemCore(actor);
  2122.     if (!actor) return;
  2123.     if (actor.eqlIsMastered(ability.id)) {
  2124.         this.drawIcon(Moogle_X.EQL.masteryIcon, x, y);
  2125.     }
  2126. };
  2127.  
  2128. Window_EqlAbilityList.prototype.eqlAdjustBaseApIfLearned = function(baseAp, ability, actor) {
  2129.     if (actor) {
  2130.         if (actor.isLearnedSkill(ability.id)) {
  2131.             baseAp = actor.eqlApNeeded(ability);
  2132.         }
  2133.     }
  2134.     return baseAp;
  2135. };
  2136.  
  2137. Window_EqlAbilityList.prototype.customMoogleXhArrowsHide = function() {
  2138.     return this._hArrowsHide;
  2139. };
  2140.  
  2141. // Compatibility stuff!
  2142.  
  2143. Window_EqlAbilityList.prototype.eqlAdjustRateYanflyItemCore = function(rate, ability) {
  2144.     if (SceneManager._scene instanceof Scene_Item) {
  2145.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemShEquipped)) {
  2146.             if (DataManager.isIndependent(this.item())) {
  2147.  
  2148.                 if (DataManager.isItem(this.item())) {
  2149.                     var index = $gameParty.items().indexOf(this.item());
  2150.                 } else if (DataManager.isWeapon(this.item())) {
  2151.                     var index = $gameParty.weapons().indexOf(this.item());
  2152.                 } else if (DataManager.isArmor(this.item())) {
  2153.                     var index = $gameParty.armors().indexOf(this.item());
  2154.                 }
  2155.  
  2156.                 if (index < 0) {
  2157.                     var carrier = null;
  2158.                     for (var a = 0; a < $gameParty.members().length; ++a) {
  2159.                         var actor = $gameParty.members()[a];
  2160.                         if (!actor) continue;
  2161.                         if (actor.equips().contains(this.item())) carrier = actor;
  2162.                     }
  2163.                 }
  2164.  
  2165.                 if (carrier) {
  2166.                     rate = carrier.eqlApRate(ability);
  2167.                 }
  2168.             }
  2169.         }
  2170.     }
  2171.  
  2172.     return rate;
  2173. };
  2174.  
  2175. Window_EqlAbilityList.prototype.eqlAdjustBaseApYanflyItemCore = function(baseAp, ability) {
  2176.     if (SceneManager._scene instanceof Scene_Item) {
  2177.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemShEquipped)) {
  2178.             if (DataManager.isIndependent(this.item())) {
  2179.  
  2180.                 if (DataManager.isItem(this.item())) {
  2181.                     var index = $gameParty.items().indexOf(this.item());
  2182.                 } else if (DataManager.isWeapon(this.item())) {
  2183.                     var index = $gameParty.weapons().indexOf(this.item());
  2184.                 } else if (DataManager.isArmor(this.item())) {
  2185.                     var index = $gameParty.armors().indexOf(this.item());
  2186.                 }
  2187.  
  2188.                 if (index < 0) {
  2189.                     var carrier = null;
  2190.                     for (var a = 0; a < $gameParty.members().length; ++a) {
  2191.                         var actor = $gameParty.members()[a];
  2192.                         if (!actor) continue;
  2193.                         if (actor.equips().contains(this.item())) carrier = actor;
  2194.                     }
  2195.                 }
  2196.  
  2197.                 if (carrier) {
  2198.                     baseAp = carrier._eqlAp[ability.id];
  2199.                     baseAp = this.eqlAdjustBaseApIfLearned(baseAp, ability, carrier);
  2200.                 }
  2201.             }
  2202.         }
  2203.     }
  2204.  
  2205.     return baseAp;
  2206. };
  2207.  
  2208. Window_EqlAbilityList.prototype.eqlAdjustMaxApYanflyItemCore = function(maxAp, ability) {
  2209.     if (SceneManager._scene instanceof Scene_Item) {
  2210.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemShEquipped)) {
  2211.             if (DataManager.isIndependent(this.item())) {
  2212.  
  2213.                 if (DataManager.isItem(this.item())) {
  2214.                     var index = $gameParty.items().indexOf(this.item());
  2215.                 } else if (DataManager.isWeapon(this.item())) {
  2216.                     var index = $gameParty.weapons().indexOf(this.item());
  2217.                 } else if (DataManager.isArmor(this.item())) {
  2218.                     var index = $gameParty.armors().indexOf(this.item());
  2219.                 }
  2220.  
  2221.                 if (index < 0) {
  2222.                     var carrier = null;
  2223.                     for (var a = 0; a < $gameParty.members().length; ++a) {
  2224.                         var actor = $gameParty.members()[a];
  2225.                         if (!actor) continue;
  2226.                         if (actor.equips().contains(this.item())) carrier = actor;
  2227.                     }
  2228.                 }
  2229.  
  2230.                 if (carrier) {
  2231.                     maxAp = carrier.eqlApNeeded(ability);
  2232.                 }
  2233.             }
  2234.         }
  2235.     }
  2236.  
  2237.     return maxAp;
  2238. };
  2239.  
  2240. Window_EqlAbilityList.prototype.eqlAdjustMasteryYanflyItemCore = function(eqlActor) {
  2241.     if (SceneManager._scene instanceof Scene_Item) {
  2242.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemShEquipped)) {
  2243.             if (DataManager.isIndependent(this.item())) {
  2244.  
  2245.                 if (DataManager.isItem(this.item())) {
  2246.                     var index = $gameParty.items().indexOf(this.item());
  2247.                 } else if (DataManager.isWeapon(this.item())) {
  2248.                     var index = $gameParty.weapons().indexOf(this.item());
  2249.                 } else if (DataManager.isArmor(this.item())) {
  2250.                     var index = $gameParty.armors().indexOf(this.item());
  2251.                 }
  2252.  
  2253.                 if (index < 0) {
  2254.                     var carrier = null;
  2255.                     for (var a = 0; a < $gameParty.members().length; ++a) {
  2256.                         var actor = $gameParty.members()[a];
  2257.                         if (!actor) continue;
  2258.                         if (actor.equips().contains(this.item())) carrier = actor;
  2259.                     }
  2260.                 }
  2261.  
  2262.                 if (carrier) {
  2263.                     eqlActor = carrier;
  2264.                 }
  2265.             }
  2266.         }
  2267.     }
  2268.  
  2269.     return eqlActor;
  2270. };
  2271.  
  2272. (function() { // IIFE
  2273.  
  2274. //=============================================================================
  2275. // Game_Interpreter
  2276. //=============================================================================
  2277.  
  2278. var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  2279. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  2280.     _Game_Interpreter_pluginCommand.call(this, command, args);
  2281.     if (command === 'EQL') {
  2282.         switch (args[0]) {
  2283.         case 'AP':
  2284.             if (args[1] === "Gain" && args[3] === "Actor") {
  2285.                 $gameActors.actor(Number(args[4])).eqlGainAp(Number(args[2]));
  2286.             }
  2287.             break;
  2288.  
  2289.         }
  2290.     }
  2291. };
  2292.  
  2293.  
  2294. })(); // IIFE
  2295.  
  2296. //=============================================================================
  2297. // End of File
  2298. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement