Scene_Skill.prototype.createSkillTypeWindow = function() {
const rect = this.skillTypeWindowRect();
this._skillTypeWindow = new Window_SkillType(rect);
this._skillTypeWindow.setHelpWindow(this._helpWindow);
this._skillTypeWindow.setHandler("skill", this.commandSkill.bind(this));
this._skillTypeWindow.setHandler("cancel", this.popScene.bind(this));
this._skillTypeWindow.setHandler("pagedown", this.nextActor.bind(this));
this._skillTypeWindow.setHandler("pageup", this.previousActor.bind(this));
};
Scene_Skill.prototype.statusWindowRect = function() {
const ww = Graphics.boxWidth;
const wh = this._skillTypeWindow.height;
const wx = Graphics.boxWidth - ww;
const wy = this.mainAreaTop();
return new Rectangle(wx, wy, ww, wh);
};
//New skillList
function Window_SkillList() {
this.initialize(...arguments);
}
Window_SkillList.prototype = Object.create(Window_Command.prototype);
Window_SkillList.prototype.constructor = Window_SkillList;
Window_SkillList.prototype.initialize = function(rect) {
Window_Command.prototype.initialize.call(this, rect);
this._actor = null;
this._stypeId = 0;
this._data = [];
};
Window_SkillList.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.scrollTo(0, 0);
}
};
Window_SkillList.prototype.setStypeId = function(stypeId) {
if (this._stypeId !== stypeId) {
this._stypeId = stypeId;
this.refresh();
this.scrollTo(0, 0);
}
};
Window_SkillList.prototype.maxCols = function() {
return 1;
};
Window_SkillList.prototype.colSpacing = function() {
return 16;
};
Window_SkillList.prototype.maxItems = function() {
return this._data ? this._data.length : 1;
};
Window_SkillList.prototype.item = function() {
return this.itemAt(this.index());
};
Window_SkillList.prototype.itemAt = function(index) {
return this._data && index >= 0 ? this._data[index] : null;
};
Window_SkillList.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this._data[this.index()]);
};
Window_SkillList.prototype.includes = function(item) {
return item && item.stypeId === this._stypeId;
};
Window_SkillList.prototype.isEnabled = function(item) {
return this._actor && this._actor.canUse(item);
};
Window_SkillList.prototype.makeItemList = function() {
if (this._actor) {
this._data = this._actor.skills();
} else {
this._data = [];
}
};
Window_SkillList.prototype.selectLast = function() {
const index = this._data.indexOf(this._actor.lastSkill());
this.forceSelect(index >= 0 ? index : 0);
};
Window_SkillList.prototype.drawItem = function(index) {
const skill = this.itemAt(index);
if (skill) {
const costWidth = this.costWidth();
const rect = this.itemLineRect(index);
this.changePaintOpacity(this.isEnabled(skill));
this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth);
this.drawSkillCost(skill, rect.x, rect.y, rect.width);
this.changePaintOpacity(1);
}
};
Window_SkillList.prototype.costWidth = function() {
return this.textWidth("000");
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
if (this._actor.skillTpCost(skill) > 0) {
this.changeTextColor(ColorManager.tpCostColor());
this.drawText(this._actor.skillTpCost(skill), x, y, width, "right");
} else if (this._actor.skillMpCost(skill) > 0) {
this.changeTextColor(ColorManager.mpCostColor());
this.drawText(this._actor.skillMpCost(skill), x, y, width, "right");
}
};
Window_SkillList.prototype.updateHelp = function() {
this.setHelpWindowItem(this.item());
};
Window_SkillList.prototype.refresh = function() {
this.makeItemList();
Window_Command.prototype.refresh.call(this);
};