summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-08-22 12:46:59 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-22 13:23:33 +0200
commit2d0cccee7c78c5b7ba8f96c88d44020932b35be9 (patch)
tree328a1eeac5e0b2521b6b21596ec8a79f1f30bd24
parent152f3965d2b73b73592d7795ce1e000e631eea5c (diff)
downloadmaria-2d0cccee7c78c5b7ba8f96c88d44020932b35be9.tar.gz
import friedrich changes
-rw-r--r--play.css4
-rw-r--r--play.html2
-rw-r--r--play.js4
-rw-r--r--rules.js42
4 files changed, 29 insertions, 23 deletions
diff --git a/play.css b/play.css
index 50eaa78..df25cd3 100644
--- a/play.css
+++ b/play.css
@@ -22,6 +22,8 @@ body {
#role_Frederick { background-color: skyblue; }
#role_Louis_XV { background-color: salmon; }
+.role.active span { font-weight: bold }
+
#mapwrap {
width: 2485px;
height: 1654px;
@@ -149,7 +151,7 @@ header.your_turn.austria { background-color: var(--color-light-austria); }
min-height: 6px;
}
-.city_tip .piece_tip, .move_tip { cursor: pointer; }
+.city_tip, .piece_tip, .move_tip { cursor: pointer; }
.city_tip:hover, .piece_tip:hover, .move_tip:hover { text-decoration: underline; }
#log .h {
diff --git a/play.html b/play.html
index 4f7e2b5..07dd3e8 100644
--- a/play.html
+++ b/play.html
@@ -41,7 +41,7 @@
<div id="mapwrap">
<div id="map">
- <svg id="roads" width="2485" height="1654"></svg>
+ <svg id="roads" width="2485" height="1654" style="position:absolute;z-index:1;pointer-events:none;"></svg>
<div id="spaces"></div>
<div id="markers"></div>
<div id="pieces"></div>
diff --git a/play.js b/play.js
index 91b8898..53bf33a 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 8
return c & 15
}
@@ -973,7 +975,7 @@ function on_update() {
action_button("end_turn", "End turn")
confirm_action_button("confirm_end_movement", "End movement",
- "You still have UNMOVED pieces.?")
+ "You have NOT moved ANY pieces!\nAre you sure you want to SKIP movement?")
action_button("undo", "Undo")
diff --git a/rules.js b/rules.js
index 8ed1fa8..2bb4dfb 100644
--- a/rules.js
+++ b/rules.js
@@ -220,12 +220,6 @@ function is_reserve(c) {
return to_suit(c) === RESERVE
}
-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(", ")
@@ -238,8 +232,9 @@ function format_selected() {
return game.selected.map(p => piece_name[p]).join(" and ")
}
-function log_selected() {
- log(game.selected.map(p => "P" + p).join(" and "))
+function log_move_to(to) {
+ let from = game.pos[game.selected[0]]
+ log("@" + game.selected.join(",") + ";" + from + "," + to)
}
function log_move_path() {
@@ -517,8 +512,11 @@ function retire_general(p) {
}
}
-function eliminate_general(p) {
- log(">P" + p + " eliminated")
+function eliminate_general(p, indent) {
+ if (indent)
+ log(">P" + p + " eliminated")
+ else
+ log("P" + p + " eliminated.")
game.pos[p] = ELIMINATED
game.troops[p] = 0
set_in_supply(p)
@@ -973,6 +971,7 @@ function move_general_to(to) {
game.move_elim = []
set_add(game.move_elim, p)
game.pos[p] = ELIMINATED
+ // NOTE: eliminating a supply train does not stop movement!
}
}
@@ -1161,7 +1160,7 @@ states.move_give = {
}
function end_move_piece() {
- log_selected_move_path()
+ log_move_path()
if (game.move_elim) {
for (let p of game.move_elim)
@@ -1414,7 +1413,7 @@ function end_recruit() {
else
log("Recruited with " + game.recruit.used.map(format_card).join(", ") + ".")
map_for_each(game.recruit.pieces, (p,s) => {
- log("Re-entered P" + p + " at S" + s)
+ log("Re-entered P" + p + " at S" + s + ".")
})
if (game.recruit.troops)
log(">" + game.recruit.troops + " troops")
@@ -1758,6 +1757,7 @@ states.combat_attack_reserve = {
inactive: inactive_attack,
prompt() {
prompt_combat(game.count, "Choose value.")
+ view.draw = [ game.reserve ]
gen_play_reserve()
},
value(v) {
@@ -1770,6 +1770,7 @@ states.combat_defend_reserve = {
inactive: inactive_defend,
prompt() {
prompt_combat(-game.count, "Choose value.")
+ view.draw = [ game.reserve ]
gen_play_reserve()
},
value(v) {
@@ -1896,7 +1897,7 @@ function resume_retreat() {
}
states.retreat_eliminate_hits = {
- inactive: "retreat loser",
+ inactive: "retreat",
prompt() {
prompt("Eliminate generals without troops.")
// remove eliminated generals
@@ -1905,23 +1906,23 @@ states.retreat_eliminate_hits = {
gen_action_piece(p)
},
piece(p) {
- eliminate_general(p)
+ eliminate_general(p, false)
set_delete(game.selected, p)
resume_retreat()
},
}
states.retreat_eliminate_trapped = {
- inactive: "retreat loser",
+ inactive: "retreat",
prompt() {
prompt("Eliminate " + format_selected() + " without a retreat path.")
for (let p of game.selected)
gen_action_piece(p)
},
piece(_) {
- log("Trapped")
+ log("Trapped.")
for (let p of game.selected)
- eliminate_general(p)
+ eliminate_general(p, false)
next_combat()
},
}
@@ -1988,7 +1989,7 @@ function search_retreat(loser, winner, range) {
}
states.retreat = {
- inactive: "retreat loser",
+ inactive: "retreat defeated general",
prompt() {
prompt("Retreat " + format_selected() + " " + Math.abs(game.count) + " cities.")
view.selected = game.selected
@@ -2006,7 +2007,7 @@ states.retreat = {
}
states.retreat_done = {
- inactive: "retreat loser",
+ inactive: "retreat defeated general",
prompt() {
prompt("Retreat done.")
view.actions.next = 1
@@ -2245,7 +2246,8 @@ states.supply_eliminate = {
let s = game.pos[x]
for (let p of all_power_generals[game.power])
if (game.pos[p] === s)
- eliminate_general(p)
+ eliminate_general(p, true)
+
resume_supply_eliminate()
},
}