Guest User

EnemyBook v1.4a by SkottyTV / DragonPC

a guest
Nov 13th, 2015
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // EnemyBook.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc v1.4a by SkottyTV // Displays detailed statuses of enemys.
  7.  * @author Yoji Ojima (Compatibility with YEP) / + SkottyTV (thx to DragonPC)
  8.  *
  9.  * @param ----- Functions -----
  10.  *
  11.  * @param Unknown Data
  12.  * @desc The index name for an unknown enemy.
  13.  * @default ??????
  14.  *
  15.  * @param AutoFill
  16.  * @desc Decide if enemys will automaticly show up in the book when defeated
  17.  * @default false
  18.  *
  19.  * @param Gold Icon
  20.  * @desc Decide if you want to use the Gold Icon from
  21.  * Yanfly Core Engine. (true or false)
  22.  * @default true
  23.  *
  24.  * @param ID before Name
  25.  * @desc Decide if enemys will have the ID number in front of their name
  26.  * @default true
  27.  *
  28.  * @param Enemys in Row
  29.  * @desc Decide how many enemys you want to show in one row.
  30.  * (default 1, maximum is 4 !)
  31.  * @default 1
  32.  *
  33.  * @param Half Index Height
  34.  * @desc Decide if you want to half the Index Window height.
  35.  * (default - true) (false will get overwritten by the damage window!)
  36.  * @default true
  37.  *
  38.  * @param Max Skill Count
  39.  * @desc Decide how many skills will be shown.
  40.  * (default - 6) (6 is recommended for small resolutions!)
  41.  * @default 6
  42.  *
  43.  * @param ----- Text -----
  44.  *
  45.  * @param No Item Text
  46.  * @desc Choose the text for "No Item".
  47.  * (0 - 31 default = - none -)
  48.  * @default - none -
  49.  *
  50.  * @param No Skill Text
  51.  * @desc Choose the text for "No Item".
  52.  * (default = - none -)
  53.  * @default - none -
  54.  *
  55.  * @param Damage Mod Text
  56.  * @desc Choose the text for "Damage Mod.".
  57.  * (default - Damage Mod.)
  58.  * @default Damage Mod.
  59.  *
  60.  * @param ----- Colors -----
  61.  *
  62.  * @param Positive Damage Color
  63.  * @desc Choose the color for positive damge mod.
  64.  * (0 - 31 default - 3)
  65.  * @default 3
  66.  *
  67.  * @param Negative Damage Color
  68.  * @desc Choose the color for negative damge mod.
  69.  * (0 - 31 default - 18)
  70.  * @default 18
  71.  *
  72.  * @param Skills Text Color
  73.  * @desc Choose the text color for the skills.
  74.  * (0 - 31 default - 0)
  75.  * @default 0
  76.  *
  77.  * @param Line Opacity
  78.  * @desc Choose the opacity of the lines.
  79.  * (0 - 255 default = 120)
  80.  * @default 120
  81.  *
  82.  * @param ----- Switches -----
  83.  *
  84.  * @param Show Items Switch
  85.  * @desc Choose the switch ID that shows the Items.
  86.  * (default 0)
  87.  * @default 0
  88.  *
  89.  * @param Show Ability Switch
  90.  * @desc Choose the switch ID that shows the Abilities.
  91.  * (default 0)
  92.  * @default 0
  93.  *
  94.  * @param Show EXP Switch
  95.  * @desc Choose the switch ID that shows the EXP.
  96.  * (default 0)
  97.  * @default 0
  98.  *
  99.  * @param Show Gold Switch
  100.  * @desc Choose the switch ID that shows the Gold.
  101.  * (default 0)
  102.  * @default 0
  103.  *
  104.  * @param Show Status Switch
  105.  * @desc Choose the switch ID that shows the status.
  106.  * (default 0)
  107.  * @default 0
  108.  *
  109.  * @param Show Damage Switch
  110.  * @desc Choose the switch ID that shows the Damage window.
  111.  * (default 0)
  112.  * @default 0
  113.  *
  114.  * @param ----- Animation -----
  115.  *
  116.  * @param Pulsing Enemy
  117.  * @desc Decide if you want to display an animated enemy.
  118.  * (default true)
  119.  * @default true
  120.  *
  121.  * @param Pulsing Intensity
  122.  * @desc Decide how strong the animation should be.
  123.  * Higher number = Less Intensity (default 4)
  124.  * @default 4
  125.  *
  126.  * @help
  127.  *
  128.  * ============================================================================
  129.  * SkottyTV v1.1 ->
  130.  * 
  131.  * - Decide if enemys will get an entry automaticly when they appear/transform!
  132.  * - Now you can add an Enemy by a variable value!
  133.  * - Able to add a third info line (desc3)!
  134.  * - Advanced Visual upgrades!
  135.  *
  136.  * SkottyTV v1.2 ->
  137.  *
  138.  * - Decide how many columns appear in one row!
  139.  * - Decide if you want to use the Gold Icon from Yanfly Core Engine!
  140.  *
  141.  * SkottyTV v1.3 ->
  142.  *
  143.  * - Decide if you want to halve the Index height.
  144.  * - Advanced Visual upgrades!
  145.  * - Pulsing animation upgrade!
  146.  * - Use switches to enable different information!
  147.  *   (EXP, Gold, Items and Parameters)
  148.  *
  149.  * SkottyTV v1.4 ->
  150.  *
  151.  * - Removed half Index Height.(to make room for the Damage Window.)
  152.  * - Added an optional "additional damage" window!
  153.  * - Added an optional "skills" section!
  154.  * - Added more switches.
  155.  * - Customizable Visual upgrades.
  156.  * - Bug fixes!
  157.  *
  158. * SkottyTV v1.4a ->
  159.  *
  160.  * - Added max skill count function.
  161.  * ============================================================================
  162.  *
  163.  * Plugin Command:
  164.  *   EnemyBook open         # Open the enemy book screen
  165.  *   EnemyBook add 3        # Add enemy #3 to the enemy book
  166.  *   EnemyBook addvar 10    # Add enemy (ID) that is in variable 10
  167.  *   EnemyBook remove 4     # Remove enemy #4 from the enemy book
  168.  *   EnemyBook complete     # Complete the enemy book
  169.  *   EnemyBook clear        # Clear the enemy book
  170.  *
  171.  * Enemy Note:
  172.  *   <desc1:The mighty Duck>   # Description text in the enemy book, line 1
  173.  *   <desc2:This is Line 2>    # Description text in the enemy book, line 2
  174.  *   <desc3:Some Info here?>   # Description text in the enemy book, line 3
  175.  *   <book:no>                 # This enemy does not appear in the enemy book
  176.  *
  177.  * ============================================================================
  178.  *
  179.  * Investigate Skill Tutorial:
  180.  * (You will need YanFly´s Battle Engine Core and ActSeqPack1 to get it work)
  181.  *
  182.  * - First set the "AutoFill" option of this plugin to false
  183.  * - Now create a skill which calls a common event X and have the following
  184.  *   in its notebox:
  185.  *   <Target Action>
  186.  *    Change Variable Y = target._enemyId
  187.  *   </Target Action>
  188.  * - Now in the common event X call a Plugin-Line and write:
  189.  *   EnemyBook addvar Y
  190.  * - Done!
  191.  *
  192.  * (X and Y is a number you choose)
  193.  */
  194.  
  195. (function() {
  196. //--------------------------------------------------- Variables --------------------------------------------------------
  197.     var parameters = PluginManager.parameters('EnemyBook');
  198.    
  199.     var unknownData = String(parameters['Unknown Data'] || '??????')
  200.     var AutoFill = String(parameters['AutoFill'] || 'false');
  201.     var IDatName = String(parameters['ID before Name'] || 'true');
  202.     var goldIcon = String(parameters['Gold Icon'] || 'true');
  203.     var AnimEnemy = String(parameters['Pulsing Enemy'] || 'true');
  204.     var damageText = String(parameters['Damage Mod Text'] || 'Damage Mod.');
  205.     var noitemText = String(parameters['No Item Text'] || '- none -');
  206.     var noskillText = String(parameters['No Skill Text'] || '- none -');
  207.     var HalfIndexHeight = String(parameters['Half Index Height'] || 'true');
  208.    
  209.     var listEnemysRow = Number(parameters['Enemys in Row']);
  210.     var ShowItems = Number(parameters['Show Items Switch']);
  211.     var ShowAbilities = Number(parameters['Show Ability Switch']);
  212.     var ShowEXP = Number(parameters['Show EXP Switch']);
  213.     var ShowGold = Number(parameters['Show Gold Switch']);
  214.     var ShowStatus = Number(parameters['Show Status Switch']);
  215.     var ShowDamage = Number(parameters['Show Damage Switch']);
  216.     var posColor = Number(parameters['Positive Damage Color'] || 3);
  217.     var negColor = Number(parameters['Negative Damage Color'] || 18);
  218.     var skillColor = Number(parameters['Skills Text Color'] || 0);
  219.     var lineOpacity = Number(parameters['Line Opacity'] || 120);
  220.     var maxSkills = Number(parameters['Max Skill Count'] || 6);
  221.     var AnimIntens = Number(parameters['Pulsing Intensity']);
  222. //--------------------------------------------------- Plugin Commands -----------------------------------------------------------
  223.     var _Game_Interpreter_pluginCommand =
  224.             Game_Interpreter.prototype.pluginCommand;
  225.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  226.         _Game_Interpreter_pluginCommand.call(this, command, args);
  227.         if (command === 'EnemyBook') {
  228.             switch (args[0]) {
  229.             case 'open':
  230.                 SceneManager.push(Scene_EnemyBook);
  231.                 break;
  232.             case 'add':
  233.                 $gameSystem.addToEnemyBook(Number(args[1]));
  234.                 break;
  235.             case 'addvar':
  236.                 $gameSystem.addToEnemyBook(Number($gameVariables.value(args[1])));
  237.                 break;
  238.             case 'remove':
  239.                 $gameSystem.removeFromEnemyBook(Number(args[1]));
  240.                 break;
  241.             case 'complete':
  242.                 $gameSystem.completeEnemyBook();
  243.                 break;
  244.             case 'clear':
  245.                 $gameSystem.clearEnemyBook();
  246.                 break;
  247.             }
  248.         }
  249.     };
  250. //--------------------------------------------------- Function Add Enemy -------------------------------------------------------
  251.     Game_System.prototype.addToEnemyBook = function(enemyId) {
  252.         if (!this._enemyBookFlags) {
  253.             this.clearEnemyBook();
  254.         }
  255.         this._enemyBookFlags[enemyId] = true;
  256.     };
  257. //--------------------------------------------------- Function Remove Enemy -----------------------------------------------------
  258.     Game_System.prototype.removeFromEnemyBook = function(enemyId) {
  259.         if (this._enemyBookFlags) {
  260.             this._enemyBookFlags[enemyId] = false;
  261.         }
  262.     };
  263. //--------------------------------------------------- Function Complete Enemy Book ----------------------------------------------
  264.     Game_System.prototype.completeEnemyBook = function() {
  265.         this.clearEnemyBook();
  266.         for (var i = 1; i < $dataEnemies.length; i++) {
  267.             this._enemyBookFlags[i] = true;
  268.         }
  269.     };
  270. //--------------------------------------------------- Function Clear Enemy Book -------------------------------------------------
  271.     Game_System.prototype.clearEnemyBook = function() {
  272.         this._enemyBookFlags = [];
  273.     };
  274. //--------------------------------------------------- Function Is the Enemy In The Book -----------------------------------------
  275.     Game_System.prototype.isInEnemyBook = function(enemy) {
  276.         if (this._enemyBookFlags && enemy) {
  277.             return !!this._enemyBookFlags[enemy.id];
  278.         } else {
  279.             return false;
  280.         }
  281.     };
  282. //--------------------------------------------------- Variable/Function Is enemy in the troop, if so add enemy to book-----------
  283.     var _Game_Troop_setup = Game_Troop.prototype.setup;
  284.     Game_Troop.prototype.setup = function(troopId) {
  285.         _Game_Troop_setup.call(this, troopId);
  286.         this.members().forEach(function(enemy) {
  287.             if (enemy.isAppeared()) {
  288.  
  289.         if (AutoFill === 'true') {
  290.             $gameSystem.addToEnemyBook(enemy.enemyId());
  291.                 }
  292.             }
  293.         }, this);
  294.     };
  295.  
  296.     var _Game_Enemy_appear = Game_Enemy.prototype.appear;
  297.     Game_Enemy.prototype.appear = function() {
  298.         _Game_Enemy_appear.call(this);
  299.     if (AutoFill === 'true') {
  300.             $gameSystem.addToEnemyBook(this._enemyId);
  301.                 }
  302.     };
  303.  
  304.     var _Game_Enemy_transform = Game_Enemy.prototype.transform;
  305.     Game_Enemy.prototype.transform = function(enemyId) {
  306.         _Game_Enemy_transform.call(this, enemyId);
  307.     if (AutoFill === 'true') {
  308.             $gameSystem.addToEnemyBook(enemyId);
  309.                 }
  310.     };
  311.  
  312.     function Scene_EnemyBook() {
  313.         this.initialize.apply(this, arguments);
  314.     }
  315. //-------------------------------------------------------------------------------------------------------------------------------
  316.     Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
  317.     Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;
  318.  
  319.     Scene_EnemyBook.prototype.initialize = function() {
  320.         Scene_MenuBase.prototype.initialize.call(this);
  321.     };
  322.  
  323.     Scene_EnemyBook.prototype.create = function() {
  324.  
  325.         var w3 = Graphics.boxWidth / 3;
  326.         var ww = (Graphics.boxWidth / 3)*2 + 2;
  327.         var wh = Graphics.boxHeight / 10;  
  328.  
  329.         Scene_MenuBase.prototype.create.call(this);
  330.         this._indexWindow = new Window_EnemyBookIndex(0, 0);
  331.         this._indexWindow.setHandler('cancel', this.popScene.bind(this));
  332.        
  333.         this._statusWindow = new Window_EnemyBookStatus(w3, 0, ww, wh*2);
  334.         if ($gameSwitches.value(ShowStatus) === true || ShowStatus === 0) {
  335.             this._statusWindow2 = new Window_EnemyBookStatus2(w3, wh*2, ww, wh*5);
  336.         } else{
  337.             this._statusWindow2 = new Window_EnemyBookStatus2(w3, wh*2, ww, wh*8);
  338.         }
  339.         this._statusWindow3 = new Window_EnemyBookStatus3(w3, wh*7, ww, wh*3);
  340.         this._statusWindow4 = new Window_EnemyBookStatus4(0, Graphics.boxHeight/2, w3, Graphics.boxHeight/2);
  341.         this.addWindow(this._indexWindow);
  342.         this.addWindow(this._statusWindow);
  343.         if ($gameSwitches.value(ShowDamage) === true || ShowDamage === 0) {
  344.             this.addWindow(this._statusWindow4);}
  345.         this.addWindow(this._statusWindow2);
  346.         if ($gameSwitches.value(ShowStatus) === true || ShowStatus === 0) {
  347.             this.addWindow(this._statusWindow3);}
  348.         this._indexWindow.setStatusWindow(this._statusWindow);
  349.         this._indexWindow.setStatusWindow2(this._statusWindow2);
  350.         this._indexWindow.setStatusWindow3(this._statusWindow3);
  351.         this._indexWindow.setStatusWindow4(this._statusWindow4);
  352.     };
  353.  
  354.     function Window_EnemyBookIndex() {
  355.         this.initialize.apply(this, arguments);
  356.     }
  357.  
  358.     Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
  359.     Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;
  360.  
  361.     Window_EnemyBookIndex.lastTopRow = 0;
  362.     Window_EnemyBookIndex.lastIndex  = 0;
  363.  
  364.     Window_EnemyBookIndex.prototype.initialize = function(x, y) {
  365.         var width = Graphics.boxWidth / 3;
  366.        
  367.     if ($gameSwitches.value(ShowDamage) === true || ShowDamage === 0 || HalfIndexHeight === "true") {
  368.         var height = Graphics.boxHeight / 2;
  369.     }
  370.     else{
  371.         var height = Graphics.boxHeight;
  372.     }
  373.        
  374.        
  375.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  376.         this.refresh();
  377.         this.setTopRow(Window_EnemyBookIndex.lastTopRow);
  378.         this.select(Window_EnemyBookIndex.lastIndex);
  379.         this.activate();
  380.     };
  381.  
  382.     Window_EnemyBookIndex.prototype.maxCols = function() {
  383.         if (listEnemysRow > 4) {
  384.             return 4;
  385.         }
  386.         else{
  387.             return listEnemysRow;
  388.         }
  389.     };
  390.  
  391.     Window_EnemyBookIndex.prototype.maxItems = function() {
  392.         return this._list ? this._list.length : 0;
  393.     };
  394.  
  395.     Window_EnemyBookIndex.prototype.setStatusWindow = function(statusWindow) {
  396.         this._statusWindow = statusWindow;
  397.         this.updateStatus();
  398.     };
  399.     Window_EnemyBookIndex.prototype.setStatusWindow2 = function(statusWindow2) {
  400.         this._statusWindow2 = statusWindow2;
  401.         this.updateStatus();
  402.     };
  403.     Window_EnemyBookIndex.prototype.setStatusWindow3 = function(statusWindow3) {
  404.         this._statusWindow3 = statusWindow3;
  405.         this.updateStatus();
  406.     };
  407.     Window_EnemyBookIndex.prototype.setStatusWindow4 = function(statusWindow4) {
  408.         this._statusWindow4 = statusWindow4;
  409.         this.updateStatus();
  410.     };
  411.  
  412.     Window_EnemyBookIndex.prototype.update = function() {
  413.         Window_Selectable.prototype.update.call(this);
  414.         this.updateStatus();
  415.     };
  416.  
  417.     Window_EnemyBookIndex.prototype.updateStatus = function() {
  418.         if (this._statusWindow) {
  419.             var enemy = this._list[this.index()];
  420.             this._statusWindow.setEnemy(enemy);
  421.         }
  422.                 if (this._statusWindow2) {
  423.             var enemy = this._list[this.index()];
  424.             this._statusWindow2.setEnemy(enemy);
  425.         }
  426.                 if (this._statusWindow3) {
  427.             var enemy = this._list[this.index()];
  428.             this._statusWindow3.setEnemy(enemy);
  429.         }
  430.                 if (this._statusWindow4) {
  431.             var enemy = this._list[this.index()];
  432.             this._statusWindow4.setEnemy(enemy);
  433.         }
  434.     };
  435.  
  436.     Window_EnemyBookIndex.prototype.refresh = function() {
  437.         this._list = [];
  438.         for (var i = 1; i < $dataEnemies.length; i++) {
  439.             var enemy = $dataEnemies[i];
  440.             if (enemy.name && enemy.meta.book !== 'no') {
  441.                 this._list.push(enemy);
  442.             }
  443.         }
  444.         this.createContents();
  445.         this.drawAllItems();
  446.     };
  447.  
  448.     Window_EnemyBookIndex.prototype.drawItem = function(index) {
  449.         var enemy = this._list[index];
  450.         var rect = this.itemRectForText(index);
  451.         var name;
  452.         if ($gameSystem.isInEnemyBook(enemy)) {
  453.         if (IDatName === 'true') { 
  454.                     name = enemy.id + " - " + enemy.name;
  455.         } else {
  456.                 name = enemy.name;
  457.              }
  458.         } else {
  459.             name = unknownData;
  460.         }
  461.         this.drawText(name, rect.x, rect.y, rect.width);
  462.     };
  463.  
  464.     Window_EnemyBookIndex.prototype.processCancel = function() {
  465.         Window_Selectable.prototype.processCancel.call(this);
  466.         Window_EnemyBookIndex.lastTopRow = this.topRow();
  467.         Window_EnemyBookIndex.lastIndex = this.index();
  468.     };
  469.  
  470.     function Window_EnemyBookStatus() {
  471.         this.initialize.apply(this, arguments);
  472.     }
  473.     function Window_EnemyBookStatus2() {
  474.        this.initialize.apply(this, arguments);
  475.     }
  476.     function Window_EnemyBookStatus3() {
  477.         this.initialize.apply(this, arguments);
  478.     }
  479.     function Window_EnemyBookStatus4() {
  480.         this.initialize.apply(this, arguments);
  481.     }
  482.  
  483.     Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
  484.     Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;
  485.    
  486.     Window_EnemyBookStatus2.prototype = Object.create(Window_Base.prototype);
  487.     Window_EnemyBookStatus2.prototype.constructor = Window_EnemyBookStatus2;
  488.    
  489.     Window_EnemyBookStatus3.prototype = Object.create(Window_Base.prototype);
  490.     Window_EnemyBookStatus3.prototype.constructor = Window_EnemyBookStatus3;
  491.    
  492.     Window_EnemyBookStatus4.prototype = Object.create(Window_Base.prototype);
  493.     Window_EnemyBookStatus4.prototype.constructor = Window_EnemyBookStatus4;
  494.    
  495.    
  496.     Window_EnemyBookStatus2.prototype.initialize = function(x, y, width, height) {
  497.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  498.         this._enemy = null;
  499.         this._enemySprite = new Sprite();
  500.         this._enemySprite.anchor.x = 0.5;
  501.         this._enemySprite.anchor.y = 0.5;
  502.         this._enemySprite.x = this.contents.width/2;
  503.         this._enemySprite.y = (this.contents.height/2)+20;
  504.         this.addChildToBack(this._enemySprite);
  505.         this.refresh();
  506.     };
  507.  
  508.     Window_EnemyBookStatus.prototype.setEnemy = function(enemy) {
  509.         if (this._enemy !== enemy) {
  510.             this._enemy = enemy;
  511.             this.refresh();
  512.         }
  513.     };
  514.     Window_EnemyBookStatus2.prototype.setEnemy = function(enemy) {
  515.         if (this._enemy !== enemy) {
  516.             this._enemy = enemy;
  517.             this.refresh();
  518.         }
  519.     };
  520.     Window_EnemyBookStatus3.prototype.setEnemy = function(enemy) {
  521.         if (this._enemy !== enemy) {
  522.             this._enemy = enemy;
  523.             this.refresh();
  524.         }
  525.     };
  526.     Window_EnemyBookStatus4.prototype.setEnemy = function(enemy) {
  527.         if (this._enemy !== enemy) {
  528.             this._enemy = enemy;
  529.             this.refresh();
  530.         }
  531.     };
  532.     //--------------------------------------------------- Function Animate Enemy ------------------------------------------------
  533.     if (AnimEnemy === 'true') {
  534.     Window_EnemyBookStatus2.prototype.update = function() {
  535.         Window_Base.prototype.update.call(this);
  536.         if (this._enemySprite.bitmap) {
  537.             var bitmapHeight = this._enemySprite.bitmap.height;
  538.             var contentsHeight = this.contents.height;
  539.            
  540.                 var scalex = (Math.cos(Graphics.frameCount*0.01))/AnimIntens;
  541.                 var scaley = ((Math.cos(Graphics.frameCount*0.01))/AnimIntens);
  542.            
  543.             this._enemySprite.scale.x = (scalex*scalex)+0.9;
  544.             this._enemySprite.scale.y = (scaley*scaley)+0.9;
  545.            
  546.             if (bitmapHeight > contentsHeight) {
  547.                 this._enemySprite.scale.x = ((scaley*scaley)+0.9)-0.3;
  548.                 this._enemySprite.scale.y = ((scaley*scaley)+0.9)-0.3;
  549.             }
  550.         }
  551.  
  552.     };
  553.     }
  554.     else {
  555.     Window_EnemyBookStatus2.prototype.update = function() {
  556.         Window_Base.prototype.update.call(this);
  557.         if (this._enemySprite.bitmap) {
  558.             var bitmapHeight = this._enemySprite.bitmap.height;
  559.             var contentsHeight = this.contents.height;
  560.            
  561.                 var scale = 1;
  562.            
  563.             this._enemySprite.scale.x = scale;
  564.             this._enemySprite.scale.y = scale;
  565.            
  566.             if (bitmapHeight > contentsHeight) {
  567.                 this._enemySprite.scale.x = contentsHeight/bitmapHeight;
  568.                 this._enemySprite.scale.y = contentsHeight/bitmapHeight;
  569.             }
  570.         }
  571.  
  572.     };
  573.     }
  574. //-------------------------------------------------------------------------------------------------------------------------------
  575.     Window_EnemyBookStatus.prototype.refresh = function() {
  576.        
  577.         this.contents.clear();
  578.        
  579.         var enemy = this._enemy;
  580.         var x = 0;
  581.         var y = 0;
  582.         var lineHeight = this.lineHeight();
  583.        
  584.         if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
  585.             return;
  586.         }
  587. //--------------------------------------------------- Draw Enemy Discription ----------------------------------------------------
  588.  
  589.         var descWidth = 1;
  590.         x = 1;
  591.         y = 0;
  592.         this.drawTextEx(enemy.meta.desc1, x, (y + lineHeight * 0)-2, descWidth);
  593.         this.drawTextEx(enemy.meta.desc2, x, (y + lineHeight * 1)-10, descWidth);
  594.         this.drawTextEx(enemy.meta.desc3, x, (y + lineHeight * 2)-18, descWidth);
  595.     };
  596. //-------------------------------------------------------------------------------------------------------------------------------
  597.  
  598. //--------------------------------------------------- Draw Enemy Bitmap ---------------------------------------------------------
  599.  
  600.     Window_EnemyBookStatus2.prototype.refresh = function(actionList) {
  601.        
  602.         this.contents.clear();
  603.        
  604.         var enemy = this._enemy;
  605.         var x = 0;
  606.         var y = 0;
  607.         var lineHeight = this.lineHeight();
  608.  
  609.         if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
  610.             this._enemySprite.bitmap = null;
  611.             return;
  612.         }
  613.  
  614.         var name = enemy.battlerName;
  615.         var hue = enemy.battlerHue;
  616.         var bitmap;
  617.         if ($gameSystem.isSideView()) {
  618.             bitmap = ImageManager.loadSvEnemy(name, hue);
  619.         } else {
  620.             bitmap = ImageManager.loadEnemy(name, hue);
  621.         }
  622.        
  623.         this._enemySprite.bitmap = bitmap;
  624.        
  625.         this.resetTextColor();
  626. //-------------------------------------------------------------------------------------------------------------------------------
  627.  
  628. //--------------------------------------------------- Draw Abilities ------------------------------------------------------------
  629.        
  630.         if ($gameSwitches.value(ShowAbilities) === true || ShowAbilities === 0) {
  631.        
  632.             x = 1;
  633.             y = lineHeight*1;
  634.        
  635.             var text = TextManager.skill + ":";
  636.  
  637.             this.contents.paintOpacity = lineOpacity;
  638.             this.contents.fillRect(this.contents.width-this.textWidth(text), 30, this.textWidth(text), 2, this.normalColor());
  639.             this.contents.paintOpacity = 255;
  640.        
  641.             this.drawText(text, this.contents.width-this.textWidth(text), -5);  
  642.          
  643.             for (var j = 0; j < enemy.actions.length && j < maxSkills; j++) {
  644.                 var ai = enemy.actions[j];
  645.                     if (ai.skillId > 0) {
  646.                         var skillName = $dataSkills[ai.skillId].name;
  647.                         var skillIcon = $dataSkills[ai.skillId].iconIndex;
  648.                         this.changeTextColor(this.textColor(skillColor));
  649.                         this.drawText(skillName, this.contents.width-this.textWidth(skillName)-36, y+3);
  650.                         this.drawIcon(skillIcon, this.contents.width-32, y+3);
  651.                         this.changeTextColor(this.normalColor());
  652.                         y += lineHeight
  653.                     }
  654.             }
  655.             if (enemy.actions.length <= 0) {
  656.                     this.contents.paintOpacity = lineOpacity;
  657.                     this.drawText(noskillText, this.contents.width-this.textWidth(noskillText), y+3);
  658.                     this.contents.paintOpacity = 255;
  659.                 }
  660.         }
  661. //-------------------------------------------------------------------------------------------------------------------------------
  662.        
  663.        
  664. //--------------------------------------------------- Draw Items ----------------------------------------------------------------
  665.  
  666.         if ($gameSwitches.value(ShowItems) === true || ShowItems === 0) {
  667.            
  668.             x = 1;
  669.             y = lineHeight*1;    
  670.        
  671.             this.contents.paintOpacity = lineOpacity;
  672.             this.contents.fillRect(x, 30, this.textWidth(TextManager.item + ':'), 2, this.normalColor());
  673.             this.contents.paintOpacity = 255;
  674.        
  675.             this.drawText(TextManager.item + ':', x, -5);
  676.                 for (var j = 0; j < enemy.dropItems.length; j++) {
  677.                     var di = enemy.dropItems[j];
  678.                         if (di.kind > 0) {
  679.                             var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
  680.                             this.drawItemName(item, x, y+3);
  681.                             y += lineHeight;
  682.                         }
  683.                 }
  684.                 if (enemy.dropItems[0].kind <= 0) {
  685.                     this.contents.paintOpacity = lineOpacity;
  686.                     this.drawText(noitemText, x, y+3);
  687.                     this.contents.paintOpacity = 255;
  688.                 }
  689.         }    
  690. //-------------------------------------------------------------------------------------------------------------------------------
  691.         x = 1
  692.         y = this.contents.height - 60
  693.        
  694.         var arr = [TextManager.expA, TextManager.currencyUnit];
  695.  
  696.         var lgth = 0;
  697.         var longest;
  698.  
  699.         for(var i=0; i < arr.length; i++){
  700.             if(arr[i].length > lgth){
  701.                 var lgth = arr[i].length;
  702.                 longest = arr[i];
  703.             }      
  704.         }
  705. //--------------------------------------------------- Draw Experience -----------------------------------------------------------
  706.         if ($gameSwitches.value(ShowEXP) === true || ShowEXP === 0) {
  707.  
  708.             this.changeTextColor(this.systemColor());
  709.             this.drawText(TextManager.expA, x, y - 5);
  710.             this.resetTextColor();
  711.            
  712.             if (goldIcon === 'true') {
  713.                 this.drawText(enemy.exp, x + this.textWidth(TextManager.expA) + 15, y - 5);
  714.             } else{
  715.                 this.drawText(enemy.exp, x + this.textWidth(longest) + 15, y - 5);
  716.             }
  717.         }
  718. //-------------------------------------------------------------------------------------------------------------------------------
  719.        
  720. //--------------------------------------------------- Draw Gold -----------------------------------------------------------------
  721.         if ($gameSwitches.value(ShowGold) === true || ShowGold === 0) {
  722.             this.changeTextColor(this.systemColor());
  723.        
  724.             if (goldIcon === 'true') { 
  725.                 this.drawIcon(Yanfly.Icon.Gold, x, y - 8 + lineHeight)
  726.                 this.resetTextColor();
  727.                 this.drawText(enemy.gold, x + this.textWidth(TextManager.expA) + 15, y - 8 + lineHeight);
  728.             } else {
  729.                 this.drawText(TextManager.currencyUnit, x, y - 8 + lineHeight);
  730.                 this.resetTextColor();
  731.                 this.drawText(enemy.gold, x + this.textWidth(longest) + 15, y - 8 + lineHeight);
  732.             }
  733.         }
  734. //-------------------------------------------------------------------------------------------------------------------------------
  735.     }
  736.        
  737.     Window_EnemyBookStatus3.prototype.refresh = function() {
  738.        
  739.         this.contents.clear();
  740.        
  741.         var enemy = this._enemy;
  742.         var x = 0;
  743.         var y = 0;
  744.         var lineHeight = this.lineHeight();
  745.        
  746.         if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
  747.             return;
  748.         }
  749.            
  750.             this.drawText(TextManager.status, (Graphics.boxWidth/3) - (this.textWidth(TextManager.status)/2), -7, 160);
  751.             this.resetTextColor();  
  752.  
  753.         this.contents.paintOpacity = lineOpacity;
  754.         this.contents.fillRect(x, 27, this.contents.width, 2, this.normalColor());
  755.         this.contents.paintOpacity = 255;
  756.  
  757.         x = (Graphics.boxWidth/3) - 235
  758.         y = 30;
  759.  
  760.         var arr = [TextManager.param(0), TextManager.param(1), TextManager.param(2), TextManager.param(3)];
  761.  
  762.         var lgth = 0;
  763.         var longest;
  764.  
  765.         for(var i=0; i < arr.length; i++){
  766.             if(arr[i].length > lgth){
  767.                 var lgth = arr[i].length;
  768.                 longest = arr[i];
  769.             }      
  770.         }
  771.        
  772.         for (var i = 0; i < 4; i++) {
  773.             this.changeTextColor(this.systemColor());
  774.             this.drawText(TextManager.param(i), x, y, 160);
  775.             this.resetTextColor();        
  776.             this.drawText(enemy.params[i], x + this.textWidth(longest + '  '), y, 60, 'left');
  777.             y += lineHeight-5;
  778.         }
  779.        
  780.         y = 30;
  781.        
  782.         var arr = [TextManager.param(4), TextManager.param(5), TextManager.param(6), TextManager.param(7)];
  783.  
  784.         var lgth = 0;
  785.         var longest2;
  786.  
  787.         for(var i=0; i < arr.length; i++){
  788.             if(arr[i].length > lgth){
  789.                 var lgth = arr[i].length;
  790.                 longest2 = arr[i];
  791.             }      
  792.         }
  793.        
  794.         x = x + 10 + this.textWidth(longest + '  ') + 90
  795.        
  796.         for (var i = 4; i < 8; i++) {
  797.             this.changeTextColor(this.systemColor());
  798.             this.drawText(TextManager.param(i), x, y, 160);
  799.             this.resetTextColor();
  800.             this.drawText(enemy.params[i], x + this.textWidth(longest2 + '  '), y, 60, 'left');
  801.             y += lineHeight-5;
  802.         }
  803.     }
  804.    
  805.     Window_EnemyBookStatus4.prototype.refresh = function() {
  806.        
  807.         this.contents.clear();
  808.        
  809.         var enemy = this._enemy;
  810.         var x = 1;
  811.         var y = 0;
  812.         var lineHeight = this.lineHeight()-6;
  813.         var ii = 1
  814.                
  815.         if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
  816.             return;
  817.         }
  818.        
  819.        this.drawText(damageText, ((Graphics.boxWidth/3)/2)-(this.textWidth(damageText)/2)-18, y-5);
  820.         this.contents.paintOpacity = lineOpacity;
  821.         this.contents.fillRect(x, 29, this.contents.width, 2, this.normalColor());
  822.         this.contents.paintOpacity = 255;
  823.        
  824.         for (var i = 0; i < 20; i++) {
  825.        
  826.             if (i < enemy.traits.length) {
  827.                 if (enemy.traits[i].code === 11) {
  828.                     this.changeTextColor(this.systemColor());
  829.                     this.drawText($dataSystem.elements[enemy.traits[i].dataId], x, y+lineHeight*ii);
  830.                         if (enemy.traits[i].value*100 > 101) {
  831.                             this.changeTextColor(this.textColor(posColor));
  832.                         }
  833.                         else{
  834.                             this.changeTextColor(this.textColor(negColor));
  835.                         }
  836.                     this.drawText((Math.round(enemy.traits[i].value*100)) + "%", (Graphics.boxWidth/3) - 110, y+lineHeight*ii, 70, 'right');
  837.                     ii += 1
  838.                     this.changeTextColor(this.normalColor());
  839.                 }
  840.             }
  841.         }
  842.     };
  843.    
  844. })();
Advertisement
Add Comment
Please, Sign In to add comment