Project1

标题: YEP插件YEP_X_VisualHpGauge的问题 [打印本页]

作者: guti4444    时间: 2016-6-19 17:23
标题: YEP插件YEP_X_VisualHpGauge的问题
YEP_X_VisualHpGauge这个插件用来显示敌人的hp,请问如何实现显示敌人的mp或tp

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

JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // Yanfly Engine Plugins - Battle Engine Extension - Visual HP Gauge
  3. // YEP_X_VisualHpGauge.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.YEP_X_VisualHpGauge = true;
  8.  
  9. var Yanfly = Yanfly || {};
  10. Yanfly.VHG = Yanfly.VHG || {};
  11.  
  12. //=============================================================================
  13. /*:
  14.  * @plugindesc v1.03 (Requires YEP_BattleEngineCore.js) Reveal HP Gauges
  15.  * when a battler is selected or takes damage in battle.
  16.  * @author Yanfly Engine Plugins
  17.  *
  18.  * @param ---General---
  19.  * @default
  20.  *
  21.  * @param Display Actor
  22.  * @desc Do you wish to display the HP Gauge for actors?
  23.  * NO - false     YES - true
  24.  * @default true
  25.  *
  26.  * @param Defeat First
  27.  * @desc Enemies must be defeated first before showing the HP Gauge.
  28.  * NO - false     YES - true
  29.  * @default false
  30.  *
  31.  * @param Always Visible
  32.  * @desc HP Gauge is always visible and doesn't fade away.
  33.  * NO - false     YES - true
  34.  * @default false
  35.  *
  36.  * @param ---Appearance---
  37.  * @default
  38.  *
  39.  * @param Minimum Gauge Width
  40.  * @desc This is the minimum width in pixels for HP Gauges.
  41.  * @default 144
  42.  *
  43.  * @param Gauge Height
  44.  * @desc This is the height in pixels for HP Gauges.
  45.  * @default 18
  46.  *
  47.  * @param Back Color
  48.  * @desc This is the text color used for the back of HP Gauges.
  49.  * @default 19
  50.  *
  51.  * @param HP Color 1
  52.  * @desc This is the text color used for the 1st part of HP Gauges.
  53.  * @default 20
  54.  *
  55.  * @param HP Color 2
  56.  * @desc This is the text color used for the 2nd part of HP Gauges.
  57.  * @default 21
  58.  *
  59.  * @param Gauge Duration
  60.  * @desc This is the frames the HP gauge will continue to show after
  61.  * it finishes draining or filling.
  62.  * @default 30
  63.  *
  64.  * @param Gauge Position
  65.  * @desc Where do you wish to show the HP gauge?
  66.  * BELOW - false     ABOVE - true
  67.  * @default false
  68.  *
  69.  * @param Y Buffer
  70.  * @desc How much do you wish to shift the gauge Y position?
  71.  * @default -16
  72.  *
  73.  * @param Use Thick Gauges
  74.  * @desc Use the thick gauges provided by this plugin?
  75.  * Default - false     Thick - true
  76.  * @default true
  77.  *
  78.  * @param ---Text Display---
  79.  * @default
  80.  *
  81.  * @param Show HP
  82.  * @desc Show the actual 'HP' text.
  83.  * NO - false     YES - true
  84.  * @default false
  85.  *
  86.  * @param Show Value
  87.  * @desc Show the HP value.
  88.  * NO - false     YES - true
  89.  * @default false
  90.  *
  91.  * @param Show Max
  92.  * @desc Show the MaxHP value if value is shown?
  93.  * NO - false     YES - true
  94.  * @default false
  95.  *
  96.  * @help
  97.  * ============================================================================
  98.  * Introduction
  99.  * ============================================================================
  100.  *
  101.  * This plugin requires YEP_BattleEngineCore.
  102.  * Make sure this plugin is located under YEP_BattleEngineCore in the plugin
  103.  * list.
  104.  *
  105.  * This plugin shows the HP Gauges of enemies as they're selected or while they
  106.  * take damage. You can also opt for actors to show their HP Gauge as well.
  107.  * Adjust the parameters to change the way you want the HP Gauges to appear.
  108.  *
  109.  * By default, enemies would need to be defeated first in order for the gauges
  110.  * to show up. This can be changed within the parameter settings. However,
  111.  * during battle test, the HP gauges are always shown unless the enemy has a
  112.  * hidden HP gauge.
  113.  *
  114.  * ============================================================================
  115.  * Notetags
  116.  * ============================================================================
  117.  *
  118.  * Class and Enemy Notetags:
  119.  *   <Hide HP Gauge>
  120.  *   This HP gauge will always be hidden if this notetag is present.
  121.  *
  122.  *   <Show HP Gauge>
  123.  *   This HP gauge will always be shown if this notetag is present while the
  124.  *   target is selected or taking damage.
  125.  *
  126.  *   <HP Gauge Width: x>
  127.  *   This will set the battler's HP Gauge width to x pixels. However, if this
  128.  *   width is less than the minimum width, minimum width will take priority.
  129.  *
  130.  *   <HP Gauge Height: x>
  131.  *   This set's the HP Gauge height to x pixels.
  132.  *
  133.  *   <HP Gauge Back Color: x>
  134.  *   This changes the HP Gauge's back color to x text color.
  135.  *
  136.  *   <HP Gauge Color 1: x>
  137.  *   This changes the HP Gauge's color 1 to x text color.
  138.  *
  139.  *   <HP Gauge Color 2: x>
  140.  *   This changes the HP Gauge's color 2 to x text color.
  141.  *
  142.  * ============================================================================
  143.  * Changelog
  144.  * ============================================================================
  145.  *
  146.  * Version 1.03:
  147.  * - Fixed a bug when Escape skill-effects are used on battlers.
  148.  *
  149.  * Version 1.02:
  150.  * - Fixed a bug with gauge height not adjusting.
  151.  *
  152.  * Version 1.01b:
  153.  * - Fixed a bug regarding dependancy checks.
  154.  * - Fixed many bugs regarding stacking errors.
  155.  *
  156.  * Version 1.01:
  157.  * - Rewrote the good majority of plugin to accomodate the following features:
  158.  * ---'Always Visible' parameter.
  159.  * ---'Gauge Position' parameter.
  160.  * ---'Y Buffer' parameter.
  161.  * ---'Use Thick Gauges' parameter.
  162.  * ---'Show HP' parameter.
  163.  * ---'Show Value' parameter.
  164.  * ---'Show Max' parameter.
  165.  *
  166.  * Version 1.00:
  167.  * - Finished Plugin!
  168.  */
  169. //=============================================================================
  170.  
  171. if (Imported.YEP_BattleEngineCore) {
  172.  
  173. //=============================================================================
  174. // Parameter Variables
  175. //=============================================================================
  176.  
  177. Yanfly.Parameters = PluginManager.parameters('YEP_X_VisualHpGauge');
  178. Yanfly.Param = Yanfly.Param || {};
  179.  
  180. Yanfly.Param.VHGDisplayActor = String(Yanfly.Parameters['Display Actor']);
  181. Yanfly.Param.VHGDefeatFirst = String(Yanfly.Parameters['Defeat First']);
  182. Yanfly.Param.VHGAlwaysShow = eval(String(Yanfly.Parameters['Always Visible']));
  183.  
  184. Yanfly.Param.VHGMinHpWidth = Number(Yanfly.Parameters['Minimum Gauge Width']);
  185. Yanfly.Param.VHGGaugeHeight = Number(Yanfly.Parameters['Gauge Height']);
  186. Yanfly.Param.VHGBackColor = Number(Yanfly.Parameters['Back Color']);
  187. Yanfly.Param.VHGHpColor1 = Number(Yanfly.Parameters['HP Color 1']);
  188. Yanfly.Param.VHGHpColor2 = Number(Yanfly.Parameters['HP Color 2']);
  189. Yanfly.Param.VHGGaugeDuration = Number(Yanfly.Parameters['Gauge Duration']);
  190. Yanfly.Param.VHGGaugePos = eval(String(Yanfly.Parameters['Gauge Position']));
  191. Yanfly.Param.VHGBufferY = Number(Yanfly.Parameters['Y Buffer']);
  192. Yanfly.Param.VHGThick = eval(String(Yanfly.Parameters['Use Thick Gauges']));
  193.  
  194. Yanfly.Param.VHGShowHP = eval(String(Yanfly.Parameters['Show HP']));
  195. Yanfly.Param.VHGShowValue = eval(String(Yanfly.Parameters['Show Value']));
  196. Yanfly.Param.VHGShowMax = eval(String(Yanfly.Parameters['Show Max']));
  197.  
  198. //=============================================================================
  199. // DataManager
  200. //=============================================================================
  201.  
  202. Yanfly.VHG.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  203. DataManager.isDatabaseLoaded = function() {
  204.     if (!Yanfly.VHG.DataManager_isDatabaseLoaded.call(this)) return false;
  205.                 this.processVHGNotetags($dataClasses);
  206.                 this.processVHGNotetags($dataEnemies);
  207.                 return true;
  208. };
  209.  
  210. DataManager.processVHGNotetags = function(group) {
  211.         for (var n = 1; n < group.length; n++) {
  212.                 var obj = group[n];
  213.                 var notedata = obj.note.split(/[\r\n]+/);
  214.  
  215.     obj.hideHpGauge = false;
  216.                 obj.showHpGauge = false;
  217.                 obj.hpGaugeWidth = 0;
  218.                 obj.hpGaugeHeight = Yanfly.Param.VHGGaugeHeight;
  219.                 obj.hpGaugeBackColor = Yanfly.Param.VHGBackColor;
  220.                 obj.hpGaugeColor1 = Yanfly.Param.VHGHpColor1;
  221.                 obj.hpGaugeColor2 = Yanfly.Param.VHGHpColor2;
  222.  
  223.                 for (var i = 0; i < notedata.length; i++) {
  224.                         var line = notedata[i];
  225.                         if (line.match(/<(?:HIDE HP GAUGE)>/i)) {
  226.                                 obj.hideHpGauge = true;
  227.                         } else if (line.match(/<(?:SHOW HP GAUGE)>/i)) {
  228.                                 obj.showHpGauge = true;
  229.                         } else if (line.match(/<(?:HP GAUGE WIDTH):[ ](\d+)>/i)) {
  230.                                 obj.hpGaugeWidth = parseInt(RegExp.$1);
  231.                         } else if (line.match(/<(?:HP GAUGE HEIGHT):[ ](\d+)>/i)) {
  232.                                 obj.hpGaugeHeight = parseInt(RegExp.$1);
  233.                         } else if (line.match(/<(?:HP GAUGE BACK COLOR):[ ](\d+)>/i)) {
  234.                                 obj.hpGaugeBackColor = parseInt(RegExp.$1);
  235.                         } else if (line.match(/<(?:HP GAUGE COLOR 1):[ ](\d+)>/i)) {
  236.                                 obj.hpGaugeColor1 = parseInt(RegExp.$1);
  237.                         } else if (line.match(/<(?:HP GAUGE COLOR 2):[ ](\d+)>/i)) {
  238.                                 obj.hpGaugeColor2 = parseInt(RegExp.$1);
  239.                         }
  240.                 }
  241.         }
  242. };
  243.  
  244. //=============================================================================
  245. // Game_System
  246. //=============================================================================
  247.  
  248. Yanfly.VHG.Game_System_initialize = Game_System.prototype.initialize;
  249. Game_System.prototype.initialize = function() {
  250.     Yanfly.VHG.Game_System_initialize.call(this);
  251.                 this.initShownHpGauge();
  252. };
  253.  
  254. Game_System.prototype.initShownHpGauge = function() {
  255.     this._shownHpGauge = [];
  256. };
  257.  
  258. Game_System.prototype.showHpGaugeEnemy = function(id) {
  259.     if (this._shownHpGauge === undefined) this.initShownHpGauge();
  260.                 if (!eval(Yanfly.Param.VHGDefeatFirst)) return true;
  261.                 return this._shownHpGauge.contains(id);
  262. };
  263.  
  264. Game_System.prototype.addHpGaugeEnemy = function(id) {
  265.     if (this._shownHpGauge === undefined) this.initShownHpGauge();
  266.                 if (this._shownHpGauge.contains(id)) return;
  267.                 this._shownHpGauge.push(id);
  268. };
  269.  
  270. //=============================================================================
  271. // Game_Battler
  272. //=============================================================================
  273.  
  274. Game_Battler.prototype.hpGaugeVisible = function() {
  275.                 if (this._noHpGauge) return false;
  276.     if (this.isHidden()) return false;
  277.                 return true;
  278. };
  279.  
  280. Game_Battler.prototype.hpGaugeWidth = function() {
  281.                 var width = Math.max(this.spriteWidth(),        Yanfly.Param.VHGMinHpWidth);
  282.                 return (width & 1) ? width + 1 : width;
  283. };
  284.  
  285. Game_Battler.prototype.hpGaugeHeight = function() {
  286.                 return Yanfly.Param.VHGGaugeHeight;
  287. };
  288.  
  289. Game_Battler.prototype.hpGaugeBackColor = function() {
  290.                 return Yanfly.Param.VHGBackColor;
  291. };
  292.  
  293. Game_Battler.prototype.hpGaugeColor1 = function() {
  294.                 return Yanfly.Param.VHGHpColor1;
  295. };
  296.  
  297. Game_Battler.prototype.hpGaugeColor2 = function() {
  298.                 return Yanfly.Param.VHGHpColor2;
  299. };
  300.  
  301. //=============================================================================
  302. // Game_Actor
  303. //=============================================================================
  304.  
  305. Game_Actor.prototype.hpGaugeVisible = function() {
  306.     if (this.isHidden()) return false;
  307.                 if (this.currentClass().showHpGauge) return true;
  308.                 if (!eval(Yanfly.Param.VHGDisplayActor)) return false;
  309.                 if (this.currentClass().hideHpGauge) return false;
  310.                 return Game_Battler.prototype.hpGaugeVisible.call(this);
  311. };
  312.  
  313. Game_Actor.prototype.hpGaugeWidth = function() {
  314.                 if (this.currentClass().hpGaugeWidth > 0) {
  315.                         var width = this.currentClass().hpGaugeWidth;
  316.                 } else {
  317.                         var width = this.spriteWidth();
  318.                 }
  319.                 width = Math.max(width,        Yanfly.Param.VHGMinHpWidth);
  320.                 return (width & 1) ? width + 1 : width;
  321. };
  322.  
  323. Game_Actor.prototype.hpGaugeHeight = function() {
  324.                 return this.currentClass().hpGaugeHeight;
  325. };
  326.  
  327. Game_Actor.prototype.hpGaugeBackColor = function() {
  328.                 return this.currentClass().hpGaugeBackColor;
  329. };
  330.  
  331. Game_Actor.prototype.hpGaugeColor1 = function() {
  332.                 return this.currentClass().hpGaugeColor1;
  333. };
  334.  
  335. Game_Actor.prototype.hpGaugeColor2 = function() {
  336.                 return this.currentClass().hpGaugeColor2;
  337. };
  338.  
  339. //=============================================================================
  340. // Game_Enemy
  341. //=============================================================================
  342.  
  343. Game_Enemy.prototype.hpGaugeVisible = function() {
  344.     if (this.isHidden()) return false;
  345.                 if (this.enemy().hideHpGauge) return false;
  346.     if (BattleManager.isBattleTest()) return true;
  347.                 if (this.enemy().showHpGauge) return true;
  348.                 if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) return false;
  349.                 return Game_Battler.prototype.hpGaugeVisible.call(this);
  350. };
  351.  
  352. Yanfly.VHG.Game_Enemy_die = Game_Enemy.prototype.die;
  353. Game_Enemy.prototype.die = function() {
  354.     Yanfly.VHG.Game_Enemy_die.call(this);
  355.                 if (eval(Yanfly.Param.VHGDefeatFirst)) {
  356.                         if (!$gameSystem.showHpGaugeEnemy(this._enemyId)) this._noHpGauge = true;
  357.                 }
  358.                 $gameSystem.addHpGaugeEnemy(this._enemyId);
  359. };
  360.  
  361. Yanfly.VHG.Game_Enemy_revive = Game_Enemy.prototype.revive;
  362. Game_Enemy.prototype.revive = function() {
  363.     if (this._hp === 0) this._noHpGauge = false;
  364.                 Yanfly.VHG.Game_Enemy_revive.call(this);
  365. };
  366.  
  367. Game_Enemy.prototype.hpGaugeWidth = function() {
  368.                 if (this.enemy().hpGaugeWidth > 0) {
  369.                         var width = this.enemy().hpGaugeWidth;
  370.                 } else {
  371.                         var width = this.spriteWidth();
  372.                 }
  373.                 width = Math.max(width,        Yanfly.Param.VHGMinHpWidth);
  374.                 return (width & 1) ? width + 1 : width;
  375. };
  376.  
  377. Game_Enemy.prototype.hpGaugeHeight = function() {
  378.                 return this.enemy().hpGaugeHeight;
  379. };
  380.  
  381. Game_Enemy.prototype.hpGaugeBackColor = function() {
  382.                 return this.enemy().hpGaugeBackColor;
  383. };
  384.  
  385. Game_Enemy.prototype.hpGaugeColor1 = function() {
  386.                 return this.enemy().hpGaugeColor1;
  387. };
  388.  
  389. Game_Enemy.prototype.hpGaugeColor2 = function() {
  390.                 return this.enemy().hpGaugeColor2;
  391. };
  392.  
  393. //=============================================================================
  394. // Sprite_Battler
  395. //=============================================================================
  396.  
  397. Yanfly.VHG.Sprite_Battler_update = Sprite_Battler.prototype.update;
  398. Sprite_Battler.prototype.update = function() {
  399.     Yanfly.VHG.Sprite_Battler_update.call(this);
  400.     this.createVisualHpGaugeWindow();
  401. };
  402.  
  403. Sprite_Battler.prototype.createVisualHpGaugeWindow = function() {
  404.                 if (this._createdVisualHpGaugeWindow) return;
  405.                 if (!this._battler) return;
  406.                 if (this.checkVisualATBGauge()) {
  407.                         if (!this._visualATBWindow) return;
  408.                         if (!this.parent.parent.children.contains(this._visualATBWindow)) return;
  409.                 }
  410.                 this._createdVisualHpGaugeWindow = true;
  411.     this._visualHpGauge = new Window_VisualHPGauge();
  412.     this._visualHpGauge.setBattler(this._battler);
  413.     this.parent.parent.addChild(this._visualHpGauge);
  414. };
  415.  
  416. Sprite_Battler.prototype.checkVisualATBGauge = function() {
  417.     if (!Imported.YEP_X_BattleSysATB) return false;
  418.     if (!BattleManager.isATB()) return false;
  419.     if (!Imported.YEP_X_VisualATBGauge) return false;
  420.     return this._battler.isEnemy();
  421. };
  422.  
  423. Yanfly.VHG.Sprite_Battler_setBattler = Sprite_Battler.prototype.setBattler;
  424. Sprite_Battler.prototype.setBattler = function(battler) {
  425.     Yanfly.VHG.Sprite_Battler_setBattler.call(this, battler);
  426.     if (this._visualHpGauge) this._visualHpGauge.setBattler(battler);
  427. };
  428.  
  429. //=============================================================================
  430. // Window_VisualHPGauge
  431. //=============================================================================
  432.  
  433. function Window_VisualHPGauge() {
  434.     this.initialize.apply(this, arguments);
  435. }
  436.  
  437. Window_VisualHPGauge.prototype = Object.create(Window_Base.prototype);
  438. Window_VisualHPGauge.prototype.constructor = Window_VisualHPGauge;
  439.  
  440. Window_VisualHPGauge.prototype.initialize = function() {
  441.     this._opacitySpeed = 255 / Yanfly.Param.VHGGaugeDuration;
  442.     this._dropSpeed = 0;
  443.     this._visibleCounter = 0;
  444.     Window_Base.prototype.initialize.call(this, 0, 0, 1, 1);
  445.     this._battler = null;
  446.     this._requestRefresh = false;
  447.     this._currentHpValue = 0;
  448.     this._displayedValue = 0;
  449.     this.contentsOpacity = 0;
  450.     this.opacity = 0;
  451. };
  452.  
  453. Window_VisualHPGauge.prototype.setBattler = function(battler) {
  454.     if (this._battler === battler) return;
  455.     this._battler = battler;
  456.     this._currentHpValue = this._battler ? this._battler.hp : 0;
  457.     this._displayedValue = this._battler ? this._battler.hp : 0;
  458. };
  459.  
  460. Window_VisualHPGauge.prototype.update = function() {
  461.     Window_Base.prototype.update.call(this);
  462.     if (!this._battler) return;
  463.     this.updateWindowAspects();
  464. };
  465.  
  466. Window_VisualHPGauge.prototype.updateWindowAspects = function() {
  467.     this.updateWindowSize();
  468.     this.updateWindowPosition();
  469.     this.updateOpacity();
  470.     this.updateHpPosition();
  471.     this.updateRefresh();
  472. };
  473.  
  474. Window_VisualHPGauge.prototype.updateWindowSize = function() {
  475.     var spriteWidth = this._battler.hpGaugeWidth();
  476.     var width = spriteWidth + this.standardPadding() * 2;
  477.     var height = Math.max(this.lineHeight(), this.gaugeHeight() + 4);
  478.     height += this.standardPadding() * 2;
  479.     if (width === this.width && height === this.height) return;
  480.     this.width = width;
  481.     this.height = height;
  482.     this.createContents();
  483.     this._requestRefresh = true;
  484. };
  485.  
  486. Window_VisualHPGauge.prototype.updateWindowPosition = function() {
  487.     if (!this._battler) return;
  488.     var battler = this._battler;
  489.     this.x = battler.spritePosX();
  490.     this.x -= Math.ceil(this.width / 2);
  491.     this.y = battler.spritePosY();
  492.     if (Yanfly.Param.VHGGaugePos) {
  493.       this.y -= battler.spriteHeight();
  494.     } else {
  495.       this.y -= this.standardPadding();
  496.     }
  497.     this.y += Yanfly.Param.VHGBufferY;
  498. };
  499.  
  500. Window_VisualHPGauge.prototype.updateOpacity = function() {
  501.     if (this.isShowWindow()) {
  502.       this.contentsOpacity += 32;
  503.     } else {
  504.       this.contentsOpacity -= 32;
  505.     }
  506. };
  507.  
  508. Window_VisualHPGauge.prototype.isShowWindow = function() {
  509.     if (!this._battler.isAppeared()) return false;
  510.     if (!this._battler.hpGaugeVisible()) return false;
  511.     if (Yanfly.Param.VHGAlwaysShow && !this._battler.isDead()) return true;
  512.     if (this._currentHpValue !== this._displayedValue) return true;
  513.     if (this._battler.isSelected()) return true;
  514.     --this._visibleCounter;
  515.     return this._visibleCounter > 0;
  516. };
  517.  
  518. Window_VisualHPGauge.prototype.updateHpPosition = function() {
  519.     if (!this._battler) return;
  520.     if (this._currentHpValue !== this._battler.hp) {
  521.       this._visibleCounter = Yanfly.Param.VHGGaugeDuration;
  522.       this._currentHpValue = this._battler.hp;
  523.       var difference = Math.abs(this._displayedValue - this._battler.hp);
  524.       this._dropSpeed = Math.ceil(difference / Yanfly.Param.VHGGaugeDuration);
  525.     }
  526.     this.updateDisplayCounter();
  527. };
  528.  
  529. Window_VisualHPGauge.prototype.updateDisplayCounter = function() {
  530.     if (this._currentHpValue == this._displayedValue) return;
  531.     var d = this._dropSpeed;
  532.     var c = this._currentHpValue;
  533.     if (this._displayedValue > this._currentHpValue) {
  534.       this._displayedValue = Math.max(this._displayedValue - d, c);
  535.     } else if (this._displayedValue < this._currentHpValue) {
  536.       this._displayedValue = Math.min(this._displayedValue + d, c);
  537.     }
  538.     this._requestRefresh = true;
  539. };
  540.  
  541. Window_VisualHPGauge.prototype.updateRefresh = function() {
  542.     if (this._requestRefresh) this.refresh();
  543. };
  544.  
  545. Window_VisualHPGauge.prototype.refresh = function() {
  546.     this.contents.clear();
  547.     if (!this._battler) return;
  548.     this._requestRefresh = false;
  549.     var wy = this.contents.height - this.lineHeight();
  550.     var ww = this.contents.width;
  551.     this.drawActorHp(this._battler, 0, wy, ww);
  552. };
  553.  
  554. Window_VisualHPGauge.prototype.gaugeBackColor = function() {
  555.     return this.textColor(this._battler.hpGaugeBackColor());
  556. };
  557.  
  558. Window_VisualHPGauge.prototype.hpGaugeColor1 = function() {
  559.     return this.textColor(this._battler.hpGaugeColor1());
  560. };
  561.  
  562. Window_VisualHPGauge.prototype.hpGaugeColor2 = function() {
  563.     return this.textColor(this._battler.hpGaugeColor2());
  564. };
  565.  
  566. Window_VisualHPGauge.prototype.drawActorHp = function(actor, x, y, width) {
  567.     width = width || 186;
  568.     var color1 = this.hpGaugeColor1();
  569.     var color2 = this.hpGaugeColor2();
  570.     var rate = this._displayedValue / actor.mhp;
  571.     this.drawGauge(x, y, width, rate, color1, color2);
  572.     if (Yanfly.Param.VHGShowHP) {
  573.       this.changeTextColor(this.systemColor());
  574.       this.drawText(TextManager.hpA, x, y, 44);
  575.     }
  576.     if (Yanfly.Param.VHGShowValue) {
  577.       var val = this._displayedValue
  578.       var max = actor.mhp;
  579.       var w = width;
  580.       var color = this.hpColor(actor);
  581.       this.drawCurrentAndMax(val, max, x, y, w, color, this.normalColor());
  582.     }
  583. };
  584.  
  585. Window_VisualHPGauge.prototype.drawCurrentAndMax = function(current, max, x, y,
  586.                                                    width, color1, color2) {
  587.     if (Yanfly.Param.VHGShowMax) {
  588.       Window_Base.prototype.drawCurrentAndMax.call(this, current, max,
  589.         x, y, width, color1, color2);
  590.     } else {
  591.       var align = Yanfly.Param.VHGShowHP ? 'right' : 'center';
  592.       var text = Yanfly.Util.toGroup(current);
  593.       this.changeTextColor(color1);
  594.       this.drawText(text, x, y, width, align);
  595.     }
  596. };
  597.  
  598. Window_VisualHPGauge.prototype.gaugeHeight = function() {
  599.     if (!this._battler) return Window_Base.prototype.gaugeHeight.call(this);
  600.     return this._battler.hpGaugeHeight();
  601. };
  602.  
  603. if (Imported.YEP_CoreEngine && Yanfly.Param.VHGThick) {
  604.  
  605. Window_VisualHPGauge.prototype.drawGauge =
  606. function(dx, dy, dw, rate, color1, color2) {
  607.     var color3 = this.gaugeBackColor();
  608.     var fillW = Math.floor(dw * rate).clamp(0, dw);
  609.     var gaugeH = this.gaugeHeight();
  610.     var gaugeY = dy + this.lineHeight() - gaugeH - 2;
  611.     if (eval(Yanfly.Param.GaugeOutline)) {
  612.       color3.paintOpacity = this.translucentOpacity();
  613.       this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
  614.       dx += 2;
  615.       gaugeY += 2;
  616.       fillW = Math.max(0, fillW - 4);
  617.       gaugeH -= 4;
  618.     } else {
  619.       var fillW = Math.floor(dw * rate);
  620.       var gaugeY = dy + this.lineHeight() - gaugeH - 2;
  621.       this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
  622.     }
  623.     this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
  624. };
  625.  
  626. } // Imported.YEP_CoreEngine
  627.  
  628. //=============================================================================
  629. // Utilities
  630. //=============================================================================
  631.  
  632. Yanfly.Util = Yanfly.Util || {};
  633.  
  634. if (!Yanfly.Util.toGroup) {
  635.     Yanfly.Util.toGroup = function(inVal) {
  636.         return inVal;
  637.     }
  638. };
  639.  
  640. //=============================================================================
  641. // End of File
  642. //=============================================================================
  643. };





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