diff --git a/public/modules/ui/battle-screen.js b/public/modules/ui/battle-screen.js index 5b441a7b4..2ab4e8d5c 100644 --- a/public/modules/ui/battle-screen.js +++ b/public/modules/ui/battle-screen.js @@ -12,6 +12,8 @@ class Battle { this.cell = findCell(this.x, this.y); this.attackers = {regiments: [], distances: [], morale: 100, casualties: 0, power: 0}; this.defenders = {regiments: [], distances: [], morale: 100, casualties: 0, power: 0}; + this.phasePerIteration = ""; + this.prevPhasePerIteration = { d: undefined, a: undefined }; this.addHeaders(); this.addRegiment("attackers", attacker); @@ -520,6 +522,13 @@ class Battle { this[side].die = +el.innerHTML; } + recordPhases(d, a) { + if (this.prevPhasePerIteration.d != d || this.prevPhasePerIteration.a != a) { + this.phasePerIteration += `Defender: ${d}, Attacker: ${a}
`; + this.prevPhasePerIteration = {d: d, a: a} + } + } + selectPhase() { const i = this.iteration; const morale = [this.attackers.morale, this.defenders.morale]; @@ -667,6 +676,8 @@ class Battle { const buttonD = ensureEl("battlePhase_defenders"); buttonD.className = "icon-button-" + this.defenders.phase; buttonD.dataset.tip = buttonD.nextElementSibling.querySelector("[data-phase='" + phase[1] + "']").dataset.tip; + + this.recordPhases(this.defenders.phase, this.attackers.phase); } run() { @@ -803,6 +814,8 @@ class Battle { button.className = "icon-button-" + phase; button.dataset.tip = ev.target.dataset.tip; this.calculateStrength(side); + + this.recordPhases(this.defenders.phase, this.attackers.phase); } applyResults() { @@ -888,7 +901,7 @@ class Battle { )} and ${getSide(this.defenders.regiments, 0)}. ${result}. \r\nAttackers losses: ${getLosses(this.attackers.casualties)}%, defenders losses: ${getLosses( this.defenders.casualties - )}%`; + )}%

\n${this.phasePerIteration}

`; notes.push({id: `marker${i}`, name: this.name, legend}); tip(`${this.name} is over. ${result}`, true, "success", 4000);