From 4844a32353f470fadc3052113c09c9b2603f9d5c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 00:35:32 +0100 Subject: zero morale. dice ranges. --- play.js | 2 +- rules.js | 80 ++++++++++++++++++++++++++++---------------------------- tools/gendata.js | 15 +++++++---- 3 files changed, 51 insertions(+), 46 deletions(-) diff --git a/play.js b/play.js index 869d55c..0784020 100644 --- a/play.js +++ b/play.js @@ -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 + '
') else append_div(e, "dice_area", card.dice) diff --git a/rules.js b/rules.js index 3bd8f1e..3f20f9b 100644 --- a/rules.js +++ b/rules.js @@ -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(`
${c.dice}
`) else result.push(`
${c.dice}
`) @@ -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, -- cgit v1.2.3