diff --git a/dying.html b/dying.html index fcba6d2..55936e0 100644 --- a/dying.html +++ b/dying.html @@ -222,6 +222,9 @@ } .sim-cond-val.wounded-hi { color: #d0a030; } .sim-cond-val.doomed-hi { color: #d04040; } + .sim-cond-val.dying-hi-1 { color: var(--c-dying-1-hi); } + .sim-cond-val.dying-hi-2 { color: var(--c-dying-2-hi); } + .sim-cond-val.dying-hi-3 { color: var(--c-dying-3-hi); } .sim-cond-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; font-family: inherit; @@ -517,6 +520,12 @@ flowchart TD
Conditions: +
+ Dying + + 0 + +
Wounded @@ -915,6 +924,24 @@ flowchart TD // ── Condition Adjusters ─────────────────────────────────────── + function adjustDying(delta) { + var current = (simState === 'DYING') ? simDying : 0; + var newVal = current + delta; + if (newVal <= 0) { + if (simState === 'DYING') { simState = 'UNCONSCIOUS'; } + simDying = 0; + } else if (newVal >= deathThreshold()) { + simState = 'DEAD'; simDying = 0; + } else { + simState = 'DYING'; simDying = newVal; + } + renderCondVals(); + simRenderStateBox(); + simRenderActions(); + document.getElementById('sim-outcomes-section').style.display = 'none'; + document.getElementById('sim-result-container').innerHTML = ''; + } + function adjustWounded(delta) { simWounded = Math.max(0, simWounded + delta); renderCondVals(); @@ -934,8 +961,12 @@ flowchart TD } function renderCondVals() { - var wEl = document.getElementById('sim-wounded-val'); - var dEl = document.getElementById('sim-doomed-val'); + var dyEl = document.getElementById('sim-dying-val'); + var wEl = document.getElementById('sim-wounded-val'); + var dEl = document.getElementById('sim-doomed-val'); + var dv = (simState === 'DYING') ? simDying : 0; + dyEl.textContent = dv; + dyEl.className = 'sim-cond-val' + (dv > 0 ? ' dying-hi-' + Math.min(3, dv) : ''); wEl.textContent = simWounded; wEl.className = 'sim-cond-val' + (simWounded > 0 ? ' wounded-hi' : ''); dEl.textContent = simDoomed; @@ -952,6 +983,7 @@ flowchart TD } simHistory = [{ state: simState, dying: simDying }]; simPending = null; + renderCondVals(); simRender(); } @@ -997,6 +1029,7 @@ flowchart TD } function simRenderWithResult(msg) { + renderCondVals(); simRenderStateBox(); simRenderActions(); document.getElementById('sim-outcomes-section').style.display = 'none';