赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 15 |
经验 | 0 |
最后登录 | 2024-12-9 |
在线时间 | 243 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1515
- 在线时间
- 243 小时
- 注册时间
- 2017-10-24
- 帖子
- 209
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
以下代码,是 的插件,但是他这几天都不在线, 哪位大神帮看下,这个插件该如何设置一个敌人为BOSS,让血条显示出来?谢谢
//===================================================================================
/*:
* @plugindesc 仿DNF血槽。
* @author 芯☆淡茹水
* @help ____________________________________________________________________
* --------------------------------------------------------------------------
* @param bloodCk
* @desc 一条血的血量。
* @default 100
* --------------------------------------------------------------------------
* @param barX
* @desc 血槽X坐标。
* @default 80
* --------------------------------------------------------------------------
* @param barY
* @desc 血槽Y坐标。
* @default 80
* --------------------------------------------------------------------------
* @param BarMomt
* @desc 是否开启血条动态(0:开启; 1:不开启)。
* @default 0
* --------------------------------------------------------------------------
* @param waitTime
* @desc BOSS血量在持续多少帧未变动时,开始血条动态。
* @default 200
*/
//===================================================================================
(function() {
var XdrsDNFBarDate = XdrsDNFBarDate || {};
var xrdbpeprtr = PluginManager.parameters('Xr_blood_type2');
XdrsDNFBarDate.barX = parseInt(xrdbpeprtr['barX']) || 80;
XdrsDNFBarDate.barY = parseInt(xrdbpeprtr['barY']) || 80;
XdrsDNFBarDate.bCk = parseInt(xrdbpeprtr['bloodCk']) || 100;
XdrsDNFBarDate.barMomt = parseInt(xrdbpeprtr['BarMomt']) || 0;
XdrsDNFBarDate.waitTime = parseInt(xrdbpeprtr['waitTime']) || 200;
//=================================================================================
var XdRsDNFBarGESetup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function(enemyId, x, y) {
XdRsDNFBarGESetup.call(this, enemyId, x, y)
this.setupBoss();
};
Game_Enemy.prototype.setupBoss = function() {
this._isBoss = this.isBossJudeg();
this._level = this._enemyType = this._enemyKind = 0;
if (!this._isBoss) return;
var ar = this.enemy().note.match(/☆(\S*)☆/)[1].split(',')
this._level = this._level || parseInt(ar[1]);
this._enemyType = this._enemyType || parseInt(ar[2]);
this._enemyKind = this._enemyKind || parseInt(ar[3]);
};
Game_Enemy.prototype.isBossJudeg = function() {
var text = this.enemy().note;
if (text === '') return false;
if (text.indexOf('☆DNF_Bar') < 0) return false;
if (!text.match(/☆(\S*)☆/)) return false;
return true;
};
Game_Enemy.prototype.isBoss = function() {
return this._isBoss;
};
Game_Enemy.prototype.level = function() {
return this._level;
};
Game_Enemy.prototype.enemyType = function() {
return this._enemyType;
};
Game_Enemy.prototype.enemyKind = function() {
return this._enemyKind;
};
//=================================================================================
Game_Troop.prototype.boss = function() {
for (var i=0;i<this.members().length;i++){
if (this.members()[i].isBoss()) return this.members()[i];
}
return null;
};
//=================================================================================
function Xr_DnfBar() {
this.initialize.apply(this, arguments);
}
Xr_DnfBar.prototype = Object.create(Sprite.prototype);
Xr_DnfBar.prototype.constructor = Xr_DnfBar;
Xr_DnfBar.prototype.initialize = function(enemy) {
Sprite.prototype.initialize.call(this);
this._uiName = 'DNF-Bar';
this._enemy = enemy;
this._count = 0;
this.iniRect();
this.createBar();
this.move(XdrsDNFBarDate.barX, XdrsDNFBarDate.barY);
};
Xr_DnfBar.prototype.iniRect = function() {
this._backRect = new Rectangle(0,0,637,41);
this._barRect = new Rectangle(0,74,598,33);
this._etRect1 = new Rectangle(598,41,31,13);
this._etRect2 = new Rectangle(598,171,31,13);
};
Xr_DnfBar.prototype.createBar = function() {
this.bitmap = ImageManager.loadPicture(this._uiName);
this.setBitmap(this, this._backRect);
this._lowBar = new Sprite(ImageManager.loadPicture(this._uiName));
this._lowBar2 = new Sprite(ImageManager.loadPicture(this._uiName));
this._upBar = new Sprite(ImageManager.loadPicture(this._uiName));
this._messShow = new Sprite(new Bitmap(637,411));
var bitmap = ImageManager.loadFace('e'+this._enemy.enemyId());
this._messShow.bitmap.blt(bitmap,0,0,24,24,8,12);
this.iniMomet();
this.setPlace();
this.addChild(this._lowBar);
this.addChild(this._lowBar2);
this.addChild(this._upBar);
this.addChild(this._messShow);
};
Xr_DnfBar.prototype.iniMomet = function() {
this._upBar.opacity = 255;
this._mmtRect = new Rectangle(0,74,598,33);
this.setBitmap(this._lowBar2, new Rectangle(0,0,1,0));
this._lowBar.move(35,8);
this.drawLowBar();
};
Xr_DnfBar.prototype.setBitmap = function(obj, rect) {
obj.setFrame(rect.x, rect.y, rect.width, rect.height);
};
Xr_DnfBar.prototype.setPlace = function() {
this._lowBar.move(35,8);
this._upBar.move(35,8);
this._lowBar2.move(36, 8);
};
Xr_DnfBar.prototype.update = function() {
Sprite.prototype.update.call(this);
if (this._dataHp !== this._enemy.hp) this.updateBar();
if (XdrsDNFBarDate.barMomt > 0) return;
if (this._count > 0) { this._count--; return;}
if (Graphics.frameCount % 2 === 0) {
this._mmtRect.width -= 2;
if (this._mmtRect.width === 560) this._mmtRect.width = 598;
this.movement();
}
};
Xr_DnfBar.prototype.updateBar = function() {
this._count = XdrsDNFBarDate.waitTime;
this._dataHp = this._enemy.hp;
this.dataCount();
this.iniMomet();
this.drawUpBar();
this.setShow();
};
Xr_DnfBar.prototype.dataCount = function() {
this._upNum = Math.ceil(this._enemy.hp / XdrsDNFBarDate.bCk);
this._lowNum = Math.floor(this._enemy.hp / XdrsDNFBarDate.bCk);
};
Xr_DnfBar.prototype.movement = function() {
if (this._lowNum < 1) return;
this._upBar.opacity = 0;
this._mmtRect.y = (this._lowNum - 1) % 5 * 33 + 74;
var aw = 598 - this._mmtRect.width;
var rect = new Rectangle(0,this._mmtRect.y,aw,33);
this.setBitmap(this._lowBar2, rect);
this._lowBar.move(35+aw, 8);
this.setBitmap(this._lowBar, this._mmtRect);
};
Xr_DnfBar.prototype.drawLowBar = function() {
this._barRect.width = 598;
this._barRect.y = (this._lowNum - 1) % 5 * 33 + 74;
this.setBitmap(this._lowBar, this._barRect);
};
Xr_DnfBar.prototype.drawUpBar = function() {
this._barRect.y = this._lowNum % 5 * 33 + 74;
this._barRect.width = this._enemy.hp % XdrsDNFBarDate.bCk * 598 / XdrsDNFBarDate.bCk,
this.setBitmap(this._upBar, this._barRect);
};
Xr_DnfBar.prototype.setShow = function() {
this._messShow.bitmap.clear();
this.drawHead();
this.drawType();
this.drawMaxNum();
};
Xr_DnfBar.prototype.drawHead = function() {
var bitmap = ImageManager.loadFace('e'+this._enemy.enemyId());
this._messShow.bitmap.blt(bitmap,0,0,24,24,8,12);
};
Xr_DnfBar.prototype.drawType = function() {
this._messShow.bitmap.fontSize = 14;
this._messShow.bitmap.fontItalic = false;
var ax = 40;
if (this._enemy.enemyType() > 0) {
var bitmap = ImageManager.loadPicture(this._uiName);
this._messShow.bitmap.blt(bitmap,598,(this._enemy.enemyType()-1) * 13 + 171,31,13,ax,18);
ax += 32;
}
if (this._enemy.enemyKind() > 0) {
var bitmap = ImageManager.loadPicture(this._uiName);
this._messShow.bitmap.blt(bitmap,598,(this._enemy.enemyKind()-1) * 13 + 41,31,13,ax,18);
ax += 38;
} else {ax += 6;}
if (this._enemy.level() > 0) {
var text = 'Lv' + this._enemy.level(),aw = this._messShow.bitmap.measureTextWidth(text);
this._messShow.bitmap.drawText(text, ax, 12, aw, 20);
ax += aw+8;
}
this._messShow.bitmap.drawText(this._enemy.name(), ax, 12, 160, 20);
};
Xr_DnfBar.prototype.drawMaxNum = function() {
this._messShow.bitmap.fontSize = 24;
this._messShow.bitmap.fontItalic = true;
var text = 'x '+this._upNum, aw = this._messShow.bitmap.measureTextWidth(text);
this._messShow.bitmap.drawText(text, 620-aw, 6, aw, 32, 2);
};
//===================================================================================
var XdRs_DB_SBCreateAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
XdRs_DB_SBCreateAllWindows.call(this);
this.createDNFBar();
};
Scene_Battle.prototype.createDNFBar = function() {
this._DNGBar = null;
if (!$gameTroop.boss()) return;
this._DNGBar = new Xr_DnfBar($gameTroop.boss());
this.addChild(this._DNGBar);
};
})();
//===================================================================================
|
|