|
|
|
@@ -1,4 +1,4 @@ |
|
|
|
import { Stat, Vigor } from './combat' |
|
|
|
import { Stat, Vigor, StatDescs, VigorDescs, StatIcons, VigorIcons } from './combat' |
|
|
|
|
|
|
|
export interface LogEntry { |
|
|
|
render: () => HTMLElement[]; |
|
|
|
@@ -101,20 +101,27 @@ export class PropElem implements LogEntry { |
|
|
|
|
|
|
|
render (): HTMLElement[] { |
|
|
|
let cls: string |
|
|
|
switch (this.prop) { |
|
|
|
case Vigor.Health: cls = "fas fa-heart"; break |
|
|
|
case Vigor.Stamina: cls = "fas fa-bolt"; break |
|
|
|
case Vigor.Resolve: cls = "fas fa-brain"; break |
|
|
|
case Stat.Toughness: cls = "fas fa-heartbeat"; break |
|
|
|
case Stat.Power: cls = "fas fa-fist-raised"; break |
|
|
|
case Stat.Speed: cls = "fas fa-weather"; break |
|
|
|
case Stat.Willpower: cls = "fas fa-book"; break |
|
|
|
case Stat.Charm: cls = "fas fa-comments"; break |
|
|
|
|
|
|
|
if (this.prop in Stat) { |
|
|
|
cls = StatIcons[this.prop as Stat] |
|
|
|
} else if (this.prop in Vigor) { |
|
|
|
cls = VigorIcons[this.prop as Vigor] |
|
|
|
} else { |
|
|
|
// this shouldn't be possible, given the typing... |
|
|
|
cls = "fas fa-exclamation-triangle" |
|
|
|
} |
|
|
|
|
|
|
|
const span = document.createElement("span") |
|
|
|
span.classList.add("stat-entry") |
|
|
|
|
|
|
|
span.dataset.tooltip = this.prop |
|
|
|
|
|
|
|
if (this.prop in Stat) { |
|
|
|
span.dataset.tooltipFull = StatDescs[this.prop as Stat] |
|
|
|
} else if (this.prop in Vigor) { |
|
|
|
span.dataset.tooltipFull = VigorDescs[this.prop as Vigor] |
|
|
|
} |
|
|
|
|
|
|
|
if (this.value !== null) { |
|
|
|
const numText = Math.round(this.value).toFixed(0) === this.value.toFixed(0) ? this.value.toFixed(0) : this.value.toFixed(1) |
|
|
|
span.textContent = numText + ' ' |
|
|
|
@@ -124,9 +131,6 @@ export class PropElem implements LogEntry { |
|
|
|
span.appendChild(elem) |
|
|
|
}) |
|
|
|
|
|
|
|
span.dataset.tooltip = this.prop |
|
|
|
span.dataset.tooltipFull = this.prop |
|
|
|
|
|
|
|
return [span] |
|
|
|
} |
|
|
|
} |
|
|
|
|