//------------------------------------------
// 人工升级@MV1.3.5 for Win7-32
//------------------------------------------
var MLC = MLC || {};
//----------------------- 更改经验值(角色当前的经验值, 是否显示升级效果)
Game_Actor.prototype.changeExp = function(exp, show) {
this._exp[this._classId] = Math.max(exp, 0);
var lastLevel = this._level;
var lastSkills = this.skills();
if($gameTemp._upGrade){ // <<<
while (!this.isMaxLevel() && this.currentExp() >= this.nextLevelExp()) {
this.levelUp();
}
while (this.currentExp() < this.currentLevelExp()) {
this.levelDown();
}
if (show && this._level > lastLevel) {
this.displayLevelUp(this.findNewSkills(lastSkills));
}
this.refresh();
}; // <<<
};
//----------------------- 刷新角色状态窗口
MLC.windowStatus_refresh = Window_Status.prototype.refresh;
Window_Status.prototype.refresh = function() {
MLC.windowStatus_refresh.call(this);
if (this._actor) {
this.createButton();
};
};
//----------------------- 创建按钮(图片文件名, 单元图像大小)
Window_Status.prototype.createButton = function(filename, spec) {
var sz= spec || 48; // 图片规格(宽×高):288×96,样式:6×2 ,预置单元大小:48×48
var name = filename || 'ButtonSet';
var levelUpButton = ImageManager.loadSystem(name);
this.buttonSprite = new Sprite_Button();
this.buttonSprite.bitmap = levelUpButton;
this.addChild(this.buttonSprite);
this.buttonSprite.setColdFrame(sz*3, sz, sz, sz);
this.buttonSprite.setHotFrame(sz*3, 0, sz, sz);
this.buttonSprite.x = this.width / 2; // 按钮水平坐标
this.buttonSprite.y = sz * 7 / 4; // 按钮垂直坐标
this.buttonSprite.setClickHandler(this.onButtonOk.bind(this));
};
//----------------------- 点击按钮
Window_Status.prototype.onButtonOk = function() {
var exp = this._actor.currentExp();
$gameTemp._upGrade = true;
this._actor.changeExp(exp, false); // 已屏蔽升级效果
SceneManager.goto(Scene_Status)
$gameTemp._upGrade = false;
};
//----------------------- 刷新画面
MLC.windowStatus_drawExpInfo = Window_Status.prototype.drawExpInfo;
Window_Status.prototype.drawExpInfo = function(x, y) {
MLC.windowStatus_drawExpInfo.call(this, x, y);
if(this._actor.nextRequiredExp() < 0){
var h = this.lineHeight();
this.contents.clearRect(x, y + h * 3, 270, h);
this.drawText('0', x, y + h * 3, 270, 'right');
};
};