From 2825e677aa9351e4a5d34b84699f79a29c143dfc Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 15 Oct 2024 16:43:12 +0200 Subject: misc assets and image names --- fonts/FriedrichSymbols-Regular.woff2 | Bin 0 -> 1184 bytes fonts/SuitSymbols.woff2 | Bin 0 -> 2464 bytes images/suit_clubs.svg | 1 + images/suit_diamonds.svg | 1 + images/suit_hearts.svg | 1 + images/suit_spades.svg | 1 + play.css | 16 +++--- play.js | 1 + rules.js | 107 +++++++++++++++++++++++++++-------- 9 files changed, 96 insertions(+), 32 deletions(-) create mode 100644 fonts/FriedrichSymbols-Regular.woff2 create mode 100644 fonts/SuitSymbols.woff2 create mode 100644 images/suit_clubs.svg create mode 100644 images/suit_diamonds.svg create mode 100644 images/suit_hearts.svg create mode 100644 images/suit_spades.svg diff --git a/fonts/FriedrichSymbols-Regular.woff2 b/fonts/FriedrichSymbols-Regular.woff2 new file mode 100644 index 0000000..467080f Binary files /dev/null and b/fonts/FriedrichSymbols-Regular.woff2 differ diff --git a/fonts/SuitSymbols.woff2 b/fonts/SuitSymbols.woff2 new file mode 100644 index 0000000..3ed53aa Binary files /dev/null and b/fonts/SuitSymbols.woff2 differ diff --git a/images/suit_clubs.svg b/images/suit_clubs.svg new file mode 100644 index 0000000..c92fd67 --- /dev/null +++ b/images/suit_clubs.svg @@ -0,0 +1 @@ + diff --git a/images/suit_diamonds.svg b/images/suit_diamonds.svg new file mode 100644 index 0000000..a2316fc --- /dev/null +++ b/images/suit_diamonds.svg @@ -0,0 +1 @@ + diff --git a/images/suit_hearts.svg b/images/suit_hearts.svg new file mode 100644 index 0000000..997e093 --- /dev/null +++ b/images/suit_hearts.svg @@ -0,0 +1 @@ + diff --git a/images/suit_spades.svg b/images/suit_spades.svg new file mode 100644 index 0000000..c1c5eb9 --- /dev/null +++ b/images/suit_spades.svg @@ -0,0 +1 @@ + diff --git a/play.css b/play.css index df25cd3..ab9a8f1 100644 --- a/play.css +++ b/play.css @@ -306,14 +306,14 @@ span.suit.reserve { color: var(--color-reserve); font-weight: bold; font-family: ; } -.piece.cube.austria { background-image: url(images/cube_austria.svg) } -.piece.cube.bavaria { background-image: url(images/cube_bavaria.svg) } -.piece.cube.france { background-image: url(images/cube_france.svg) } -.piece.cube.pragmatic { background-image: url(images/cube_pragmatic.svg) } -.piece.cube.prussia { background-image: url(images/cube_prussia.svg) } -.piece.cube.saxony { background-image: url(images/cube_saxony.svg) } - -.piece.disc.austria { background-image: url(images/disc_hussar.svg) } +.piece.cube.austria { background-image: url(pieces/cube_austria.svg) } +.piece.cube.bavaria { background-image: url(pieces/cube_bavaria.svg) } +.piece.cube.france { background-image: url(pieces/cube_france.svg) } +.piece.cube.pragmatic { background-image: url(pieces/cube_pragmatic.svg) } +.piece.cube.prussia { background-image: url(pieces/cube_prussia.svg) } +.piece.cube.saxony { background-image: url(pieces/cube_saxony.svg) } + +.piece.disc.austria { background-image: url(pieces/disc_hussar.svg) } .piece.cylinder.austria_1 { background-image: url(pieces/cylinder_austria_1.svg) } .piece.cylinder.austria_2 { background-image: url(pieces/cylinder_austria_2.svg) } diff --git a/play.js b/play.js index 53bf33a..ce98e12 100644 --- a/play.js +++ b/play.js @@ -168,6 +168,7 @@ function make_road(a, b, type) { e.setAttribute("y1", y1) e.setAttribute("x2", x2) e.setAttribute("y2", y2) + e.setAttribute("visibility", "hidden") document.getElementById("roads").appendChild(e) if (!ui.roads[a]) ui.roads[a] = {} diff --git a/rules.js b/rules.js index 2bb4dfb..6dec54a 100644 --- a/rules.js +++ b/rules.js @@ -176,6 +176,69 @@ const all_austria_trains = [ ...all_power_trains[P_AUSTRIA], ] +const all_france_allied_trains = [ + ...all_power_trains[P_FRANCE], + ...all_power_trains[P_BAVARIA], + ...all_power_trains[P_PRUSSIA], + ...all_power_trains[P_SAXONY], +] + +const all_austria_allied_trains = [ + ...all_power_trains[P_AUSTRIA], + ...all_power_trains[P_PRAGMATIC], +] + +const all_austria_allied_generals = [ + ...all_power_generals[P_AUSTRIA], + ...all_power_generals[P_PRAGMATIC], +] + +const all_france_allied_generals = [ + ...all_power_generals[P_FRANCE], + ...all_power_generals[P_BAVARIA], + ...all_power_generals[P_PRUSSIA], + ...all_power_generals[P_SAXONY], +] + +function all_allied_trains(pow) { + switch (pow) { + case P_FRANCE: + case P_BAVARIA: + case P_PRUSSIA: + case P_SAXONY: + return all_france_allied_trains + case P_AUSTRIA: + case P_PRAGMATIC: + return all_austria_allied_trains + } +} + +function all_enemy_trains(pow) { + switch (pow) { + case P_FRANCE: + case P_BAVARIA: + case P_PRUSSIA: + case P_SAXONY: + return all_austria_allied_trains + case P_AUSTRIA: + case P_PRAGMATIC: + return all_france_allied_trains + } +} + +function all_enemy_generals(pow) { + switch (pow) { + case P_FRANCE: + case P_BAVARIA: + case P_PRUSSIA: + case P_SAXONY: + return all_austria_allied_generals + case P_AUSTRIA: + case P_PRAGMATIC: + return all_france_allied_generals + } +} + function is_general(p) { return p < 20 } @@ -334,7 +397,7 @@ function get_top_piece(s) { } function get_supreme_commander(s) { - // TODO: promoted minor power + // TODO: promoted minor power (check who is actually on top!) for (let p of all_generals) if (game.pos[p] === s) return p @@ -405,31 +468,31 @@ function has_any_piece(to) { } function has_friendly_supply_train(to) { - for (let p of all_friendly_trains[game.power]) + for (let p of all_allied_trains(game.power)) if (game.pos[p] === to) return true return false } function has_enemy_supply_train(to) { - for (let p of all_enemy_trains[game.power]) + for (let p of all_enemy_trains(game.power)) if (game.pos[p] === to) return true return false } function has_enemy_general(to) { - for (let p of all_enemy_generals[game.power]) + for (let p of all_enemy_generals(game.power)) if (game.pos[p] === to) return true return false } function has_enemy_piece(to) { - for (let p of all_enemy_generals[game.power]) + for (let p of all_enemy_generals(game.power)) if (game.pos[p] === to) return true - for (let p of all_enemy_trains[game.power]) + for (let p of all_enemy_trains(game.power)) if (game.pos[p] === to) return true return false @@ -813,7 +876,7 @@ states.movement = { for (let p of all_power_generals[game.power]) { if (!set_has(game.moved, p) && game.pos[p] < ELIMINATED) { if (can_general_move_anywhere(p)) { - gen_action_supreme_commander(game.pos[p]) + gen_action_piece(p) done_generals = false } } @@ -847,14 +910,8 @@ states.movement = { let here = game.pos[p] - if (is_general(p)) { - game.selected = [] - for (let other of all_power_generals[game.power]) - if (other >= p && game.pos[other] === here && !set_has(game.moved, other)) - game.selected.push(other) - } else { - game.selected = [ p ] - } + // Note: Can only move one piece at a time in Maria! + game.selected = [ p ] game.count = 0 @@ -884,7 +941,8 @@ states.movement = { delete game.move_conq delete game.move_reconq - goto_recruit() + // MARIA: recruit during winter goto_recruit() + goto_combat() }, } @@ -965,7 +1023,7 @@ function move_general_to(to) { } // eliminate supply train - for (let p of all_enemy_trains[pow]) { + for (let p of all_enemy_trains(pow)) { if (game.pos[p] === to) { if (!game.move_elim) game.move_elim = [] @@ -1293,7 +1351,7 @@ function has_re_entry_space(p) { } function is_attack_position(s) { - for (let p of all_enemy_generals[game.power]) + for (let p of all_enemy_generals(game.power)) if (set_has(data.cities.adjacent[s], game.pos[p])) return true return false @@ -1363,7 +1421,7 @@ states.recruit = { for (let p of all_power_generals[game.power]) { if (game.troops[p] > 0 && game.troops[p] < 8) { let s = game.pos[p] - gen_action_supreme_commander(s) + gen_action_piece(s) } else if (game.pos[p] === ELIMINATED && has_re_entry_space(p)) gen_action_piece(p) @@ -1426,7 +1484,8 @@ function end_recruit() { delete game.recruit } - goto_combat() + // MARIA: NOT goto_combat() + // goto_combat() } states.re_enter = { @@ -1470,7 +1529,7 @@ function goto_combat() { if (game.pos[p] < ELIMINATED) set_add(from, game.pos[p]) - for (let p of all_enemy_generals[game.power]) + for (let p of all_enemy_generals(game.power)) if (game.pos[p] < ELIMINATED) set_add(to, game.pos[p]) @@ -2215,7 +2274,7 @@ states.supply_restore = { if (game.pos[p] >= ELIMINATED) continue if (is_out_of_supply(p) && has_supply_line(p)) - gen_action_supreme_commander(game.pos[p]) + gen_action_piece(game.pos[p]) } }, piece(x) { @@ -2239,7 +2298,7 @@ states.supply_eliminate = { if (game.pos[p] >= ELIMINATED) continue if (is_out_of_supply(p) && !has_supply_line(p)) - gen_action_supreme_commander(game.pos[p]) + gen_action_piece(game.pos[p]) } }, piece(x) { @@ -2260,7 +2319,7 @@ states.supply_flip = { if (game.pos[p] >= ELIMINATED) continue if (!is_out_of_supply(p) && !has_supply_line(p)) - gen_action_supreme_commander(game.pos[p]) + gen_action_piece(game.pos[p]) } }, piece(x) { -- cgit v1.2.3