diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-15 16:43:12 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-15 16:43:12 +0200 |
commit | 2825e677aa9351e4a5d34b84699f79a29c143dfc (patch) | |
tree | 50361f7dfa4fe3ecc7bf0671b814ef3d99e6e0db | |
parent | 2d0cccee7c78c5b7ba8f96c88d44020932b35be9 (diff) | |
download | maria-2825e677aa9351e4a5d34b84699f79a29c143dfc.tar.gz |
misc assets and image names
-rw-r--r-- | fonts/FriedrichSymbols-Regular.woff2 | bin | 0 -> 1184 bytes | |||
-rw-r--r-- | fonts/SuitSymbols.woff2 | bin | 0 -> 2464 bytes | |||
-rw-r--r-- | images/suit_clubs.svg | 1 | ||||
-rw-r--r-- | images/suit_diamonds.svg | 1 | ||||
-rw-r--r-- | images/suit_hearts.svg | 1 | ||||
-rw-r--r-- | images/suit_spades.svg | 1 | ||||
-rw-r--r-- | play.css | 16 | ||||
-rw-r--r-- | play.js | 1 | ||||
-rw-r--r-- | rules.js | 107 |
9 files changed, 96 insertions, 32 deletions
diff --git a/fonts/FriedrichSymbols-Regular.woff2 b/fonts/FriedrichSymbols-Regular.woff2 Binary files differnew file mode 100644 index 0000000..467080f --- /dev/null +++ b/fonts/FriedrichSymbols-Regular.woff2 diff --git a/fonts/SuitSymbols.woff2 b/fonts/SuitSymbols.woff2 Binary files differnew file mode 100644 index 0000000..3ed53aa --- /dev/null +++ b/fonts/SuitSymbols.woff2 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 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="275" height="283"><path fill="#007c49" d="M135.965.566C123.473.34 104.77 9.384 93.783 24.56c-9.86 14.006-12.652 35.983-.623 52.89 10.337 13.21 22.949 25.004 30.592 34.563 4.544 6.18 6.157 23.873 6.156 30.334.164 4.402.26 7.67.334 10.515-7.058-.903-14.84-2.554-18.531-5.267-9.56-7.643-21.353-20.255-34.563-30.592-16.907-12.029-38.886-9.238-52.892.621C8.754 128.846-.346 148.12.296 160.6.06 173.09 9.11 191.807 24.292 202.799c14.006 9.859 35.985 12.652 52.893.623 13.209-10.337 25.001-22.949 34.56-30.592 3.78-2.779 11.86-4.45 19.049-5.338.073.643.156 1.315.271 2.065.204 5.006.47 12.682.202 20.279-.295 1.818-.495 4.024-.62 6.506-.14 1.282-.292 2.754-.408 3.847-7.02 30.631-1.733 8.797-12.379 49.084l-11.664 33.108s.076-.08.23-.223c1.085-1.003 6.105-5.17 17.005-7.666 6.36-.78 7.07-.97 13.625-1.19h.006c5.233.202 6.33.418 12.197 1.137 12.457 2.855 17.234 7.891 17.234 7.891L155.86 250.46c-11.677-40.905-8.245-29.596-11.552-50.322-1.078-6.381-1.467-13.991-1.809-23.899.034-3.12.048-5.961.076-8.236 7.59.82 16.705 2.523 20.801 5.535 9.559 7.642 21.352 20.256 34.563 30.594 16.907 12.028 38.884 9.235 52.89-.625 15.175-10.987 24.22-29.69 23.992-42.182.653-12.48-8.448-31.765-23.957-42.994-14.006-9.859-35.985-12.652-52.892-.623-13.21 10.337-25.004 22.95-34.563 30.594-4.002 2.943-12.807 4.642-20.289 5.484l-.031-.002c.076-2.996.174-6.494.355-11.365 0-6.461 1.613-24.156 6.157-30.336 7.642-9.559 20.253-21.35 30.591-34.56 12.03-16.908 9.236-38.887-.623-52.893C168.513 9.36 149.652.303 137.16.646l-.008-.029q-.584-.04-1.187-.05"/></svg> 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 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="255" height="285"><path fill="#c2263e" d="M126.791.273c-4.472 13.194-10.568 25.79-17.456 37.88-21.24 37.063-51.31 68.964-86.88 92.594A288 288 0 0 1 .943 143.748c-.873-.076 3.318 1.016 1.034.619 36.252 19.004 67.41 47.02 91.705 79.841 12.655 17.148 23.722 35.535 32.325 55.052a155 155 0 0 1 2.151 5.19c5.142-14.986 12.359-29.195 20.534-42.737 23.838-39.218 57.73-72.152 97.31-95.326 2.494-1.527 5.844-3.274 8.012-4.584-27.504-14.27-52.176-33.77-73.011-56.662a302.7 302.7 0 0 1-45.57-65.853c-3.149-6.21-6.108-12.526-8.642-19.015"/></svg> 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 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="223" height="213"><path fill="#ed1c24" d="M167.092.654C151.76.441 132.18 5.868 111.375 29.486 82.504-3.119 56.015-.757 40 2.998 19.143 11.044 3.505 21.509.625 50.373c-.907 15.768 6.032 39.828 23.625 60.375.692 1.661 21.627 23.98 45.75 47.25 18.742 20.363 18.82 22.881 24.5 29.25 2.283 2.84 5.437 7.5 17 25.25.027-.133.05-.267.078-.4 11.467-17.601 14.626-22.27 16.902-25.1 5.68-6.369 5.758-8.887 24.5-29.25 24.123-23.27 45.057-45.589 45.749-47.25 17.594-20.547 24.532-44.607 23.625-60.375-2.88-28.864-18.518-39.329-39.374-47.375-4.521-1.06-9.879-2.01-15.888-2.094"/></svg> 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 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="232" height="259"><path fill="#274085" d="M116.076-.002c-.042.504-.102 1.48-.078.445-.126-.125-.59 1.36-.874 1.846-4.358 9.511-11.031 17.692-17.83 25.551-5.448 6.213-11.114 12.296-17.573 17.475-2.273 1.717-4.25 3.787-6.397 5.656C62.236 61.025 51.09 71.015 39.813 80.856 31.4 88.14 22.876 95.482 16.226 104.478a72 72 0 0 0-7.415 12.044C3.513 127.313.285 139.295.537 151.372c.188 7.174 1.721 14.534 5.75 20.583 4.06 6.608 9.364 12.714 16.329 16.343 2.306 1.206 4.739 2.21 7.275 2.77 10.516 2.988 22.067 2.634 32.174-1.67 10.421-4.345 18.839-12.487 25.094-21.742 3.494-4.862 7.576-9.442 12.638-12.71 2.358-1.44 5.198-2.783 8.016-2.052 1.922.473 3.062 2.373 3.542 4.172-.356 6.317-1.284 12.586-1.824 18.886-.949 4.669-2.092 9.3-3.04 13.971-.915 4.495-1.725 9.014-2.913 13.448-1.897 7.422-3.824 14.839-5.834 22.23l-11.549 32.78c3.154-2.882 7.125-4.69 11.104-6.131 2.768-.933 5.584-1.822 8.511-2.054 3.963-.528 7.96-.897 11.96-.865 3.948.126 7.874.621 11.778 1.176 5.674 1.365 11.342 3.39 16.003 6.992.53.423 1.203 1.229.722.174l-10.414-31.214c-2.798-9.968-5.776-19.89-8.285-29.937-1.515-5.936-1.909-12.07-2.91-18.098-.978-5.572-1.512-11.21-1.784-16.857-.211-2.242.605-4.446 1.585-6.424.899-1.705 2.83-2.868 4.781-2.489 3.029.522 5.51 2.551 7.785 4.489 4.507 3.938 7.965 8.888 12.332 12.968 9.398 9.19 21.143 16.293 34.109 18.953a57 57 0 0 0 19.42.686c1.56-.18 3.044-.978 4.51-1.564 6.948-3.104 12.49-8.677 16.66-14.945 2.065-3.048 3.989-6.24 5.09-9.777 2.774-8.539 2.6-17.769 1.034-26.524-1.816-9.878-5.553-19.377-10.766-27.952-.587-.566-1.064-1.511-1.628-2.205-6.018-8.454-13.612-15.612-21.381-22.427-13.42-11.671-26.681-23.522-39.835-35.49-1.57-1.442-3.117-2.906-4.838-4.168-6.882-5.661-12.914-12.268-18.707-19.017-6.64-7.834-13.036-16.107-16.955-25.683"/></svg> @@ -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) } @@ -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] = {} @@ -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) { |