Project1

标题: 战斗显示敌人血条 [打印本页]

作者: Jason233    时间: 2017-11-9 22:25
标题: 战斗显示敌人血条
怎样利用YEP插件如何做到显示敌人血条,求详解,提前谢谢大佬!
作者: 380617414    时间: 2017-11-9 22:28
http://www.jianshu.com/p/96a3f87a06f5
这里有教程,好好看下吧。
作者: Jason233    时间: 2017-11-9 22:30
380617414 发表于 2017-11-9 22:28
http://www.jianshu.com/p/96a3f87a06f5
这里有教程,好好看下吧。

这个我看过,就是没给看懂。希望大佬知道一次,然后会用一条之后其它都会用了。还有谢谢你的回复!!
作者: king    时间: 2017-11-9 23:33
http://www.jianshu.com/p/e2035484dbfa
数据库——敌人——注释

在注释方框里面写上

<Show HP Gauge>
<HP Gauge Width: 300>
<HP Gauge Color 1: 10>
<HP Gauge Color 2: 12>
测试一下就知道了!



作者: 擦不完的水    时间: 2017-11-10 11:23
我记得我是开了插件ON之后把Show参数改成true之后就出来了,没写注释。。。
要放在战斗引擎核心插件下面。。。
试试看吧
作者: j296196585    时间: 2017-11-11 02:25
本帖最后由 j296196585 于 2017-11-11 02:27 编辑

不知道你需要MOG 不
JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // MOG_HPGauge.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc (v1.0) Apresenta um medidor de HP do alvo.
  7.  * @author Moghunter
  8.  *
  9.  * @param Gauge For Actors
  10.  * @desc Apresentar o HP nos aliados .
  11.  * @default true
  12.  *
  13.  * @param Gauge For Enemies
  14.  * @desc Apresentar o HP nos inimigos.
  15.  * @default true
  16.  *
  17.  * @param Show HP On Selection
  18.  * @desc Apresentar o HP na seleção do alvo.
  19.  * @default true
  20.  *
  21.  * @param Fade Duration
  22.  * @desc Definição do tempo para ativar o fade.
  23.  * @default 90
  24.  *
  25.  * @param Slide Animation
  26.  * @desc Ativar animação de deslize.
  27.  * @default true
  28.  *  
  29.  * @param Show HP Number Actor
  30.  * @desc Apresentar o número de HP para o ator.
  31.  * @default false
  32.  *
  33.  * @param Show HP Number Enemy
  34.  * @desc Apresentar o número de HP para o inimigo.
  35.  * @default true
  36.  *
  37.  * @param Required to Kill
  38.  * @desc Requer derrotar o inimigo para mostrar o HP.
  39.  * @default false
  40.  *
  41.  * @param Actor Layout X-Axis
  42.  * @desc Posição X-Axis do layout.
  43.  * @default 0
  44.  *
  45.  * @param Actor Layout Y-Axis
  46.  * @desc Posição Y-Axis do layout.
  47.  * @default 0
  48.  *
  49.  * @param Actor Meter X-Axis
  50.  * @desc Posição X-Axis do medidor.
  51.  * @default 0
  52.  *
  53.  * @param Actor Meter Y-Axis
  54.  * @desc Posição Y-Axis do medidor.
  55.  * @default 3
  56.  *
  57.  * @param Actor HP Number X-Axis
  58.  * @desc Posição X-Axis do numero de HP.
  59.  * @default -25
  60.  *
  61.  * @param Actor HP Number Y-Axis
  62.  * @desc Posição Y-Axis do numero de HP.
  63.  * @default -22
  64.  *
  65.  * @param Enemy Layout X-Axis
  66.  * @desc Posição X-Axis do layout.
  67.  * @default 0
  68.  *
  69.  * @param Enemy Layout Y-Axis
  70.  * @desc Posição Y-Axis do layout.
  71.  * @default 0
  72.  *
  73.  * @param Enemy Meter X-Axis
  74.  * @desc Posição X-Axis do medidor.
  75.  * @default 8
  76.  *
  77.  * @param Enemy Meter Y-Axis
  78.  * @desc Posição Y-Axis do medidor.
  79.  * @default 10
  80.  *
  81.  * @param Enemy HP Number X-Axis
  82.  * @desc Posição X-Axis do numero de HP.
  83.  * @default -25
  84.  *
  85.  * @param Enemy HP Number Y-Axis
  86.  * @desc Posição Y-Axis do numero de HP.
  87.  * @default -19
  88.  *  
  89.  * @help  
  90.  * =============================================================================
  91.  * +++ MOG - HP Gauge (v1.0) +++
  92.  * By Moghunter
  93.  * [url=https://atelierrgss.wordpress.com/]https://atelierrgss.wordpress.com/[/url]
  94.  * =============================================================================
  95.  * Apresenta um medidor de HP do alvo.
  96.  * Serão necessários os arquivos. (img/system/)
  97.  *
  98.  * HPGaugeActor_A.png
  99.  * HPGaugeActor_B.png
  100.  * HPGaugeActor_C.png
  101.  * HPGaugeEnemy_A.png
  102.  * HPGaugeEnemy_B.png
  103.  * HPGaugeEnemy_C.png  
  104.  *
  105.  * =============================================================================
  106.  * NOTETAGS
  107.  * =============================================================================
  108.  * Para ocultar o HP do inimigo use a seguinte Tag na caixa de notas
  109.  *
  110.  * Hide HP
  111.  *
  112.  * -----------------------------------------------------------------------------
  113.  * Para ajustar a posição do medidor use a Tag abaixo.
  114.  *
  115.  * Hp Gauge Offset: X:Y
  116.  *
  117.  * Exemplo
  118.  *
  119.  * Hp Gauge Offset: 130:40
  120.  *
  121.  */
  122.  
  123. //=============================================================================
  124. // ** PLUGIN PARAMETERS
  125. //=============================================================================
  126.   var Imported = Imported || {};
  127.   Imported.MOG_HPGauge = true;
  128.   var Moghunter = Moghunter || {};
  129.  
  130.    Moghunter.parameters = PluginManager.parameters('MOG_HPGauge');
  131.     Moghunter.hpgauge_actors = String(Moghunter.parameters['Gauge For Actors'] || "true");
  132.         Moghunter.hpgauge_enemies = String(Moghunter.parameters['Gauge For Enemies'] || "true");
  133.         Moghunter.hpgauge_selection = String(Moghunter.parameters['Show HP On Selection'] || "true");
  134.         Moghunter.hpgauge_slide = String(Moghunter.parameters['Slide Animation'] || "true");
  135.         Moghunter.hpgauge_showNumberActor = String(Moghunter.parameters['Show HP Number Actor'] || "false");
  136.         Moghunter.hpgauge_showNumberEnemy = String(Moghunter.parameters['Show HP Number Enemy'] || "true");
  137.         Moghunter.hpgauge_NumberAfter = String(Moghunter.parameters['Required to Kill'] || "false");
  138.     Moghunter.hpgauge_a_x = Number(Moghunter.parameters['Enemy Layout X-Axis'] || 0);
  139.     Moghunter.hpgauge_a_y = Number(Moghunter.parameters['Enemy Layout Y-Axis'] || 0);
  140.     Moghunter.hpgauge_b_x = Number(Moghunter.parameters['Enemy Meter X-Axis'] || 8);
  141.     Moghunter.hpgauge_b_y = Number(Moghunter.parameters['Enemy Meter Y-Axis'] || 10);        
  142.     Moghunter.hpgauge_c_x = Number(Moghunter.parameters['Enemy HP Number X-Axis'] || -30);
  143.     Moghunter.hpgauge_c_y = Number(Moghunter.parameters['Enemy HP Number Y-Axis'] || -19);        
  144.     Moghunter.hpgauge_a_xa = Number(Moghunter.parameters['Actor Layout X-Axis'] || 0);
  145.     Moghunter.hpgauge_a_ya = Number(Moghunter.parameters['Actor Layout Y-Axis'] || 0);
  146.     Moghunter.hpgauge_b_xa = Number(Moghunter.parameters['Actor Meter X-Axis'] || 0);
  147.     Moghunter.hpgauge_b_ya = Number(Moghunter.parameters['Actor Meter Y-Axis'] || 3);        
  148.     Moghunter.hpgauge_c_xa = Number(Moghunter.parameters['Actor HP Number X-Axis'] || -25);
  149.     Moghunter.hpgauge_c_ya = Number(Moghunter.parameters['Actor HP Number Y-Axis'] || -19);               
  150.         Moghunter.hpgauge_duration = Number(Moghunter.parameters['Fade Duration'] || 90);
  151.  
  152. //=============================================================================
  153. // ** Game_Temp
  154. //=============================================================================
  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. //=============================================================================
  166. // ** Game_System
  167. //=============================================================================
  168.  
  169. //==============================
  170. // * Initialize
  171. //==============================
  172. var _mog_hpgauge_sys_initialize = Game_System.prototype.initialize;
  173. Game_System.prototype.initialize = function() {
  174.         _mog_hpgauge_sys_initialize.call(this);
  175.     this._hpGaugeEDef = [];
  176. };
  177.  
  178. //=============================================================================
  179. // ** BattleManager
  180. //=============================================================================
  181.  
  182. //==============================
  183. // * processVictory
  184. //==============================
  185. var _mog_hpGauge_processVictory = BattleManager.processVictory;
  186. BattleManager.processVictory = function() {
  187.          $gameTemp._hpGauge[0] = false;
  188.          _mog_hpGauge_processVictory.call(this);         
  189. };
  190.  
  191. //==============================
  192. // * processAbort
  193. //==============================
  194. var _mog_hpGauge_processAbort = BattleManager.processAbort;
  195. BattleManager.processAbort = function() {
  196.          $gameTemp._hpGauge[0] = false;
  197.          _mog_hpGauge_processAbort.call(this);         
  198. };
  199.  
  200. //==============================
  201. // * processDefeat
  202. //==============================
  203. var _mog_hpGauge_processDefeat = BattleManager.processDefeat;
  204. BattleManager.processDefeat = function() {
  205.          $gameTemp._hpGauge[0] = false;
  206.          _mog_hpGauge_processDefeat.call(this);         
  207. };
  208.  
  209. //=============================================================================
  210. // ** Game Battler
  211. //=============================================================================
  212.  
  213. //==============================
  214. // * init Members
  215. //==============================
  216. var _mog_hpgauge_gbat_initMembers = Game_Battler.prototype.initMembers;
  217. Game_Battler.prototype.initMembers = function() {
  218.     _mog_hpgauge_gbat_initMembers.call(this);
  219.     this._ehpgauge = [false,0,0,false,false];
  220. };
  221.  
  222. //==============================
  223. // * check HP Gauge Notes
  224. //==============================
  225. Game_Battler.prototype.checkHPGaugeNotes = function() {
  226.         this.notetags().forEach(function(note) {
  227.                 if (note == "Hide HP") {this._ehpgauge[0] = false};
  228.          var note_data = note.split(': ')
  229.                  if (note_data[0].toLowerCase() == "hp gauge offset"){
  230.                          var par = note_data[1].split(':');
  231.                      this._ehpgauge[1] = Number(par[0]);
  232.                          this._ehpgauge[2] = Number(par[1]);
  233.                  };               
  234.         },this);
  235. };
  236.  
  237. //==============================
  238. // * Notetags
  239. //==============================
  240. Game_Battler.prototype.notetags = function() {
  241.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  242.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  243. };
  244.  
  245. //=============================================================================
  246. // ** Game_Actor
  247. //=============================================================================
  248.  
  249. //==============================
  250. // * Setup
  251. //==============================
  252. var _mog_hp_gauge_gactor_setup = Game_Actor.prototype.setup;
  253. Game_Actor.prototype.setup = function(actorId) {
  254.         _mog_hp_gauge_gactor_setup.call(this,actorId);
  255.         if (String(Moghunter.hpgauge_actors) === "true") {this._ehpgauge[0] = true};
  256.         this.checkHPGaugeNotes();
  257. };
  258.  
  259. //=============================================================================
  260. // ** Game_Enemy
  261. //=============================================================================
  262.  
  263. //==============================
  264. // * Setup
  265. //==============================
  266. var _mog_hpgauge_genemy_setup = Game_Enemy.prototype.setup;
  267. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  268.         _mog_hpgauge_genemy_setup.call(this,enemyId, x, y);
  269.         if (String(Moghunter.hpgauge_enemies) === "true") {this._ehpgauge[0] = true};
  270.         this.checkHPGaugeNotes();
  271. };
  272.  
  273. //==============================
  274. // * Die
  275. //==============================
  276. var _mog_hpgauge_genemy_die = Game_Enemy.prototype.die;
  277. Game_Enemy.prototype.die = function() {
  278.         _mog_hpgauge_genemy_die.call(this);
  279.         $gameSystem._hpGaugeEDef[this._enemyId] = true;
  280. };
  281.  
  282. //=============================================================================
  283. // ** Game Action
  284. //=============================================================================
  285.  
  286. //==============================
  287. // * Apply
  288. //==============================
  289. var _mog_hpgauge_gaction_apply = Game_Action.prototype.apply;
  290. Game_Action.prototype.apply = function(target) {
  291.          _mog_hpgauge_gaction_apply.call(this,target);
  292.      if (target) {
  293.                  if (this.isHpRecover()) {
  294.                          target._ehpgauge[4] = true;
  295.                  } else if (this.item() && this.item().damage.type === 5) {
  296.                          target._ehpgauge[4] = true;
  297.                          var subj = this.subject();
  298.                          if (subj) {subj._ehpgauge[4] = true};
  299.                  };
  300.           };
  301. };
  302.  
  303. //=============================================================================
  304. // ** Spriteset_Battle
  305. //=============================================================================        
  306.  
  307. //==============================
  308. // * CreateLowerLayer
  309. //==============================
  310. var _mog_hpgauge_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer
  311. Spriteset_Battle.prototype.createUpperLayer = function() {
  312.         this.create_HPGauge();
  313.         _mog_hpgauge_createUpperLayer.call(this);        
  314. };
  315.  
  316. //==============================
  317. // * Create HP Gauge
  318. //==============================
  319. Spriteset_Battle.prototype.create_HPGauge = function() {
  320.     this.createHPField();
  321.         this.createHPSprites()
  322. };
  323.  
  324. //==============================
  325. // * Create EHP Field
  326. //==============================
  327. Spriteset_Battle.prototype.createHPField = function() {
  328.     this._hpField = new Sprite();
  329.         this._hpField.z = 100;
  330.         this.addChild(this._hpField);
  331. };
  332.  
  333. //==============================
  334. // * Create HP Sprites
  335. //==============================
  336. Spriteset_Battle.prototype.createHPSprites = function() {
  337.         $gameTemp._hpGauge[0] = true;
  338.         this._HPSprites = [];
  339.         if (String(Moghunter.hpgauge_actors) === "true") {
  340.                 for (var i = 0; i < this._actorSprites.length; i++) {
  341.                          this._HPSprites[i] = new HPGaugeSprite(this._actorSprites[i],0);
  342.                          this._hpField.addChild(this._HPSprites[i]);        
  343.                 };
  344.         };
  345.         if (String(Moghunter.hpgauge_enemies) === "true") {
  346.                 for (var i = 0; i < this._enemySprites.length; i++) {
  347.                          this._HPSprites[i] = new HPGaugeSprite(this._enemySprites[i],1);
  348.                          this._hpField.addChild(this._HPSprites[i]);
  349.                 };
  350.         };
  351. };
  352.  
  353. //==============================
  354. // * Update
  355. //==============================
  356. var _mog_hpGauge_sprBat_update = Spriteset_Battle.prototype.update;
  357. Spriteset_Battle.prototype.update = function() {
  358.         _mog_hpGauge_sprBat_update.call(this);
  359.         if (Imported.MOG_BattleCamera && this._hpField) {this.updateHPField()};
  360. };
  361.  
  362. //==============================
  363. // * Update
  364. //==============================
  365. Spriteset_Battle.prototype.updateHPField = function() {
  366.     this._hpField.x = this._battleField.x
  367.         this._hpField.y = this._battleField.y
  368. };
  369.  
  370. //=============================================================================
  371. // ** HP Gauge Sprite
  372. //=============================================================================
  373. function HPGaugeSprite() {
  374.     this.initialize.apply(this, arguments);
  375. };
  376.  
  377. HPGaugeSprite.prototype = Object.create(Sprite.prototype);
  378. HPGaugeSprite.prototype.constructor = HPGaugeSprite;
  379.  
  380. //==============================
  381. // * Initialize
  382. //==============================
  383. HPGaugeSprite.prototype.initialize = function(sprite,type) {
  384.     Sprite.prototype.initialize.call(this);
  385.     this._sprite = sprite;
  386.         this._slideX = 0;
  387.         this._duration = 0;
  388.         this.opacity = 0;
  389.         this.type = type;
  390.         this.z = 100;
  391.         this._slideA = String(Moghunter.hpgauge_slide) === "true" ? true : false;
  392.         this._selectionHP = String(Moghunter.hpgauge_selection) === "true" ? true : false;
  393.         if (type === 0) {
  394.             this._showHPNumber = String(Moghunter.hpgauge_showNumberActor) === "true" ? true : false;
  395.         } else {
  396.             this._showHPNumber = String(Moghunter.hpgauge_showNumberEnemy) === "true" ? true : false;
  397.         };
  398.         this._IDA = type === 0 ? true : this.enemyIDA();
  399.         if (type === 1 && String(Moghunter.hpgauge_NumberAfter) != "true") {this._IDA = true};
  400.         this._data = [0,0,0,0,0];
  401.         this.loadBitmaps();
  402. };
  403.  
  404. //==============================
  405. // * Battler
  406. //==============================
  407. HPGaugeSprite.prototype.battler = function() {
  408.     return this._sprite._battler;
  409. };
  410.  
  411. //==============================
  412. // * Load Bitmaps
  413. //==============================
  414. HPGaugeSprite.prototype.loadBitmaps = function() {
  415.         if (this.type === 0) {
  416.         this._layImg = ImageManager.loadSystem("HPGaugeActor_A");
  417.             this._meterImg = ImageManager.loadSystem("HPGaugeActor_B");
  418.                 this._numberImg = ImageManager.loadSystem("HPGaugeActor_C");
  419.         } else {
  420.         this._layImg = ImageManager.loadSystem("HPGaugeEnemy_A");
  421.             this._meterImg = ImageManager.loadSystem("HPGaugeEnemy_B");        
  422.                 this._numberImg = ImageManager.loadSystem("HPGaugeEnemy_C");        
  423.         };
  424. };
  425.  
  426. //==============================
  427. // * createSprites
  428. //==============================
  429. HPGaugeSprite.prototype.createSprites = function() {
  430.         this.createLayout();
  431.         this.createMeter();
  432.         if (this._showHPNumber) {this.createNumber()};
  433. };
  434.  
  435. //==============================
  436. // * Create Layout
  437. //==============================
  438. HPGaugeSprite.prototype.createLayout = function() {
  439.     this._layout = new Sprite(this._layImg);
  440.         if (this.type === 0) {
  441.             this._layout.x = Moghunter.hpgauge_a_xa - this._layImg.width / 2;
  442.             this._layout.y = Moghunter.hpgauge_a_ya - this._layImg.height / 2;
  443.         } else {
  444.             this._layout.x = Moghunter.hpgauge_a_x - this._layImg.width / 2;
  445.             this._layout.y = Moghunter.hpgauge_a_y - this._layImg.height / 2;
  446.         };
  447.         this.addChild(this._layout);
  448. };
  449.  
  450. //==============================
  451. // * Create Gauge
  452. //==============================
  453. HPGaugeSprite.prototype.createMeter = function() {
  454.         this._meter = [];
  455.         for (var i = 0; i < 2; i++) {
  456.                 this._meter[i] = new Sprite(this._meterImg);
  457.                 this._meter[i].value1 = this.battler().hp;
  458.                 this._meter[i].value2 = this.battler().mhp;
  459.                 this._meter[i].ds = 0;
  460.                 this._meter[i].w = this._meterImg.width;
  461.                 this._meter[i].h = this._meterImg.height / 2;
  462.                 if (this.type === 0) {
  463.                     this._meter[i].x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_b_xa - this._meterImg.width / 2;
  464.                     this._meter[i].y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_b_ya - this._meterImg.height / 2;
  465.                 } else {
  466.                     this._meter[i].x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_b_x - this._meterImg.width / 2;
  467.                     this._meter[i].y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_b_y - this._meterImg.height / 2;
  468.             };
  469.                 this.addChild(this._meter[i]);
  470.         };
  471.     this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  472.         this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);        
  473.         this.updateMeter();
  474. };
  475.  
  476. //==============================
  477. // * Need Refresh Blue Meter
  478. //==============================
  479. HPGaugeSprite.prototype.needRefreshBlueMeter = function() {
  480.         if (this.battler()._ehpgauge[4]) {return true};
  481.     if (this._meter[1].value1 != this.battler().hp) {return true};
  482.         if (this._meter[1].value2 != this.battler().mhp) {return true};
  483.         return false
  484. };
  485.  
  486. //==============================
  487. // * refresh Blue Meter
  488. //==============================
  489. HPGaugeSprite.prototype.refreshBlueMeter = function() {
  490.          this.battler()._ehpgauge[4] = false;
  491.      this._meter[1].value1 = this.battler().hp;
  492.          this._meter[1].value2 = this.battler().mhp;
  493.          if (!$gameTemp._hpGauge[0]) {return};
  494.          this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  495.          this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);
  496.          this.prepareSlide();
  497. };
  498.  
  499. //==============================
  500. // * prepare Slide
  501. //==============================
  502. HPGaugeSprite.prototype.prepareSlide = function() {
  503.         if (this.opacity < 100 || this._slideX > 0) {
  504.             this._slideX = this._slideA ? -50 : -0.01;
  505.             this.opacity = 0;
  506.         };
  507.         this._duration = Math.min(Math.max(Moghunter.hpgauge_duration,1),999);
  508. };
  509.  
  510. //==============================
  511. // * Update Dif
  512. //==============================
  513. HPGaugeSprite.prototype.update_dif = function(value,real_value,speed,type) {
  514.         if (value == real_value) {return value};
  515.         var mr = type === 0 ? 1 : 0.1;
  516.     var dnspeed = mr + (Math.abs(value - real_value) / speed);
  517.         if (value > real_value) {value -= dnspeed;
  518.             if (value < real_value) {value = real_value};
  519.         } else if (value < real_value) {value  += dnspeed;
  520.             if (value  > real_value) {value  = real_value};               
  521.     };
  522.         if (type === 0) {
  523.             return Math.floor(value);
  524.         } else {
  525.                 return value;
  526.         };
  527. };
  528.  
  529. //==============================
  530. // * Need Refresh Red Meter
  531. //==============================
  532. HPGaugeSprite.prototype.needRefreshRedMeter = function() {
  533.      if (this._meter[0].value1 != this.battler().hp) {return true};
  534.          return false;
  535. };
  536.  
  537. //==============================
  538. // * refresh Red Meter
  539. //==============================
  540. HPGaugeSprite.prototype.refreshRedMeter = function() {
  541.            this._meter[0].value1 = this.update_dif(this._meter[0].value1,this.battler().hp, 60,1);
  542.          this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
  543. };
  544.  
  545. //==============================
  546. // * Update Meter
  547. //==============================
  548. HPGaugeSprite.prototype.updateMeter = function() {
  549.          if (this.needRefreshRedMeter()) {this.refreshRedMeter()};
  550.          if (this.needRefreshBlueMeter()) {this.refreshBlueMeter()};
  551. };
  552.  
  553. //==============================
  554. // * Refresh Meter
  555. //==============================
  556. HPGaugeSprite.prototype.refreshMeter = function(sprite,value1,value2,h) {
  557.      var wd = value1 * sprite.w / value2
  558.          sprite.setFrame(0,sprite.h * h,wd,sprite.h);  
  559. };
  560.  
  561. //==============================
  562. // * create Number
  563. //==============================
  564. HPGaugeSprite.prototype.createNumber = function() {
  565.         this._hp_number = [];
  566.         this._numberData = [this.battler().hp - 1,this._numberImg.width / 11,this._numberImg.height]
  567.         for (var i = 0; i < 6; i++) {
  568.                  this._hp_number[i] = new Sprite(this._numberImg);
  569.                  this._hp_number[i].visible = false;
  570.                  if (this.type === 0) {
  571.                      this._hp_number[i].x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_c_xa;
  572.                      this._hp_number[i].y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_c_ya;
  573.                  } else {
  574.                      this._hp_number[i].x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_c_x;
  575.                      this._hp_number[i].y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_c_y;
  576.                  };
  577.                  this._hp_number[i].org = [this._hp_number[i].x,this._hp_number[i].y];
  578.                  this.addChild(this._hp_number[i]);                 
  579.         };
  580. };
  581.  
  582. //==============================
  583. // * update Number
  584. //==============================
  585. HPGaugeSprite.prototype.updateNumber = function() {
  586.         if (this._numberData[0] != this.battler().hp) {this.refreshNumber()};
  587. };
  588.  
  589. //==============================
  590. // * enemy IDA
  591. //==============================
  592. HPGaugeSprite.prototype.enemyIDA = function() {
  593.          if (this.battler().isActor()) {return true};
  594.      return $gameSystem._hpGaugeEDef[this.battler()._enemyId];
  595. };
  596.  
  597. //==============================
  598. // * ID available
  599. //==============================
  600. HPGaugeSprite.prototype.idIsAvailable = function() {
  601.         return this._IDA;
  602. };
  603.  
  604. //==============================
  605. // * refresh Number
  606. //==============================
  607. HPGaugeSprite.prototype.refreshNumber = function() {
  608.         this._numberData[0] = this.update_dif(this._numberData[0],this.battler().hp, 40,0);
  609.     var w = this._numberData[1];
  610.         var h = this._numberData[2];
  611.         var number = Math.abs(this._numberData[0]).toString().split("");
  612.     for (var i = 0; i < this._hp_number.length; i++) {
  613.            this._hp_number[i].visible = false;         
  614.            if (this.idIsAvailable()) {        
  615.                    if (i <  number.length) {
  616.                            var n = Number(number[i]);
  617.                            this._hp_number[i].setFrame(n * w, 0, w, h);
  618.                            this._hp_number[i].visible = true;           
  619.                            this._hp_number[i].x = this._hp_number[i].org[0] + (w * i);
  620.                    };
  621.            } else {
  622.                    if (i === 0) {
  623.                            this._hp_number[0].setFrame(10 * w, 0, w, h);
  624.                            this._hp_number[0].visible = true;           
  625.                            this._hp_number[0].x = this._hp_number[0].org[0] + (w * 2);                             
  626.                    };
  627.            };
  628.     };        
  629. };
  630.  
  631. //==============================
  632. // * Is Visible
  633. //==============================
  634. HPGaugeSprite.prototype.isVisible = function() {
  635.         if (!this.battler()) {return false};
  636.         if (this.battler().isHidden()) {return false};
  637.     if (!this.battler()._ehpgauge[0]) {return false};
  638.         return true;
  639. };
  640.  
  641. //==============================
  642. // * force Visible
  643. //==============================
  644. HPGaugeSprite.prototype.forceVisible = function() {
  645.      if (this.battler()._ehpgauge[3]) {return true};
  646.          if (this._selectionHP && this.battler().isSelected() && !this.battler().isDead()) {return true};
  647.          return false;
  648. };
  649.  
  650. //==============================
  651. // * pos X
  652. //==============================
  653. HPGaugeSprite.prototype.posX = function() {
  654.         var xs = this.forceVisible() ? 0 : this._slideX;
  655.     return this._sprite.x + xs + this.battler()._ehpgauge[1];
  656. };
  657.  
  658. //==============================
  659. // * pos Y
  660. //==============================
  661. HPGaugeSprite.prototype.posY = function() {
  662.     return this._sprite.y + this.battler()._ehpgauge[2];
  663. };
  664.  
  665. //==============================
  666. // * Update Slide
  667. //==============================
  668. HPGaugeSprite.prototype.updateSlide = function() {
  669.         this._slideX += 2;
  670.         this.opacity += 10;
  671.         if (this._slideX >= 0) {
  672.                 this._slideX = 0;
  673.                 this.opacity = 255;
  674.         };
  675. };
  676.  
  677. //==============================
  678. // * Update Fade
  679. //==============================
  680. HPGaugeSprite.prototype.updateFade = function() {
  681.         if (this._slideA) {this._slideX += 2};
  682.         this.opacity -= 10;
  683. };
  684.  
  685. //==============================
  686. // * Update Slide
  687. //==============================
  688. HPGaugeSprite.prototype.updateAnimation = function() {
  689.     if (this._slideX < 0) {this.updateSlide();return};
  690.         if (this._duration > 0) {this._duration--;return};
  691.         if (this.opacity > 0) {this.updateFade()};        
  692. };
  693.  
  694. //==============================
  695. // * Update Force Visible
  696. //==============================
  697. HPGaugeSprite.prototype.updateForceVisible = function() {
  698.     this.opacity = 255;
  699.     this._duration = 0;
  700.     this._slideX = 0;
  701. };
  702.  
  703. //==============================
  704. // * Update Position
  705. //==============================
  706. HPGaugeSprite.prototype.updatePosition = function() {
  707.    if (this.forceVisible()) {
  708.        this.updateForceVisible();
  709.    } else {
  710.            this.updateAnimation();
  711.    };
  712.    this.x = this.posX();
  713.    this.y = this.posY();
  714. };
  715.  
  716. //==============================
  717. // * Update
  718. //==============================
  719. HPGaugeSprite.prototype.update = function() {
  720.     Sprite.prototype.update.call(this);
  721.         this.visible = this.isVisible();
  722.         if (!this.battler()) {return};
  723.         if (!this._layout && this._meterImg.isReady()) {this.createSprites()};
  724.         if (this._meter) {this.updateMeter()};
  725.         if (this._hp_number) {this.updateNumber()};
  726.     this.updatePosition();
  727. };

360截图20171111022348975.jpg (169.27 KB, 下载次数: 1)

360截图20171111022348975.jpg

HPGaugeActor_A.png (17.5 KB, 下载次数: 9)

HPGaugeActor_A.png

HPGaugeActor_B.png (17.59 KB, 下载次数: 7)

HPGaugeActor_B.png

HPGaugeActor_C.png (18.84 KB, 下载次数: 8)

HPGaugeActor_C.png

HPGaugeEnemy_A.png (20.58 KB, 下载次数: 9)

HPGaugeEnemy_A.png

HPGaugeEnemy_B.png (17.6 KB, 下载次数: 10)

HPGaugeEnemy_B.png

HPGaugeEnemy_C.png (18.84 KB, 下载次数: 8)

HPGaugeEnemy_C.png

作者: doomto    时间: 2017-11-11 15:16
事件 添加插件命令 设置怪物

360截图20171111151508245.jpg (22.3 KB, 下载次数: 28)

360截图20171111151508245.jpg

作者: eHery    时间: 2017-11-12 18:48
king 发表于 2017-11-9 23:33
http://www.jianshu.com/p/e2035484dbfa
数据库——敌人——注释

没必要,在插件设置里把Always Visible写成true就行,如果Boss不希望就在敌人注释那里写<Hide HP Gauge>




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