查看: 2497|回复: 12

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

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

开拓者

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

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

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

×
MOG_HPGauge显示能否超过6位数



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

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

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

点评

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

使用道具 举报

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

开拓者

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


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



[pre lang="javascript"]//=============================================================================
// MOG_HPGauge.js
//=============================================================================

/*:
* @plugindesc (v1.0) Apresenta um medidor de HP do alvo.
* @author Moghunter
*
* @param Gauge For Actors
* @desc Apresentar o HP nos aliados .
* @default true
*
* @param Gauge For Enemies
* @desc Apresentar o HP nos inimigos.
* @default true
*
* @param Show HP On Selection
* @desc Apresentar o HP na seleção do alvo.
* @default true
*
* @param Fade Duration
* @desc Definição do tempo para ativar o fade.
* @default 90
*
* @param Slide Animation
* @desc Ativar animação de deslize.
* @default true
*  
* @param Show HP Number Actor
* @desc Apresentar o número de HP para o ator.
* @default false
*
* @param Show HP Number Enemy
* @desc Apresentar o número de HP para o inimigo.
* @default true
*
* @param Required to Kill
* @desc Requer derrotar o inimigo para mostrar o HP.
* @default false
*
* @param Actor Layout X-Axis
* @desc Posição X-Axis do layout.
* @default 0
*
* @param Actor Layout Y-Axis
* @desc Posição Y-Axis do layout.
* @default 0
*
* @param Actor Meter X-Axis
* @desc Posição X-Axis do medidor.
* @default 0
*
* @param Actor Meter Y-Axis
* @desc Posição Y-Axis do medidor.
* @default 3
*
* @param Actor HP Number X-Axis
* @desc Posição X-Axis do numero de HP.
* @default -25
*
* @param Actor HP Number Y-Axis
* @desc Posição Y-Axis do numero de HP.
* @default -22
*
* @param Enemy Layout X-Axis
* @desc Posição X-Axis do layout.
* @default 0
*
* @param Enemy Layout Y-Axis
* @desc Posição Y-Axis do layout.
* @default 0
*
* @param Enemy Meter X-Axis
* @desc Posição X-Axis do medidor.
* @default 8
*
* @param Enemy Meter Y-Axis
* @desc Posição Y-Axis do medidor.
* @default 10
*
* @param Enemy HP Number X-Axis
* @desc Posição X-Axis do numero de HP.
* @default -25
*
* @param Enemy HP Number Y-Axis
* @desc Posição Y-Axis do numero de HP.
* @default -19
*  
* @help  
* =============================================================================
* +++ MOG - HP Gauge (v1.0) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* =============================================================================
* Apresenta um medidor de HP do alvo.
* Serão necessários os arquivos. (img/system/)
*
* HPGaugeActor_A.png
* HPGaugeActor_B.png
* HPGaugeActor_C.png
* HPGaugeEnemy_A.png
* HPGaugeEnemy_B.png
* HPGaugeEnemy_C.png  
*
* =============================================================================
* NOTETAGS
* =============================================================================
* Para ocultar o HP do inimigo use a seguinte Tag na caixa de notas
*
* Hide HP
*
* -----------------------------------------------------------------------------
* Para ajustar a posição do medidor use a Tag abaixo.
*
* Hp Gauge Offset: X:Y
*
* Exemplo
*
* Hp Gauge Offset: 130:40
*
*/

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
  var Imported = Imported || {};
  Imported.MOG_HPGauge = true;
  var Moghunter = Moghunter || {};

   Moghunter.parameters = PluginManager.parameters('MOG_HPGauge');
    Moghunter.hpgauge_actors = String(Moghunter.parameters['Gauge For Actors'] || "true");
        Moghunter.hpgauge_enemies = String(Moghunter.parameters['Gauge For Enemies'] || "true");
        Moghunter.hpgauge_selection = String(Moghunter.parameters['Show HP On Selection'] || "true");
        Moghunter.hpgauge_slide = String(Moghunter.parameters['Slide Animation'] || "true");
        Moghunter.hpgauge_showNumberActor = String(Moghunter.parameters['Show HP Number Actor'] || "false");
        Moghunter.hpgauge_showNumberEnemy = String(Moghunter.parameters['Show HP Number Enemy'] || "true");
        Moghunter.hpgauge_NumberAfter = String(Moghunter.parameters['Required to Kill'] || "false");
    Moghunter.hpgauge_a_x = Number(Moghunter.parameters['Enemy Layout X-Axis'] || 0);
    Moghunter.hpgauge_a_y = Number(Moghunter.parameters['Enemy Layout Y-Axis'] || 0);
    Moghunter.hpgauge_b_x = Number(Moghunter.parameters['Enemy Meter X-Axis'] || 8);
    Moghunter.hpgauge_b_y = Number(Moghunter.parameters['Enemy Meter Y-Axis'] || 10);       
    Moghunter.hpgauge_c_x = Number(Moghunter.parameters['Enemy HP Number X-Axis'] || -30);
    Moghunter.hpgauge_c_y = Number(Moghunter.parameters['Enemy HP Number Y-Axis'] || -19);       
    Moghunter.hpgauge_a_xa = Number(Moghunter.parameters['Actor Layout X-Axis'] || 0);
    Moghunter.hpgauge_a_ya = Number(Moghunter.parameters['Actor Layout Y-Axis'] || 0);
    Moghunter.hpgauge_b_xa = Number(Moghunter.parameters['Actor Meter X-Axis'] || 0);
    Moghunter.hpgauge_b_ya = Number(Moghunter.parameters['Actor Meter Y-Axis'] || 3);       
    Moghunter.hpgauge_c_xa = Number(Moghunter.parameters['Actor HP Number X-Axis'] || -25);
    Moghunter.hpgauge_c_ya = Number(Moghunter.parameters['Actor HP Number Y-Axis'] || -19);               
        Moghunter.hpgauge_duration = Number(Moghunter.parameters['Fade Duration'] || 90);

//=============================================================================
// ** Game_Temp
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_hpgauge_temp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function() {
        _mog_hpgauge_temp_initialize.call(this);
    this._hpGauge = [true,false];
};

//=============================================================================
// ** Game_System
//=============================================================================

//==============================
// * Initialize
//==============================
var _mog_hpgauge_sys_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
        _mog_hpgauge_sys_initialize.call(this);
    this._hpGaugeEDef = [];
};

//=============================================================================
// ** BattleManager
//=============================================================================

//==============================
// * processVictory
//==============================
var _mog_hpGauge_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
         $gameTemp._hpGauge[0] = false;
         _mog_hpGauge_processVictory.call(this);         
};

//==============================
// * processAbort
//==============================
var _mog_hpGauge_processAbort = BattleManager.processAbort;
BattleManager.processAbort = function() {
         $gameTemp._hpGauge[0] = false;
         _mog_hpGauge_processAbort.call(this);         
};

//==============================
// * processDefeat
//==============================
var _mog_hpGauge_processDefeat = BattleManager.processDefeat;
BattleManager.processDefeat = function() {
         $gameTemp._hpGauge[0] = false;
         _mog_hpGauge_processDefeat.call(this);         
};

//=============================================================================
// ** Game Battler
//=============================================================================

//==============================
// * init Members
//==============================
var _mog_hpgauge_gbat_initMembers = Game_Battler.prototype.initMembers;
Game_Battler.prototype.initMembers = function() {
    _mog_hpgauge_gbat_initMembers.call(this);
    this._ehpgauge = [false,0,0,false,false];
};

//==============================
// * check HP Gauge Notes
//==============================
Game_Battler.prototype.checkHPGaugeNotes = function() {
        this.notetags().forEach(function(note) {
                if (note == "Hide HP") {this._ehpgauge[0] = false};
         var note_data = note.split(': ')
                 if (note_data[0].toLowerCase() == "hp gauge offset"){
                         var par = note_data[1].split(':');
                     this._ehpgauge[1] = Number(par[0]);
                         this._ehpgauge[2] = Number(par[1]);
                 };               
        },this);
};

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

//=============================================================================
// ** Game_Actor
//=============================================================================

//==============================
// * Setup
//==============================
var _mog_hp_gauge_gactor_setup = Game_Actor.prototype.setup;
Game_Actor.prototype.setup = function(actorId) {
        _mog_hp_gauge_gactor_setup.call(this,actorId);
        if (String(Moghunter.hpgauge_actors) === "true") {this._ehpgauge[0] = true};
        this.checkHPGaugeNotes();
};

//=============================================================================
// ** Game_Enemy
//=============================================================================

//==============================
// * Setup
//==============================
var _mog_hpgauge_genemy_setup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
        _mog_hpgauge_genemy_setup.call(this,enemyId, x, y);
        if (String(Moghunter.hpgauge_enemies) === "true") {this._ehpgauge[0] = true};
        this.checkHPGaugeNotes();
};

//==============================
// * Die
//==============================
var _mog_hpgauge_genemy_die = Game_Enemy.prototype.die;
Game_Enemy.prototype.die = function() {
        _mog_hpgauge_genemy_die.call(this);
        $gameSystem._hpGaugeEDef[this._enemyId] = true;
};

//=============================================================================
// ** Game Action
//=============================================================================

//==============================
// * Apply
//==============================
var _mog_hpgauge_gaction_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
         _mog_hpgauge_gaction_apply.call(this,target);
     if (target) {
                 if (this.isHpRecover()) {
                         target._ehpgauge[4] = true;
                 } else if (this.item() && this.item().damage.type === 5) {
                         target._ehpgauge[4] = true;
                         var subj = this.subject();
                         if (subj) {subj._ehpgauge[4] = true};
                 };
          };
};

//=============================================================================
// ** Spriteset_Battle
//=============================================================================       

//==============================
// * CreateLowerLayer
//==============================
var _mog_hpgauge_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer
Spriteset_Battle.prototype.createUpperLayer = function() {
        this.create_HPGauge();
        _mog_hpgauge_createUpperLayer.call(this);       
};

//==============================
// * Create HP Gauge
//==============================
Spriteset_Battle.prototype.create_HPGauge = function() {
    this.createHPField();
        this.createHPSprites()
};

//==============================
// * Create EHP Field
//==============================
Spriteset_Battle.prototype.createHPField = function() {
    this._hpField = new Sprite();
        this._hpField.z = 100;
        this.addChild(this._hpField);
};

//==============================
// * Create HP Sprites
//==============================
Spriteset_Battle.prototype.createHPSprites = function() {
        $gameTemp._hpGauge[0] = true;
        this._HPSprites = [];
        if (String(Moghunter.hpgauge_actors) === "true") {
                for (var i = 0; i < this._actorSprites.length; i++) {
                         this._HPSprites = new HPGaugeSprite(this._actorSprites,0);
                         this._hpField.addChild(this._HPSprites);       
                };
        };
        if (String(Moghunter.hpgauge_enemies) === "true") {
                for (var i = 0; i < this._enemySprites.length; i++) {
                         this._HPSprites = new HPGaugeSprite(this._enemySprites,1);
                         this._hpField.addChild(this._HPSprites);
                };
        };
};

//==============================
// * Update
//==============================
var _mog_hpGauge_sprBat_update = Spriteset_Battle.prototype.update;
Spriteset_Battle.prototype.update = function() {
        _mog_hpGauge_sprBat_update.call(this);
        if (Imported.MOG_BattleCamera && this._hpField) {this.updateHPField()};
};

//==============================
// * Update
//==============================
Spriteset_Battle.prototype.updateHPField = function() {
    this._hpField.x = this._battleField.x
        this._hpField.y = this._battleField.y
};

//=============================================================================
// ** HP Gauge Sprite
//=============================================================================
function HPGaugeSprite() {
    this.initialize.apply(this, arguments);
};

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

//==============================
// * Initialize
//==============================
HPGaugeSprite.prototype.initialize = function(sprite,type) {
    Sprite.prototype.initialize.call(this);
    this._sprite = sprite;
        this._slideX = 0;
        this._duration = 0;
        this.opacity = 0;
        this.type = type;
        this.z = 100;
        this._slideA = String(Moghunter.hpgauge_slide) === "true" ? true : false;
        this._selectionHP = String(Moghunter.hpgauge_selection) === "true" ? true : false;
        if (type === 0) {
            this._showHPNumber = String(Moghunter.hpgauge_showNumberActor) === "true" ? true : false;
        } else {
            this._showHPNumber = String(Moghunter.hpgauge_showNumberEnemy) === "true" ? true : false;
        };
        this._IDA = type === 0 ? true : this.enemyIDA();
        if (type === 1 && String(Moghunter.hpgauge_NumberAfter) != "true") {this._IDA = true};
        this._data = [0,0,0,0,0];
        this.loadBitmaps();
};
   
//==============================
// * Battler
//==============================
HPGaugeSprite.prototype.battler = function() {
    return this._sprite._battler;
};

//==============================
// * Load Bitmaps
//==============================
HPGaugeSprite.prototype.loadBitmaps = function() {
        if (this.type === 0) {
        this._layImg = ImageManager.loadSystem("HPGaugeActor_A");
            this._meterImg = ImageManager.loadSystem("HPGaugeActor_B");
                this._numberImg = ImageManager.loadSystem("HPGaugeActor_C");
        } else {
        this._layImg = ImageManager.loadSystem("HPGaugeEnemy_A");
            this._meterImg = ImageManager.loadSystem("HPGaugeEnemy_B");       
                this._numberImg = ImageManager.loadSystem("HPGaugeEnemy_C");       
        };
};

//==============================
// * createSprites
//==============================
HPGaugeSprite.prototype.createSprites = function() {
        this.createLayout();
        this.createMeter();
        if (this._showHPNumber) {this.createNumber()};
};

//==============================
// * Create Layout
//==============================
HPGaugeSprite.prototype.createLayout = function() {
    this._layout = new Sprite(this._layImg);
        if (this.type === 0) {
            this._layout.x = Moghunter.hpgauge_a_xa - this._layImg.width / 2;
            this._layout.y = Moghunter.hpgauge_a_ya - this._layImg.height / 2;
        } else {
            this._layout.x = Moghunter.hpgauge_a_x - this._layImg.width / 2;
            this._layout.y = Moghunter.hpgauge_a_y - this._layImg.height / 2;
        };
        this.addChild(this._layout);
};

//==============================
// * Create Gauge
//==============================
HPGaugeSprite.prototype.createMeter = function() {
        this._meter = [];
        for (var i = 0; i < 2; i++) {
                this._meter = new Sprite(this._meterImg);
                this._meter.value1 = this.battler().hp;
                this._meter.value2 = this.battler().mhp;
                this._meter.ds = 0;
                this._meter.w = this._meterImg.width;
                this._meter.h = this._meterImg.height / 2;
                if (this.type === 0) {
                    this._meter.x = Moghunter.hpgauge_a_xa + Moghunter.hpgauge_b_xa - this._meterImg.width / 2;
                    this._meter.y = Moghunter.hpgauge_a_ya + Moghunter.hpgauge_b_ya - this._meterImg.height / 2;
                } else {
                    this._meter.x = Moghunter.hpgauge_a_x + Moghunter.hpgauge_b_x - this._meterImg.width / 2;
                    this._meter.y = Moghunter.hpgauge_a_y + Moghunter.hpgauge_b_y - this._meterImg.height / 2;
            };
                this.addChild(this._meter);
        };
    this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
        this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);       
        this.updateMeter();
};

//==============================
// * Need Refresh Blue Meter
//==============================
HPGaugeSprite.prototype.needRefreshBlueMeter = function() {
        if (this.battler()._ehpgauge[4]) {return true};
    if (this._meter[1].value1 != this.battler().hp) {return true};
        if (this._meter[1].value2 != this.battler().mhp) {return true};
        return false
};

//==============================
// * refresh Blue Meter
//==============================
HPGaugeSprite.prototype.refreshBlueMeter = function() {
         this.battler()._ehpgauge[4] = false;
     this._meter[1].value1 = this.battler().hp;
         this._meter[1].value2 = this.battler().mhp;
         if (!$gameTemp._hpGauge[0]) {return};
         this.refreshMeter(this._meter[0],this._meter[0].value1,this.battler().mhp,1);
         this.refreshMeter(this._meter[1],this.battler().hp,this.battler().mhp,0);
         this.prepareSlide();
};

//==============================
// * prepare Slide
//==============================
HPGaugeSprite.prototype.prepareSlide = function() {
        if (this.opacity < 100 || this._slideX > 0) {
            this._slideX = this._slideA ? -50 : -0.01;
            this.opacity = 0;
        };
        this._duration = Math.min(Math.max(Moghunter.hpgauge_duration,1),999);
};

//==============================
// * Update Dif
//==============================
HPGaugeSprite.prototype.update_dif = function(value,real_value,speed,type) {
        if (value == real_value) {return value};
        var mr = type === 0 ? 1 : 0.1;
    var dnspeed = mr + (Math.abs(value - real_value) / speed);
        if (value > real_value) {value -= dnspeed;
            if (value < real_value) {value = real_value};
        } else if (value < real_value) {value  += dnspeed;
            if (value  > real_value) {value  = real_value};               
    };
        if (type === 0) {
            return Math.floor(value);
        } else {
                return value;
        };
};

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

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

//==============================
// * Update Meter
//==============================
HPGaugeSprite.prototype.updateMeter = function() {
         if (this.needRefreshRedMeter()) {this.refreshRedMeter()};
         if (this.needRefreshBlueMeter()) {this.refreshBlueMeter()};
};

//==============================
// * Refresh Meter
//==============================
HPGaugeSprite.prototype.refreshMeter = function(sprite,value1,value2,h) {
     var wd = value1 * sprite.w / value2
         sprite.setFrame(0,sprite.h * h,wd,sprite.h);  
};

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

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

//==============================
// * enemy IDA
//==============================
HPGaugeSprite.prototype.enemyIDA = function() {
         if (this.battler().isActor()) {return true};
     return $gameSystem._hpGaugeEDef[this.battler()._enemyId];
};

//==============================
// * ID available
//==============================
HPGaugeSprite.prototype.idIsAvailable = function() {
        return this._IDA;
};

//==============================
// * refresh Number
//==============================
HPGaugeSprite.prototype.refreshNumber = function() {
        this._numberData[0] = this.update_dif(this._numberData[0],this.battler().hp, 40,0);
    var w = this._numberData[1];
        var h = this._numberData[2];
        var number = Math.abs(this._numberData[0]).toString().split("");
    for (var i = 0; i < this._hp_number.length; i++) {
           this._hp_number.visible = false;         
           if (this.idIsAvailable()) {       
                   if (i <  number.length) {
                           var n = Number(number);
                           this._hp_number.setFrame(n * w, 0, w, h);
                           this._hp_number.visible = true;          
                           this._hp_number.x = this._hp_number.org[0] + (w * i);
                   };
           } else {
                   if (i === 0) {
                           this._hp_number[0].setFrame(10 * w, 0, w, h);
                           this._hp_number[0].visible = true;          
                           this._hp_number[0].x = this._hp_number[0].org[0] + (w * 2);                             
                   };
           };
    };       
};

//==============================
// * Is Visible
//==============================
HPGaugeSprite.prototype.isVisible = function() {
        if (!this.battler()) {return false};
        if (this.battler().isHidden()) {return false};
    if (!this.battler()._ehpgauge[0]) {return false};
        return true;
};

//==============================
// * force Visible
//==============================
HPGaugeSprite.prototype.forceVisible = function() {
     if (this.battler()._ehpgauge[3]) {return true};
         if (this._selectionHP && this.battler().isSelected() && !this.battler().isDead()) {return true};
         return false;
};

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

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

//==============================
// * Update Slide
//==============================
HPGaugeSprite.prototype.updateSlide = function() {
        this._slideX += 2;
        this.opacity += 10;
        if (this._slideX >= 0) {
                this._slideX = 0;
                this.opacity = 255;
        };
};

//==============================
// * Update Fade
//==============================
HPGaugeSprite.prototype.updateFade = function() {
        if (this._slideA) {this._slideX += 2};
        this.opacity -= 10;
};

//==============================
// * Update Slide
//==============================
HPGaugeSprite.prototype.updateAnimation = function() {
    if (this._slideX < 0) {this.updateSlide();return};
        if (this._duration > 0) {this._duration--;return};
        if (this.opacity > 0) {this.updateFade()};       
};

//==============================
// * Update Force Visible
//==============================
HPGaugeSprite.prototype.updateForceVisible = function() {
    this.opacity = 255;
    this._duration = 0;
    this._slideX = 0;
};

//==============================
// * Update Position
//==============================
HPGaugeSprite.prototype.updatePosition = function() {
   if (this.forceVisible()) {
       this.updateForceVisible();
   } else {
           this.updateAnimation();
   };
   this.x = this.posX();
   this.y = this.posY();
};

//==============================
// * Update
//==============================
HPGaugeSprite.prototype.update = function() {
    Sprite.prototype.update.call(this);
        this.visible = this.isVisible();
        if (!this.battler()) {return};
        if (!this._layout && this._meterImg.isReady()) {this.createSprites()};
        if (this._meter) {this.updateMeter()};
        if (this._hp_number) {this.updateNumber()};
    this.updatePosition();
};[/pre]

点评

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

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-10-11 13:41:42 | 显示全部楼层
[pre lang="javascript"]//=============================================================================
// MOG_BossHP.js
//=============================================================================

/*:
* @plugindesc (v2.1) Apresenta um medidor de HP para os chefes.
* @author Moghunter
*
* @param Shake Effect
* @desc Ativar o efeito tremer.
* @default true
*
* @param HP Number Visible
* @desc Apresentar o HP em numeros.
* @default true
*
* @param Show Face
* @desc Apresentar a face do inimigo.
* @default true
*
* @param Slant Animation
* @desc Ativar a animação de Flow no medidor de HP.
* @default true
*
* @param Flow Speed
* @desc Definição da velocidade da animação.
* @default 4
*  
* @param Name Font Size
* @desc Definição do tamanho da fonte.
* @default 18
*
* @param Layout X-Axis
* @desc Posição X-Axis do layout.
* @default 150
*
* @param Layout Y-Axis
* @desc Posição Y-Axis do layout.
* @default 10
*
* @param BHP Name X-Axis
* @desc Posição X-Axis do numero.
* @default 36
*
* @param Name Y-Axis
* @desc Posição Y-Axis do numero.
* @default 23   
*
* @param Face X-Axis
* @desc Posição X-Axis da face.
* @default -50
*
* @param Face Y-Axis
* @desc Posição Y-Axis da face.
* @default 10   
*
* @param Meter X-Axis
* @desc Posição X-Axis do medidor.
* @default 22
*
* @param Meter Y-Axis
* @desc Posição Y-Axis do medidor.
* @default 28
*
* @param Number X-Axis
* @desc Posição X-Axis do numero.
* @default 460
*
* @param Number Y-Axis
* @desc Posição Y-Axis do numero.
* @default 32  
*
* @help  
* =============================================================================
* +++ MOG - Boss HP Meter (v2.1) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* =============================================================================
* Apresenta um medidor de HP para os chefes.
*
* Serão necessários os arquivos. (img/bosshp/)
*
* Boss_HP_A.png
* Boss_HP_A.png
* Boss_HP_C.png
*
* =============================================================================
* Use a Tag abaixo na caixa de notas para definir quais os inimigos terão o
* medidor de chefe.
*
* Boss HP
*
* =============================================================================
* FACE NAME
* =============================================================================
* Nomeie as faces dos inimigos da seguinte maneira.
*
* Face_ + ID.png
*
* EG
*
* Face_1.png
* Face_2.png
* Face_3.png
* ....
*
* -----------------------------------------------------------------------------
* Para definir a posição do medidor de HP use o seguinte comentário através do
* comando PLUGIN COMMAND.
*
* boss_hp_position : X : Y
*
* X - Posição X-axis.
* Y - Posição X-axis.
*
* -----------------------------------------------------------------------------
* Para ocultar ou mostrar os numeros de HP use o seguinte comentário através do
* comando PLUGIN COMMAND.
*
* boss_hp_number_hide
* boss_hp_number_show
*
* -----------------------------------------------------------------------------
* HISTÓRICO
* -----------------------------------------------------------------------------
* v2.1 - Compatibilidade com o Chrono Engine.
* v2.0 - Opção de apresentar a Face do inimigo.
*      - Adição da animação de flow.
*
*/
       
//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
  var Imported = Imported || {};
  Imported.MOG_BossHP = true;
  var Moghunter = Moghunter || {};

   Moghunter.parameters = PluginManager.parameters('MOG_BossHP');
        Moghunter.bosshp_flowAnimation = String(Moghunter.parameters['Slant Animation'] || "true");
        Moghunter.bosshp_flowAnimationSpeed = Number(Moghunter.parameters['Flow Speed'] || 4);
        Moghunter.bosshp_face = String(Moghunter.parameters['Show Face'] || "true");
    Moghunter.bosshp_faceX = Number(Moghunter.parameters['Face X-Axis'] || -50);
        Moghunter.bosshp_faceY = Number(Moghunter.parameters['Face Y-Axis'] || 10);
    Moghunter.bosshp_layout_x = Number(Moghunter.parameters['Layout X-Axis'] || 150);
    Moghunter.bosshp_layout_y = Number(Moghunter.parameters['Layout Y-Axis'] || 10)
    Moghunter.bosshp_meter_x = Number(Moghunter.parameters['Meter X-Axis'] || 22);
    Moghunter.bosshp_meter_y = Number(Moghunter.parameters['Meter Y-Axis'] || 28);       
    Moghunter.bosshp_number_x = Number(Moghunter.parameters['Number X-Axis'] || 460);
    Moghunter.bosshp_number_y = Number(Moghunter.parameters['Number Y-Axis'] || 32);
    Moghunter.bosshp_name_x = Number(Moghunter.parameters['Name X-Axis'] || 36);
    Moghunter.bosshp_name_y = Number(Moghunter.parameters['Name Y-Axis'] || 23);
        Moghunter.bosshp_font_size = Number(Moghunter.parameters['Name Font Size'] || 18);
        Moghunter.bosshp_shake_effect = String(Moghunter.parameters['Shake Effect'] || true);       
        Moghunter.bosshp_hp_number_visible = String(Moghunter.parameters['HP Number Visible'] || true);


//=============================================================================
// ** ImageManager
//=============================================================================

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

       
//=============================================================================
// ** Game_Temp
//=============================================================================

//==============================
// * Initialize
//==============================
var _alias_mog_bosshp_temp_initialize = Game_Temp.prototype.initialize
Game_Temp.prototype.initialize = function() {
        _alias_mog_bosshp_temp_initialize.call(this);
        this._battler_bhp_temp = [null,0,false,0];
        this._battler_bhp_refresh = false;
        this._battler_bhp_remove = false;
};

//=============================================================================
// ** Game_System
//=============================================================================

//==============================
// * Initialize
//==============================
var _alias_mog_bosshp_sys_initialize = Game_System.prototype.initialize
Game_System.prototype.initialize = function() {
        _alias_mog_bosshp_sys_initialize.call(this);
        this._bosshp_data = [Moghunter.bosshp_layout_x,Moghunter.bosshp_layout_y,Moghunter.bosshp_hp_number_visible];
        this._battler_bhp_oldNumber = [0,0];
        this._chronoBossEnemy = null;
        this._chronoBossMapID = 0;
}

//=============================================================================
// ** Game_Interpreter
//=============================================================================       

//==============================
// * PluginCommand
//==============================
var _alias_mog_bosshp_ex_pluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _alias_mog_bosshp_ex_pluginCommand.call(this,command, args)
    this.setPluginCommandBossHP(command, args);
        return true;
};

//==============================
// * set Plugin Command Boss HP
//==============================
Game_Interpreter.prototype.setPluginCommandBossHP = function(command, args) {
        if (command === "boss_hp_position")  { $gameSystem._bosshp_data[0] = args[1];
             $gameSystem._bosshp_data[1] = args[3];};
        if (command === "boss_hp_number_hide")  {$gameSystem._bosshp_data[2] = "false";};
        if (command === "boss_hp_number_show")  {$gameSystem._bosshp_data[2] = "true";};
        if (command === "boss_hp_erase")  {$gameTemp._battler_bhp_remove = "true";};
        if (Imported.MOG_ChronoEngine) {
                if (command === "boss_set_event_battler_id")  {
                        for (var i = 0; i < $gameMap.allEnemiesOnMap().length; i++) {
                                var ev = $gameMap.allEnemiesOnMap();
                                var battler = ev.battler();;
                                if (battler._bosshp_meter) {
                                    $gameSystem._chronoBossEnemy = battler;
                                        $gameTemp._battler_bhp_refresh = true;
                                        break
                                };
                        };               
                };
        };
};

//=============================================================================
// ** BattleManager
//=============================================================================

//==============================
// * processVictory
//==============================
var _alias_mog_bosshp_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
         $gameTemp._battler_bhp_temp[2] = true
         _alias_mog_bosshp_processVictory.call(this);         
};

//==============================
// * processAbort
//==============================
var _alias_mog_bosshp_processAbort = BattleManager.processAbort;
BattleManager.processAbort = function() {
         $gameTemp._battler_bhp_temp[2] = true
         _alias_mog_bosshp_processAbort.call(this);         
};

//==============================
// * processDefeat
//==============================
var _alias_mog_bosshp_processDefeat = BattleManager.processDefeat;
BattleManager.processDefeat = function() {
         $gameTemp._battler_bhp_temp[2] = true
         _alias_mog_bosshp_processDefeat.call(this);         
};

//=============================================================================
// ** Game Battler
//=============================================================================

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

//==============================
// * Appear
//==============================
var _mog_bhp_gbat_appear = Game_BattlerBase.prototype.appear;
Game_BattlerBase.prototype.appear = function() {
    _mog_bhp_gbat_appear.call(this);
        $gameTemp._battler_bhp_refresh = true;
};

//=============================================================================
// ** Game_Enemy
//=============================================================================

//==============================
// * initMembers
//==============================
var _alias_mog_bosshp_initMembers = Game_Enemy.prototype.initMembers;
Game_Enemy.prototype.initMembers = function() {
        _alias_mog_bosshp_initMembers.call(this);
        this._bosshp_meter = false;
};

//==============================
// * Setup
//==============================
var _alias_mog_bosshp_setup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
        _alias_mog_bosshp_setup.call(this,enemyId, x, y);
    this.checkBossHPnoteTag();       
};

//==============================
// * Setup
//==============================
Game_Enemy.prototype.checkBossHPnoteTag = function() {
        for (var i = 0; i < this.notetags().length; i++) {
                if (this.notetags() == "Boss HP") {this._bosshp_meter = true};
        };       
};

//==============================
// * transform
//==============================
var _mog_bosshp_enemy_transform = Game_Enemy.prototype.transform;
Game_Enemy.prototype.transform = function(enemyId) {
        _mog_bosshp_enemy_transform.call(this,enemyId)
    $gameTemp._battler_bhp_refresh = true;
        this.checkBossHPnoteTag();       
};
       
//=============================================================================
// ** Game Action
//=============================================================================

//==============================
// * Apply
//==============================
var _alias_mog_bosshp_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
         if (target.isEnemy() && target._bosshp_meter) {
                 $gameTemp._battler_bhp_temp[1] = target.hp;
             var old_hp = target.hp; $gameTemp._battler_bhp_temp[3] = 0
         };
         _alias_mog_bosshp_apply.call(this,target);
         if (target.isEnemy() && target._bosshp_meter) {
                 $gameTemp._battler_bhp_temp[0] = target;
             if (old_hp > target.hp) {$gameTemp._battler_bhp_temp[3] = 60};
         };
};


//=============================================================================
// ** Scene Map
//=============================================================================       

//==============================
// * Terminate
//==============================
var _mog_bossHP_smap_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function() {
        $gameSystem._chronoBossEnemy = null;
        $gameSystem._chronoBossMapID = $gameMap._mapId;
        if (this._spriteset && this._spriteset._bosshp_sprites) {
                var battler = this._spriteset._bosshp_sprites._battler;
                if (!battler.isDead()) {       
                $gameSystem._chronoBossEnemy = battler;
                        $gameSystem._battler_bhp_oldNumber[0] = this._spriteset._bosshp_sprites._hp_data[2];
                        $gameSystem._battler_bhp_oldNumber[1] = this._spriteset._bosshp_sprites._hp_data[6];
                };
        };         
    _mog_bossHP_smap_terminate.call(this);
};

//=============================================================================
// ** Spriteset_Base
//=============================================================================       

//==============================
// * Initialize
//==============================
var _mog_bossHPCN_sprBase_initialize = Sprite_Base.prototype.initialize;
Sprite_Base.prototype.initialize = function() {
   _mog_bossHPCN_sprBase_initialize.call(this);
   if ($gameSystem._chronoBossMapID != $gameMap._mapId) {;
       $gameSystem._chronoBossEnemy = null;
           $gameSystem._chronoBossMapID = $gameMap._mapId;
   };   
};

//==============================
// * Create Boss HP Sprites
//==============================
Spriteset_Base.prototype.createBossHPGauge = function() {       
        $gameTemp._battler_bhp_refresh = false;
        var init_battler = this.checkBossHpEnemies();
        this.removeBossHPGauge();
        if (init_battler) {
                if (!this._bosshp_sprites) {
          if (Imported.MOG_ChronoEngine) {
                           this.removeBossHPGauge();
                           this._bosshp_sprites = new Sprite_BossHP(init_battler);
                           this._hudField.addChild(this._bosshp_sprites);                          
                   } else {
                           this._bosshp_sprites = new Sprite_BossHP(init_battler);
                           this.addChild(this._bosshp_sprites);
                   };
                };
        };
};

//==============================
// * Create Boss HP Sprites
//==============================
Spriteset_Base.prototype.checkBossHpEnemies = function() {
        var boss = null;
        if (Imported.MOG_ChronoEngine) {
                if ($gameSystem.isChronoMode()) {
                        $gameMap.enemiesF().forEach(function(enemy) {
                                 battler = enemy.battler()
                                 if (battler._bosshp_meter) {boss = battler};
                        },this);                       
                } else if ($gameSystem._chronoBossEnemy) {
                     boss = $gameSystem._chronoBossEnemy;
            };
        } else {
                $gameTroop.members().forEach(function(enemy) {
                                if (enemy._bosshp_meter && !enemy.isHidden()) {boss = enemy};
                },this);
        };
        return boss;
};

//==============================
// ** remove Boss HP Gauge
//==============================
Spriteset_Base.prototype.removeBossHPGauge = function() {
        $gameTemp._battler_bhp_remove = false;
        $gameSystem._chronoBossEnemy = null;
        if (!this._bosshp_sprites) {return};
        if (this._hudField) {
                this._hudField.removeChild(this._bosshp_sprites);
        } else {
            this.removeChild(this._bosshp_sprites);
        };
    this._bosshp_sprites = null;
};

//==============================
// * Update
//==============================
var _mog_bosshp_SprtBase_update = Spriteset_Base.prototype.update;
Spriteset_Base.prototype.update = function() {
        _mog_bosshp_SprtBase_update.call(this);
        if ($gameTemp._battler_bhp_refresh) {this.createBossHPGauge()};
        if (!this._bosshp_sprites && $gameSystem._chronoBossEnemy) {
             this.createBossHPGauge();
        };
        if ($gameTemp._battler_bhp_remove) {this.removeBossHPGauge()};
};

//=============================================================================
// ** Spriteset_Battle
//=============================================================================       

//==============================
// * CreateLowerLayer
//==============================
var _alias_mog_bosshp_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer
Spriteset_Battle.prototype.createLowerLayer = function() {
        _alias_mog_bosshp_createLowerLayer.call(this);
        this.createBossHPGauge();
};


//=============================================================================
// ** Sprite_BossHP
//=============================================================================       
function Sprite_BossHP() {
    this.initialize.apply(this, arguments);
}

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

//==============================
// * Initialize
//==============================
Sprite_BossHP.prototype.initialize = function(init_battler) {
    Sprite.prototype.initialize.call(this);       
        this._init = true;
        $gameTemp._battler_bhp_temp = [init_battler,init_battler.hp,false,0];
        this._flowAnimation = String(Moghunter.bosshp_flowAnimation) === "true" ? true : false;
        this._battler = init_battler;
        this._hp_data = [-1,-1,0,0,0,0,0,0,0,Number($gameSystem._bosshp_data[0]),Number($gameSystem._bosshp_data[1]),false,true];
    this.createSprites();
        if (String(Moghunter.bosshp_shake_effect) === "true") {this._hp_data[11] = true};
        if (String($gameSystem._bosshp_data[2]) != "true") {this._hp_data[12] = false};
};

//==============================
// * create Sprites
//==============================
Sprite_BossHP.prototype.createSprites = function() {
    this.createLayout();
    this.createHPMeter();
        if (String(Moghunter.bosshp_face) === "true") {this.createFace()};
        this.createHPNumber();
    this.createName();
};

//==============================
// * createLayout
//==============================
Sprite_BossHP.prototype.createLayout = function() {
        this._layout = new Sprite(ImageManager.loadBossHp("Boss_HP_A"));
        this._layout.x = this._hp_data[9];
        this._layout.y = this._hp_data[10];
        this._layout.opacity = 0;
        this.addChild(this._layout);       
};

//==============================
// * create Face
//==============================
Sprite_BossHP.prototype.createFace = function() {
     this._face = new Sprite();
         this.addChild(this._face);
         this.refreshFace();
         this.updateFace();
};

//==============================
// * update Face
//==============================
Sprite_BossHP.prototype.updateFace = function() {
         this._face.x = this._layout.x + Moghunter.bosshp_faceX;
         this._face.y = this._layout.y + Moghunter.bosshp_faceY;
         this._face.visible = this._layout.visible;
         this._face.opacity = this._layout.opacity;
};

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

//==============================
// * create HP Meter
//==============================
Sprite_BossHP.prototype.createHPMeter = function() {
        this._hp_meter_red = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
        this._hp_meter_red.x = this._layout.x + Moghunter.bosshp_meter_x;
        this._hp_meter_red.y = this._layout.y + Moghunter.bosshp_meter_y;
        this._hp_meter_red.opacity = 0;
        this._hp_meter_redFlow = [-1,0,0,0];
        this._hp_meter_red.setFrame(0,0,1,1);       
        this.addChild(this._hp_meter_red);
        this._hp_meter_blue = new Sprite(ImageManager.loadBossHp("Boss_HP_B"));
        this._hp_meter_blue.x = this._hp_meter_red.x;
        this._hp_meter_blue.y = this._hp_meter_red.y;       
        this._hp_meter_blue.opacity = 0;
        this._hp_meter_blueFlow = [-1,0,0,0];
        this._hp_meter_blue.setFrame(0,0,1,1);       
        this.addChild(this._hp_meter_blue);
};       

//==============================
// * create HP Number
//==============================
Sprite_BossHP.prototype.createHPNumber = function() {
        this._hp_number = [];
        this._hp_number_data = []
        this._hp_number_img = ImageManager.loadBossHp("Boss_HP_C");
        for (var i = 0; i < 9; i++) {
                 this._hp_number = new Sprite(this._hp_number_img);
                 this._hp_number.visible = false;
                 this._hp_number.opacity = 0;
                 this._hp_number.x = this._layout.x + Moghunter.bosshp_number_x;
                 this._hp_number.y = this._layout.y + Moghunter.bosshp_number_y;
                 this._hp_number_data = 0;
                 this.addChild(this._hp_number);                 
        };
};

//==============================
// * create Name
//==============================
Sprite_BossHP.prototype.createName = function() {
        this._name = new Sprite(new Bitmap(300,48));
        this.addChild(this._name);
        this._name.bitmap.fontSize = Moghunter.bosshp_font_size;
        this.refresh_name();
        this._name.x = this._layout.x + Moghunter.bosshp_name_x;
        this._name.y = this._layout.y + Moghunter.bosshp_name_y;
        this._name.opacity = 0;
};

//==============================
// * get Sprite Data
//==============================
Sprite_BossHP.prototype.getSpriteData = function() {
            this._hp_meter_blueFlow[0] = this._flowAnimation ? (this._hp_meter_blue.bitmap.width / 3) : this._hp_meter_blue.bitmap.width;
                this._hp_meter_blueFlow[1] = this._hp_meter_blue.bitmap.height;
                this._hp_meter_blueFlow[2] = this._hp_meter_blueFlow[0] * 2;
                this._hp_meter_blueFlow[3] = 0;
            this._hp_meter_redFlow[0] = this._flowAnimation ? (this._hp_meter_red.bitmap.width / 3) : this._hp_meter_red.bitmap.width;
                this._hp_meter_redFlow[1] = this._hp_meter_red.bitmap.height;
                this._hp_meter_redFlow[2] = this._hp_meter_redFlow[0] * 2;
                this._hp_meter_redFlow[3] = 0;               
};

//==============================
// * Update
//==============================
Sprite_BossHP.prototype.update = function() {
    Sprite.prototype.update.call(this);       
        if (this._hp_meter_blueFlow[0] === -1) {
            if (this._layout.bitmap.isReady()) {
                        this.getSpriteData();
                } else {
                        return
                };
    };
        if (this._flowAnimation) {this.updateFlowAnimation()};
        if ($gameTemp._battler_bhp_temp[3] != 0) {this.refreshShake()};
        if (this.need_onSkillCancelites()) {this.onSkillCancelites(5)} else {this.onSkillCancelites(-5)};
        if ($gameTemp._battler_bhp_temp[0] != this._battler) {this.refresh_all();        };
        if (this._flowAnimation) {
            this.refresh_blue_meter();
        } else if (this._hp_data[0] != this._battler.hp || this._hp_data[1] != this._battler.mhp) {
                this.refresh_blue_meter();
        };
        if (this._hp_data[2] != this._battler.hp) {this.refresh_red_meter();};
        if (this._hp_data[6] != this._battler.hp) {this.update_hp_number();};
        if (this._hp_data[11]) {this.update_shake_effect();};
        if (this._face) {this.updateFace()};
        this._init = false;
};

//==============================
// * refresh Shake
//==============================
Sprite_BossHP.prototype.refreshShake = function() {
        this._hp_data[7] = $gameTemp._battler_bhp_temp[3];
        $gameTemp._battler_bhp_temp[3] = 0;
};

//==============================
// * Update Flow Animation
//==============================
Sprite_BossHP.prototype.updateFlowAnimation = function() {
    this._hp_meter_blueFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
        if (this._hp_meter_blueFlow[3] > this._hp_meter_blueFlow[2]) {
                this._hp_meter_blueFlow[3] = 0;
        };
    this._hp_meter_redFlow[3] += Moghunter.bosshp_flowAnimationSpeed;
        if (this._hp_meter_redFlow[3] > this._hp_meter_redFlow[2]) {
                this._hp_meter_redFlow[3] = 0;
        };       
};

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

//==============================
// * Update HP Number
//==============================
Sprite_BossHP.prototype.update_hp_number = function() {
          if (!this._hp_data[12]) {return};
          if (this._init && $gameSystem._battler_bhp_oldNumber[1] != 0) {
                  this._hp_data[6] = $gameSystem._battler_bhp_oldNumber[1];
                  $gameSystem._battler_bhp_oldNumber[1] = 0;
          };          
      var nspd = 1 + Math.floor((Math.abs(this._hp_data[6] - this._battler.hp) / 30))
      if (this._hp_data[6] < this._battler.hp) {
                  this._hp_data[6] += nspd;
                  if (this._hp_data[6] > this._battler.hp) {this._hp_data[6] = this._battler.hp};
          }
          else if (this._hp_data[6] > this._battler.hp) {
                  this._hp_data[6] -= nspd;
                  if (this._hp_data[6] < this._battler.hp) {this._hp_data[6] = this._battler.hp};
          };
          this.refresh_hp_number();
};
          
//==============================
// * Refresh HP Number
//==============================
Sprite_BossHP.prototype.refresh_hp_number = function() {
   var w = this._hp_number_img.width / 10;
   var h = this._hp_number_img.height;       
   //$gameMessage.add(this._hp_number.length)
   this._hp_data[4] = Math.abs(this._hp_data[6]).toString().split("");  
   if (this._hp_data[4].length > this._hp_number.length) {return};
   if (this._hp_data[4].length != this._hp_data[5]) {
           for (var i = 0; i < 9) {this._hp_number.visible = false};this._hp_data[5] = this._hp_data[4].length};
   for (var i = 0; i < this._hp_data[4].length; i++) {
           var n = Number(this._hp_data[4]);
           this._hp_number.setFrame(n * w, 0, w, h);
           this._hp_number.visible = true;          
           var nx = -(w * i) + (w * this._hp_data[4].length)
           this._hp_number.x = (this._layout.x + Moghunter.bosshp_number_x) - nx;
   };
};

//==============================
// * Refresh Name
//==============================
Sprite_BossHP.prototype.refresh_name = function() {
        this._name.bitmap.clear();
        this._name.bitmap.drawText(this._battler.enemy().name, 0, 0, this._name.bitmap.width, this._name.bitmap.height,0);       
};

//==============================
// * Need Fade Sprites
//==============================
Sprite_BossHP.prototype.need_onSkillCancelites = function() {
        if ($gameMessage.isBusy()) {return true} ;       
        if ($gameTemp._battler_bhp_temp[2]) {return true} ;
        if (!this._battler) {return true} ;
        if (this._battler.isDead()) {return true};
        return false;
};

//==============================
// * Fade Sprites
//==============================
Sprite_BossHP.prototype.onSkillCancelites = function(value) {
        if (this._init) {
           this._layout.opacity = 255;
           this._hp_meter_blue.opacity = this._layout.opacity;
           this._hp_meter_red.opacity = this._layout.opacity;
           this._name.opacity = this._layout.opacity;
           for (var i = 0; i < 9; i++) {this._hp_number.opacity = this._layout.opacity};       
           return       
        };
        this._layout.opacity -= value;
        this._hp_meter_blue.opacity = this._layout.opacity;
        this._hp_meter_red.opacity = this._layout.opacity;
        this._name.opacity = this._layout.opacity;
        for (var i = 0; i < 9; i++) {this._hp_number.opacity -= value};
};

//==============================
// * Refresh All
//==============================
Sprite_BossHP.prototype.refresh_all = function() {
         this._battler = $gameTemp._battler_bhp_temp[0];
         this._hp_data[2] = $gameTemp._battler_bhp_temp[1];
         this._hp_data[6] = $gameTemp._battler_bhp_temp[1];  
         this.refresh_hp_number();  
         this.refresh_blue_meter();
         this.refresh_red_meter();
         this.refresh_name();
         if (this._face) {this.refreshFace()};
};

//==============================
// * Refresh Blue Meter
//==============================
Sprite_BossHP.prototype.refresh_blue_meter = function() {
         this._hp_data[0] = this._battler.hp;
         this._hp_data[1] = this._battler.mhp;
     this._layout.y = this._hp_data[10]         
         var meter_rate = this._hp_meter_blueFlow[0] * this._battler.hp / this._battler.mhp;
         this._hp_meter_blue.setFrame(this._hp_meter_blueFlow[3], 0, meter_rate, this._hp_meter_blue.bitmap.height / 2);
};

//==============================
// * Refresh Red Meter
//==============================
Sprite_BossHP.prototype.refresh_red_meter = function() {
          if (this._init) {
                  if ($gameSystem._battler_bhp_oldNumber[0] != 0) {
                      this._hp_data[2] = $gameSystem._battler_bhp_oldNumber[0];
                      $gameSystem._battler_bhp_oldNumber[0] = 0;
                  } else {
                        this._hp_data[2] = this._battler.mhp;                       
                  };
         };               
          var dnspeed = 1 + (Math.abs(this._hp_data[2] - this._battler.hp) / 160);
          if (this._hp_data[2] > this._battler.hp) {this._hp_data[2] -= dnspeed;
                  if (this._hp_data[2] < this._battler.hp) {this._hp_data[2] = this._battler.hp};}
          else if (this._hp_data[2] < this._battler.hp) {this._hp_data[2]  += dnspeed;
                  if (this._hp_data[2]  > this._battler.hp) {this._hp_data[2]  = this._battler.hp};                       
          };
         var meter_rate = this._hp_meter_redFlow[0] * this._hp_data[2] / this._battler.mhp;
         this._hp_meter_red.setFrame(this._hp_meter_redFlow[3], this._hp_meter_red.bitmap.height / 2, meter_rate, this._hp_meter_red.bitmap.height / 2);       
};[/pre]

点评

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

使用道具 举报

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

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


MVHP.png

点评

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

评分

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

查看全部评分

回复 0 1

使用道具 举报

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部