From d53aa3d5af6950d0ac4bfbcb5ab214a083c28e3a Mon Sep 17 00:00:00 2001 From: iainp5 Date: Fri, 11 Oct 2024 08:32:59 +0100 Subject: Added die images --- play.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'play.js') 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: '', + D2: '', + D3: '', + D4: '', + D5: '', + D6: '' +} + // =========================== VISUAL FUNCTIONS ==========================================# function on_focus_card_tip(card_number) { -- cgit v1.2.3