From c41b9834c835555c8a595ae88af630da2e357537 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Tue, 10 Dec 2024 20:27:19 +0000 Subject: Add icons --- play.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'play.js') diff --git a/play.js b/play.js index 0135fd3..a68ee3c 100644 --- a/play.js +++ b/play.js @@ -860,6 +860,22 @@ function sub_die(match) { return die[match] || match } +function sub_icon(match) { + console.log('sub_icon called, match', match) + return ICONS[match] || match +} + +function sub_arrow(match) { + return '' +} + +const ICONS = { + '£CC': '', + '£CU': '', + '£DC': '', + '£DU': '', +} + const die = { D1: '', D2: '', @@ -885,7 +901,7 @@ function on_log(text, ix) { p.className = "i" } - + console.log('text', text) text = text.replace(/_/g, " ") text = text.replace(/C(\d+)/g, sub_card_name) @@ -893,6 +909,8 @@ function on_log(text, ix) { text = text.replace(/V(\d+)/g, sub_power_card_value) text = text.replace(/%(\d+)/g, sub_space_name) text = text.replace(/D[1-6]/g, sub_die) + text = text.replace(/£[CD][CU]\b/g, sub_icon) + text = text.replace(/.to/g, sub_arrow) if (text.match(/^\.h1/)) { text = text.substring(4) -- cgit v1.2.3