查看: 3665|回复: 2

[有事请教] 新手求教

[复制链接]
梦石
0
星屑
84
在线时间
11 小时
注册时间
2018-8-6
回帖
10
发表于 2018-10-7 00:29:09 | 显示全部楼层 |阅读模式

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

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

×
问一下请问有没有显示怪物血量的插件?还有插件到底怎么用,为什么我下载了一个时间插件打开后什么都没有发生呢?
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2018-10-7 00:48:06 | 显示全部楼层
本帖最后由 j296196585 于 2018-10-7 00:54 编辑

MOG系列
  1. //=============================================================================
  2. // MOG_HPGauge.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.2) 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.2) +++
  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. * HISTÓRICO
  122. * =============================================================================
  123. * (v1.2) - Correção de apresentar o HP dos aliados no modo batalha frontal.
  124. *        - Melhoria na codificação e na compatibilidade de plugins.
  125. */

  126. //=============================================================================
  127. // ** PLUGIN PARAMETERS
  128. //=============================================================================
  129.   var Imported = Imported || {};
  130.   Imported.MOG_HPGauge = true;
  131.   var Moghunter = Moghunter || {};

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

  153. //=============================================================================
  154. // ** Game_Temp
  155. //=============================================================================

  156. //==============================
  157. // * Initialize
  158. //==============================
  159. var _mog_hpgauge_temp_initialize = Game_Temp.prototype.initialize;
  160. Game_Temp.prototype.initialize = function() {
  161.         _mog_hpgauge_temp_initialize.call(this);
  162.     this._hpGauge = [true,false];
  163. };

  164. //=============================================================================
  165. // ** Game_System
  166. //=============================================================================

  167. //==============================
  168. // * Initialize
  169. //==============================
  170. var _mog_hpgauge_sys_initialize = Game_System.prototype.initialize;
  171. Game_System.prototype.initialize = function() {
  172.         _mog_hpgauge_sys_initialize.call(this);
  173.     this._hpGaugeEDef = [];
  174. };

  175. //=============================================================================
  176. // ** BattleManager
  177. //=============================================================================

  178. //==============================
  179. // * processVictory
  180. //==============================
  181. var _mog_hpGauge_processVictory = BattleManager.processVictory;
  182. BattleManager.processVictory = function() {
  183.          $gameTemp._hpGauge[0] = false;
  184.          _mog_hpGauge_processVictory.call(this);         
  185. };

  186. //==============================
  187. // * processAbort
  188. //==============================
  189. var _mog_hpGauge_processAbort = BattleManager.processAbort;
  190. BattleManager.processAbort = function() {
  191.          $gameTemp._hpGauge[0] = false;
  192.          _mog_hpGauge_processAbort.call(this);         
  193. };

  194. //==============================
  195. // * processDefeat
  196. //==============================
  197. var _mog_hpGauge_processDefeat = BattleManager.processDefeat;
  198. BattleManager.processDefeat = function() {
  199.          $gameTemp._hpGauge[0] = false;
  200.          _mog_hpGauge_processDefeat.call(this);         
  201. };

  202. //=============================================================================
  203. // ** Game Battler
  204. //=============================================================================

  205. //==============================
  206. // * init Members
  207. //==============================
  208. var _mog_hpgauge_gbat_initMembers = Game_Battler.prototype.initMembers;
  209. Game_Battler.prototype.initMembers = function() {
  210.     _mog_hpgauge_gbat_initMembers.call(this);
  211.     this._ehpgauge = [false,0,0,false,false];
  212. };

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

  227. //==============================
  228. // * Notetags
  229. //==============================
  230. Game_Battler.prototype.notetags = function() {
  231.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  232.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  233. };

  234. //=============================================================================
  235. // ** Game_Actor
  236. //=============================================================================

  237. //==============================
  238. // * Setup
  239. //==============================
  240. var _mog_hp_gauge_gactor_setup = Game_Actor.prototype.setup;
  241. Game_Actor.prototype.setup = function(actorId) {
  242.         _mog_hp_gauge_gactor_setup.call(this,actorId);
  243.         if (String(Moghunter.hpgauge_actors) === "true") {this._ehpgauge[0] = true};
  244.         this.checkHPGaugeNotes();
  245. };

  246. //=============================================================================
  247. // ** Game_Enemy
  248. //=============================================================================

  249. //==============================
  250. // * Setup
  251. //==============================
  252. var _mog_hpgauge_genemy_setup = Game_Enemy.prototype.setup;
  253. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  254.         _mog_hpgauge_genemy_setup.call(this,enemyId, x, y);
  255.         if (String(Moghunter.hpgauge_enemies) === "true") {this._ehpgauge[0] = true};
  256.         this.checkHPGaugeNotes();
  257. };

  258. //==============================
  259. // * Die
  260. //==============================
  261. var _mog_hpgauge_genemy_die = Game_Enemy.prototype.die;
  262. Game_Enemy.prototype.die = function() {
  263.         _mog_hpgauge_genemy_die.call(this);
  264.         $gameSystem._hpGaugeEDef[this._enemyId] = true;
  265. };

  266. //=============================================================================
  267. // ** Game Action
  268. //=============================================================================

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

  285. //=============================================================================
  286. // ** Spriteset_Battle
  287. //=============================================================================       

  288. //==============================
  289. // * Create Lower Layer
  290. //==============================
  291. var _mog_hpGauge_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer;
  292. Spriteset_Battle.prototype.createLowerLayer = function() {
  293.         _mog_hpGauge_createLowerLayer.call(this);
  294.         this.create_HPGauge();
  295. };

  296. //==============================
  297. // * Create HP Gauge
  298. //==============================
  299. Spriteset_Battle.prototype.create_HPGauge = function() {
  300.     this.createHPField();
  301.         this.createHPSprites()
  302. };

  303. //==============================
  304. // * Create EHP Field
  305. //==============================
  306. Spriteset_Battle.prototype.createHPField = function() {
  307.     this._hpField = new Sprite();
  308.         this._hpField.z = 100;
  309.         this.addChild(this._hpField);
  310. };

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

  330. //==============================
  331. // * Update
  332. //==============================
  333. var _mog_hpGauge_sprBat_update = Spriteset_Battle.prototype.update;
  334. Spriteset_Battle.prototype.update = function() {
  335.         _mog_hpGauge_sprBat_update.call(this);
  336.         if (Imported.MOG_BattleCamera && this._hpField) {this.updateHPField()};
  337. };

  338. //==============================
  339. // * Update
  340. //==============================
  341. Spriteset_Battle.prototype.updateHPField = function() {
  342.     this._hpField.x = this._battleField.x
  343.         this._hpField.y = this._battleField.y
  344. };

  345. //=============================================================================
  346. // ** HP Gauge Sprite
  347. //=============================================================================
  348. function HPGaugeSprite() {
  349.     this.initialize.apply(this, arguments);
  350. };

  351. HPGaugeSprite.prototype = Object.create(Sprite.prototype);
  352. HPGaugeSprite.prototype.constructor = HPGaugeSprite;

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

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

  397. //==============================
  398. // * createSprites
  399. //==============================
  400. HPGaugeSprite.prototype.createSprites = function() {
  401.         this.createLayout();
  402.         this.createMeter();
  403.         if (this._showHPNumber) {this.createNumber()};
  404. };

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

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

  444. //==============================
  445. // * Need Refresh Blue Meter
  446. //==============================
  447. HPGaugeSprite.prototype.needRefreshBlueMeter = function() {
  448.         if (this.battler()._ehpgauge[4]) {return true};
  449.     if (this._meter[1].value1 != this.battler().hp) {return true};
  450.         if (this._meter[1].value2 != this.battler().mhp) {return true};
  451.         return false
  452. };

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

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

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

  493. //==============================
  494. // * Need Refresh Red Meter
  495. //==============================
  496. HPGaugeSprite.prototype.needRefreshRedMeter = function() {
  497.      if (this._meter[0].value1 != this.battler().hp) {return true};
  498.          return false;
  499. };

  500. //==============================
  501. // * refresh Red Meter
  502. //==============================
  503. HPGaugeSprite.prototype.refreshRedMeter = function() {
  504.            this._meter[0].value1 = this.update_dif(this._meter[0].value1,this.battler().hp, 60,1);
  505.          this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  506. };

  507. //==============================
  508. // * Update Meter
  509. //==============================
  510. HPGaugeSprite.prototype.updateMeter = function() {
  511.          if (this.needRefreshRedMeter()) {this.refreshRedMeter()};
  512.          if (this.needRefreshBlueMeter()) {this.refreshBlueMeter()};
  513. };

  514. //==============================
  515. // * Refresh Meter
  516. //==============================
  517. HPGaugeSprite.prototype.refreshMeter = function(sprite,value1,value2,h) {
  518.      var wd = value1 * sprite.w / value2
  519.          sprite.setFrame(0,sprite.h * h,wd,sprite.h);  
  520. };

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

  541. //==============================
  542. // * update Number
  543. //==============================
  544. HPGaugeSprite.prototype.updateNumber = function() {
  545.         if (this._numberData[0] != this.battler().hp) {this.refreshNumber()};
  546. };

  547. //==============================
  548. // * enemy IDA
  549. //==============================
  550. HPGaugeSprite.prototype.enemyIDA = function() {
  551.          if (this.battler().isActor()) {return true};
  552.      return $gameSystem._hpGaugeEDef[this.battler()._enemyId];
  553. };

  554. //==============================
  555. // * ID available
  556. //==============================
  557. HPGaugeSprite.prototype.idIsAvailable = function() {
  558.         return this._IDA;
  559. };

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

  586. //==============================
  587. // * Is Visible
  588. //==============================
  589. HPGaugeSprite.prototype.isVisible = function() {
  590.         if (!this.battler()) {return false};
  591.         if (this.battler().isHidden()) {return false};
  592.     if (!this.battler()._ehpgauge[0]) {return false};
  593.         if (this.type === 0 && !$gameSystem.isSideView()) {
  594.                 return false;
  595.         };
  596.         return true;
  597. };

  598. //==============================
  599. // * force Visible
  600. //==============================
  601. HPGaugeSprite.prototype.forceVisible = function() {
  602.      if (this.battler()._ehpgauge[3]) {return true};
  603.          if (this._selectionHP && this.battler().isSelected() && !this.battler().isDead()) {return true};
  604.          return false;
  605. };

  606. //==============================
  607. // * pos X
  608. //==============================
  609. HPGaugeSprite.prototype.posX = function() {
  610.         var xs = this.forceVisible() ? 0 : this._slideX;
  611.     return this._sprite.x + xs + this.battler()._ehpgauge[1];
  612. };

  613. //==============================
  614. // * pos Y
  615. //==============================
  616. HPGaugeSprite.prototype.posY = function() {
  617.     return this._sprite.y + this.battler()._ehpgauge[2];
  618. };

  619. //==============================
  620. // * Update Slide
  621. //==============================
  622. HPGaugeSprite.prototype.updateSlide = function() {
  623.         this._slideX += 2;
  624.         this.opacity += 10;
  625.         if (this._slideX >= 0) {
  626.                 this._slideX = 0;
  627.                 this.opacity = 255;
  628.         };
  629. };

  630. //==============================
  631. // * Update Fade
  632. //==============================
  633. HPGaugeSprite.prototype.updateFade = function() {
  634.         if (this._slideA) {this._slideX += 2};
  635.         this.opacity -= 10;
  636. };

  637. //==============================
  638. // * Update Slide
  639. //==============================
  640. HPGaugeSprite.prototype.updateAnimation = function() {
  641.     if (this._slideX < 0) {this.updateSlide();return};
  642.         if (this._duration > 0) {this._duration--;return};
  643.         if (this.opacity > 0) {this.updateFade()};       
  644. };

  645. //==============================
  646. // * Update Force Visible
  647. //==============================
  648. HPGaugeSprite.prototype.updateForceVisible = function() {
  649.     this.opacity = 255;
  650.     this._duration = 0;
  651.     this._slideX = 0;
  652. };

  653. //==============================
  654. // * Update Position
  655. //==============================
  656. HPGaugeSprite.prototype.updatePosition = function() {
  657.    if (this.forceVisible()) {
  658.        this.updateForceVisible();
  659.    } else {
  660.            this.updateAnimation();
  661.    };
  662.    this.x = this.posX();
  663.    this.y = this.posY();
  664. };

  665. //==============================
  666. // * Update
  667. //==============================
  668. HPGaugeSprite.prototype.update = function() {
  669.     Sprite.prototype.update.call(this);
  670.         this.visible = this.isVisible();
  671.         if (!this.battler()) {return};
  672.         if (!this._layout && this._meterImg.isReady()) {this.createSprites()};
  673.         if (this._meter) {this.updateMeter()};
  674.         if (this._hp_number) {this.updateNumber()};
  675.     this.updatePosition();
  676. };
复制代码
更多图片 小图 大图
组图打开中,请稍候......
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

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

开拓者

发表于 2018-10-7 01:02:36 | 显示全部楼层
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部