diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 73 |
1 files changed, 59 insertions, 14 deletions
@@ -1586,12 +1586,16 @@ function sub_card_x(match, p1, p2) { return `<span class="tip ${match[0]}" onmouseenter="on_focus_influence_tip(${x})" onmouseleave="on_blur_tip()">${p1} ${p2}</span>` } +var log_combat = 0 +var log_place = 0 +var log_pretender = 0 + function on_log(text) { let p = document.createElement("div") if (text.match(/^>/)) { text = text.substring(1) - p.className = 'i' + p.className = "i" } text = text.replace(/&/g, "&") @@ -1615,38 +1619,79 @@ function on_log(text) { if (text.match(/^.turn/)) { text = text.substring(6) - p.className = 'turn ' + text + p.className = "turn " + text } if (text.match(/^\.h1 Red/)) { text = text.substring(4) p.className = "h1 R" - } - else if (text.match(/^\.h1 Blue/)) { + } else if (text.match(/^\.h1 Blue/)) { text = text.substring(4) p.className = "h1 B" - } - else if (text.match(/^\.h1 Yellow/)) { + } else if (text.match(/^\.h1 Yellow/)) { text = text.substring(4) p.className = "h1 Y" - } - else if (text.match(/^\.h1 Green/)) { + } else if (text.match(/^\.h1 Green/)) { text = text.substring(4) p.className = "h1 G" - } - else if (text.match(/^\.h1/)) { + } else if (text.match(/^\.h1/)) { text = text.substring(4) p.className = "h1" - } - else if (text.match(/^\.h2/)) { + } else if (text.match(/^\.h2/)) { text = text.substring(4) p.className = "h2" - } - else if (text.match(/^\.h3/)) { + } else if (text.match(/^\.h3/)) { text = text.substring(4) p.className = "h3" } + // Group pretender messages + + if (text.match(/^Pretender\.$/) || text.match(/^Occupied /)) { + log_pretender = 1 + p.classList.add("h2") + text = text.replace(".", "") + } + if (log_pretender === 1 && text === "") + log_pretender = 0 + if (log_pretender) + p.classList.add("group", "populace") + + // Group combat messages + + if (text.match(/^Battle in /)) { + p.classList.add("h2") + log_combat = 2 + } + if (log_combat > 0) { + if ( + text === "DEFENDER" || + text === "ATTACKER" || + text === "FLANKING MANEUVER" || + text === "SPICULUM" || + text === "RESULT" + ) + p.classList.add("h3") + if (text === "RESULT") + log_combat = 1 + } + if (log_combat === 1 && text === "") + log_combat = 0 + if (log_combat) + p.classList.add("group", "military") + + // Group place governor + + if (text.match(/^Place Governor in /) || text.match(/^Praetorian Guard in /)) { + log_place = 1 + p.classList.add("h2") + text = text.replace(".", "") + } + if (log_place === 1 && text === "") + log_place = 0 + if (log_place) + p.classList.add("group", "senate") + p.innerHTML = text return p } |