summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.js18
-rw-r--r--rules.js60
-rw-r--r--tools/gendata.js4
3 files changed, 76 insertions, 6 deletions
diff --git a/data.js b/data.js
index 5b9edc8..70627b6 100644
--- a/data.js
+++ b/data.js
@@ -16426,7 +16426,8 @@ cards: [
"effect": "1 hit per die. 1 self per action.",
"target_list": [
537,
- 538
+ 538,
+ 536
]
},
{
@@ -16435,7 +16436,8 @@ cards: [
"target": "Weissenfels",
"effect": "1 hit.",
"target_list": [
- 537
+ 537,
+ 536
]
}
],
@@ -16462,7 +16464,8 @@ cards: [
"effect": "1 hit per die. 1 self per action.",
"target_list": [
538,
- 539
+ 539,
+ 536
]
},
{
@@ -16472,7 +16475,8 @@ cards: [
"effect": "1 hit.",
"target_list": [
538,
- 539
+ 539,
+ 536
]
}
],
@@ -16500,7 +16504,8 @@ cards: [
"effect": "1 hit per die. 1 self per action.",
"target_list": [
539,
- 538
+ 538,
+ 536
]
},
{
@@ -16510,7 +16515,8 @@ cards: [
"effect": "1 hit.",
"target_list": [
539,
- 538
+ 538,
+ 536
]
}
],
diff --git a/rules.js b/rules.js
index 7a842cd..910c46f 100644
--- a/rules.js
+++ b/rules.js
@@ -316,6 +316,14 @@ const S43_VILLARS_LEFT = find_card(43, "Villars's Left")
const S43_BROGLIE = find_card(43, "Broglie")
const S43_PRINCE_DE_TINGRY = find_card(43, "Prince de Tingry")
+const S44_HOTHENFRIEDBERG = find_scenario(44)
+const S44_CHARLES = find_card(44, "Charles")
+const S44_FREDERICK_II = find_card(44, "Frederick II")
+const S44_BAYREUTH_DRAGOONS = find_card(44, "Bayreuth Dragoons")
+const S44_LEOPOLDS_L = find_card(44, "Leopold's Left")
+const S44_LEOPOLDS_C = find_card(44, "Leopold's Center")
+const S44_LEOPOLDS_R = find_card(44, "Leopold's Right")
+
// === SETUP ===
exports.setup = function (seed, scenario, options) {
@@ -1774,6 +1782,17 @@ function goto_start_turn() {
}
}
+ if (game.scenario === S44_HOTHENFRIEDBERG) {
+ if (player_index() === 1) {
+ let have_inf_or_cav = false
+ for (let c of game.front[1])
+ if (is_infantry(c) || is_cavalry(c))
+ have_inf_or_cav = true
+ if (!have_inf_or_cav)
+ return goto_game_over(P1, "Frederick has no Infantry or Cavalry in play!")
+ }
+ }
+
goto_action_phase()
}
@@ -2047,6 +2066,19 @@ function find_first_target_of_command(c, a) {
return S37_THE_FOG
}
+ if (game.scenario === S44_HOTHENFRIEDBERG) {
+ if (c === S44_CHARLES) {
+ if (game.reserve[1].length > 0)
+ return game.reserve[1]
+ return -1
+ }
+ if (c === S44_FREDERICK_II) {
+ for (let t of card_has_rule(c, "command_sequence"))
+ if (is_card_in_reserve(t))
+ return t
+ }
+ }
+
if (!a.target_list)
throw new Error("no rule for Command target: " + a.target)
@@ -2059,6 +2091,18 @@ function find_first_target_of_command(c, a) {
}
function find_all_targets_of_command(c, a) {
+
+ if (game.scenario === S44_HOTHENFRIEDBERG) {
+ if (c === S44_CHARLES) {
+ return game.reserve[1].slice()
+ }
+ if (c === S44_FREDERICK_II) {
+ for (let t of card_has_rule(S44_FREDERICK_II, "command_sequence"))
+ if (is_card_in_reserve(t))
+ return [ t ]
+ }
+ }
+
let list = []
for (let t of a.target_list) {
if (is_card_in_reserve(t))
@@ -2223,6 +2267,13 @@ function update_attack1() {
game.hits *= 2
}
+ if (game.scenario === S44_HOTHENFRIEDBERG) {
+ if (game.target === S44_CHARLES) {
+ if (game.selected === S44_LEOPOLDS_L || game.selected === S44_LEOPOLDS_C || game.selected === S44_LEOPOLDS_R)
+ game.self = 0
+ }
+ }
+
// Oblique Attack (CAL expansion rule)
if (is_infantry(game.selected)) {
if (get_sticks(game.selected) >= get_sticks(game.target) + 3)
@@ -2413,6 +2464,15 @@ states.command = {
}
}
+ if (game.scenario === S44_HOTHENFRIEDBERG) {
+ // one at a time
+ if (game.selected === S44_CHARLES || game.selected === S44_FREDERICK_II) {
+ pay_for_action(game.selected)
+ end_action_phase()
+ return
+ }
+ }
+
if (find_first_target_of_command(game.selected, current_action()) < 0) {
pay_for_action(game.selected)
end_action_phase()
diff --git a/tools/gendata.js b/tools/gendata.js
index 1df67b1..bd1e799 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -308,6 +308,10 @@ function process_card(c, ix) {
a.target_list = null
else
a.target_list = tname.split(/, | OR | or | and /).map(name => find_card(c.scenario, name))
+
+ // Hothenfriedberg invisible charles last target in list!
+ if (c.number === "267A" || c.number === "268A" || c.number === "269A")
+ a.target_list.push(find_card(c.scenario, "Charles"))
}
if (a.type === "Absorb")
a.target_list = a.target_list.filter(x => x !== ix) // never absorb for self