diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-13 00:35:32 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | 4844a32353f470fadc3052113c09c9b2603f9d5c (patch) | |
tree | dff95e3936f10101316e6a339f8bdbc1a5c2184f | |
parent | 89890d99c1f8b87ebeae1aff08c5be24a28247cb (diff) | |
download | table-battles-4844a32353f470fadc3052113c09c9b2603f9d5c.tar.gz |
zero morale. dice ranges.
-rw-r--r-- | play.js | 2 | ||||
-rw-r--r-- | rules.js | 80 | ||||
-rw-r--r-- | tools/gendata.js | 15 |
3 files changed, 51 insertions, 46 deletions
@@ -166,7 +166,7 @@ function create_formation_card(id) { } if (card.dice) { - if (card.star) + if (card.morale === 2) append_div(e, "dice_area", card.dice + '<div class="star">★</div>') else append_div(e, "dice_area", card.dice) @@ -16,16 +16,16 @@ Special card rules implemented: suffer_1_less start_with_no_cubes take_from + rout_with + remove_with wild TODO: - rout_with - remove_with attack_reserve - no_morale + attack_choose_target + take_from TODO: extra input steps - attack_choice may_take_from @@ -526,18 +526,18 @@ const place_dice_once = { "(5)": true, "(6)": true, "(1)/(2)": true, - "(1)-(3)": true, - "(1)-(4)": true, - "(1)-(5)": true, + "(1-3)": true, + "(1-4)": true, + "(1-5)": true, "(2)/(3)": true, - "(2)-(4)": true, - "(2)-(5)": true, - "(2)-(6)": true, + "(2-4)": true, + "(2-5)": true, + "(2-6)": true, "(3)/(4)": true, - "(3)-(5)": true, - "(3)-(6)": true, + "(3-5)": true, + "(3-6)": true, "(4)/(5)": true, - "(4)-(6)": true, + "(4-6)": true, "(5)/(6)": true, } @@ -575,18 +575,18 @@ const place_dice_check = { "4-6": (c) => check_range(c, 4, 6), "5/6": (c) => check_range(c, 5, 6), "(1)/(2)": (c) => check_range(c, 1, 2), - "(1)-(3)": (c) => check_range(c, 1, 3), - "(1)-(4)": (c) => check_range(c, 1, 4), - "(1)-(5)": (c) => check_range(c, 1, 5), + "(1-3)": (c) => check_range(c, 1, 3), + "(1-4)": (c) => check_range(c, 1, 4), + "(1-5)": (c) => check_range(c, 1, 5), "(2)/(3)": (c) => check_range(c, 2, 2), - "(2)-(4)": (c) => check_range(c, 2, 4), - "(2)-(5)": (c) => check_range(c, 2, 5), - "(2)-(6)": (c) => check_range(c, 2, 6), + "(2-4)": (c) => check_range(c, 2, 4), + "(2-5)": (c) => check_range(c, 2, 5), + "(2-6)": (c) => check_range(c, 2, 6), "(3)/(4)": (c) => check_range(c, 3, 4), - "(3)-(5)": (c) => check_range(c, 3, 5), - "(3)-(6)": (c) => check_range(c, 3, 6), + "(3-5)": (c) => check_range(c, 3, 5), + "(3-6)": (c) => check_range(c, 3, 6), "(4)/(5)": (c) => check_range(c, 4, 5), - "(4)-(6)": (c) => check_range(c, 4, 6), + "(4-6)": (c) => check_range(c, 4, 6), "(5)/(6)": (c) => check_range(c, 5, 6), } @@ -624,18 +624,18 @@ const place_dice_gen = { "4-6": (c) => gen_range(c, 4, 6), "5/6": (c) => gen_range(c, 5, 6), "(1)/(2)": (c) => gen_range(c, 1, 2), - "(1)-(3)": (c) => gen_range(c, 1, 3), - "(1)-(4)": (c) => gen_range(c, 1, 4), - "(1)-(5)": (c) => gen_range(c, 1, 5), + "(1-3)": (c) => gen_range(c, 1, 3), + "(1-4)": (c) => gen_range(c, 1, 4), + "(1-5)": (c) => gen_range(c, 1, 5), "(2)/(3)": (c) => gen_range(c, 2, 2), - "(2)-(4)": (c) => gen_range(c, 2, 4), - "(2)-(5)": (c) => gen_range(c, 2, 5), - "(2)-(6)": (c) => gen_range(c, 2, 6), + "(2-4)": (c) => gen_range(c, 2, 4), + "(2-5)": (c) => gen_range(c, 2, 5), + "(2-6)": (c) => gen_range(c, 2, 6), "(3)/(4)": (c) => gen_range(c, 3, 4), - "(3)-(5)": (c) => gen_range(c, 3, 5), - "(3)-(6)": (c) => gen_range(c, 3, 6), + "(3-5)": (c) => gen_range(c, 3, 5), + "(3-6)": (c) => gen_range(c, 3, 6), "(4)/(5)": (c) => gen_range(c, 4, 5), - "(4)-(6)": (c) => gen_range(c, 4, 6), + "(4-6)": (c) => gen_range(c, 4, 6), "(5)/(6)": (c) => gen_range(c, 5, 6), } @@ -673,18 +673,18 @@ const place_dice_take = { "4-6": (c, d) => take_single(c, d), "5/6": (c, d) => take_single(c, d), "(1)/(2)": (c, d) => take_single(c, d), - "(1)-(3)": (c, d) => take_single(c, d), - "(1)-(4)": (c, d) => take_single(c, d), - "(1)-(5)": (c, d) => take_single(c, d), + "(1-3)": (c, d) => take_single(c, d), + "(1-4)": (c, d) => take_single(c, d), + "(1-5)": (c, d) => take_single(c, d), "(2)/(3)": (c, d) => take_single(c, d), - "(2)-(4)": (c, d) => take_single(c, d), - "(2)-(5)": (c, d) => take_single(c, d), - "(2)-(6)": (c, d) => take_single(c, d), + "(2-4)": (c, d) => take_single(c, d), + "(2-5)": (c, d) => take_single(c, d), + "(2-6)": (c, d) => take_single(c, d), "(3)/(4)": (c, d) => take_single(c, d), - "(3)-(5)": (c, d) => take_single(c, d), - "(3)-(6)": (c, d) => take_single(c, d), + "(3-5)": (c, d) => take_single(c, d), + "(3-6)": (c, d) => take_single(c, d), "(4)/(5)": (c, d) => take_single(c, d), - "(4)-(6)": (c, d) => take_single(c, d), + "(4-6)": (c, d) => take_single(c, d), "(5)/(6)": (c, d) => take_single(c, d), } diff --git a/tools/gendata.js b/tools/gendata.js index 98e4f20..61d1f2c 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -63,10 +63,15 @@ for (let c of card_records) { } else if (c.strength.endsWith("*")) { card.strength = parseInt(c.strength) - card.star = 1 + card.morale = 2 + } + else if (c.strength.endsWith("-")) { + card.strength = parseInt(c.strength) + card.morale = 0 } else { card.strength = parseInt(c.strength) + card.morale = 1 } card.dice = c.dice @@ -105,7 +110,7 @@ for (let c of card_records) { } if (c.dice) { - if (card.star) + if (card.morale === 2) result.push(`<div class="dice_area">${c.dice}<div class="star">★</div></div>`) else result.push(`<div class="dice_area">${c.dice}</div>`) @@ -229,7 +234,7 @@ function find_friendly_cards(scenario, wing) { w1 = 2, w2 = 3 let list = [] for (let c of cards) - if (c.scenario === scenario && (c.wing === w1 || c.wing === w1)) + if (c.scenario === scenario && (c.wing === w1 || c.wing === w2)) list.push(card_index[c.number]) return list } @@ -352,8 +357,8 @@ for (let s of scenario_records) { name: s.name, date: s.date, players: [ - { name: s.player1, cards: parse_cards(s.cards1), morale: parseInt(s.morale1), tactical: parseInt(s.tactical1) }, - { name: s.player2, cards: parse_cards(s.cards2), morale: parseInt(s.morale2), tactical: parseInt(s.tactical2) }, + { name: s.player1, cards: parse_cards(s.cards1), morale: parseInt(s.morale1), tactical: parseInt(s.tactical1) || undefined }, + { name: s.player2, cards: parse_cards(s.cards2), morale: parseInt(s.morale2), tactical: parseInt(s.tactical2) || undefined }, ], rule: s.rule || undefined, rule_text: s.rule_text || undefined, |