summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-11 08:32:59 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-11 08:32:59 +0100
commitd53aa3d5af6950d0ac4bfbcb5ab214a083c28e3a (patch)
tree2de60fd25e4dd964369a6c9ecc1f520be449b25b /play.js
parenta93ef46743251516b3ad4075fdd518ed45d0776d (diff)
download1989-dawn-of-freedom-d53aa3d5af6950d0ac4bfbcb5ab214a083c28e3a.tar.gz
Added die images
Diffstat (limited to 'play.js')
-rw-r--r--play.js28
1 files changed, 10 insertions, 18 deletions
diff --git a/play.js b/play.js
index 99dd5f6..9f4c107 100644
--- a/play.js
+++ b/play.js
@@ -228,17 +228,6 @@ function on_log(text) { // eslint-disable-line no-unused-vars
let p = document.createElement("div")
-
-/*
- let last_text = last_log_entry ? last_log_entry.split(' ') : []
- console.log('last text', last_text, 'text', text.split(' ')[3])
- if (last_text[0] === 'Added' && last_text[4] === text.split(' ')[4]) {
- let new_influence = parseInt(last_text[1]) + 1
- new_text = `Added ${new_influence} influence in ${last_text[4]}`
- console.log('new_influence', new_influence, 'new_text', new_text)
- } */
-
-
if (text.match(/^>/)) {
text = text.substring(1)
p.className = 'i'
@@ -249,6 +238,7 @@ function on_log(text) { // eslint-disable-line no-unused-vars
text = text.replace(/P(\d+)/g, sub_power_card_name)
text = text.replace(/V(\d+)/g, sub_power_card_value)
text = text.replace(/%(\d+)/g, sub_space_name)
+ text = text.replace(/\b[D][1-6]\b/g, sub_die)
if (text.match(/^\.h1/)) {
@@ -272,13 +262,6 @@ function on_log(text) { // eslint-disable-line no-unused-vars
p.className = 'h3'
}
- //console.log('view.log', view.log)
- /*console.log('new text', text)
- if (last_log_entry_text) {
- console.log('log = text', last_log_entry_text === text)
- }
-
-*/
p.innerHTML = text
return p
}
@@ -741,6 +724,15 @@ function sub_die(match) {
return die[match] || match
}
+const die = {
+ D1: '<span class="die white d1"></span>',
+ D2: '<span class="die white d2"></span>',
+ D3: '<span class="die white d3"></span>',
+ D4: '<span class="die white d4"></span>',
+ D5: '<span class="die white d5"></span>',
+ D6: '<span class="die white d6"></span>'
+}
+
// =========================== VISUAL FUNCTIONS ==========================================#
function on_focus_card_tip(card_number) {