Project1

标题: soulsaga [打印本页]

作者: j296196585    时间: 2017-7-28 14:10
标题: soulsaga
本帖最后由 j296196585 于 2017-7-30 10:46 编辑

MOG_EnemyHP请问如何破限
最大显示6位数 根本太少了吗 可以破限显示更多吗


JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // MOG_EnemyHP.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc (v1.4) Apresenta o HP do inimigo ao ataca-lo.
  7.  * @author Moghunter
  8.  *
  9.  * @param EHP Fade Duration
  10.  * @desc Definição do tempo para ativar o fade.
  11.  * (Default = 120)
  12.  * @default 120
  13.  *
  14.  * @param EHP Layout X-Axis
  15.  * @desc Posição X-Axis do layout.
  16.  * @default 0
  17.  *
  18.  * @param EHP Layout Y-Axis
  19.  * @desc Posição Y-Axis do layout.
  20.  * @default 0
  21.  *
  22.  * @param EHP Meter X-Axis
  23.  * @desc Posição X-Axis do medidor.
  24.  * @default 4
  25.  *
  26.  * @param EHP Meter Y-Axis
  27.  * @desc Posição Y-Axis do medidor.
  28.  * @default 2
  29.  +
  30.  * @help  
  31.  * =============================================================================
  32.  * +++ MOG - Enemy HP Meter (v1.4) +++
  33.  * By Moghunter
  34.  * [url]https://atelierrgss.wordpress.com/[/url]
  35.  * =============================================================================
  36.  * Apresenta o HP do inimigo ao ataca-lo.
  37.  * Serão necessários os arquivos. (img/system/)
  38.  *
  39.  * EnemyHP_A.png
  40.  * EnemyHP_B.png
  41.  *
  42.  * Para ocultar o HP do inimigo use a seguinte Tag na caixa de notas
  43.  *
  44.  * Hide HP
  45.  *
  46.  * =============================================================================
  47.  * ** Histórico **
  48.  * =============================================================================
  49.  * (v1.4) Melhoria na compatibilidade de plugins.   
  50.  * (v1.3) Correção do Crash relativo as Notetags.  
  51.  * (v1.2) Melhoria na codificação.
  52.  * (v1.1) - Melhoria na animação do medidor vermelho.
  53.  *      - Mudança da Tag para ocular o hp para HIDE HP.
  54.  *      - Melhoria na codificação.
  55.  */
  56.  
  57. //=============================================================================
  58. // ** PLUGIN PARAMETERS
  59. //=============================================================================
  60.   var Imported = Imported || {};
  61.   Imported.MOG_EnemyHP = true;
  62.   var Moghunter = Moghunter || {};
  63.  
  64.    Moghunter.parameters = PluginManager.parameters('MOG_EnemyHP');
  65.     Moghunter.enemyhp_a_x = Number(Moghunter.parameters['EHP Layout X-Axis'] || 0);
  66.     Moghunter.enemyhp_a_y = Number(Moghunter.parameters['EHP Layout Y-Axis'] || 0);
  67.     Moghunter.enemyhp_b_x = Number(Moghunter.parameters['EHP Meter X-Axis'] || 4);
  68.     Moghunter.enemyhp_b_y = Number(Moghunter.parameters['EHP Meter Y-Axis'] || 2);       
  69.     Moghunter.enemyhp_duration = Number(Moghunter.parameters['EHP Fade Duration'] || 120);
  70.  
  71. //=============================================================================
  72. // ** Game Battler
  73. //=============================================================================
  74.  
  75. //==============================
  76. // * Notetags
  77. //==============================
  78. Game_Battler.prototype.notetags = function() {
  79.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  80.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  81. };
  82.  
  83. //=============================================================================
  84. // ** Game_Enemy
  85. //=============================================================================
  86.  
  87. //==============================
  88. // * Setup
  89. //==============================
  90. var _alias_mog_gba_setup = Game_Enemy.prototype.setup;
  91. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  92.         _alias_mog_gba_setup.call(this,enemyId, x, y);
  93.         this._hp_meter = true
  94.         for (var i = 0; i < this.notetags().length; i++) {
  95.                 if (this.notetags()[i] == "Hide HP") {this._hp_meter = false};
  96.         };               
  97. };
  98.  
  99. //=============================================================================
  100. // ** Spriteset_Battle
  101. //=============================================================================       
  102.  
  103. //==============================
  104. // * CreateLowerLayer
  105. //==============================
  106. var _alias_mog_enemyhp_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer
  107. Spriteset_Battle.prototype.createUpperLayer = function() {
  108.         this.create_ehp_sprites();
  109.         _alias_mog_enemyhp_createUpperLayer.call(this);       
  110. };
  111.  
  112. //==============================
  113. // * Update
  114. //==============================
  115. var _alias_mog_enemyhp_update = Spriteset_Battle.prototype.update
  116. Spriteset_Battle.prototype.update = function() {
  117.         _alias_mog_enemyhp_update.call(this);
  118.         this.update_ehp_sprites();
  119. };
  120.  
  121. //==============================
  122. // * Create EHP Sprites
  123. //==============================
  124. Spriteset_Battle.prototype.create_ehp_sprites = function() {
  125.         this._ehp_sprites_a = [];
  126.         this._ehp_sprites_b = [];
  127.         this._ehp_sprites_c = [];
  128.         this._ehp_sprites_data = [];
  129.     for (var i = 0; i < this._enemySprites.length; i++) {
  130.                 if (this._enemySprites[i]._battler == null) {return;};
  131.         this._ehp_sprites_a[i] = new Sprite(ImageManager.loadSystem("EnemyHP_A"));
  132.                 this._ehp_sprites_b[i] = new Sprite(ImageManager.loadSystem("EnemyHP_B"));
  133.                 this._ehp_sprites_c[i] = new Sprite(ImageManager.loadSystem("EnemyHP_B"));
  134.         this._ehp_sprites_a[i].opacity = 0;
  135.                 this._ehp_sprites_b[i].opacity = 0;
  136.                 this._ehp_sprites_c[i].opacity = 0;               
  137.                 this._ehp_sprites_a[i].z = 50;
  138.                 this._ehp_sprites_b[i].z = 51;
  139.                 this._ehp_sprites_c[i].z = 52;
  140.                 if (!this._enemySprites[i]._battler._hp_meter) {this._ehp_sprites_a[i].visible = false};
  141.                 this._ehp_sprites_b[i].visible = this._ehp_sprites_a[i].visible
  142.                 this._ehp_sprites_c[i].visible = this._ehp_sprites_a[i].visible
  143.                 this._battleField.addChild(this._ehp_sprites_a[i]);
  144.                 this._battleField.addChild(this._ehp_sprites_b[i]);       
  145.                 this._battleField.addChild(this._ehp_sprites_c[i]);       
  146.                 this._ehp_sprites_data[i] = [this._enemySprites[i]._battler.hp,0,0,Math.max(Moghunter.enemyhp_duration,32),this._enemySprites[i]._battler.hp,];
  147.     };
  148. };
  149.  
  150. //==============================
  151. // * Update EHP Sprites
  152. //==============================
  153. Spriteset_Battle.prototype.update_ehp_sprites = function() {
  154.         for (var i = 0; i < this._enemySprites.length; i++) {
  155.                 if (this._ehp_sprites_a[i] == null) {return;};
  156.                 if (!this._ehp_sprites_a[i].bitmap.isReady()) {return};               
  157.                 this._ehp_sprites_a[i].x = this._enemySprites[i].x + Moghunter.enemyhp_a_x +this._ehp_sprites_data[i][1] - (this._ehp_sprites_a[i].bitmap.width / 2);
  158.                 this._ehp_sprites_a[i].y = this._enemySprites[i].y + Moghunter.enemyhp_a_y;
  159.                 this._ehp_sprites_b[i].x = this._ehp_sprites_a[i].x + Moghunter.enemyhp_b_x;
  160.                 this._ehp_sprites_b[i].y = this._ehp_sprites_a[i].y + Moghunter.enemyhp_b_y;
  161.                 this._ehp_sprites_c[i].x = this._ehp_sprites_a[i].x + Moghunter.enemyhp_b_x;
  162.                 this._ehp_sprites_c[i].y = this._ehp_sprites_a[i].y + Moghunter.enemyhp_b_y;               
  163.                 this._ehp_sprites_b[i].opacity = this._ehp_sprites_a[i].opacity;
  164.                 this._ehp_sprites_c[i].opacity = this._ehp_sprites_a[i].opacity;
  165.                 this.update_ehp_red_bar(i);
  166.                 this.update_ehp_blue_bar(i)        ;
  167.     };
  168. };
  169.  
  170. //==============================
  171. // * Update EHP Blue Bar
  172. //==============================
  173. Spriteset_Battle.prototype.update_ehp_blue_bar = function(i) {
  174.                 if (this._enemySprites[i]._battler.isDead()) {
  175.                         this._ehp_sprites_a[i].opacity -= 2;
  176.                 };
  177.                 if (this._ehp_sprites_data[i][2] > 0) {
  178.                         this._ehp_sprites_data[i][2] -= 1
  179.                 };                 
  180.                 if (this._ehp_sprites_data[i][2] > this._ehp_sprites_data[i][3]) {
  181.                         this._ehp_sprites_data[i][1] += 2;
  182.                         this._ehp_sprites_a[i].opacity += 17
  183.                 } else {
  184.                         if (this._ehp_sprites_data[i][1] < 30 && this._ehp_sprites_data[i][2] <= 15) {
  185.                                 this._ehp_sprites_data[i][1] += 2;this._ehp_sprites_a[i].opacity -= 17
  186.                         };
  187.                 }               
  188.                 if (this._ehp_sprites_data[i][0] != this._enemySprites[i]._battler.hp) {               
  189.  
  190.                         if (this._ehp_sprites_data[i][2] > 15 && this._ehp_sprites_data[i][2] <= this._ehp_sprites_data[i][3]) {
  191.                                 this._ehp_sprites_data[i][2] = this._ehp_sprites_data[i][3]
  192.                         } else {
  193.                                 this._ehp_sprites_data[i][1] = -30;
  194.                                 this._ehp_sprites_data[i][2] = this._ehp_sprites_data[i][3] + 15;
  195.                         }                               
  196.                 }
  197.                 this._ehp_sprites_data[i][0] = this._enemySprites[i]._battler.hp;                    
  198.                 var meter_rate = this._ehp_sprites_c[i].bitmap.width * this._enemySprites[i]._battler.hp / this._enemySprites[i]._battler.mhp;
  199.             this._ehp_sprites_c[i].setFrame(0, 0, meter_rate, this._ehp_sprites_c[i].bitmap.height / 2);
  200. };
  201.  
  202. //==============================
  203. // * Update EHP Red Bar
  204. //==============================
  205. Spriteset_Battle.prototype.update_ehp_red_bar = function(i) {
  206.                 if (this._ehp_sprites_data[i][4] != this._enemySprites[i]._battler.hp) {
  207.                                         var dnspeed = 1 + (Math.abs(this._ehp_sprites_data[i][4] - this._enemySprites[i]._battler.hp) / (Moghunter.enemyhp_duration / 2));
  208.                         if (this._ehp_sprites_data[i][4] > this._enemySprites[i]._battler.hp) {
  209.                             this._ehp_sprites_data[i][4] -= dnspeed;
  210.                                 if (this._ehp_sprites_data[i][4] < this._enemySprites[i]._battler.hp ) {
  211.                                     this._ehp_sprites_data[i][4] = this._enemySprites[i]._battler.hp};
  212.                         }
  213.                         else if (this._ehp_sprites_data[i][4] < this._enemySprites[i]._battler.hp) {
  214.                             this._ehp_sprites_data[i][4] += dnspeed;
  215.                                 if (this._ehp_sprites_data[i][4] > this._enemySprites[i]._battler.hp ) {
  216.                                     this._ehp_sprites_data[i][4] = this._enemySprites[i]._battler.hp};                       
  217.                         }
  218.                         var meter_rate = this._ehp_sprites_b[i].bitmap.width * this._ehp_sprites_data[i][4] / this._enemySprites[i]._battler.mhp;
  219.                      this._ehp_sprites_b[i].setFrame(0, this._ehp_sprites_b[i].bitmap.height / 2, meter_rate, this._ehp_sprites_b[i].bitmap.height / 2);
  220.             };       
  221. };

360截图20170728140817029.jpg (7.4 KB, 下载次数: 0)

360截图20170728140817029.jpg





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1