summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--info/readme.html2
-rw-r--r--play.css23
-rw-r--r--play.js37
-rw-r--r--rules.js43
4 files changed, 90 insertions, 15 deletions
diff --git a/info/readme.html b/info/readme.html
index e64a9e4..f8a5b41 100644
--- a/info/readme.html
+++ b/info/readme.html
@@ -63,4 +63,4 @@ Click the name and the city will scroll into view.
<hr>
<p style="text-align:center">
-<img src="/friedrich/images/suit_clubs.svg" height="32">
+<img src="/friedrich/images/suit_spades.svg" height="32">
diff --git a/play.css b/play.css
index 1f72299..89b1bdd 100644
--- a/play.css
+++ b/play.css
@@ -149,6 +149,8 @@ body {
#log span.suit { font-size: 11px; }
+span.value { padding: 0 1px }
+
span.suit.reserve { padding: 0 1px; }
span.suit.spades { color: var(--color-spades) }
@@ -156,6 +158,7 @@ span.suit.clubs { color: var(--color-clubs) }
span.suit.hearts { color: var(--color-hearts) }
span.suit.diamonds { color: var(--color-diamonds) }
span.suit.reserve { color: var(--color-reserve); font-weight: bold; font-family: "Source Serif SmText"; }
+span.suit.reserve { font-weight: bold; font-family: "Source Serif SmText"; }
/* PANELS */
@@ -431,6 +434,26 @@ span.suit.reserve { color: var(--color-reserve); font-weight: bold; font-family:
}
}
+body.shift span.value.deck_1 { background-color: #9513 }
+body.shift span.value.deck_2 { background-color: #04f2 }
+body.shift span.value.deck_3 { background-color: #0f03 }
+body.shift span.value.deck_4 { background-color: #f002 }
+body.shift span.value.deck_5 { background-color: #0002 }
+
+/*
+body.shift .card.tc.face.deck_1 { border-color: #7d643d; }
+body.shift .card.tc.face.deck_2 { border-color: #3e6c8c; }
+body.shift .card.tc.face.deck_3 { border-color: #687e33; }
+body.shift .card.tc.face.deck_4 { border-color: #ac4531; }
+body.shift .card.tc.face.deck_1 { border-color: silver; }
+
+body.shift .card.tc.face.deck_1 { box-shadow: 0 0 0 2px #7d643d; }
+body.shift .card.tc.face.deck_2 { box-shadow: 0 0 0 2px #3e6c8c; }
+body.shift .card.tc.face.deck_3 { box-shadow: 0 0 0 2px #687e33; }
+body.shift .card.tc.face.deck_4 { box-shadow: 0 0 0 2px #ac4531; }
+body.shift .card.tc.face.deck_1 { box-shadow: 0 0 0 2px silver; }
+*/
+
/* CARDS */
.card {
diff --git a/play.js b/play.js
index 2e54aec..1d6f3bb 100644
--- a/play.js
+++ b/play.js
@@ -133,6 +133,8 @@ function to_suit(c) {
}
function to_value(c) {
+ if (to_suit(c) === 4)
+ return 10
return c & 15
}
@@ -930,12 +932,26 @@ const colorize_H = '<span class="suit hearts">\u2665</span>'
const colorize_D = '<span class="suit diamonds">\u2666</span>'
const colorize_R = '$1<span class="suit reserve">R</span>'
+const colorize_1 = '<span class="value deck_1">$1</span>'
+const colorize_2 = '<span class="value deck_2">$1</span>'
+const colorize_3 = '<span class="value deck_3">$1</span>'
+const colorize_4 = '<span class="value deck_4">$1</span>'
+const colorize_5 = '<span class="value deck_5">$1</span>'
+
function colorize(text) {
+ text = text.replace(/1\^(\d+[\u2660\u2663\u2665\u2666R])/g, colorize_1)
+ text = text.replace(/2\^(\d+[\u2660\u2663\u2665\u2666R])/g, colorize_2)
+ text = text.replace(/3\^(\d+[\u2660\u2663\u2665\u2666R])/g, colorize_3)
+ text = text.replace(/4\^(\d+[\u2660\u2663\u2665\u2666R])/g, colorize_4)
+ text = text.replace(/5\^(\d+[\u2660\u2663\u2665\u2666R])/g, colorize_5)
+ text = text.replace(/(\d+)R/g, colorize_R)
text = text.replaceAll("\u2660", colorize_S)
text = text.replaceAll("\u2663", colorize_C)
text = text.replaceAll("\u2665", colorize_H)
text = text.replaceAll("\u2666", colorize_D)
- text = text.replace(/(\d+)R/g, colorize_R)
+
+/*
+ */
return text
}
@@ -1242,6 +1258,22 @@ function sub_space(_match, p1) {
return `<span class="city_tip" onclick="on_click_city_tip(${x})" onmouseenter="on_focus_city_tip(${x})" onmouseleave="on_blur_city_tip(${x})">${n}</span>`
}
+const suit_icon = [
+ '<span class="suit spades">\u2660</span>',
+ '<span class="suit clubs">\u2663</span>',
+ '<span class="suit hearts">\u2665</span>',
+ '<span class="suit diamonds">\u2666</span>',
+ '<span class="suit reserve">R</span>',
+]
+
+function sub_tc(_match, p1) {
+ let c = p1 | 0
+ let d = to_deck(c)
+ let v = to_value(c)
+ let s = to_suit(c)
+ return `<span class="value deck_${d+1}">${v}</span>${suit_icon[s]}`
+}
+
function on_log(text) {
let p = document.createElement("div")
@@ -1264,9 +1296,10 @@ function on_log(text) {
text = text.replace(/</g, "&lt;")
text = text.replace(/>/g, "&gt;")
+ text = colorize(text)
text = text.replace(/S(\d+)/g, sub_space)
text = text.replace(/P(\d+)/g, sub_piece)
- text = colorize(text)
+ text = text.replace(/C(\d+)/g, sub_tc)
if (text.match(/^\$(\d+)/)) {
let fx = parseInt(text.substring(1))
diff --git a/rules.js b/rules.js
index ac65ea3..89d84e3 100644
--- a/rules.js
+++ b/rules.js
@@ -311,12 +311,20 @@ function to_value(c) {
return c & 15
}
-function format_card(c) {
+function format_card_prompt(c) {
if (is_reserve(c))
return "10R"
return to_value(c) + suit_name[to_suit(c)]
}
+function format_card(c) {
+ return (to_deck(c)+1) + "^" + format_card_prompt(c)
+}
+
+function format_reserve(c, v) {
+ return (to_deck(c)+1) + "^" + v + "R"
+}
+
function is_reserve(c) {
return to_suit(c) === RESERVE
}
@@ -332,12 +340,18 @@ function is_west_of(here, there) {
return dx < 0 && Math.abs(dx) >= Math.abs(dy)
}
-function format_cards(list) {
+function format_card_list(list) {
if (list.length > 0)
return list.map(format_card).join(", ")
return "nothing"
}
+function format_card_list_prompt(list) {
+ if (list.length > 0)
+ return list.map(format_card_prompt).join(", ")
+ return "nothing"
+}
+
function format_selected() {
if (game.selected.length === 0)
return "nobody"
@@ -1125,7 +1139,7 @@ states.tactical_cards_discard = {
inactive: "draw tactical cards",
prompt() {
view.draw = game.draw
- prompt("Draw " + format_cards(game.draw) + ". Discard one of them.")
+ prompt("Draw " + format_card_list_prompt(game.draw) + ". Discard one of them.")
for (let c of game.draw)
gen_action_card(c)
},
@@ -1141,7 +1155,7 @@ states.tactical_cards_discard_done = {
inactive: "draw tactical cards",
prompt() {
view.draw = game.draw
- prompt("Draw " + format_cards(game.draw) + ".")
+ prompt("Draw " + format_card_list_prompt(game.draw) + ".")
view.actions.end_cards = 1
},
end_cards() {
@@ -1153,7 +1167,7 @@ states.tactical_cards_show = {
inactive: "draw tactical cards",
prompt() {
view.draw = game.draw
- prompt("Draw " + format_cards(game.draw) + ".")
+ prompt("Draw " + format_card_list_prompt(game.draw) + ".")
view.actions.end_cards = 1
},
end_cards() {
@@ -2411,10 +2425,12 @@ function play_card(c, sign) {
}
function play_reserve(v, sign) {
+ let c = game.reserve
+ delete game.reserve
let prefix = (sign < 0 ? ">>" : ">") + POWER_NAME[game.power]
if (fate_card_zero()) {
let score = signed_number(sign * game.count)
- log(`${prefix} 0R = ${score}`)
+ log(`${prefix} ${format_reserve(c, 0)} = ${score}`)
clear_fate_effect()
return
}
@@ -2425,9 +2441,9 @@ function play_reserve(v, sign) {
game.count += v
let score = signed_number(sign * game.count)
if (bonus > 0)
- log(`${prefix} ${v-bonus}R + ${bonus} = ${score}`)
+ log(`${prefix} ${format_reserve(c, v-bonus)} + ${bonus} = ${score}`)
else
- log(`${prefix} ${v}R = ${score}`)
+ log(`${prefix} ${format_reserve(c, v)} = ${score}`)
if (bonus > 0)
clear_fate_effect()
}
@@ -2437,6 +2453,7 @@ function play_combat_card(c, sign, resume, next_state) {
array_remove_item(game.hand[game.power], c)
if (is_reserve(c)) {
game.state = next_state
+ game.reserve = c
} else {
play_card(c, sign)
resume()
@@ -2477,6 +2494,7 @@ states.combat_attack_reserve = {
inactive: inactive_attack,
prompt() {
prompt_combat(game.count, "Choose value.")
+ view.draw = [ game.reserve ]
gen_play_reserve()
},
value(v) {
@@ -2489,6 +2507,7 @@ states.combat_defend_reserve = {
inactive: inactive_defend,
prompt() {
prompt_combat(-game.count, "Choose value.")
+ view.draw = [ game.reserve ]
gen_play_reserve()
},
value(v) {
@@ -3656,7 +3675,7 @@ states.austria_and_russia_may_exchange_one_tc_with_each_other_2 = {
states.austria_and_russia_may_exchange_one_tc_with_each_other_3 = {
inactive: "exchange TC with Austria",
prompt() {
- prompt("You received " + format_card(game.exchange_a) + " from Austria.")
+ prompt("You received " + format_card_prompt(game.exchange_a) + " from Austria.")
view.draw = [ game.exchange_a ]
view.actions.done = 1
},
@@ -3672,7 +3691,7 @@ states.austria_and_russia_may_exchange_one_tc_with_each_other_3 = {
states.austria_and_russia_may_exchange_one_tc_with_each_other_4 = {
inactive: "exchange TC with Russia",
prompt() {
- prompt("You received " + format_card(game.exchange_r) + " from Russia.")
+ prompt("You received " + format_card_prompt(game.exchange_r) + " from Russia.")
view.draw = [ game.exchange_r ]
view.actions.done = 1
},
@@ -3705,7 +3724,7 @@ states.france_may_discard_any_one_tc_for_a_new_one_from_the_draw_deck = {
states.france_may_discard_any_one_tc_for_a_new_one_from_the_draw_deck_2 = {
inactive: "discard a TC for a new one",
prompt() {
- prompt("You drew " + format_cards(game.draw) + " from the draw deck.")
+ prompt("You drew " + format_card_list_prompt(game.draw) + " from the draw deck.")
view.draw = game.draw
view.actions.done = 1
},
@@ -3747,7 +3766,7 @@ states.prussia_may_draw_randomly_one_tc_from_austria_after_first_giving_one_tc_o
states.prussia_may_draw_randomly_one_tc_from_austria_after_first_giving_one_tc_of_her_choice_to_austria_2 = {
inactive: "randomly draw one TC from Austria",
prompt() {
- prompt("You randomly drew " + format_card(game.draw) + " from Austria.")
+ prompt("You randomly drew " + format_card_prompt(game.draw) + " from Austria.")
view.draw = [ game.draw ]
view.actions.done = 1
},