JavaScript: Window_SrpgPrediction.prototype.drawContents = function() {
var windowWidth = this.windowWidth();
var lineHeight = this.lineHeight();
var x = 40;
// attacker
var actor = this._actionArray[1];
var target = this._targetArray[1];
var action = actor.currentAction();
var damage = action.srpgPredictionDamage(target);
var hit = action.itemHit(target);
var eva = action.itemEva(target);
var cri = action.itemCri(target); // show cri
this.drawSrpgBattleActionName(actor, action, windowWidth / 2 + x, lineHeight * 0, true);
this.drawSrpgBattleHit(hit, eva, windowWidth / 2 + x, lineHeight * 1);
this.drawSrpgBattleCri(cri, windowWidth / 2 + x, lineHeight * 2); // show cri
this.drawSrpgBattleDistance(actor, action, windowWidth / 2 + 160 + x, lineHeight * 1);
this.drawSrpgBattleDamage(damage, windowWidth / 2 + x + 160, lineHeight * 2); // show cri
// target
var actor = this._targetArray[1];
var target = this._actionArray[1];
var action = actor.currentAction();
if (!this._targetArray[1].canUse(action.item())) {
action = null;
}
if (!action || actor == target) {
this.drawSrpgBattleActionName(actor, action, x, lineHeight * 0, false);
return;
}
var damage = action.srpgPredictionDamage(target);
var hit = action.itemHit(target);
var eva = action.itemEva(target);
var cri = action.itemCri(target); // show cri
this.drawSrpgBattleActionName(actor, action, x, lineHeight * 0, true);
this.drawSrpgBattleHit(hit, eva, x, lineHeight * 1);
this.drawSrpgBattleCri(cri, x, lineHeight * 2); // show cri
this.drawSrpgBattleDistance(actor, action, x + 160, lineHeight * 1);
this.drawSrpgBattleDamage(damage, x + 160, lineHeight * 2); // show cri
this._targetArray[1].clearActions();
};
Window_SrpgPrediction.prototype.drawSrpgBattleActionName = function(actor, action, x, y, flag) {
if (action && flag == true) {
var skill = action.item();
if (skill) {
var costWidth = this.costWidth();
this.changePaintOpacity(this.isEnabled(actor, skill));
if (DataManager.isSkill(skill) && skill.id == actor.attackSkillId() &&
!actor.hasNoWeapons()) {
if (actor.isActor()) {
var item = actor.weapons()[0];
} else {
var item = $dataWeapons[Number(actor.enemy().meta.srpgWeapon)];
}
this.drawItemName(item, x + 4, y, 280 - costWidth);
} else {
this.drawItemName(skill, x + 4, y, 280 - costWidth);
}
this.drawSkillCost(actor, skill, x, y, 288);
this.changePaintOpacity(1);
// is attack effective
if (actor.isActor()) {
if ($gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].elementRate($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].currentAction().item().damage.elementId) > 1) {
this.drawIcon(73, x - 28, y + 2);
} else if ($gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].elementRate($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].currentAction().item().damage.elementId) < 1) {
this.drawIcon(74, x - 28, y + 2);
}
} else if (!actor.isActor()) {
if ($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].elementRate($gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].currentAction().item().damage.elementId) > 1) {
this.drawIcon(73, x - 28, y + 2);
} else if ($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].elementRate($gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1].currentAction().item().damage.elementId) < 1) {
this.drawIcon(74, x - 28, y + 2);
}
}
} else {
this.drawText('------------', x + 52, y, 96, 'right');
}
} else {
this.drawText('------------', x + 52, y, 96, 'right');
}
};