diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-12-10 21:59:09 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-12-10 21:59:09 +0000 |
commit | 3906a65b1e02aa1b60853e3129f1f921f85bf5a6 (patch) | |
tree | e6701810d01fe561ce5f45baef5880ef4d1a35bc /play.js | |
parent | 8eb0411bad2ce49f99ce5b21b576104a91e9bc45 (diff) | |
parent | 97656ab8c2b6a97f2616afa468bc002f1b85af40 (diff) | |
download | 1989-dawn-of-freedom-3906a65b1e02aa1b60853e3129f1f921f85bf5a6.tar.gz |
Merge branch 'main' into log
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -863,6 +863,32 @@ 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 '<span>→</span>' +} + +const ICONS = { + '£CC': '<span class="icon com_c"></span>', + '£CU': '<span class="icon com_nc"></span>', + '£DC': '<span class="icon dem_c"></span>', + '£DU': '<span class="icon dem_nc"></span>', + '.dT5': '<span class="number d_tst">5</span>', + '.dT6': '<span class="number d_tst">6</span>', + '.dT7': '<span class="number d_tst">7</span>', + '.dT8': '<span class="number d_tst">8</span>', + '.dT9': '<span class="number d_tst">9</span>', + '.dT10': '<span class="number d_tst">10</span>', + '.cT5': '<span class="number c_tst">5</span>', + '.cT6': '<span class="number c_tst">6</span>', + '.cT7': '<span class="number c_tst">7</span>', + '.cT8': '<span class="number c_tst">8</span>' +} + const die = { D1: '<span class="die white d1"></span>', D2: '<span class="die white d2"></span>', @@ -889,7 +915,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) @@ -897,6 +923,10 @@ 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(/\.cT(\d+)/g, sub_icon) + text = text.replace(/\.dT(\d+)/g, sub_icon) + text = text.replace(/.to/g, sub_arrow) if (text.match(/^\.h1/)) { text = text.substring(4) |