summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-04-20 15:19:10 +0200
committerTor Andersson <tor@ccxvii.net>2024-04-20 15:19:10 +0200
commite74af64036a70307e67b8061ddc534849dbebde5 (patch)
treecf6956d17081ba0264568a2e484532e0f315286a /rules.ts
parent24cbf5074a29efa7d476e9eb44019d817740f007 (diff)
downloadplantagenet-e74af64036a70307e67b8061ddc534849dbebde5.tar.gz
Fix Scots event behavior.
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts27
1 files changed, 14 insertions, 13 deletions
diff --git a/rules.ts b/rules.ts
index 1a804e5..d1bfa6c 100644
--- a/rules.ts
+++ b/rules.ts
@@ -10178,14 +10178,15 @@ function end_lancaster_event_scots() {
states.scots = {
inactive: "Scots",
prompt() {
- view.prompt = "Scots: You may add 1 Men-at-Arms and 1 Militia to each Lord."
- for (let lord of all_lancaster_lords) {
- if (is_lord_on_map(lord) && map_get(game.event_scots, lord, 0) < 3) {
- gen_action_lord(lord)
+ if (game.who === NOBODY) {
+ view.prompt = "Scots: You may add 1 Men-at-Arms and 1 Militia to each Lord."
+ for (let lord of all_lancaster_lords) {
+ if (is_lord_on_map(lord) && map_get(game.event_scots, lord, 0) < 3) {
+ gen_action_lord(lord)
+ }
}
- }
-
- if (game.who !== NOBODY) {
+ } else {
+ view.prompt = `Scots: You may add 1 Men-at-Arms and 1 Militia to ${lord_name[game.who]}.`
let troops = map_get(game.event_scots, game.who, 0)
if ((troops & 1) === 0)
view.actions.add_militia = 1
@@ -10199,16 +10200,16 @@ states.scots = {
},
add_militia() {
add_lord_forces(game.who, MILITIA, 1)
- let troops = map_get(game.event_scots, game.who, 0)
- map_set(game.event_scots, game.who, troops + 1)
- if (troops !== 0)
+ let troops = map_get(game.event_scots, game.who, 0) | 1
+ map_set(game.event_scots, game.who, troops)
+ if (troops === 3)
game.who = NOBODY
},
add_men_at_arms() {
add_lord_forces(game.who, MEN_AT_ARMS, 1)
- let troops = map_get(game.event_scots, game.who, 0)
- map_set(game.event_scots, game.who, troops + 2)
- if (troops !== 0)
+ let troops = map_get(game.event_scots, game.who, 0) | 2
+ map_set(game.event_scots, game.who, troops)
+ if (troops === 3)
game.who = NOBODY
},
lord(lord) {