查看: 2539|回复: 12

[已经解决] MOG_HPGauge显示能否超过6位数

[复制链接]
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2017-10-9 22:21:35 | 显示全部楼层 |阅读模式

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

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

×
MOG_HPGauge显示能否超过6位数



//==============================
// * create Number
//==============================
HPGaugeSprite.prototype.createNumber = function() {
        this._hp_number = [];
        this._numberData = [this.battler().hp - 1,this._numberImg.width / 11,this._numberImg.height]
        for (var i = 0; i < 6; i++) {
                 this._hp_number = new Sprite(this._numberImg);
                 this._hp_number.visible = false;
                 if (this.type === 0) {
                     this._hp_number.x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_c_xa;
                     this._hp_number.y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_c_ya;
                 } else {
                     this._hp_number.x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_c_x;
                     this._hp_number.y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_c_y;
                 };
                 this._hp_number.org = [this._hp_number.x,this._hp_number.y];
                 this.addChild(this._hp_number);                 
        };
};

不知道是不是这里调试 一动插件就错误

360截图20171009221802290.jpg
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-10-10 11:29:05 | 显示全部楼层
for (var i = 0; i < 6; i++) {
6是指6位数..不排除还有其他位置要改..

点评

叫你这么一说有种高精度的感觉(刚复习了下高精度算法所以特别敏感)......  发表于 2017-10-10 22:25
回复

使用道具 举报

梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

 楼主| 发表于 2017-10-11 13:19:18 | 显示全部楼层


这是原插件  完全不知道从哪里下手。。


  1. //=============================================================================
  2. // MOG_HPGauge.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.0) Apresenta um medidor de HP do alvo.
  6. * @author Moghunter
  7. *
  8. * @param Gauge For Actors
  9. * @desc Apresentar o HP nos aliados .
  10. * @default true
  11. *
  12. * @param Gauge For Enemies
  13. * @desc Apresentar o HP nos inimigos.
  14. * @default true
  15. *
  16. * @param Show HP On Selection
  17. * @desc Apresentar o HP na seleção do alvo.
  18. * @default true
  19. *
  20. * @param Fade Duration
  21. * @desc Definição do tempo para ativar o fade.
  22. * @default 90
  23. *
  24. * @param Slide Animation
  25. * @desc Ativar animação de deslize.
  26. * @default true
  27. *  
  28. * @param Show HP Number Actor
  29. * @desc Apresentar o número de HP para o ator.
  30. * @default false
  31. *
  32. * @param Show HP Number Enemy
  33. * @desc Apresentar o número de HP para o inimigo.
  34. * @default true
  35. *
  36. * @param Required to Kill
  37. * @desc Requer derrotar o inimigo para mostrar o HP.
  38. * @default false
  39. *
  40. * @param Actor Layout X-Axis
  41. * @desc Posição X-Axis do layout.
  42. * @default 0
  43. *
  44. * @param Actor Layout Y-Axis
  45. * @desc Posição Y-Axis do layout.
  46. * @default 0
  47. *
  48. * @param Actor Meter X-Axis
  49. * @desc Posição X-Axis do medidor.
  50. * @default 0
  51. *
  52. * @param Actor Meter Y-Axis
  53. * @desc Posição Y-Axis do medidor.
  54. * @default 3
  55. *
  56. * @param Actor HP Number X-Axis
  57. * @desc Posição X-Axis do numero de HP.
  58. * @default -25
  59. *
  60. * @param Actor HP Number Y-Axis
  61. * @desc Posição Y-Axis do numero de HP.
  62. * @default -22
  63. *
  64. * @param Enemy Layout X-Axis
  65. * @desc Posição X-Axis do layout.
  66. * @default 0
  67. *
  68. * @param Enemy Layout Y-Axis
  69. * @desc Posição Y-Axis do layout.
  70. * @default 0
  71. *
  72. * @param Enemy Meter X-Axis
  73. * @desc Posição X-Axis do medidor.
  74. * @default 8
  75. *
  76. * @param Enemy Meter Y-Axis
  77. * @desc Posição Y-Axis do medidor.
  78. * @default 10
  79. *
  80. * @param Enemy HP Number X-Axis
  81. * @desc Posição X-Axis do numero de HP.
  82. * @default -25
  83. *
  84. * @param Enemy HP Number Y-Axis
  85. * @desc Posição Y-Axis do numero de HP.
  86. * @default -19
  87. *  
  88. * @help  
  89. * =============================================================================
  90. * +++ MOG - HP Gauge (v1.0) +++
  91. * By Moghunter
  92. * [url]https://atelierrgss.wordpress.com/[/url]
  93. * =============================================================================
  94. * Apresenta um medidor de HP do alvo.
  95. * Serão necessários os arquivos. (img/system/)
  96. *
  97. * HPGaugeActor_A.png
  98. * HPGaugeActor_B.png
  99. * HPGaugeActor_C.png
  100. * HPGaugeEnemy_A.png
  101. * HPGaugeEnemy_B.png
  102. * HPGaugeEnemy_C.png  
  103. *
  104. * =============================================================================
  105. * NOTETAGS
  106. * =============================================================================
  107. * Para ocultar o HP do inimigo use a seguinte Tag na caixa de notas
  108. *
  109. * Hide HP
  110. *
  111. * -----------------------------------------------------------------------------
  112. * Para ajustar a posição do medidor use a Tag abaixo.
  113. *
  114. * Hp Gauge Offset: X:Y
  115. *
  116. * Exemplo
  117. *
  118. * Hp Gauge Offset: 130:40
  119. *
  120. */

  121. //=============================================================================
  122. // ** PLUGIN PARAMETERS
  123. //=============================================================================
  124.   var Imported = Imported || {};
  125.   Imported.MOG_HPGauge = true;
  126.   var Moghunter = Moghunter || {};

  127.    Moghunter.parameters = PluginManager.parameters('MOG_HPGauge');
  128.     Moghunter.hpgauge_actors = String(Moghunter.parameters['Gauge For Actors'] || "true");
  129.         Moghunter.hpgauge_enemies = String(Moghunter.parameters['Gauge For Enemies'] || "true");
  130.         Moghunter.hpgauge_selection = String(Moghunter.parameters['Show HP On Selection'] || "true");
  131.         Moghunter.hpgauge_slide = String(Moghunter.parameters['Slide Animation'] || "true");
  132.         Moghunter.hpgauge_showNumberActor = String(Moghunter.parameters['Show HP Number Actor'] || "false");
  133.         Moghunter.hpgauge_showNumberEnemy = String(Moghunter.parameters['Show HP Number Enemy'] || "true");
  134.         Moghunter.hpgauge_NumberAfter = String(Moghunter.parameters['Required to Kill'] || "false");
  135.     Moghunter.hpgauge_a_x = Number(Moghunter.parameters['Enemy Layout X-Axis'] || 0);
  136.     Moghunter.hpgauge_a_y = Number(Moghunter.parameters['Enemy Layout Y-Axis'] || 0);
  137.     Moghunter.hpgauge_b_x = Number(Moghunter.parameters['Enemy Meter X-Axis'] || 8);
  138.     Moghunter.hpgauge_b_y = Number(Moghunter.parameters['Enemy Meter Y-Axis'] || 10);       
  139.     Moghunter.hpgauge_c_x = Number(Moghunter.parameters['Enemy HP Number X-Axis'] || -30);
  140.     Moghunter.hpgauge_c_y = Number(Moghunter.parameters['Enemy HP Number Y-Axis'] || -19);       
  141.     Moghunter.hpgauge_a_xa = Number(Moghunter.parameters['Actor Layout X-Axis'] || 0);
  142.     Moghunter.hpgauge_a_ya = Number(Moghunter.parameters['Actor Layout Y-Axis'] || 0);
  143.     Moghunter.hpgauge_b_xa = Number(Moghunter.parameters['Actor Meter X-Axis'] || 0);
  144.     Moghunter.hpgauge_b_ya = Number(Moghunter.parameters['Actor Meter Y-Axis'] || 3);       
  145.     Moghunter.hpgauge_c_xa = Number(Moghunter.parameters['Actor HP Number X-Axis'] || -25);
  146.     Moghunter.hpgauge_c_ya = Number(Moghunter.parameters['Actor HP Number Y-Axis'] || -19);               
  147.         Moghunter.hpgauge_duration = Number(Moghunter.parameters['Fade Duration'] || 90);

  148. //=============================================================================
  149. // ** Game_Temp
  150. //=============================================================================

  151. //==============================
  152. // * Initialize
  153. //==============================
  154. var _mog_hpgauge_temp_initialize = Game_Temp.prototype.initialize;
  155. Game_Temp.prototype.initialize = function() {
  156.         _mog_hpgauge_temp_initialize.call(this);
  157.     this._hpGauge = [true,false];
  158. };

  159. //=============================================================================
  160. // ** Game_System
  161. //=============================================================================

  162. //==============================
  163. // * Initialize
  164. //==============================
  165. var _mog_hpgauge_sys_initialize = Game_System.prototype.initialize;
  166. Game_System.prototype.initialize = function() {
  167.         _mog_hpgauge_sys_initialize.call(this);
  168.     this._hpGaugeEDef = [];
  169. };

  170. //=============================================================================
  171. // ** BattleManager
  172. //=============================================================================

  173. //==============================
  174. // * processVictory
  175. //==============================
  176. var _mog_hpGauge_processVictory = BattleManager.processVictory;
  177. BattleManager.processVictory = function() {
  178.          $gameTemp._hpGauge[0] = false;
  179.          _mog_hpGauge_processVictory.call(this);         
  180. };

  181. //==============================
  182. // * processAbort
  183. //==============================
  184. var _mog_hpGauge_processAbort = BattleManager.processAbort;
  185. BattleManager.processAbort = function() {
  186.          $gameTemp._hpGauge[0] = false;
  187.          _mog_hpGauge_processAbort.call(this);         
  188. };

  189. //==============================
  190. // * processDefeat
  191. //==============================
  192. var _mog_hpGauge_processDefeat = BattleManager.processDefeat;
  193. BattleManager.processDefeat = function() {
  194.          $gameTemp._hpGauge[0] = false;
  195.          _mog_hpGauge_processDefeat.call(this);         
  196. };

  197. //=============================================================================
  198. // ** Game Battler
  199. //=============================================================================

  200. //==============================
  201. // * init Members
  202. //==============================
  203. var _mog_hpgauge_gbat_initMembers = Game_Battler.prototype.initMembers;
  204. Game_Battler.prototype.initMembers = function() {
  205.     _mog_hpgauge_gbat_initMembers.call(this);
  206.     this._ehpgauge = [false,0,0,false,false];
  207. };

  208. //==============================
  209. // * check HP Gauge Notes
  210. //==============================
  211. Game_Battler.prototype.checkHPGaugeNotes = function() {
  212.         this.notetags().forEach(function(note) {
  213.                 if (note == "Hide HP") {this._ehpgauge[0] = false};
  214.          var note_data = note.split(': ')
  215.                  if (note_data[0].toLowerCase() == "hp gauge offset"){
  216.                          var par = note_data[1].split(':');
  217.                      this._ehpgauge[1] = Number(par[0]);
  218.                          this._ehpgauge[2] = Number(par[1]);
  219.                  };               
  220.         },this);
  221. };

  222. //==============================
  223. // * Notetags
  224. //==============================
  225. Game_Battler.prototype.notetags = function() {
  226.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  227.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  228. };

  229. //=============================================================================
  230. // ** Game_Actor
  231. //=============================================================================

  232. //==============================
  233. // * Setup
  234. //==============================
  235. var _mog_hp_gauge_gactor_setup = Game_Actor.prototype.setup;
  236. Game_Actor.prototype.setup = function(actorId) {
  237.         _mog_hp_gauge_gactor_setup.call(this,actorId);
  238.         if (String(Moghunter.hpgauge_actors) === "true") {this._ehpgauge[0] = true};
  239.         this.checkHPGaugeNotes();
  240. };

  241. //=============================================================================
  242. // ** Game_Enemy
  243. //=============================================================================

  244. //==============================
  245. // * Setup
  246. //==============================
  247. var _mog_hpgauge_genemy_setup = Game_Enemy.prototype.setup;
  248. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  249.         _mog_hpgauge_genemy_setup.call(this,enemyId, x, y);
  250.         if (String(Moghunter.hpgauge_enemies) === "true") {this._ehpgauge[0] = true};
  251.         this.checkHPGaugeNotes();
  252. };

  253. //==============================
  254. // * Die
  255. //==============================
  256. var _mog_hpgauge_genemy_die = Game_Enemy.prototype.die;
  257. Game_Enemy.prototype.die = function() {
  258.         _mog_hpgauge_genemy_die.call(this);
  259.         $gameSystem._hpGaugeEDef[this._enemyId] = true;
  260. };

  261. //=============================================================================
  262. // ** Game Action
  263. //=============================================================================

  264. //==============================
  265. // * Apply
  266. //==============================
  267. var _mog_hpgauge_gaction_apply = Game_Action.prototype.apply;
  268. Game_Action.prototype.apply = function(target) {
  269.          _mog_hpgauge_gaction_apply.call(this,target);
  270.      if (target) {
  271.                  if (this.isHpRecover()) {
  272.                          target._ehpgauge[4] = true;
  273.                  } else if (this.item() && this.item().damage.type === 5) {
  274.                          target._ehpgauge[4] = true;
  275.                          var subj = this.subject();
  276.                          if (subj) {subj._ehpgauge[4] = true};
  277.                  };
  278.           };
  279. };

  280. //=============================================================================
  281. // ** Spriteset_Battle
  282. //=============================================================================       

  283. //==============================
  284. // * CreateLowerLayer
  285. //==============================
  286. var _mog_hpgauge_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer
  287. Spriteset_Battle.prototype.createUpperLayer = function() {
  288.         this.create_HPGauge();
  289.         _mog_hpgauge_createUpperLayer.call(this);       
  290. };

  291. //==============================
  292. // * Create HP Gauge
  293. //==============================
  294. Spriteset_Battle.prototype.create_HPGauge = function() {
  295.     this.createHPField();
  296.         this.createHPSprites()
  297. };

  298. //==============================
  299. // * Create EHP Field
  300. //==============================
  301. Spriteset_Battle.prototype.createHPField = function() {
  302.     this._hpField = new Sprite();
  303.         this._hpField.z = 100;
  304.         this.addChild(this._hpField);
  305. };

  306. //==============================
  307. // * Create HP Sprites
  308. //==============================
  309. Spriteset_Battle.prototype.createHPSprites = function() {
  310.         $gameTemp._hpGauge[0] = true;
  311.         this._HPSprites = [];
  312.         if (String(Moghunter.hpgauge_actors) === "true") {
  313.                 for (var i = 0; i < this._actorSprites.length; i++) {
  314.                          this._HPSprites[i] = new HPGaugeSprite(this._actorSprites[i],0);
  315.                          this._hpField.addChild(this._HPSprites[i]);       
  316.                 };
  317.         };
  318.         if (String(Moghunter.hpgauge_enemies) === "true") {
  319.                 for (var i = 0; i < this._enemySprites.length; i++) {
  320.                          this._HPSprites[i] = new HPGaugeSprite(this._enemySprites[i],1);
  321.                          this._hpField.addChild(this._HPSprites[i]);
  322.                 };
  323.         };
  324. };

  325. //==============================
  326. // * Update
  327. //==============================
  328. var _mog_hpGauge_sprBat_update = Spriteset_Battle.prototype.update;
  329. Spriteset_Battle.prototype.update = function() {
  330.         _mog_hpGauge_sprBat_update.call(this);
  331.         if (Imported.MOG_BattleCamera && this._hpField) {this.updateHPField()};
  332. };

  333. //==============================
  334. // * Update
  335. //==============================
  336. Spriteset_Battle.prototype.updateHPField = function() {
  337.     this._hpField.x = this._battleField.x
  338.         this._hpField.y = this._battleField.y
  339. };

  340. //=============================================================================
  341. // ** HP Gauge Sprite
  342. //=============================================================================
  343. function HPGaugeSprite() {
  344.     this.initialize.apply(this, arguments);
  345. };

  346. HPGaugeSprite.prototype = Object.create(Sprite.prototype);
  347. HPGaugeSprite.prototype.constructor = HPGaugeSprite;

  348. //==============================
  349. // * Initialize
  350. //==============================
  351. HPGaugeSprite.prototype.initialize = function(sprite,type) {
  352.     Sprite.prototype.initialize.call(this);
  353.     this._sprite = sprite;
  354.         this._slideX = 0;
  355.         this._duration = 0;
  356.         this.opacity = 0;
  357.         this.type = type;
  358.         this.z = 100;
  359.         this._slideA = String(Moghunter.hpgauge_slide) === "true" ? true : false;
  360.         this._selectionHP = String(Moghunter.hpgauge_selection) === "true" ? true : false;
  361.         if (type === 0) {
  362.             this._showHPNumber = String(Moghunter.hpgauge_showNumberActor) === "true" ? true : false;
  363.         } else {
  364.             this._showHPNumber = String(Moghunter.hpgauge_showNumberEnemy) === "true" ? true : false;
  365.         };
  366.         this._IDA = type === 0 ? true : this.enemyIDA();
  367.         if (type === 1 && String(Moghunter.hpgauge_NumberAfter) != "true") {this._IDA = true};
  368.         this._data = [0,0,0,0,0];
  369.         this.loadBitmaps();
  370. };
  371.    
  372. //==============================
  373. // * Battler
  374. //==============================
  375. HPGaugeSprite.prototype.battler = function() {
  376.     return this._sprite._battler;
  377. };

  378. //==============================
  379. // * Load Bitmaps
  380. //==============================
  381. HPGaugeSprite.prototype.loadBitmaps = function() {
  382.         if (this.type === 0) {
  383.         this._layImg = ImageManager.loadSystem("HPGaugeActor_A");
  384.             this._meterImg = ImageManager.loadSystem("HPGaugeActor_B");
  385.                 this._numberImg = ImageManager.loadSystem("HPGaugeActor_C");
  386.         } else {
  387.         this._layImg = ImageManager.loadSystem("HPGaugeEnemy_A");
  388.             this._meterImg = ImageManager.loadSystem("HPGaugeEnemy_B");       
  389.                 this._numberImg = ImageManager.loadSystem("HPGaugeEnemy_C");       
  390.         };
  391. };

  392. //==============================
  393. // * createSprites
  394. //==============================
  395. HPGaugeSprite.prototype.createSprites = function() {
  396.         this.createLayout();
  397.         this.createMeter();
  398.         if (this._showHPNumber) {this.createNumber()};
  399. };

  400. //==============================
  401. // * Create Layout
  402. //==============================
  403. HPGaugeSprite.prototype.createLayout = function() {
  404.     this._layout = new Sprite(this._layImg);
  405.         if (this.type === 0) {
  406.             this._layout.x = Moghunter.hpgauge_a_xa - this._layImg.width / 2;
  407.             this._layout.y = Moghunter.hpgauge_a_ya - this._layImg.height / 2;
  408.         } else {
  409.             this._layout.x = Moghunter.hpgauge_a_x - this._layImg.width / 2;
  410.             this._layout.y = Moghunter.hpgauge_a_y - this._layImg.height / 2;
  411.         };
  412.         this.addChild(this._layout);
  413. };

  414. //==============================
  415. // * Create Gauge
  416. //==============================
  417. HPGaugeSprite.prototype.createMeter = function() {
  418.         this._meter = [];
  419.         for (var i = 0; i < 2; i++) {
  420.                 this._meter[i] = new Sprite(this._meterImg);
  421.                 this._meter[i].value1 = this.battler().hp;
  422.                 this._meter[i].value2 = this.battler().mhp;
  423.                 this._meter[i].ds = 0;
  424.                 this._meter[i].w = this._meterImg.width;
  425.                 this._meter[i].h = this._meterImg.height / 2;
  426.                 if (this.type === 0) {
  427.                     this._meter[i].x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_b_xa - this._meterImg.width / 2;
  428.                     this._meter[i].y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_b_ya - this._meterImg.height / 2;
  429.                 } else {
  430.                     this._meter[i].x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_b_x - this._meterImg.width / 2;
  431.                     this._meter[i].y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_b_y - this._meterImg.height / 2;
  432.             };
  433.                 this.addChild(this._meter[i]);
  434.         };
  435.     this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  436.         this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);       
  437.         this.updateMeter();
  438. };

  439. //==============================
  440. // * Need Refresh Blue Meter
  441. //==============================
  442. HPGaugeSprite.prototype.needRefreshBlueMeter = function() {
  443.         if (this.battler()._ehpgauge[4]) {return true};
  444.     if (this._meter[1].value1 != this.battler().hp) {return true};
  445.         if (this._meter[1].value2 != this.battler().mhp) {return true};
  446.         return false
  447. };

  448. //==============================
  449. // * refresh Blue Meter
  450. //==============================
  451. HPGaugeSprite.prototype.refreshBlueMeter = function() {
  452.          this.battler()._ehpgauge[4] = false;
  453.      this._meter[1].value1 = this.battler().hp;
  454.          this._meter[1].value2 = this.battler().mhp;
  455.          if (!$gameTemp._hpGauge[0]) {return};
  456.          this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  457.          this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);
  458.          this.prepareSlide();
  459. };

  460. //==============================
  461. // * prepare Slide
  462. //==============================
  463. HPGaugeSprite.prototype.prepareSlide = function() {
  464.         if (this.opacity < 100 || this._slideX > 0) {
  465.             this._slideX = this._slideA ? -50 : -0.01;
  466.             this.opacity = 0;
  467.         };
  468.         this._duration = Math.min(Math.max(Moghunter.hpgauge_duration,1),999);
  469. };

  470. //==============================
  471. // * Update Dif
  472. //==============================
  473. HPGaugeSprite.prototype.update_dif = function(value,real_value,speed,type) {
  474.         if (value == real_value) {return value};
  475.         var mr = type === 0 ? 1 : 0.1;
  476.     var dnspeed = mr + (Math.abs(value - real_value) / speed);
  477.         if (value > real_value) {value -= dnspeed;
  478.             if (value < real_value) {value = real_value};
  479.         } else if (value < real_value) {value  += dnspeed;
  480.             if (value  > real_value) {value  = real_value};               
  481.     };
  482.         if (type === 0) {
  483.             return Math.floor(value);
  484.         } else {
  485.                 return value;
  486.         };
  487. };

  488. //==============================
  489. // * Need Refresh Red Meter
  490. //==============================
  491. HPGaugeSprite.prototype.needRefreshRedMeter = function() {
  492.      if (this._meter[0].value1 != this.battler().hp) {return true};
  493.          return false;
  494. };

  495. //==============================
  496. // * refresh Red Meter
  497. //==============================
  498. HPGaugeSprite.prototype.refreshRedMeter = function() {
  499.            this._meter[0].value1 = this.update_dif(this._meter[0].value1,this.battler().hp, 60,1);
  500.          this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  501. };

  502. //==============================
  503. // * Update Meter
  504. //==============================
  505. HPGaugeSprite.prototype.updateMeter = function() {
  506.          if (this.needRefreshRedMeter()) {this.refreshRedMeter()};
  507.          if (this.needRefreshBlueMeter()) {this.refreshBlueMeter()};
  508. };

  509. //==============================
  510. // * Refresh Meter
  511. //==============================
  512. HPGaugeSprite.prototype.refreshMeter = function(sprite,value1,value2,h) {
  513.      var wd = value1 * sprite.w / value2
  514.          sprite.setFrame(0,sprite.h * h,wd,sprite.h);  
  515. };

  516. //==============================
  517. // * create Number
  518. //==============================
  519. HPGaugeSprite.prototype.createNumber = function() {
  520.         this._hp_number = [];
  521.         this._numberData = [this.battler().hp - 1,this._numberImg.width / 11,this._numberImg.height]
  522.         for (var i = 0; i < 6; i++) {
  523.                  this._hp_number[i] = new Sprite(this._numberImg);
  524.                  this._hp_number[i].visible = false;
  525.                  if (this.type === 0) {
  526.                      this._hp_number[i].x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_c_xa;
  527.                      this._hp_number[i].y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_c_ya;
  528.                  } else {
  529.                      this._hp_number[i].x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_c_x;
  530.                      this._hp_number[i].y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_c_y;
  531.                  };
  532.                  this._hp_number[i].org = [this._hp_number[i].x,this._hp_number[i].y];
  533.                  this.addChild(this._hp_number[i]);                 
  534.         };
  535. };

  536. //==============================
  537. // * update Number
  538. //==============================
  539. HPGaugeSprite.prototype.updateNumber = function() {
  540.         if (this._numberData[0] != this.battler().hp) {this.refreshNumber()};
  541. };

  542. //==============================
  543. // * enemy IDA
  544. //==============================
  545. HPGaugeSprite.prototype.enemyIDA = function() {
  546.          if (this.battler().isActor()) {return true};
  547.      return $gameSystem._hpGaugeEDef[this.battler()._enemyId];
  548. };

  549. //==============================
  550. // * ID available
  551. //==============================
  552. HPGaugeSprite.prototype.idIsAvailable = function() {
  553.         return this._IDA;
  554. };

  555. //==============================
  556. // * refresh Number
  557. //==============================
  558. HPGaugeSprite.prototype.refreshNumber = function() {
  559.         this._numberData[0] = this.update_dif(this._numberData[0],this.battler().hp, 40,0);
  560.     var w = this._numberData[1];
  561.         var h = this._numberData[2];
  562.         var number = Math.abs(this._numberData[0]).toString().split("");
  563.     for (var i = 0; i < this._hp_number.length; i++) {
  564.            this._hp_number[i].visible = false;         
  565.            if (this.idIsAvailable()) {       
  566.                    if (i <  number.length) {
  567.                            var n = Number(number[i]);
  568.                            this._hp_number[i].setFrame(n * w, 0, w, h);
  569.                            this._hp_number[i].visible = true;          
  570.                            this._hp_number[i].x = this._hp_number[i].org[0] + (w * i);
  571.                    };
  572.            } else {
  573.                    if (i === 0) {
  574.                            this._hp_number[0].setFrame(10 * w, 0, w, h);
  575.                            this._hp_number[0].visible = true;          
  576.                            this._hp_number[0].x = this._hp_number[0].org[0] + (w * 2);                             
  577.                    };
  578.            };
  579.     };       
  580. };

  581. //==============================
  582. // * Is Visible
  583. //==============================
  584. HPGaugeSprite.prototype.isVisible = function() {
  585.         if (!this.battler()) {return false};
  586.         if (this.battler().isHidden()) {return false};
  587.     if (!this.battler()._ehpgauge[0]) {return false};
  588.         return true;
  589. };

  590. //==============================
  591. // * force Visible
  592. //==============================
  593. HPGaugeSprite.prototype.forceVisible = function() {
  594.      if (this.battler()._ehpgauge[3]) {return true};
  595.          if (this._selectionHP && this.battler().isSelected() && !this.battler().isDead()) {return true};
  596.          return false;
  597. };

  598. //==============================
  599. // * pos X
  600. //==============================
  601. HPGaugeSprite.prototype.posX = function() {
  602.         var xs = this.forceVisible() ? 0 : this._slideX;
  603.     return this._sprite.x + xs + this.battler()._ehpgauge[1];
  604. };

  605. //==============================
  606. // * pos Y
  607. //==============================
  608. HPGaugeSprite.prototype.posY = function() {
  609.     return this._sprite.y + this.battler()._ehpgauge[2];
  610. };

  611. //==============================
  612. // * Update Slide
  613. //==============================
  614. HPGaugeSprite.prototype.updateSlide = function() {
  615.         this._slideX += 2;
  616.         this.opacity += 10;
  617.         if (this._slideX >= 0) {
  618.                 this._slideX = 0;
  619.                 this.opacity = 255;
  620.         };
  621. };

  622. //==============================
  623. // * Update Fade
  624. //==============================
  625. HPGaugeSprite.prototype.updateFade = function() {
  626.         if (this._slideA) {this._slideX += 2};
  627.         this.opacity -= 10;
  628. };

  629. //==============================
  630. // * Update Slide
  631. //==============================
  632. HPGaugeSprite.prototype.updateAnimation = function() {
  633.     if (this._slideX < 0) {this.updateSlide();return};
  634.         if (this._duration > 0) {this._duration--;return};
  635.         if (this.opacity > 0) {this.updateFade()};       
  636. };

  637. //==============================
  638. // * Update Force Visible
  639. //==============================
  640. HPGaugeSprite.prototype.updateForceVisible = function() {
  641.     this.opacity = 255;
  642.     this._duration = 0;
  643.     this._slideX = 0;
  644. };

  645. //==============================
  646. // * Update Position
  647. //==============================
  648. HPGaugeSprite.prototype.updatePosition = function() {
  649.    if (this.forceVisible()) {
  650.        this.updateForceVisible();
  651.    } else {
  652.            this.updateAnimation();
  653.    };
  654.    this.x = this.posX();
  655.    this.y = this.posY();
  656. };

  657. //==============================
  658. // * Update
  659. //==============================
  660. HPGaugeSprite.prototype.update = function() {
  661.     Sprite.prototype.update.call(this);
  662.         this.visible = this.isVisible();
  663.         if (!this.battler()) {return};
  664.         if (!this._layout && this._meterImg.isReady()) {this.createSprites()};
  665.         if (this._meter) {this.updateMeter()};
  666.         if (this._hp_number) {this.updateNumber()};
  667.     this.updatePosition();
  668. };
复制代码


点评

话说你这个脚本只是HP条..並不是BOSS的HP值脚本..  发表于 2017-10-11 13:38
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-10-11 13:41:42 | 显示全部楼层
  1. //=============================================================================
  2. // MOG_BossHP.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v2.1) Apresenta um medidor de HP para os chefes.
  6. * @author Moghunter
  7. *
  8. * @param Shake Effect
  9. * @desc Ativar o efeito tremer.
  10. * @default true
  11. *
  12. * @param HP Number Visible
  13. * @desc Apresentar o HP em numeros.
  14. * @default true
  15. *
  16. * @param Show Face
  17. * @desc Apresentar a face do inimigo.
  18. * @default true
  19. *
  20. * @param Slant Animation
  21. * @desc Ativar a animação de Flow no medidor de HP.
  22. * @default true
  23. *
  24. * @param Flow Speed
  25. * @desc Definição da velocidade da animação.
  26. * @default 4
  27. *  
  28. * @param Name Font Size
  29. * @desc Definição do tamanho da fonte.
  30. * @default 18
  31. *
  32. * @param Layout X-Axis
  33. * @desc Posição X-Axis do layout.
  34. * @default 150
  35. *
  36. * @param Layout Y-Axis
  37. * @desc Posição Y-Axis do layout.
  38. * @default 10
  39. *
  40. * @param BHP Name X-Axis
  41. * @desc Posição X-Axis do numero.
  42. * @default 36
  43. *
  44. * @param Name Y-Axis
  45. * @desc Posição Y-Axis do numero.
  46. * @default 23   
  47. *
  48. * @param Face X-Axis
  49. * @desc Posição X-Axis da face.
  50. * @default -50
  51. *
  52. * @param Face Y-Axis
  53. * @desc Posição Y-Axis da face.
  54. * @default 10   
  55. *
  56. * @param Meter X-Axis
  57. * @desc Posição X-Axis do medidor.
  58. * @default 22
  59. *
  60. * @param Meter Y-Axis
  61. * @desc Posição Y-Axis do medidor.
  62. * @default 28
  63. *
  64. * @param Number X-Axis
  65. * @desc Posição X-Axis do numero.
  66. * @default 460
  67. *
  68. * @param Number Y-Axis
  69. * @desc Posição Y-Axis do numero.
  70. * @default 32  
  71. *
  72. * @help  
  73. * =============================================================================
  74. * +++ MOG - Boss HP Meter (v2.1) +++
  75. * By Moghunter
  76. * [url]https://atelierrgss.wordpress.com/[/url]
  77. * =============================================================================
  78. * Apresenta um medidor de HP para os chefes.
  79. *
  80. * Serão necessários os arquivos. (img/bosshp/)
  81. *
  82. * Boss_HP_A.png
  83. * Boss_HP_A.png
  84. * Boss_HP_C.png
  85. *
  86. * =============================================================================
  87. * Use a Tag abaixo na caixa de notas para definir quais os inimigos terão o
  88. * medidor de chefe.
  89. *
  90. * Boss HP
  91. *
  92. * =============================================================================
  93. * FACE NAME
  94. * =============================================================================
  95. * Nomeie as faces dos inimigos da seguinte maneira.
  96. *
  97. * Face_ + ID.png
  98. *
  99. * EG
  100. *
  101. * Face_1.png
  102. * Face_2.png
  103. * Face_3.png
  104. * ....
  105. *
  106. * -----------------------------------------------------------------------------
  107. * Para definir a posição do medidor de HP use o seguinte comentário através do
  108. * comando PLUGIN COMMAND.
  109. *
  110. * boss_hp_position : X : Y
  111. *
  112. * X - Posição X-axis.
  113. * Y - Posição X-axis.
  114. *
  115. * -----------------------------------------------------------------------------
  116. * Para ocultar ou mostrar os numeros de HP use o seguinte comentário através do
  117. * comando PLUGIN COMMAND.
  118. *
  119. * boss_hp_number_hide
  120. * boss_hp_number_show
  121. *
  122. * -----------------------------------------------------------------------------
  123. * HISTÓRICO
  124. * -----------------------------------------------------------------------------
  125. * v2.1 - Compatibilidade com o Chrono Engine.
  126. * v2.0 - Opção de apresentar a Face do inimigo.
  127. *      - Adição da animação de flow.
  128. *
  129. */
  130.        
  131. //=============================================================================
  132. // ** PLUGIN PARAMETERS
  133. //=============================================================================
  134.   var Imported = Imported || {};
  135.   Imported.MOG_BossHP = true;
  136.   var Moghunter = Moghunter || {};

  137.    Moghunter.parameters = PluginManager.parameters('MOG_BossHP');
  138.         Moghunter.bosshp_flowAnimation = String(Moghunter.parameters['Slant Animation'] || "true");
  139.         Moghunter.bosshp_flowAnimationSpeed = Number(Moghunter.parameters['Flow Speed'] || 4);
  140.         Moghunter.bosshp_face = String(Moghunter.parameters['Show Face'] || "true");
  141.     Moghunter.bosshp_faceX = Number(Moghunter.parameters['Face X-Axis'] || -50);
  142.         Moghunter.bosshp_faceY = Number(Moghunter.parameters['Face Y-Axis'] || 10);
  143.     Moghunter.bosshp_layout_x = Number(Moghunter.parameters['Layout X-Axis'] || 150);
  144.     Moghunter.bosshp_layout_y = Number(Moghunter.parameters['Layout Y-Axis'] || 10)
  145.     Moghunter.bosshp_meter_x = Number(Moghunter.parameters['Meter X-Axis'] || 22);
  146.     Moghunter.bosshp_meter_y = Number(Moghunter.parameters['Meter Y-Axis'] || 28);       
  147.     Moghunter.bosshp_number_x = Number(Moghunter.parameters['Number X-Axis'] || 460);
  148.     Moghunter.bosshp_number_y = Number(Moghunter.parameters['Number Y-Axis'] || 32);
  149.     Moghunter.bosshp_name_x = Number(Moghunter.parameters['Name X-Axis'] || 36);
  150.     Moghunter.bosshp_name_y = Number(Moghunter.parameters['Name Y-Axis'] || 23);
  151.         Moghunter.bosshp_font_size = Number(Moghunter.parameters['Name Font Size'] || 18);
  152.         Moghunter.bosshp_shake_effect = String(Moghunter.parameters['Shake Effect'] || true);       
  153.         Moghunter.bosshp_hp_number_visible = String(Moghunter.parameters['HP Number Visible'] || true);


  154. //=============================================================================
  155. // ** ImageManager
  156. //=============================================================================

  157. //==============================
  158. // * Boss Hp
  159. //==============================
  160. ImageManager.loadBossHp = function(filename) {
  161.     return this.loadBitmap('img/bosshp/', filename, 0, true);
  162. };

  163.        
  164. //=============================================================================
  165. // ** Game_Temp
  166. //=============================================================================

  167. //==============================
  168. // * Initialize
  169. //==============================
  170. var _alias_mog_bosshp_temp_initialize = Game_Temp.prototype.initialize
  171. Game_Temp.prototype.initialize = function() {
  172.         _alias_mog_bosshp_temp_initialize.call(this);
  173.         this._battler_bhp_temp = [null,0,false,0];
  174.         this._battler_bhp_refresh = false;
  175.         this._battler_bhp_remove = false;
  176. };

  177. //=============================================================================
  178. // ** Game_System
  179. //=============================================================================

  180. //==============================
  181. // * Initialize
  182. //==============================
  183. var _alias_mog_bosshp_sys_initialize = Game_System.prototype.initialize
  184. Game_System.prototype.initialize = function() {
  185.         _alias_mog_bosshp_sys_initialize.call(this);
  186.         this._bosshp_data = [Moghunter.bosshp_layout_x,Moghunter.bosshp_layout_y,Moghunter.bosshp_hp_number_visible];
  187.         this._battler_bhp_oldNumber = [0,0];
  188.         this._chronoBossEnemy = null;
  189.         this._chronoBossMapID = 0;
  190. }

  191. //=============================================================================
  192. // ** Game_Interpreter
  193. //=============================================================================       

  194. //==============================
  195. // * PluginCommand
  196. //==============================
  197. var _alias_mog_bosshp_ex_pluginCommand = Game_Interpreter.prototype.pluginCommand
  198. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  199.         _alias_mog_bosshp_ex_pluginCommand.call(this,command, args)
  200.     this.setPluginCommandBossHP(command, args);
  201.         return true;
  202. };

  203. //==============================
  204. // * set Plugin Command Boss HP
  205. //==============================
  206. Game_Interpreter.prototype.setPluginCommandBossHP = function(command, args) {
  207.         if (command === "boss_hp_position")  { $gameSystem._bosshp_data[0] = args[1];
  208.              $gameSystem._bosshp_data[1] = args[3];};
  209.         if (command === "boss_hp_number_hide")  {$gameSystem._bosshp_data[2] = "false";};
  210.         if (command === "boss_hp_number_show")  {$gameSystem._bosshp_data[2] = "true";};
  211.         if (command === "boss_hp_erase")  {$gameTemp._battler_bhp_remove = "true";};
  212.         if (Imported.MOG_ChronoEngine) {
  213.                 if (command === "boss_set_event_battler_id")  {
  214.                         for (var i = 0; i < $gameMap.allEnemiesOnMap().length; i++) {
  215.                                 var ev = $gameMap.allEnemiesOnMap()[i];
  216.                                 var battler = ev.battler();;
  217.                                 if (battler._bosshp_meter) {
  218.                                     $gameSystem._chronoBossEnemy = battler;
  219.                                         $gameTemp._battler_bhp_refresh = true;
  220.                                         break
  221.                                 };
  222.                         };               
  223.                 };
  224.         };
  225. };

  226. //=============================================================================
  227. // ** BattleManager
  228. //=============================================================================

  229. //==============================
  230. // * processVictory
  231. //==============================
  232. var _alias_mog_bosshp_processVictory = BattleManager.processVictory;
  233. BattleManager.processVictory = function() {
  234.          $gameTemp._battler_bhp_temp[2] = true
  235.          _alias_mog_bosshp_processVictory.call(this);         
  236. };

  237. //==============================
  238. // * processAbort
  239. //==============================
  240. var _alias_mog_bosshp_processAbort = BattleManager.processAbort;
  241. BattleManager.processAbort = function() {
  242.          $gameTemp._battler_bhp_temp[2] = true
  243.          _alias_mog_bosshp_processAbort.call(this);         
  244. };

  245. //==============================
  246. // * processDefeat
  247. //==============================
  248. var _alias_mog_bosshp_processDefeat = BattleManager.processDefeat;
  249. BattleManager.processDefeat = function() {
  250.          $gameTemp._battler_bhp_temp[2] = true
  251.          _alias_mog_bosshp_processDefeat.call(this);         
  252. };

  253. //=============================================================================
  254. // ** Game Battler
  255. //=============================================================================

  256. //==============================
  257. // * Notetags
  258. //==============================
  259. Game_Battler.prototype.notetags = function() {
  260.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  261.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  262. };

  263. //==============================
  264. // * Appear
  265. //==============================
  266. var _mog_bhp_gbat_appear = Game_BattlerBase.prototype.appear;
  267. Game_BattlerBase.prototype.appear = function() {
  268.     _mog_bhp_gbat_appear.call(this);
  269.         $gameTemp._battler_bhp_refresh = true;
  270. };

  271. //=============================================================================
  272. // ** Game_Enemy
  273. //=============================================================================

  274. //==============================
  275. // * initMembers
  276. //==============================
  277. var _alias_mog_bosshp_initMembers = Game_Enemy.prototype.initMembers;
  278. Game_Enemy.prototype.initMembers = function() {
  279.         _alias_mog_bosshp_initMembers.call(this);
  280.         this._bosshp_meter = false;
  281. };

  282. //==============================
  283. // * Setup
  284. //==============================
  285. var _alias_mog_bosshp_setup = Game_Enemy.prototype.setup;
  286. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  287.         _alias_mog_bosshp_setup.call(this,enemyId, x, y);
  288.     this.checkBossHPnoteTag();       
  289. };

  290. //==============================
  291. // * Setup
  292. //==============================
  293. Game_Enemy.prototype.checkBossHPnoteTag = function() {
  294.         for (var i = 0; i < this.notetags().length; i++) {
  295.                 if (this.notetags()[i] == "Boss HP") {this._bosshp_meter = true};
  296.         };       
  297. };

  298. //==============================
  299. // * transform
  300. //==============================
  301. var _mog_bosshp_enemy_transform = Game_Enemy.prototype.transform;
  302. Game_Enemy.prototype.transform = function(enemyId) {
  303.         _mog_bosshp_enemy_transform.call(this,enemyId)
  304.     $gameTemp._battler_bhp_refresh = true;
  305.         this.checkBossHPnoteTag();       
  306. };
  307.        
  308. //=============================================================================
  309. // ** Game Action
  310. //=============================================================================

  311. //==============================
  312. // * Apply
  313. //==============================
  314. var _alias_mog_bosshp_apply = Game_Action.prototype.apply;
  315. Game_Action.prototype.apply = function(target) {
  316.          if (target.isEnemy() && target._bosshp_meter) {
  317.                  $gameTemp._battler_bhp_temp[1] = target.hp;
  318.              var old_hp = target.hp; $gameTemp._battler_bhp_temp[3] = 0
  319.          };
  320.          _alias_mog_bosshp_apply.call(this,target);
  321.          if (target.isEnemy() && target._bosshp_meter) {
  322.                  $gameTemp._battler_bhp_temp[0] = target;
  323.              if (old_hp > target.hp) {$gameTemp._battler_bhp_temp[3] = 60};
  324.          };
  325. };


  326. //=============================================================================
  327. // ** Scene Map
  328. //=============================================================================       

  329. //==============================
  330. // * Terminate
  331. //==============================
  332. var _mog_bossHP_smap_terminate = Scene_Map.prototype.terminate;
  333. Scene_Map.prototype.terminate = function() {
  334.         $gameSystem._chronoBossEnemy = null;
  335.         $gameSystem._chronoBossMapID = $gameMap._mapId;
  336.         if (this._spriteset && this._spriteset._bosshp_sprites) {
  337.                 var battler = this._spriteset._bosshp_sprites._battler;
  338.                 if (!battler.isDead()) {       
  339.                 $gameSystem._chronoBossEnemy = battler;
  340.                         $gameSystem._battler_bhp_oldNumber[0] = this._spriteset._bosshp_sprites._hp_data[2];
  341.                         $gameSystem._battler_bhp_oldNumber[1] = this._spriteset._bosshp_sprites._hp_data[6];
  342.                 };
  343.         };         
  344.     _mog_bossHP_smap_terminate.call(this);
  345. };

  346. //=============================================================================
  347. // ** Spriteset_Base
  348. //=============================================================================       

  349. //==============================
  350. // * Initialize
  351. //==============================
  352. var _mog_bossHPCN_sprBase_initialize = Sprite_Base.prototype.initialize;
  353. Sprite_Base.prototype.initialize = function() {
  354.    _mog_bossHPCN_sprBase_initialize.call(this);
  355.    if ($gameSystem._chronoBossMapID != $gameMap._mapId) {;
  356.        $gameSystem._chronoBossEnemy = null;
  357.            $gameSystem._chronoBossMapID = $gameMap._mapId;
  358.    };   
  359. };

  360. //==============================
  361. // * Create Boss HP Sprites
  362. //==============================
  363. Spriteset_Base.prototype.createBossHPGauge = function() {       
  364.         $gameTemp._battler_bhp_refresh = false;
  365.         var init_battler = this.checkBossHpEnemies();
  366.         this.removeBossHPGauge();
  367.         if (init_battler) {
  368.                 if (!this._bosshp_sprites) {
  369.           if (Imported.MOG_ChronoEngine) {
  370.                            this.removeBossHPGauge();
  371.                            this._bosshp_sprites = new Sprite_BossHP(init_battler);
  372.                            this._hudField.addChild(this._bosshp_sprites);                          
  373.                    } else {
  374.                            this._bosshp_sprites = new Sprite_BossHP(init_battler);
  375.                            this.addChild(this._bosshp_sprites);
  376.                    };
  377.                 };
  378.         };
  379. };

  380. //==============================
  381. // * Create Boss HP Sprites
  382. //==============================
  383. Spriteset_Base.prototype.checkBossHpEnemies = function() {
  384.         var boss = null;
  385.         if (Imported.MOG_ChronoEngine) {
  386.                 if ($gameSystem.isChronoMode()) {
  387.                         $gameMap.enemiesF().forEach(function(enemy) {
  388.                                  battler = enemy.battler()
  389.                                  if (battler._bosshp_meter) {boss = battler};
  390.                         },this);                       
  391.                 } else if ($gameSystem._chronoBossEnemy) {
  392.                      boss = $gameSystem._chronoBossEnemy;
  393.             };
  394.         } else {
  395.                 $gameTroop.members().forEach(function(enemy) {
  396.                                 if (enemy._bosshp_meter && !enemy.isHidden()) {boss = enemy};
  397.                 },this);
  398.         };
  399.         return boss;
  400. };

  401. //==============================
  402. // ** remove Boss HP Gauge
  403. //==============================
  404. Spriteset_Base.prototype.removeBossHPGauge = function() {
  405.         $gameTemp._battler_bhp_remove = false;
  406.         $gameSystem._chronoBossEnemy = null;
  407.         if (!this._bosshp_sprites) {return};
  408.         if (this._hudField) {
  409.                 this._hudField.removeChild(this._bosshp_sprites);
  410.         } else {
  411.             this.removeChild(this._bosshp_sprites);
  412.         };
  413.     this._bosshp_sprites = null;
  414. };

  415. //==============================
  416. // * Update
  417. //==============================
  418. var _mog_bosshp_SprtBase_update = Spriteset_Base.prototype.update;
  419. Spriteset_Base.prototype.update = function() {
  420.         _mog_bosshp_SprtBase_update.call(this);
  421.         if ($gameTemp._battler_bhp_refresh) {this.createBossHPGauge()};
  422.         if (!this._bosshp_sprites && $gameSystem._chronoBossEnemy) {
  423.              this.createBossHPGauge();
  424.         };
  425.         if ($gameTemp._battler_bhp_remove) {this.removeBossHPGauge()};
  426. };

  427. //=============================================================================
  428. // ** Spriteset_Battle
  429. //=============================================================================       

  430. //==============================
  431. // * CreateLowerLayer
  432. //==============================
  433. var _alias_mog_bosshp_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer
  434. Spriteset_Battle.prototype.createLowerLayer = function() {
  435.         _alias_mog_bosshp_createLowerLayer.call(this);
  436.         this.createBossHPGauge();
  437. };


  438. //=============================================================================
  439. // ** Sprite_BossHP
  440. //=============================================================================       
  441. function Sprite_BossHP() {
  442.     this.initialize.apply(this, arguments);
  443. }

  444. Sprite_BossHP.prototype = Object.create(Sprite.prototype);
  445. Sprite_BossHP.prototype.constructor = Sprite_BossHP;

  446. //==============================
  447. // * Initialize
  448. //==============================
  449. Sprite_BossHP.prototype.initialize = function(init_battler) {
  450.     Sprite.prototype.initialize.call(this);       
  451.         this._init = true;
  452.         $gameTemp._battler_bhp_temp = [init_battler,init_battler.hp,false,0];
  453.         this._flowAnimation = String(Moghunter.bosshp_flowAnimation) === "true" ? true : false;
  454.         this._battler = init_battler;
  455.         this._hp_data = [-1,-1,0,0,0,0,0,0,0,Number($gameSystem._bosshp_data[0]),Number($gameSystem._bosshp_data[1]),false,true];
  456.     this.createSprites();
  457.         if (String(Moghunter.bosshp_shake_effect) === "true") {this._hp_data[11] = true};
  458.         if (String($gameSystem._bosshp_data[2]) != "true") {this._hp_data[12] = false};
  459. };

  460. //==============================
  461. // * create Sprites
  462. //==============================
  463. Sprite_BossHP.prototype.createSprites = function() {
  464.     this.createLayout();
  465.     this.createHPMeter();
  466.         if (String(Moghunter.bosshp_face) === "true") {this.createFace()};
  467.         this.createHPNumber();
  468.     this.createName();
  469. };

  470. //==============================
  471. // * createLayout
  472. //==============================
  473. Sprite_BossHP.prototype.createLayout = function() {
  474.         this._layout = new Sprite(ImageManager.loadBossHp("Boss_HP_A"));
  475.         this._layout.x = this._hp_data[9];
  476.         this._layout.y = this._hp_data[10];
  477.         this._layout.opacity = 0;
  478.         this.addChild(this._layout);       
  479. };

  480. //==============================
  481. // * create Face
  482. //==============================
  483. Sprite_BossHP.prototype.createFace = function() {
  484.      this._face = new Sprite();
  485.          this.addChild(this._face);
  486.          this.refreshFace();
  487.          this.updateFace();
  488. };

  489. //==============================
  490. // * update Face
  491. //==============================
  492. Sprite_BossHP.prototype.updateFace = function() {
  493.          this._face.x = this._layout.x + Moghunter.bosshp_faceX;
  494.          this._face.y = this._layout.y + Moghunter.bosshp_faceY;
  495.          this._face.visible = this._layout.visible;
  496.          this._face.opacity = this._layout.opacity;
  497. };

  498. //==============================
  499. // * refresh Face
  500. //==============================
  501. Sprite_BossHP.prototype.refreshFace = function() {
  502.     this._face.bitmap = ImageManager.loadBossHp("Face_" + String(this._battler._enemyId));
  503. };

  504. //==============================
  505. // * create HP Meter
  506. //==============================
  507. Sprite_BossHP.prototype.createHPMeter = function() {
  508.         this._hp_meter_red = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
  509.         this._hp_meter_red.x = this._layout.x + Moghunter.bosshp_meter_x;
  510.         this._hp_meter_red.y = this._layout.y + Moghunter.bosshp_meter_y;
  511.         this._hp_meter_red.opacity = 0;
  512.         this._hp_meter_redFlow = [-1,0,0,0];
  513.         this._hp_meter_red.setFrame(0,0,1,1);       
  514.         this.addChild(this._hp_meter_red);
  515.         this._hp_meter_blue = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
  516.         this._hp_meter_blue.x = this._hp_meter_red.x;
  517.         this._hp_meter_blue.y = this._hp_meter_red.y;       
  518.         this._hp_meter_blue.opacity = 0;
  519.         this._hp_meter_blueFlow = [-1,0,0,0];
  520.         this._hp_meter_blue.setFrame(0,0,1,1);       
  521.         this.addChild(this._hp_meter_blue);
  522. };       

  523. //==============================
  524. // * create HP Number
  525. //==============================
  526. Sprite_BossHP.prototype.createHPNumber = function() {
  527.         this._hp_number = [];
  528.         this._hp_number_data = []
  529.         this._hp_number_img = ImageManager.loadBossHp("Boss_HP_C");
  530.         for (var i = 0; i < 9; i++) {
  531.                  this._hp_number[i] = new Sprite(this._hp_number_img);
  532.                  this._hp_number[i].visible = false;
  533.                  this._hp_number[i].opacity = 0;
  534.                  this._hp_number[i].x = this._layout.x + Moghunter.bosshp_number_x;
  535.                  this._hp_number[i].y = this._layout.y + Moghunter.bosshp_number_y;
  536.                  this._hp_number_data[i] = 0;
  537.                  this.addChild(this._hp_number[i]);                 
  538.         };
  539. };

  540. //==============================
  541. // * create Name
  542. //==============================
  543. Sprite_BossHP.prototype.createName = function() {
  544.         this._name = new Sprite(new Bitmap(300,48));
  545.         this.addChild(this._name);
  546.         this._name.bitmap.fontSize = Moghunter.bosshp_font_size;
  547.         this.refresh_name();
  548.         this._name.x = this._layout.x + Moghunter.bosshp_name_x;
  549.         this._name.y = this._layout.y + Moghunter.bosshp_name_y;
  550.         this._name.opacity = 0;
  551. };

  552. //==============================
  553. // * get Sprite Data
  554. //==============================
  555. Sprite_BossHP.prototype.getSpriteData = function() {
  556.             this._hp_meter_blueFlow[0] = this._flowAnimation ? (this._hp_meter_blue.bitmap.width / 3) : this._hp_meter_blue.bitmap.width;
  557.                 this._hp_meter_blueFlow[1] = this._hp_meter_blue.bitmap.height;
  558.                 this._hp_meter_blueFlow[2] = this._hp_meter_blueFlow[0] * 2;
  559.                 this._hp_meter_blueFlow[3] = 0;
  560.             this._hp_meter_redFlow[0] = this._flowAnimation ? (this._hp_meter_red.bitmap.width / 3) : this._hp_meter_red.bitmap.width;
  561.                 this._hp_meter_redFlow[1] = this._hp_meter_red.bitmap.height;
  562.                 this._hp_meter_redFlow[2] = this._hp_meter_redFlow[0] * 2;
  563.                 this._hp_meter_redFlow[3] = 0;               
  564. };

  565. //==============================
  566. // * Update
  567. //==============================
  568. Sprite_BossHP.prototype.update = function() {
  569.     Sprite.prototype.update.call(this);       
  570.         if (this._hp_meter_blueFlow[0] === -1) {
  571.             if (this._layout.bitmap.isReady()) {
  572.                         this.getSpriteData();
  573.                 } else {
  574.                         return
  575.                 };
  576.     };
  577.         if (this._flowAnimation) {this.updateFlowAnimation()};
  578.         if ($gameTemp._battler_bhp_temp[3] != 0) {this.refreshShake()};
  579.         if (this.need_onSkillCancelites()) {this.onSkillCancelites(5)} else {this.onSkillCancelites(-5)};
  580.         if ($gameTemp._battler_bhp_temp[0] != this._battler) {this.refresh_all();        };
  581.         if (this._flowAnimation) {
  582.             this.refresh_blue_meter();
  583.         } else if (this._hp_data[0] != this._battler.hp || this._hp_data[1] != this._battler.mhp) {
  584.                 this.refresh_blue_meter();
  585.         };
  586.         if (this._hp_data[2] != this._battler.hp) {this.refresh_red_meter();};
  587.         if (this._hp_data[6] != this._battler.hp) {this.update_hp_number();};
  588.         if (this._hp_data[11]) {this.update_shake_effect();};
  589.         if (this._face) {this.updateFace()};
  590.         this._init = false;
  591. };

  592. //==============================
  593. // * refresh Shake
  594. //==============================
  595. Sprite_BossHP.prototype.refreshShake = function() {
  596.         this._hp_data[7] = $gameTemp._battler_bhp_temp[3];
  597.         $gameTemp._battler_bhp_temp[3] = 0;
  598. };

  599. //==============================
  600. // * Update Flow Animation
  601. //==============================
  602. Sprite_BossHP.prototype.updateFlowAnimation = function() {
  603.     this._hp_meter_blueFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
  604.         if (this._hp_meter_blueFlow[3] > this._hp_meter_blueFlow[2]) {
  605.                 this._hp_meter_blueFlow[3] = 0;
  606.         };
  607.     this._hp_meter_redFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
  608.         if (this._hp_meter_redFlow[3] > this._hp_meter_redFlow[2]) {
  609.                 this._hp_meter_redFlow[3] = 0;
  610.         };       
  611. };

  612. //==============================
  613. // * Update Shake Effect
  614. //==============================
  615. Sprite_BossHP.prototype.update_shake_effect = function() {
  616.     if (this._hp_data[7] <= 0) {return;};
  617.         this._hp_data[7] -= 1;
  618.         this._layout.y = -3 + this._hp_data[10] + Math.floor(Math.random() * 6);
  619.         if (this._hp_data[7] <= 0) {this._layout.y = this._hp_data[10]};
  620. };

  621. //==============================
  622. // * Update HP Number
  623. //==============================
  624. Sprite_BossHP.prototype.update_hp_number = function() {
  625.           if (!this._hp_data[12]) {return};
  626.           if (this._init && $gameSystem._battler_bhp_oldNumber[1] != 0) {
  627.                   this._hp_data[6] = $gameSystem._battler_bhp_oldNumber[1];
  628.                   $gameSystem._battler_bhp_oldNumber[1] = 0;
  629.           };          
  630.       var nspd = 1 + Math.floor((Math.abs(this._hp_data[6] - this._battler.hp) / 30))
  631.       if (this._hp_data[6] < this._battler.hp) {
  632.                   this._hp_data[6] += nspd;
  633.                   if (this._hp_data[6] > this._battler.hp) {this._hp_data[6] = this._battler.hp};
  634.           }
  635.           else if (this._hp_data[6] > this._battler.hp) {
  636.                   this._hp_data[6] -= nspd;
  637.                   if (this._hp_data[6] < this._battler.hp) {this._hp_data[6] = this._battler.hp};
  638.           };
  639.           this.refresh_hp_number();
  640. };
  641.           
  642. //==============================
  643. // * Refresh HP Number
  644. //==============================
  645. Sprite_BossHP.prototype.refresh_hp_number = function() {
  646.    var w = this._hp_number_img.width / 10;
  647.    var h = this._hp_number_img.height;       
  648.    //$gameMessage.add(this._hp_number.length)
  649.    this._hp_data[4] = Math.abs(this._hp_data[6]).toString().split("");  
  650.    if (this._hp_data[4].length > this._hp_number.length) {return};
  651.    if (this._hp_data[4].length != this._hp_data[5]) {
  652.            for (var i = 0; i < 9) {this._hp_number[i].visible = false};this._hp_data[5] = this._hp_data[4].length};
  653.    for (var i = 0; i < this._hp_data[4].length; i++) {
  654.            var n = Number(this._hp_data[4][i]);
  655.            this._hp_number[i].setFrame(n * w, 0, w, h);
  656.            this._hp_number[i].visible = true;          
  657.            var nx = -(w * i) + (w * this._hp_data[4].length)
  658.            this._hp_number[i].x = (this._layout.x + Moghunter.bosshp_number_x) - nx;
  659.    };
  660. };

  661. //==============================
  662. // * Refresh Name
  663. //==============================
  664. Sprite_BossHP.prototype.refresh_name = function() {
  665.         this._name.bitmap.clear();
  666.         this._name.bitmap.drawText(this._battler.enemy().name, 0, 0, this._name.bitmap.width, this._name.bitmap.height,0);       
  667. };

  668. //==============================
  669. // * Need Fade Sprites
  670. //==============================
  671. Sprite_BossHP.prototype.need_onSkillCancelites = function() {
  672.         if ($gameMessage.isBusy()) {return true} ;       
  673.         if ($gameTemp._battler_bhp_temp[2]) {return true} ;
  674.         if (!this._battler) {return true} ;
  675.         if (this._battler.isDead()) {return true};
  676.         return false;
  677. };

  678. //==============================
  679. // * Fade Sprites
  680. //==============================
  681. Sprite_BossHP.prototype.onSkillCancelites = function(value) {
  682.         if (this._init) {
  683.            this._layout.opacity = 255;
  684.            this._hp_meter_blue.opacity = this._layout.opacity;
  685.            this._hp_meter_red.opacity = this._layout.opacity;
  686.            this._name.opacity = this._layout.opacity;
  687.            for (var i = 0; i < 9; i++) {this._hp_number[i].opacity = this._layout.opacity};       
  688.            return       
  689.         };
  690.         this._layout.opacity -= value;
  691.         this._hp_meter_blue.opacity = this._layout.opacity;
  692.         this._hp_meter_red.opacity = this._layout.opacity;
  693.         this._name.opacity = this._layout.opacity;
  694.         for (var i = 0; i < 9; i++) {this._hp_number[i].opacity -= value};
  695. };

  696. //==============================
  697. // * Refresh All
  698. //==============================
  699. Sprite_BossHP.prototype.refresh_all = function() {
  700.          this._battler = $gameTemp._battler_bhp_temp[0];
  701.          this._hp_data[2] = $gameTemp._battler_bhp_temp[1];
  702.          this._hp_data[6] = $gameTemp._battler_bhp_temp[1];  
  703.          this.refresh_hp_number();  
  704.          this.refresh_blue_meter();
  705.          this.refresh_red_meter();
  706.          this.refresh_name();
  707.          if (this._face) {this.refreshFace()};
  708. };

  709. //==============================
  710. // * Refresh Blue Meter
  711. //==============================
  712. Sprite_BossHP.prototype.refresh_blue_meter = function() {
  713.          this._hp_data[0] = this._battler.hp;
  714.          this._hp_data[1] = this._battler.mhp;
  715.      this._layout.y = this._hp_data[10]         
  716.          var meter_rate = this._hp_meter_blueFlow[0] * this._battler.hp / this._battler.mhp;
  717.          this._hp_meter_blue.setFrame(this._hp_meter_blueFlow[3], 0, meter_rate, this._hp_meter_blue.bitmap.height / 2);
  718. };

  719. //==============================
  720. // * Refresh Red Meter
  721. //==============================
  722. Sprite_BossHP.prototype.refresh_red_meter = function() {
  723.           if (this._init) {
  724.                   if ($gameSystem._battler_bhp_oldNumber[0] != 0) {
  725.                       this._hp_data[2] = $gameSystem._battler_bhp_oldNumber[0];
  726.                       $gameSystem._battler_bhp_oldNumber[0] = 0;
  727.                   } else {
  728.                         this._hp_data[2] = this._battler.mhp;                       
  729.                   };
  730.          };               
  731.           var dnspeed = 1 + (Math.abs(this._hp_data[2] - this._battler.hp) / 160);
  732.           if (this._hp_data[2] > this._battler.hp) {this._hp_data[2] -= dnspeed;
  733.                   if (this._hp_data[2] < this._battler.hp) {this._hp_data[2] = this._battler.hp};}
  734.           else if (this._hp_data[2] < this._battler.hp) {this._hp_data[2]  += dnspeed;
  735.                   if (this._hp_data[2]  > this._battler.hp) {this._hp_data[2]  = this._battler.hp};                       
  736.           };
  737.          var meter_rate = this._hp_meter_redFlow[0] * this._hp_data[2] / this._battler.mhp;
  738.          this._hp_meter_red.setFrame(this._hp_meter_redFlow[3], this._hp_meter_red.bitmap.height / 2, meter_rate, this._hp_meter_red.bitmap.height / 2);       
  739. };
复制代码

点评

扯远了 这个血条你知道在哪里修改不、。、、、  发表于 2017-10-11 22:07
芯大的血条和MOG 血条有冲突 我该怎么办呢  发表于 2017-10-11 22:07
这是新的血条 BOSS血条我重新找芯大做了一条 可惜工资一直没发 使用权我还没有  发表于 2017-10-11 22:06
...BOSS血条很久 就解决了  发表于 2017-10-11 22:05
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-10-12 10:01:20 | 显示全部楼层
本帖最后由 soulsaga 于 2017-10-12 10:12 编辑
soulsaga 发表于 2017-10-11 13:41
//=============================================================================
// MOG_BossHP.js
//= ...

不是说了for (var i = 0; i < 6; i++) {里面的6么..亲测有效啊..


MVHP.png

点评

谢谢 估计跟我定制的血条 出问题了O(∩_∩)O谢谢  发表于 2017-10-14 22:13

评分

参与人数 2星屑 +50 赞 +1 收起 理由
余烬之中 + 50 认可答案
j296196585 + 1 认可答案

查看全部评分

回复 0 1

使用道具 举报

梦石
0
星屑
13
在线时间
0 小时
注册时间
2017-10-14
回帖
5
发表于 2017-10-14 15:48:42 | 显示全部楼层
你这个是横版战斗嘛?人物攻击是动态的,还是原地不动的那种?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部