// Declare Constants
const lineHeight = this.lineHeight();
const actor = this._actor;
const padding = this.itemPadding();
let width = this.innerWidth / 2;
const elements = this.getElementIDs();
let x = 0;
let y = 0;
// Draw Actor Graphic
this.drawActorGraphic(0, width);
// Draw Element Trait Sets
this.drawItemDarkRect(0, y, width, lineHeight, 2);
this.drawItemDarkRect(width, y, width, lineHeight, 2);
const labelFmt = '\\C[16]%1: \\C[0]%2';
const traitType1 = DataManager.traitSetType('Element');
const traitSet1 = actor.traitSet('Element');
this.drawTextEx(labelFmt.format(traitType1.Label, traitSet1.Display), padding, y, width - padding * 2);
const traitType2 = DataManager.traitSetType('SubElement');
const traitSet2 = actor.traitSet('SubElement');
this.drawTextEx(labelFmt.format(traitType2.Label, traitSet2.Display), width + padding, y, width - padding * 2);
y += lineHeight;
this.setDescriptionFontSizeToTraitSet();
const traitHeight = (this.innerHeight / Math.max(Window_StatusData.traitCol1.length, Window_StatusData.traitCol2.length)) - lineHeight;
this.drawItemDarkRect(0, y, width, traitHeight);
this.drawItemDarkRect(width, y, width, traitHeight);
this.drawTextEx(traitSet1.Description, padding, y, width - padding * 2);
this.drawTextEx(traitSet2.Description, width + padding, y, width - padding * 2);
this.resetDescriptionFontSize();
this.resetFontSettings();
y += traitHeight;
const topY = y;
// Draw Elemental Data
this.drawItemDarkRect(width * 0, y, width, lineHeight, 2);
this.drawItemDarkRect(width * 1, y, width, lineHeight, 2);
this.changeTextColor(ColorManager.systemColor());
this.drawText(TextManager.statusMenuDmgReceive, width * 0, y, width, 'center');
this.drawText(TextManager.statusMenuDmgDealt, width * 1, y, width, 'center');
y += lineHeight;
this.setDescriptionFontSizeToTraitSet();
const smallLineHeight = this.textSizeEx(' ').height;
for (const elementId of elements) {
this.drawItemDarkRect(width * 0, y, width, smallLineHeight);
this.drawItemDarkRect(width * 1, y, width, smallLineHeight);
// Name
const name = $dataSystem.elements[elementId];
const column = Math.floor(elementId / 12);
const elementX1 = width * (column === 0 ? 0.25 : 0.75) + padding;
const elementX2 = width * (column === 0 ? 1.25 : 1.75) + padding;
this.drawTextEx(name, elementX1, y, width/4);
this.drawTextEx(name, elementX2, y, width/4);
// Received Damage Rate
this.resetFontSettings();
const rate = actor.elementRate(elementId);
const flippedRate = (rate - 1) * -1;
this.changeTextColor(ColorManager.paramchangeTextColor(flippedRate));
let rateText = '%1%'.format(Math.round(flippedRate * 100));
if (actor.getAbsorbedElements().includes(elementId)) {
this.changeTextColor(ColorManager.powerUpColor());
rateText = TextManager.statusMenuDmgAbsorb.format(Math.round(rate * 100));
} else if (rate > 1) {
rateText = '%1'.format(rateText);
} else if (rate <= 1) {
rateText = '+%1'.format(rateText);
}
this.contents.drawText(rateText, width * 0, y, (width / 4 * (column === 0 ? 1 : 3)) - padding, smallLineHeight, 'right');
// Dealt Damage Rate
const dealtPlus = actor.getDealtElementPlus(elementId);
const dealtRate = actor.getDealtElementRate(elementId);
const dealtFlat = actor.getDealtElementFlat(elementId);
const dealt = ((1 + dealtPlus) * dealtRate + dealtFlat) - 1;
this.changeTextColor(ColorManager.paramchangeTextColor(dealt));
let dealtText = '%1%'.format(dealt);
if (dealt >= 0) dealtText = '+%1'.format(dealtText);
this.contents.drawText(dealtText, width * 1, y, (width / 4 * (column === 0 ? 1 : 3)) - padding, smallLineHeight, 'right');
y += smallLineHeight;
if (elementId % 11 === 0) y = topY + lineHeight;
}
this.resetDescriptionFontSize();
this.resetFontSettings();
this.drawItemDarkRect(width * 0, y, width, this.innerHeight - y);
this.drawItemDarkRect(width * 1, y, width, this.innerHeight - y);
this.drawItemDarkRect(width * 2, y, width, this.innerHeight - y);