diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 92 |
1 files changed, 53 insertions, 39 deletions
@@ -3,6 +3,7 @@ /* global data, view, send_action, action_button, player */ const wing_name = [ "red", "pink", "blue", "dkblue" ] +const side_color = [ "red", "red", "blue", "blue" ] const reactions = [ "Screen", "Counterattack", "Absorb" ] let ui = { @@ -357,8 +358,8 @@ function on_update() { let w1 = data.cards[view.front[0][0]].wing let w2 = data.cards[view.front[1][0]].wing - ui.role_panel[0].className = "role " + wing_name[w1] - ui.role_panel[1].className = "role " + wing_name[w2] + ui.role_panel[0].className = "role " + side_color[w1] + ui.role_panel[1].className = "role " + side_color[w2] ui.role_name[0].textContent = data.scenarios[view.scenario].players[0].name ui.role_name[1].textContent = data.scenarios[view.scenario].players[1].name @@ -454,37 +455,37 @@ for (let i = 0; i < 12; ++i) { } const ICONS = { - D0: '<span class="die black d0"></span>', - D1: '<span class="die black d1"></span>', - D2: '<span class="die black d2"></span>', - D3: '<span class="die black d3"></span>', - D4: '<span class="die black d4"></span>', - D5: '<span class="die black d5"></span>', - D6: '<span class="die black d6"></span>', - R1: '<span class="die red d1"></span>', - R2: '<span class="die red d2"></span>', - R3: '<span class="die red d3"></span>', - R4: '<span class="die red d4"></span>', - R5: '<span class="die red d5"></span>', - R6: '<span class="die red d6"></span>', - P1: '<span class="die pink d1"></span>', - P2: '<span class="die pink d2"></span>', - P3: '<span class="die pink d3"></span>', - P4: '<span class="die pink d4"></span>', - P5: '<span class="die pink d5"></span>', - P6: '<span class="die pink d6"></span>', - B1: '<span class="die blue d1"></span>', - B2: '<span class="die blue d2"></span>', - B3: '<span class="die blue d3"></span>', - B4: '<span class="die blue d4"></span>', - B5: '<span class="die blue d5"></span>', - B6: '<span class="die blue d6"></span>', - K1: '<span class="die dkblue d1"></span>', - K2: '<span class="die dkblue d2"></span>', - K3: '<span class="die dkblue d3"></span>', - K4: '<span class="die dkblue d4"></span>', - K5: '<span class="die dkblue d5"></span>', - K6: '<span class="die dkblue d6"></span>', + D0: '<span class="mini black d0"></span>', + D1: '<span class="mini black d1"></span>', + D2: '<span class="mini black d2"></span>', + D3: '<span class="mini black d3"></span>', + D4: '<span class="mini black d4"></span>', + D5: '<span class="mini black d5"></span>', + D6: '<span class="mini black d6"></span>', + R1: '<span class="mini red d1"></span>', + R2: '<span class="mini red d2"></span>', + R3: '<span class="mini red d3"></span>', + R4: '<span class="mini red d4"></span>', + R5: '<span class="mini red d5"></span>', + R6: '<span class="mini red d6"></span>', + P1: '<span class="mini pink d1"></span>', + P2: '<span class="mini pink d2"></span>', + P3: '<span class="mini pink d3"></span>', + P4: '<span class="mini pink d4"></span>', + P5: '<span class="mini pink d5"></span>', + P6: '<span class="mini pink d6"></span>', + B1: '<span class="mini blue d1"></span>', + B2: '<span class="mini blue d2"></span>', + B3: '<span class="mini blue d3"></span>', + B4: '<span class="mini blue d4"></span>', + B5: '<span class="mini blue d5"></span>', + B6: '<span class="mini blue d6"></span>', + K1: '<span class="mini dkblue d1"></span>', + K2: '<span class="mini dkblue d2"></span>', + K3: '<span class="mini dkblue d3"></span>', + K4: '<span class="mini dkblue d4"></span>', + K5: '<span class="mini dkblue d5"></span>', + K6: '<span class="mini dkblue d6"></span>', } function sub_icon(match) { @@ -492,9 +493,10 @@ function sub_icon(match) { } function sub_card(match) { - let wing = "" - let name = match - return `<span class="${wing}">${name}</span>` + let c = parseInt(match.substring(1)) + let wing = wing_name[data.cards[c].wing] + let name = data.cards[c].name + return `<span class="n ${wing}">${name}</span>` } function on_log(text) { @@ -507,14 +509,26 @@ function on_log(text) { text = text.substring(4) p.className = "h2" } - else if (text.match(/^>/)) { - text = text.substring(1) - p.className = "ind" + else if (text.match(/^\.t0/)) { + text = data.scenarios[view.scenario].players[0].name + p.className = "t" + } + else if (text.match(/^\.t1/)) { + text = data.scenarios[view.scenario].players[1].name + p.className = "t" } else if (text.match(/^\.i /)) { text = text.substring(3) p.className = "i" } + else if (text.match(/^>>/)) { + text = text.substring(2) + p.className = "i2" + } + else if (text.match(/^>/)) { + text = text.substring(1) + p.className = "i1" + } text = text.replace(/\bC\d+\b/g, sub_card) text = text.replace(/\b[DPRBK]\d\b/g, sub_icon) |