查看: 4732|回复: 0

[已经解决] YEP插件YEP_X_VisualHpGauge的问题

[复制链接]
梦石
0
星屑
342
在线时间
101 小时
注册时间
2013-9-10
回帖
35
发表于 2016-6-19 17:23:50 | 显示全部楼层 |阅读模式

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

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

×
YEP_X_VisualHpGauge这个插件用来显示敌人的hp,请问如何实现显示敌人的mp或tp

自己尝试替换代码中的HP Hp hp为MP Mp mp无法实现(想想也不会这么简单)

  1. //=============================================================================
  2. // Yanfly Engine Plugins - Battle Engine Extension - Visual HP Gauge
  3. // YEP_X_VisualHpGauge.js
  4. //=============================================================================

  5. var Imported = Imported || {};
  6. Imported.YEP_X_VisualHpGauge = true;

  7. var Yanfly = Yanfly || {};
  8. Yanfly.VHG = Yanfly.VHG || {};

  9. //=============================================================================
  10. /*:
  11. * @plugindesc v1.03 (Requires YEP_BattleEngineCore.js) Reveal HP Gauges
  12. * when a battler is selected or takes damage in battle.
  13. * @author Yanfly Engine Plugins
  14. *
  15. * @param ---General---
  16. * @default
  17. *
  18. * @param Display Actor
  19. * @desc Do you wish to display the HP Gauge for actors?
  20. * NO - false     YES - true
  21. * @default true
  22. *
  23. * @param Defeat First
  24. * @desc Enemies must be defeated first before showing the HP Gauge.
  25. * NO - false     YES - true
  26. * @default false
  27. *
  28. * @param Always Visible
  29. * @desc HP Gauge is always visible and doesn't fade away.
  30. * NO - false     YES - true
  31. * @default false
  32. *
  33. * @param ---Appearance---
  34. * @default
  35. *
  36. * @param Minimum Gauge Width
  37. * @desc This is the minimum width in pixels for HP Gauges.
  38. * @default 144
  39. *
  40. * @param Gauge Height
  41. * @desc This is the height in pixels for HP Gauges.
  42. * @default 18
  43. *
  44. * @param Back Color
  45. * @desc This is the text color used for the back of HP Gauges.
  46. * @default 19
  47. *
  48. * @param HP Color 1
  49. * @desc This is the text color used for the 1st part of HP Gauges.
  50. * @default 20
  51. *
  52. * @param HP Color 2
  53. * @desc This is the text color used for the 2nd part of HP Gauges.
  54. * @default 21
  55. *
  56. * @param Gauge Duration
  57. * @desc This is the frames the HP gauge will continue to show after
  58. * it finishes draining or filling.
  59. * @default 30
  60. *
  61. * @param Gauge Position
  62. * @desc Where do you wish to show the HP gauge?
  63. * BELOW - false     ABOVE - true
  64. * @default false
  65. *
  66. * @param Y Buffer
  67. * @desc How much do you wish to shift the gauge Y position?
  68. * @default -16
  69. *
  70. * @param Use Thick Gauges
  71. * @desc Use the thick gauges provided by this plugin?
  72. * Default - false     Thick - true
  73. * @default true
  74. *
  75. * @param ---Text Display---
  76. * @default
  77. *
  78. * @param Show HP
  79. * @desc Show the actual 'HP' text.
  80. * NO - false     YES - true
  81. * @default false
  82. *
  83. * @param Show Value
  84. * @desc Show the HP value.
  85. * NO - false     YES - true
  86. * @default false
  87. *
  88. * @param Show Max
  89. * @desc Show the MaxHP value if value is shown?
  90. * NO - false     YES - true
  91. * @default false
  92. *
  93. * @help
  94. * ============================================================================
  95. * Introduction
  96. * ============================================================================
  97. *
  98. * This plugin requires YEP_BattleEngineCore.
  99. * Make sure this plugin is located under YEP_BattleEngineCore in the plugin
  100. * list.
  101. *
  102. * This plugin shows the HP Gauges of enemies as they're selected or while they
  103. * take damage. You can also opt for actors to show their HP Gauge as well.
  104. * Adjust the parameters to change the way you want the HP Gauges to appear.
  105. *
  106. * By default, enemies would need to be defeated first in order for the gauges
  107. * to show up. This can be changed within the parameter settings. However,
  108. * during battle test, the HP gauges are always shown unless the enemy has a
  109. * hidden HP gauge.
  110. *
  111. * ============================================================================
  112. * Notetags
  113. * ============================================================================
  114. *
  115. * Class and Enemy Notetags:
  116. *   <Hide HP Gauge>
  117. *   This HP gauge will always be hidden if this notetag is present.
  118. *
  119. *   <Show HP Gauge>
  120. *   This HP gauge will always be shown if this notetag is present while the
  121. *   target is selected or taking damage.
  122. *
  123. *   <HP Gauge Width: x>
  124. *   This will set the battler's HP Gauge width to x pixels. However, if this
  125. *   width is less than the minimum width, minimum width will take priority.
  126. *
  127. *   <HP Gauge Height: x>
  128. *   This set's the HP Gauge height to x pixels.
  129. *
  130. *   <HP Gauge Back Color: x>
  131. *   This changes the HP Gauge's back color to x text color.
  132. *
  133. *   <HP Gauge Color 1: x>
  134. *   This changes the HP Gauge's color 1 to x text color.
  135. *
  136. *   <HP Gauge Color 2: x>
  137. *   This changes the HP Gauge's color 2 to x text color.
  138. *
  139. * ============================================================================
  140. * Changelog
  141. * ============================================================================
  142. *
  143. * Version 1.03:
  144. * - Fixed a bug when Escape skill-effects are used on battlers.
  145. *
  146. * Version 1.02:
  147. * - Fixed a bug with gauge height not adjusting.
  148. *
  149. * Version 1.01b:
  150. * - Fixed a bug regarding dependancy checks.
  151. * - Fixed many bugs regarding stacking errors.
  152. *
  153. * Version 1.01:
  154. * - Rewrote the good majority of plugin to accomodate the following features:
  155. * ---'Always Visible' parameter.
  156. * ---'Gauge Position' parameter.
  157. * ---'Y Buffer' parameter.
  158. * ---'Use Thick Gauges' parameter.
  159. * ---'Show HP' parameter.
  160. * ---'Show Value' parameter.
  161. * ---'Show Max' parameter.
  162. *
  163. * Version 1.00:
  164. * - Finished Plugin!
  165. */
  166. //=============================================================================

  167. if (Imported.YEP_BattleEngineCore) {

  168. //=============================================================================
  169. // Parameter Variables
  170. //=============================================================================

  171. Yanfly.Parameters = PluginManager.parameters('YEP_X_VisualHpGauge');
  172. Yanfly.Param = Yanfly.Param || {};

  173. Yanfly.Param.VHGDisplayActor = String(Yanfly.Parameters['Display Actor']);
  174. Yanfly.Param.VHGDefeatFirst = String(Yanfly.Parameters['Defeat First']);
  175. Yanfly.Param.VHGAlwaysShow = eval(String(Yanfly.Parameters['Always Visible']));

  176. Yanfly.Param.VHGMinHpWidth = Number(Yanfly.Parameters['Minimum Gauge Width']);
  177. Yanfly.Param.VHGGaugeHeight = Number(Yanfly.Parameters['Gauge Height']);
  178. Yanfly.Param.VHGBackColor = Number(Yanfly.Parameters['Back Color']);
  179. Yanfly.Param.VHGHpColor1 = Number(Yanfly.Parameters['HP Color 1']);
  180. Yanfly.Param.VHGHpColor2 = Number(Yanfly.Parameters['HP Color 2']);
  181. Yanfly.Param.VHGGaugeDuration = Number(Yanfly.Parameters['Gauge Duration']);
  182. Yanfly.Param.VHGGaugePos = eval(String(Yanfly.Parameters['Gauge Position']));
  183. Yanfly.Param.VHGBufferY = Number(Yanfly.Parameters['Y Buffer']);
  184. Yanfly.Param.VHGThick = eval(String(Yanfly.Parameters['Use Thick Gauges']));

  185. Yanfly.Param.VHGShowHP = eval(String(Yanfly.Parameters['Show HP']));
  186. Yanfly.Param.VHGShowValue = eval(String(Yanfly.Parameters['Show Value']));
  187. Yanfly.Param.VHGShowMax = eval(String(Yanfly.Parameters['Show Max']));

  188. //=============================================================================
  189. // DataManager
  190. //=============================================================================

  191. Yanfly.VHG.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  192. DataManager.isDatabaseLoaded = function() {
  193.     if (!Yanfly.VHG.DataManager_isDatabaseLoaded.call(this)) return false;
  194.                 this.processVHGNotetags($dataClasses);
  195.                 this.processVHGNotetags($dataEnemies);
  196.                 return true;
  197. };

  198. DataManager.processVHGNotetags = function(group) {
  199.         for (var n = 1; n < group.length; n++) {
  200.                 var obj = group[n];
  201.                 var notedata = obj.note.split(/[\r\n]+/);

  202.     obj.hideHpGauge = false;
  203.                 obj.showHpGauge = false;
  204.                 obj.hpGaugeWidth = 0;
  205.                 obj.hpGaugeHeight = Yanfly.Param.VHGGaugeHeight;
  206.                 obj.hpGaugeBackColor = Yanfly.Param.VHGBackColor;
  207.                 obj.hpGaugeColor1 = Yanfly.Param.VHGHpColor1;
  208.                 obj.hpGaugeColor2 = Yanfly.Param.VHGHpColor2;

  209.                 for (var i = 0; i < notedata.length; i++) {
  210.                         var line = notedata[i];
  211.                         if (line.match(/<(?:HIDE HP GAUGE)>/i)) {
  212.                                 obj.hideHpGauge = true;
  213.                         } else if (line.match(/<(?:SHOW HP GAUGE)>/i)) {
  214.                                 obj.showHpGauge = true;
  215.                         } else if (line.match(/<(?:HP GAUGE WIDTH):[ ](\d+)>/i)) {
  216.                                 obj.hpGaugeWidth = parseInt(RegExp.$1);
  217.                         } else if (line.match(/<(?:HP GAUGE HEIGHT):[ ](\d+)>/i)) {
  218.                                 obj.hpGaugeHeight = parseInt(RegExp.$1);
  219.                         } else if (line.match(/<(?:HP GAUGE BACK COLOR):[ ](\d+)>/i)) {
  220.                                 obj.hpGaugeBackColor = parseInt(RegExp.$1);
  221.                         } else if (line.match(/<(?:HP GAUGE COLOR 1):[ ](\d+)>/i)) {
  222.                                 obj.hpGaugeColor1 = parseInt(RegExp.$1);
  223.                         } else if (line.match(/<(?:HP GAUGE COLOR 2):[ ](\d+)>/i)) {
  224.                                 obj.hpGaugeColor2 = parseInt(RegExp.$1);
  225.                         }
  226.                 }
  227.         }
  228. };

  229. //=============================================================================
  230. // Game_System
  231. //=============================================================================

  232. Yanfly.VHG.Game_System_initialize = Game_System.prototype.initialize;
  233. Game_System.prototype.initialize = function() {
  234.     Yanfly.VHG.Game_System_initialize.call(this);
  235.                 this.initShownHpGauge();
  236. };

  237. Game_System.prototype.initShownHpGauge = function() {
  238.     this._shownHpGauge = [];
  239. };

  240. Game_System.prototype.showHpGaugeEnemy = function(id) {
  241.     if (this._shownHpGauge === undefined) this.initShownHpGauge();
  242.                 if (!eval(Yanfly.Param.VHGDefeatFirst)) return true;
  243.                 return this._shownHpGauge.contains(id);
  244. };

  245. Game_System.prototype.addHpGaugeEnemy = function(id) {
  246.     if (this._shownHpGauge === undefined) this.initShownHpGauge();
  247.                 if (this._shownHpGauge.contains(id)) return;
  248.                 this._shownHpGauge.push(id);
  249. };

  250. //=============================================================================
  251. // Game_Battler
  252. //=============================================================================

  253. Game_Battler.prototype.hpGaugeVisible = function() {
  254.                 if (this._noHpGauge) return false;
  255.     if (this.isHidden()) return false;
  256.                 return true;
  257. };

  258. Game_Battler.prototype.hpGaugeWidth = function() {
  259.                 var width = Math.max(this.spriteWidth(),        Yanfly.Param.VHGMinHpWidth);
  260.                 return (width & 1) ? width + 1 : width;
  261. };

  262. Game_Battler.prototype.hpGaugeHeight = function() {
  263.                 return Yanfly.Param.VHGGaugeHeight;
  264. };

  265. Game_Battler.prototype.hpGaugeBackColor = function() {
  266.                 return Yanfly.Param.VHGBackColor;
  267. };

  268. Game_Battler.prototype.hpGaugeColor1 = function() {
  269.                 return Yanfly.Param.VHGHpColor1;
  270. };

  271. Game_Battler.prototype.hpGaugeColor2 = function() {
  272.                 return Yanfly.Param.VHGHpColor2;
  273. };

  274. //=============================================================================
  275. // Game_Actor
  276. //=============================================================================

  277. Game_Actor.prototype.hpGaugeVisible = function() {
  278.     if (this.isHidden()) return false;
  279.                 if (this.currentClass().showHpGauge) return true;
  280.                 if (!eval(Yanfly.Param.VHGDisplayActor)) return false;
  281.                 if (this.currentClass().hideHpGauge) return false;
  282.                 return Game_Battler.prototype.hpGaugeVisible.call(this);
  283. };

  284. Game_Actor.prototype.hpGaugeWidth = function() {
  285.                 if (this.currentClass().hpGaugeWidth > 0) {
  286.                         var width = this.currentClass().hpGaugeWidth;
  287.                 } else {
  288.                         var width = this.spriteWidth();
  289.                 }
  290.                 width = Math.max(width,        Yanfly.Param.VHGMinHpWidth);
  291.                 return (width & 1) ? width + 1 : width;
  292. };

  293. Game_Actor.prototype.hpGaugeHeight = function() {
  294.                 return this.currentClass().hpGaugeHeight;
  295. };

  296. Game_Actor.prototype.hpGaugeBackColor = function() {
  297.                 return this.currentClass().hpGaugeBackColor;
  298. };

  299. Game_Actor.prototype.hpGaugeColor1 = function() {
  300.                 return this.currentClass().hpGaugeColor1;
  301. };

  302. Game_Actor.prototype.hpGaugeColor2 = function() {
  303.                 return this.currentClass().hpGaugeColor2;
  304. };

  305. //=============================================================================
  306. // Game_Enemy
  307. //=============================================================================

  308. Game_Enemy.prototype.hpGaugeVisible = function() {
  309.     if (this.isHidden()) return false;
  310.                 if (this.enemy().hideHpGauge) return false;
  311.     if (BattleManager.isBattleTest()) return true;
  312.                 if (this.enemy().showHpGauge) return true;
  313.                 if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) return false;
  314.                 return Game_Battler.prototype.hpGaugeVisible.call(this);
  315. };

  316. Yanfly.VHG.Game_Enemy_die = Game_Enemy.prototype.die;
  317. Game_Enemy.prototype.die = function() {
  318.     Yanfly.VHG.Game_Enemy_die.call(this);
  319.                 if (eval(Yanfly.Param.VHGDefeatFirst)) {
  320.                         if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) this._noHpGauge = true;
  321.                 }
  322.                 $gameSystem.addHpGaugeEnemy(this._enemyId);
  323. };

  324. Yanfly.VHG.Game_Enemy_revive = Game_Enemy.prototype.revive;
  325. Game_Enemy.prototype.revive = function() {
  326.     if (this._hp === 0) this._noHpGauge = false;
  327.                 Yanfly.VHG.Game_Enemy_revive.call(this);
  328. };

  329. Game_Enemy.prototype.hpGaugeWidth = function() {
  330.                 if (this.enemy().hpGaugeWidth > 0) {
  331.                         var width = this.enemy().hpGaugeWidth;
  332.                 } else {
  333.                         var width = this.spriteWidth();
  334.                 }
  335.                 width = Math.max(width,        Yanfly.Param.VHGMinHpWidth);
  336.                 return (width & 1) ? width + 1 : width;
  337. };

  338. Game_Enemy.prototype.hpGaugeHeight = function() {
  339.                 return this.enemy().hpGaugeHeight;
  340. };

  341. Game_Enemy.prototype.hpGaugeBackColor = function() {
  342.                 return this.enemy().hpGaugeBackColor;
  343. };

  344. Game_Enemy.prototype.hpGaugeColor1 = function() {
  345.                 return this.enemy().hpGaugeColor1;
  346. };

  347. Game_Enemy.prototype.hpGaugeColor2 = function() {
  348.                 return this.enemy().hpGaugeColor2;
  349. };

  350. //=============================================================================
  351. // Sprite_Battler
  352. //=============================================================================

  353. Yanfly.VHG.Sprite_Battler_update = Sprite_Battler.prototype.update;
  354. Sprite_Battler.prototype.update = function() {
  355.     Yanfly.VHG.Sprite_Battler_update.call(this);
  356.     this.createVisualHpGaugeWindow();
  357. };

  358. Sprite_Battler.prototype.createVisualHpGaugeWindow = function() {
  359.                 if (this._createdVisualHpGaugeWindow) return;
  360.                 if (!this._battler) return;
  361.                 if (this.checkVisualATBGauge()) {
  362.                         if (!this._visualATBWindow) return;
  363.                         if (!this.parent.parent.children.contains(this._visualATBWindow)) return;
  364.                 }
  365.                 this._createdVisualHpGaugeWindow = true;
  366.     this._visualHpGauge = new Window_VisualHPGauge();
  367.     this._visualHpGauge.setBattler(this._battler);
  368.     this.parent.parent.addChild(this._visualHpGauge);
  369. };

  370. Sprite_Battler.prototype.checkVisualATBGauge = function() {
  371.     if (!Imported.YEP_X_BattleSysATB) return false;
  372.     if (!BattleManager.isATB()) return false;
  373.     if (!Imported.YEP_X_VisualATBGauge) return false;
  374.     return this._battler.isEnemy();
  375. };

  376. Yanfly.VHG.Sprite_Battler_setBattler = Sprite_Battler.prototype.setBattler;
  377. Sprite_Battler.prototype.setBattler = function(battler) {
  378.     Yanfly.VHG.Sprite_Battler_setBattler.call(this, battler);
  379.     if (this._visualHpGauge) this._visualHpGauge.setBattler(battler);
  380. };

  381. //=============================================================================
  382. // Window_VisualHPGauge
  383. //=============================================================================

  384. function Window_VisualHPGauge() {
  385.     this.initialize.apply(this, arguments);
  386. }

  387. Window_VisualHPGauge.prototype = Object.create(Window_Base.prototype);
  388. Window_VisualHPGauge.prototype.constructor = Window_VisualHPGauge;

  389. Window_VisualHPGauge.prototype.initialize = function() {
  390.     this._opacitySpeed = 255 / Yanfly.Param.VHGGaugeDuration;
  391.     this._dropSpeed = 0;
  392.     this._visibleCounter = 0;
  393.     Window_Base.prototype.initialize.call(this, 0, 0, 1, 1);
  394.     this._battler = null;
  395.     this._requestRefresh = false;
  396.     this._currentHpValue = 0;
  397.     this._displayedValue = 0;
  398.     this.contentsOpacity = 0;
  399.     this.opacity = 0;
  400. };

  401. Window_VisualHPGauge.prototype.setBattler = function(battler) {
  402.     if (this._battler === battler) return;
  403.     this._battler = battler;
  404.     this._currentHpValue = this._battler ? this._battler.hp : 0;
  405.     this._displayedValue = this._battler ? this._battler.hp : 0;
  406. };

  407. Window_VisualHPGauge.prototype.update = function() {
  408.     Window_Base.prototype.update.call(this);
  409.     if (!this._battler) return;
  410.     this.updateWindowAspects();
  411. };

  412. Window_VisualHPGauge.prototype.updateWindowAspects = function() {
  413.     this.updateWindowSize();
  414.     this.updateWindowPosition();
  415.     this.updateOpacity();
  416.     this.updateHpPosition();
  417.     this.updateRefresh();
  418. };

  419. Window_VisualHPGauge.prototype.updateWindowSize = function() {
  420.     var spriteWidth = this._battler.hpGaugeWidth();
  421.     var width = spriteWidth + this.standardPadding() * 2;
  422.     var height = Math.max(this.lineHeight(), this.gaugeHeight() + 4);
  423.     height += this.standardPadding() * 2;
  424.     if (width === this.width && height === this.height) return;
  425.     this.width = width;
  426.     this.height = height;
  427.     this.createContents();
  428.     this._requestRefresh = true;
  429. };

  430. Window_VisualHPGauge.prototype.updateWindowPosition = function() {
  431.     if (!this._battler) return;
  432.     var battler = this._battler;
  433.     this.x = battler.spritePosX();
  434.     this.x -= Math.ceil(this.width / 2);
  435.     this.y = battler.spritePosY();
  436.     if (Yanfly.Param.VHGGaugePos) {
  437.       this.y -= battler.spriteHeight();
  438.     } else {
  439.       this.y -= this.standardPadding();
  440.     }
  441.     this.y += Yanfly.Param.VHGBufferY;
  442. };

  443. Window_VisualHPGauge.prototype.updateOpacity = function() {
  444.     if (this.isShowWindow()) {
  445.       this.contentsOpacity += 32;
  446.     } else {
  447.       this.contentsOpacity -= 32;
  448.     }
  449. };

  450. Window_VisualHPGauge.prototype.isShowWindow = function() {
  451.     if (!this._battler.isAppeared()) return false;
  452.     if (!this._battler.hpGaugeVisible()) return false;
  453.     if (Yanfly.Param.VHGAlwaysShow && !this._battler.isDead()) return true;
  454.     if (this._currentHpValue !== this._displayedValue) return true;
  455.     if (this._battler.isSelected()) return true;
  456.     --this._visibleCounter;
  457.     return this._visibleCounter > 0;
  458. };

  459. Window_VisualHPGauge.prototype.updateHpPosition = function() {
  460.     if (!this._battler) return;
  461.     if (this._currentHpValue !== this._battler.hp) {
  462.       this._visibleCounter = Yanfly.Param.VHGGaugeDuration;
  463.       this._currentHpValue = this._battler.hp;
  464.       var difference = Math.abs(this._displayedValue - this._battler.hp);
  465.       this._dropSpeed = Math.ceil(difference / Yanfly.Param.VHGGaugeDuration);
  466.     }
  467.     this.updateDisplayCounter();
  468. };

  469. Window_VisualHPGauge.prototype.updateDisplayCounter = function() {
  470.     if (this._currentHpValue == this._displayedValue) return;
  471.     var d = this._dropSpeed;
  472.     var c = this._currentHpValue;
  473.     if (this._displayedValue > this._currentHpValue) {
  474.       this._displayedValue = Math.max(this._displayedValue - d, c);
  475.     } else if (this._displayedValue < this._currentHpValue) {
  476.       this._displayedValue = Math.min(this._displayedValue + d, c);
  477.     }
  478.     this._requestRefresh = true;
  479. };

  480. Window_VisualHPGauge.prototype.updateRefresh = function() {
  481.     if (this._requestRefresh) this.refresh();
  482. };

  483. Window_VisualHPGauge.prototype.refresh = function() {
  484.     this.contents.clear();
  485.     if (!this._battler) return;
  486.     this._requestRefresh = false;
  487.     var wy = this.contents.height - this.lineHeight();
  488.     var ww = this.contents.width;
  489.     this.drawActorHp(this._battler, 0, wy, ww);
  490. };

  491. Window_VisualHPGauge.prototype.gaugeBackColor = function() {
  492.     return this.textColor(this._battler.hpGaugeBackColor());
  493. };

  494. Window_VisualHPGauge.prototype.hpGaugeColor1 = function() {
  495.     return this.textColor(this._battler.hpGaugeColor1());
  496. };

  497. Window_VisualHPGauge.prototype.hpGaugeColor2 = function() {
  498.     return this.textColor(this._battler.hpGaugeColor2());
  499. };

  500. Window_VisualHPGauge.prototype.drawActorHp = function(actor, x, y, width) {
  501.     width = width || 186;
  502.     var color1 = this.hpGaugeColor1();
  503.     var color2 = this.hpGaugeColor2();
  504.     var rate = this._displayedValue / actor.mhp;
  505.     this.drawGauge(x, y, width, rate, color1, color2);
  506.     if (Yanfly.Param.VHGShowHP) {
  507.       this.changeTextColor(this.systemColor());
  508.       this.drawText(TextManager.hpA, x, y, 44);
  509.     }
  510.     if (Yanfly.Param.VHGShowValue) {
  511.       var val = this._displayedValue
  512.       var max = actor.mhp;
  513.       var w = width;
  514.       var color = this.hpColor(actor);
  515.       this.drawCurrentAndMax(val, max, x, y, w, color, this.normalColor());
  516.     }
  517. };

  518. Window_VisualHPGauge.prototype.drawCurrentAndMax = function(current, max, x, y,
  519.                                                    width, color1, color2) {
  520.     if (Yanfly.Param.VHGShowMax) {
  521.       Window_Base.prototype.drawCurrentAndMax.call(this, current, max,
  522.         x, y, width, color1, color2);
  523.     } else {
  524.       var align = Yanfly.Param.VHGShowHP ? 'right' : 'center';
  525.       var text = Yanfly.Util.toGroup(current);
  526.       this.changeTextColor(color1);
  527.       this.drawText(text, x, y, width, align);
  528.     }
  529. };

  530. Window_VisualHPGauge.prototype.gaugeHeight = function() {
  531.     if (!this._battler) return Window_Base.prototype.gaugeHeight.call(this);
  532.     return this._battler.hpGaugeHeight();
  533. };

  534. if (Imported.YEP_CoreEngine && Yanfly.Param.VHGThick) {

  535. Window_VisualHPGauge.prototype.drawGauge =
  536. function(dx, dy, dw, rate, color1, color2) {
  537.     var color3 = this.gaugeBackColor();
  538.     var fillW = Math.floor(dw * rate).clamp(0, dw);
  539.     var gaugeH = this.gaugeHeight();
  540.     var gaugeY = dy + this.lineHeight() - gaugeH - 2;
  541.     if (eval(Yanfly.Param.GaugeOutline)) {
  542.       color3.paintOpacity = this.translucentOpacity();
  543.       this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
  544.       dx += 2;
  545.       gaugeY += 2;
  546.       fillW = Math.max(0, fillW - 4);
  547.       gaugeH -= 4;
  548.     } else {
  549.       var fillW = Math.floor(dw * rate);
  550.       var gaugeY = dy + this.lineHeight() - gaugeH - 2;
  551.       this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
  552.     }
  553.     this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
  554. };

  555. } // Imported.YEP_CoreEngine

  556. //=============================================================================
  557. // Utilities
  558. //=============================================================================

  559. Yanfly.Util = Yanfly.Util || {};

  560. if (!Yanfly.Util.toGroup) {
  561.     Yanfly.Util.toGroup = function(inVal) {
  562.         return inVal;
  563.     }
  564. };

  565. //=============================================================================
  566. // End of File
  567. //=============================================================================
  568. };
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部