summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.css10
-rw-r--r--play.js30
-rw-r--r--rules.js266
3 files changed, 171 insertions, 135 deletions
diff --git a/play.css b/play.css
index 9c1ede2..5c53497 100644
--- a/play.css
+++ b/play.css
@@ -23,7 +23,7 @@ body.Green header.your_turn { background-color: darkseagreen; }
#log .h2 { background-color: gainsboro; padding-top:2px; padding-bottom:2px; text-align: center; }
#log .h3 { text-decoration: underline; }
#log div { padding-left: 20px; text-indent: -12px; }
-#log div.indent { padding-left: 32px; text-indent: -12px; }
+#log div.i { padding-left: 32px; text-indent: -12px; }
#log .white, #log .black {
display: inline-block;
@@ -592,14 +592,6 @@ body.p2 #Galatia_NPG { display: block }
.card.influence_s4x{background-image:url(cards.2x/influence_s4x.jpg)}
}
-.influence_m1 + .influence_m1 { margin-left: -180px; }
-.influence_p1 + .influence_p1 { margin-left: -180px; }
-.influence_s1 + .influence_s1 { margin-left: -180px; }
-
-#played .influence_m1 + .influence_p1 { margin-left: -180px }
-#played .influence_m1 + .influence_s1 { margin-left: -180px }
-#played .influence_p1 + .influence_s1 { margin-left: -180px }
-
/* PANELS */
.panel {
diff --git a/play.js b/play.js
index 9c4eb7c..3fb1ee1 100644
--- a/play.js
+++ b/play.js
@@ -635,8 +635,8 @@ let ui = {
document.getElementById("mapsvg").getElementById("region_alamanni"),
document.getElementById("mapsvg").getElementById("region_franks"),
document.getElementById("mapsvg").getElementById("region_goths"),
- document.getElementById("mapsvg").getElementById("region_nomads"),
document.getElementById("mapsvg").getElementById("region_sassanids"),
+ document.getElementById("mapsvg").getElementById("region_nomads"),
document.getElementById("mapsvg").getElementById("region_mare_occidentale"),
document.getElementById("mapsvg").getElementById("region_mare_orientale"),
@@ -955,6 +955,8 @@ function on_update() {
let legacy = view.legacy[pi]
let turns = view.emperor_turns[pi]
+ if (legacy > 80)
+ legacy -= 80
if (legacy > 40) {
legacy -= 40
ui.legacy[pi].classList.toggle("legacy_40", true)
@@ -1350,27 +1352,31 @@ function on_log(text) {
p.className = 'turn ' + text
}
- if (text.match(/^\.h1/)) {
+ if (text.match(/^\.h1 Red/)) {
text = text.substring(4)
- p.className = "h1"
+ p.className = "h1 p_red"
}
- else if (text.match(/^\.h2 Red/)) {
+ else if (text.match(/^\.h1 Blue/)) {
text = text.substring(4)
- p.className = "h2 p_red"
+ p.className = "h1 p_blue"
}
- else if (text.match(/^\.h2 Blue/)) {
+ else if (text.match(/^\.h1 Yellow/)) {
text = text.substring(4)
- p.className = "h2 p_blue"
+ p.className = "h1 p_yellow"
}
- else if (text.match(/^\.h2 Yellow/)) {
+ else if (text.match(/^\.h1 Green/)) {
text = text.substring(4)
- p.className = "h2 p_yellow"
+ p.className = "h1 p_green"
}
- else if (text.match(/^\.h2 Green/)) {
+ else if (text.match(/^\.h1/)) {
text = text.substring(4)
- p.className = "h2 p_green"
+ p.className = "h1"
+ }
+ else if (text.match(/^\.h4/)) {
+ text = text.substring(4)
+ p.className = "h3"
}
- if (text.match(/^\.h3/)) {
+ else if (text.match(/^\.h3/)) {
text = text.substring(4)
p.className = "h3"
}
diff --git a/rules.js b/rules.js
index 26f4bba..08faab7 100644
--- a/rules.js
+++ b/rules.js
@@ -4,10 +4,14 @@
TODO
----
-[ ] cut holes for capital in region svg
[ ] combat battle screen - splay stack / dialog for watching contents and taking hits
[ ] killed leader stash for buy/trash phase
+[ ] emperor variant (and tokens)
+[ ] expansion cards (and images)
+
+[ ] barbarian_count
+
*/
var game
@@ -46,7 +50,7 @@ const SENATE = 1
const POPULACE = 2
const LEGION_COUNT = 33
-const BARBARIAN_COUNT = 53
+const BARBARIAN_COUNT = [ 33, 43, 53 ]
// REGIONS
@@ -301,7 +305,7 @@ const EVENT_NAME = [
"Raiding Parties",
"Preparing for War",
"Inflation",
- "Good_auguries",
+ "Good Auguries",
"Diocletian",
]
@@ -338,9 +342,9 @@ const CARD_INDEX = [
]
const CARD_INFO = [
- { name: "M1", type: 0, value: 1, event: "None" },
- { name: "S1", type: 1, value: 1, event: "None" },
- { name: "P1", type: 2, value: 1, event: "None" },
+ { name: "M1", type: 0, value: 1, event: "Military 1" },
+ { name: "S1", type: 1, value: 1, event: "Senate 1" },
+ { name: "P1", type: 2, value: 1, event: "Populace 1" },
{ name: "M2", type: 0, value: 2, event: "Castra" },
{ name: "S2", type: 1, value: 2, event: "Tribute" },
{ name: "P2", type: 2, value: 2, event: "Quaestor" },
@@ -502,8 +506,8 @@ function remove_militia(province) { game.militia &= ~(1 << province) }
function has_mob(province) { return game.mobs[province] > 0 }
function count_mobs(province) { return game.mobs[province] }
-function add_one_mob(province) { game.mobs[province] ++ }
-function remove_one_mob(province) { game.mobs[province] -- }
+function add_mobs(province, n) { game.mobs[province] += n }
+function remove_mobs(province, n) { game.mobs[province] -= n }
function remove_all_mobs(province) { game.mobs[province] = 0 }
function has_amphitheater(province) { return game.amphitheater & (1 << province) }
@@ -1046,9 +1050,9 @@ function eliminate_militia(where) {
remove_militia_castra(where)
}
-function flip_discard_to_available(p) {
- game.draw[p] = game.discard[p]
- game.discard[p] = []
+function flip_discard_to_available() {
+ game.draw[game.current] = game.discard[game.current]
+ game.discard[game.current] = []
}
function assign_hit_to_legion(id) {
@@ -1109,7 +1113,7 @@ function has_card_event(event) {
states.setup_province = {
prompt() {
- view.prompt = "Select a starting Province."
+ view.prompt = "Setup: Choose a province to place your governor and general."
view.selected_governor = game.current * 6
view.selected_general = game.current * 6
view.color = SENATE
@@ -1120,6 +1124,8 @@ states.setup_province = {
capital(where) {
push_undo()
+ log(PLAYER_NAMES[game.current] + " started in S" + where + ".")
+
set_governor_location(game.current * 6 + 0, where)
add_militia(where)
@@ -1134,7 +1140,7 @@ states.setup_province = {
states.setup_hand = {
prompt() {
- view.prompt = "Draw your initial hand."
+ view.prompt = "Setup: Draw cards."
let hand = current_hand()
if (hand.length < 5) {
for (let c of current_draw())
@@ -1160,7 +1166,7 @@ states.setup_hand = {
// === UPKEEP ===
function goto_start_turn() {
- log_h2(PLAYER_NAMES[game.current])
+ log_h1(PLAYER_NAMES[game.current])
game.killed = 0
game.battled = 0
@@ -1201,29 +1207,39 @@ function goto_crisis() {
game.dice[2] = 0
game.dice[3] = 0
- log(`Crisis B${game.dice[0]} W${game.dice[1]}`)
-
let sum = game.dice[0] + game.dice[1]
+ let msg = "Crisis B" + game.dice[0] + " W" + game.dice[1]
- if (sum === 2)
+ if (sum === 2) {
+ log(msg + " - Ira Deorum")
return goto_ira_deorum()
- if (sum === 12)
+ }
+
+ if (sum === 12) {
+ log(msg + " - Pax Deorum")
return goto_pax_deorum()
- if (sum === 7)
+ }
+
+ if (sum === 7) {
+ log(msg + " - Event")
return goto_crisis_event()
+ }
+ let tribe = 0
if (game.legacy.length === 2)
- return goto_barbarian_crisis(CRISIS_TABLE_2P[sum - 2])
- if (game.legacy.length === 3)
- return goto_barbarian_crisis(CRISIS_TABLE_3P[sum - 2])
- return goto_barbarian_crisis(CRISIS_TABLE_4P[sum - 2])
+ tribe = CRISIS_TABLE_2P[sum - 2]
+ else if (game.legacy.length === 3)
+ tribe = CRISIS_TABLE_3P[sum - 2]
+ else
+ tribe = CRISIS_TABLE_4P[sum - 2]
+
+ log(msg + " - " + BARBARIAN_NAME[tribe])
+ goto_barbarian_crisis(tribe)
}
// CRISIS: IRA DEORUM
function goto_ira_deorum() {
- logi("Ira Deorum")
-
game.count = 0
let tribe_count = get_tribe_count()
for (let tribe = 0; tribe < tribe_count; ++tribe)
@@ -1237,7 +1253,7 @@ function goto_ira_deorum() {
states.ira_deorum = {
prompt() {
- prompt("Ira Deorum: Activate one Barbarian in each tribe's homeland.")
+ prompt("Ira Deorum: Activate one barbarian in each tribe's homeland.")
let tribe_count = get_tribe_count()
for (let tribe = 0; tribe < tribe_count; ++tribe)
if (game.count & (1 << tribe))
@@ -1258,16 +1274,25 @@ states.ira_deorum = {
// CRISIS: PAX DEORUM
function goto_pax_deorum() {
- logi("Pax Deorum")
-
game.count = game.current
+ game.current = prev_player()
+ resume_pax_deorum()
+}
- for (let p = 0; p < game.legacy.length; ++p)
- if (game.draw[p].length === 0)
- flip_discard_to_available(p)
+function resume_pax_deorum() {
+ if (game.current === game.count) {
+ goto_take_actions()
+ return
+ }
- game.current = prev_player()
game.state = "pax_deorum"
+ game.current = prev_player()
+ if (game.draw[game.current].length === 0)
+ flip_discard_to_available()
+
+ // Skip players if game end has triggered.
+ if (game.end && game.current < game.count)
+ resume_pax_deorum()
}
states.pax_deorum = {
@@ -1279,20 +1304,14 @@ states.pax_deorum = {
card(c, player) {
set_add(game.hand[player], c)
set_delete(game.draw[player], c)
- if (game.current === game.count)
- goto_take_actions()
- else
- game.current = prev_player()
+ resume_pax_deorum()
},
}
// CRISIS: BARBARIAN INVASION
function goto_barbarian_crisis(tribe) {
- logi(BARBARIAN_NAME[tribe])
-
game.crisis = tribe
-
if (find_inactive_barbarian_at_home(tribe) >= 0)
game.state = "barbarian_crisis"
else
@@ -1302,7 +1321,7 @@ function goto_barbarian_crisis(tribe) {
states.barbarian_crisis = {
prompt() {
let tribe = game.crisis
- prompt(BARBARIAN_NAME[tribe] + " Crisis!")
+ prompt(BARBARIAN_NAME[tribe] + ": Activate one barbarian.")
gen_action_barbarian(find_inactive_barbarian_at_home(tribe))
},
barbarian(id) {
@@ -1348,7 +1367,7 @@ function goto_barbarian_invasion(tribe, black, white) {
states.barbarian_invasion = {
prompt() {
let tribe = game.crisis
- prompt(BARBARIAN_NAME[tribe] + " Invasion!")
+ prompt(BARBARIAN_NAME[tribe] + " invade!")
gen_action_barbarian(find_active_barbarian_at_home(tribe))
},
barbarian(id) {
@@ -1392,7 +1411,7 @@ function invade_with_barbarian_counter(id, path, where) {
function goto_crisis_event() {
game.active_event = game.events.pop()
- log_h3(EVENT_NAME[game.active_event])
+ logi(EVENT_NAME[game.active_event])
switch (game.active_event) {
case EVENT_ARDASHIR: return goto_crisis_barbarian_leader(ARDASHIR, SASSANIDS_HOMELAND)
@@ -1441,7 +1460,7 @@ function goto_crisis_barbarian_leader(id, where) {
states.crisis_barbarian_leader = {
prompt() {
- prompt("Crisis: " + EVENT_NAME[game.active_event] + ".")
+ prompt(EVENT_NAME[game.active_event] + "!")
gen_action_region(game.where)
},
region(where) {
@@ -1460,7 +1479,7 @@ function goto_crisis_rival_emperor(id, where) {
states.crisis_rival_emperor = {
prompt() {
- prompt("Crisis: " + EVENT_NAME[game.active_event] + ".")
+ prompt(EVENT_NAME[game.active_event] + "!")
gen_action_region(game.where)
},
region(where) {
@@ -1530,14 +1549,13 @@ function goto_ludi_saeculares() {
game.current = emperor
game.state = "ludi_saeculares"
} else {
- log("There is no Emperor.")
goto_take_actions()
}
}
states.ludi_saeculares = {
prompt() {
- prompt("Ludi Saeculares: Discard one card from your hand.")
+ prompt("Ludi Saeculares: Discard a card to gain legacy equal to twice its value.")
for (let c of current_hand())
gen_action_card(c)
},
@@ -1552,7 +1570,7 @@ states.ludi_saeculares = {
states.ludi_saeculares_done = {
prompt() {
- prompt("Ludi Saeculares: Discard one card from your hand.")
+ prompt("Ludi Saeculares: Done.")
view.actions.done = 1
},
done() {
@@ -1566,11 +1584,15 @@ states.ludi_saeculares_done = {
// === TAKE ACTIONS ===
function goto_take_actions() {
+ log_br()
game.state = "take_actions"
game.ip = [ 0, 0, 0 ]
game.played = []
game.used = []
- game.placed = 0 // only place governor once (and no place if recalled)
+
+ game.placed = 0
+ if (is_emperor_player())
+ set_placed_governor(ITALIA)
}
states.take_actions = {
@@ -1681,7 +1703,7 @@ states.take_actions = {
gen_action_recall(where)
// Increase Support Level
- let support = game.support[where]
+ let support = get_support(where)
if (where !== ITALIA && support < 4) {
if (pip > support)
gen_action_support(where, support + 1)
@@ -1791,6 +1813,7 @@ states.take_actions = {
push_undo()
let hand = current_hand()
if (set_has(hand, c)) {
+ log("Played " + card_event_name(c) + ".")
set_delete(hand, c)
set_add(game.played, c)
add_card_ip(c)
@@ -1851,7 +1874,7 @@ states.take_actions = {
let where = get_governor_location(game.selected_governor)
log("Held Games in S" + where + ".")
spend_ip(POPULACE, 2)
- remove_one_mob(where)
+ remove_mobs(where, 1)
},
amphitheater() {
@@ -1911,9 +1934,9 @@ states.take_actions = {
n += 1
if (game.selected_general >= 0)
n += count_units_in_army(game.selected_general)
- n = Math.min(game.mobs[where], n)
+ n = Math.min(count_mobs(where), n)
log("Disperse " + n + " Mobs in S" + where)
- game.mobs[where] -= n
+ remove_mobs(where, n)
reduce_support(where)
},
@@ -1991,7 +2014,7 @@ function resume_occupy_seat_of_power() {
states.occupy_seat_of_power_1 = {
prompt() {
- prompt("Occupy Pretender Provincial Capital: Remove Seat of Power and pretender.")
+ prompt("Occupy Pretender Provincial Capital: Remove seat of power marker and governor.")
view.color = POPULACE
gen_action_region(game.where)
},
@@ -2006,7 +2029,7 @@ states.occupy_seat_of_power_1 = {
states.occupy_seat_of_power_2 = {
prompt() {
- prompt("Occupy Pretender Provincial Capital: Remove Breakaway markers.")
+ prompt("Occupy Pretender Provincial Capital: Remove breakaway markers.")
view.color = POPULACE
for (let where = 1; where < 12; ++where)
if (is_breakaway(where) && (get_province_governor(where) / 6 | 0) === game.count)
@@ -2022,7 +2045,7 @@ states.occupy_seat_of_power_2 = {
states.occupy_breakaway = {
prompt() {
- prompt("Occupy Pretender Provincial Capital: Remove Breakaway marker.")
+ prompt("Occupy Pretender Provincial Capital: Remove breakaway marker and governor.")
view.color = POPULACE
gen_action_region(game.where)
},
@@ -2044,7 +2067,7 @@ function goto_replace_pretender() {
states.replace_pretender_governor = {
prompt() {
- prompt("Occupy Pretender Provincial Capital: You may place an available Governor.")
+ prompt("Occupy Pretender Provincial Capital: You may place an available governor.")
view.selected_region = game.where
view.color = SENATE
for (let i = 0; i < 6; ++i) {
@@ -2070,10 +2093,10 @@ states.replace_pretender_governor = {
function improve_support() {
let where = get_governor_location(game.selected_governor)
- let support = game.support[where]
+ let support = get_support(where)
log("Built Support in S" + where + ".")
spend_ip(POPULACE, support + 1)
- game.support[where] = support + 1
+ set_support(where, support + 1)
}
// ACTION: RECALL GOVERNOR
@@ -2098,14 +2121,14 @@ function gen_place_governor() {
}
function reduce_support(where) {
- if (game.support[where] === 1)
+ if (get_support(where) === 1)
remove_governor(where)
else
- game.support[where] -= 1
+ set_support(where, get_support(where) - 1)
}
function increase_support(where) {
- game.support[where] += 1
+ set_support(where, get_support(where) + 1)
}
function remove_governor(where) {
@@ -2128,7 +2151,7 @@ function remove_governor(where) {
}
if (where !== ITALIA)
- game.support[where] = 1
+ set_support(where, 1)
update_neutral_italia()
}
@@ -2147,9 +2170,9 @@ function place_governor(where, new_governor) {
set_governor_location(new_governor, where)
if (where === ITALIA)
- game.support[where] = count_own_provinces()
+ set_support(where, count_own_provinces())
else
- game.support[where] = Math.max(1, game.support[where] - 1)
+ set_support(where, Math.max(1, get_support(where) - 1))
if (where !== ITALIA && is_emperor_governor(new_governor))
increase_support(ITALIA)
@@ -2253,6 +2276,7 @@ function roll_to_place_governor(pg) {
if (have >= need) {
logi("Success!")
+
if (game.where === ITALIA) {
// Remember for Damnatio Memoriae
let old_emperor = get_province_player(ITALIA)
@@ -2261,22 +2285,24 @@ function roll_to_place_governor(pg) {
else
game.count = 0
}
+
place_governor(game.where, game.selected_governor)
+
+ if (game.where === ITALIA && (has_card_event(CARD_S4) || has_card_event(CARD_S4B)))
+ game.state = "damnatio_memoriae"
+ else
+ game.state = "take_actions"
} else {
logi("Failed!")
- }
-
- if (has_card_event(CARD_S4) || has_card_event(CARD_S4B))
- game.state = "damnatio_memoriae"
- else
game.state = "take_actions"
+ }
}
// ACTION: DAMNATIO MEMORIAE
states.damnatio_memoriae = {
prompt() {
- prompt("Place Governor: You may play Damnatio Memoriae!")
+ prompt("Place Governor: You may play Damnatio Memoriae.")
gen_card_event(CARD_S4)
gen_card_event(CARD_S4B)
},
@@ -2305,16 +2331,16 @@ function play_damnatio_memoriae_exp() {
states.damnatio_memoriae_mobs = {
prompt() {
- prompt("Damnatio Memoriae: Place " + game.count + " Mobs provinces you govern.")
+ prompt("Damnatio Memoriae: Place " + game.count + " mobs in provinces you govern.")
view.color = SENATE
for (let where = 0; where < 12; ++where)
- if (is_own_province(where) && game.mobs[where] < 6)
+ if (is_own_province(where) && count_mobs(where) < 6)
gen_action_region(where)
},
region(where) {
push_undo()
log("Added Mob to S" + where)
- add_one_mob(where)
+ add_mobs(where, 1)
if (--game.count === 0)
game.state = "take_actions"
},
@@ -2391,7 +2417,7 @@ function gen_move_army() {
states.move_army_at_sea = {
prompt() {
let [ mip, sip, pip ] = game.ip
- prompt("Move Army.")
+ prompt("Move Army: " + mip + " Military.")
view.color = MILITARY
view.selected_general = game.selected_general
gen_move_army()
@@ -2551,7 +2577,7 @@ function play_foederati() {
states.foederati = {
prompt() {
- prompt("Foederati: Remove or recruit a Barbarian.")
+ prompt("Foederati: Remove or recruit a barbarian.")
view.selected_general = game.selected_general
let from = get_general_location(game.selected_general)
gen_foederati(from)
@@ -2585,7 +2611,7 @@ function play_mob() {
states.mob = {
prompt() {
- prompt("Mob: Place a Mob in a province.")
+ prompt("Mob: Place a mob in a province with no mobs.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
if (!has_mob(where) && is_enemy_province(where))
@@ -2629,7 +2655,7 @@ function play_pretender() {
states.pretender_seat_of_power = {
prompt() {
- prompt("Pretender: Place a Seat of Power.")
+ prompt("Pretender: Place your seat of power marker.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
for (let where = 1; where < 12; ++where)
@@ -2658,7 +2684,7 @@ function goto_pretender_breakaway() {
states.pretender_breakaway = {
prompt() {
- prompt("Pretender: Place Breakaway markers.")
+ prompt("Pretender: Place breakaway markers.")
view.color = POPULACE
let seat = find_seat_of_power()
for (let where of PRETENDER_ADJACENT[seat])
@@ -2681,23 +2707,23 @@ function play_flanking_maneuver() {
}
function goto_battle_vs_general(where, attacker, target) {
- log("Initiate Battle vs " + GENERAL_NAME[target] + " in S" + where)
+ log("Initiate Battle against " + GENERAL_NAME[target] + " in S" + where)
goto_battle("general", where, attacker, target)
}
function goto_battle_vs_barbarian(where, attacker, target) {
let tribe = get_barbarian_tribe(target)
- log("Initiate Battle vs " + BARBARIAN_NAME[tribe] + " in S" + where)
+ log("Initiate Battle against " + BARBARIAN_NAME[tribe] + " in S" + where)
goto_battle("barbarians", where, attacker, tribe)
}
function goto_battle_vs_rival_emperor(where, attacker, target) {
- log("Initiate Battle vs Rival Emperor in S" + where)
+ log("Initiate Battle against " + RIVAL_EMPEROR_NAME[target] + " in S" + where)
goto_battle("rival_emperor", where, attacker, target)
}
function goto_battle_vs_militia(where, attacker) {
- log("Initiate Battle vs Militia in S" + where)
+ log("Initiated Battle against militia in S" + where)
goto_battle("militia", where, attacker, -1)
}
@@ -2744,15 +2770,27 @@ function gen_initiate_battle(where) {
}
}
+function format_battle_target() {
+ switch (game.battle.type) {
+ case "militia": return "militia"
+ case "barbarians": return BARBARIAN_NAME[game.battle.target]
+ case "general": return GENERAL_NAME[game.battle.target]
+ case "rival_emperor": return RIVAL_EMPEROR_NAME[game.battle.target]
+ }
+}
+
states.battle = {
prompt() {
- prompt("Battle!")
- if (!game.battle.flanking)
+ prompt("Initiate Battle against " + format_battle_target() + " in " + REGION_NAME[game.where] + ".")
+ if (!game.battle.flanking && has_card_event(CARD_M3)) {
+ view.prompt += " You may play Flanking Maneuver."
gen_card_event(CARD_M3)
+ }
view.actions.roll = 1
},
card(c) {
- log(card_name(c))
+ push_undo()
+ log(card_event_name(c))
set_add(game.used, c)
play_card_event(c)
},
@@ -3197,7 +3235,7 @@ function goto_combat_victory_attacker() {
states.advance_after_combat = {
prompt() {
- prompt("Battle: You may advance into provincial capital.")
+ prompt("Combat: You may advance into provincial capital.")
gen_action_capital(game.where)
view.actions.pass = 1
},
@@ -3229,7 +3267,7 @@ function can_free_increase_support_level(where) {
states.free_increase_support_level = {
prompt() {
- prompt("Combat: Increase Support Level or use Leader to buy cheaper card?")
+ prompt("Combat: Increase support level or save counter to reduce cost of card?")
view.color = POPULACE
gen_action_region(game.where)
view.actions.save = 1
@@ -3282,7 +3320,7 @@ function resume_support_check() {
states.support_check = {
prompt() {
- prompt("Support Check: Reduce support where active Barbarians, Rival Emperors or opponent armies in capital.")
+ prompt("Support Check: Reduce support where active barbarians, rival emperors or opponent armies in capital.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
if ((game.count & (1 << where)) === 0)
@@ -3293,10 +3331,7 @@ states.support_check = {
region(where) {
push_undo()
game.count |= (1 << where)
- if (game.support[where] > 1)
- game.support[where] -= 1
- else
- remove_governor(where)
+ reduce_support(where)
resume_support_check()
},
}
@@ -3311,24 +3346,21 @@ function goto_support_check_emperor() {
states.support_check_emperor = {
prompt() {
- prompt("Support Check: Reduce support in Italia for Rival Emperor and/or Pretender.")
+ prompt("Support Check: Reduce support in Italia for rival emperor and/or pretender on map.")
view.color = POPULACE
gen_action_region(ITALIA)
},
region(where) {
push_undo()
game.count |= (1 << where)
- if (game.support[where] > 1)
- game.support[where] -= 1
- else
- remove_governor(where)
+ reduce_support(where)
goto_support_check_mobs()
},
}
function goto_support_check_mobs() {
for (let where = 0; where < 12; ++where) {
- if (is_own_province(where) && game.mobs[where] >= game.support[where]) {
+ if (is_own_province(where) && count_mobs(where) >= get_support(where)) {
game.state = "support_check_mobs"
return
}
@@ -3338,10 +3370,10 @@ function goto_support_check_mobs() {
states.support_check_mobs = {
prompt() {
- prompt("Support Check: Remove Governors where number of Mobs exceed support.")
+ prompt("Support Check: Remove governors where number of mobs exceed support.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
- if (is_own_province(where) && game.mobs[where] >= game.support[where])
+ if (is_own_province(where) && count_mobs(where) >= get_support(where))
gen_action_region(where)
},
region(where) {
@@ -3365,7 +3397,7 @@ function goto_expand_pretender_empire() {
states.expand_pretender_empire = {
prompt() {
- prompt("Expand Pretender Empire!")
+ prompt("Expand Pretender Empire: Add breakaway markers.")
view.color = POPULACE
for (let where = 1; where < 12; ++where)
if (is_expand_pretender_province(where))
@@ -3402,7 +3434,7 @@ function goto_legitimize_claim() {
states.legitimize_claim = {
prompt() {
- prompt("Gain Legacy: Remove Seat of Power and Breakaway markers in your provinces.")
+ prompt("Gain Legacy: Remove seat of power and breakaway markers in your provinces.")
for (let where = 1; where < 12; ++where)
if (is_own_province(where) && is_seat_of_power(where) || is_breakaway(where))
gen_action_region(where)
@@ -3416,7 +3448,7 @@ states.legitimize_claim = {
}
function goto_gain_legacy_emperor() {
- award_legacy(game.current, "Emperor", Math.max(0, game.support[ITALIA] - count_pretender_provinces()))
+ award_legacy(game.current, "Emperor", Math.max(0, get_support(ITALIA) - count_pretender_provinces()))
if (!is_any_rival_emperor_or_pretender()) {
log(PLAYER_NAMES[game.current] + " gained Emperor Turn")
game.emperor_turns[game.current] += 1
@@ -3442,8 +3474,8 @@ function count_political_points() {
let pp = 0
for (let where = 0; where < 12; ++where) {
if (is_own_province(where)) {
- pp += game.support[where]
- pp -= game.mobs[where]
+ pp += get_support(where)
+ pp -= count_mobs(where)
}
}
return pp
@@ -3467,7 +3499,7 @@ function goto_buy_trash_cards() {
states.buy_trash_discard = {
prompt() {
- prompt("You may discard any number of cards.")
+ prompt("Buy/Trash Cards: You may discard any number of cards.")
for (let c of current_hand())
gen_action_card(c)
view.actions.done = 1
@@ -3525,7 +3557,7 @@ states.buy_trash = {
let military_bonus = has_military_card_bonus()
let senate_bonus = has_senate_card_bonus()
- prompt("Buy/Trash cards: " + game.pp + "PP left.")
+ prompt("Buy/Trash Cards: " + game.pp + " political points.")
if (military_bonus)
view.prompt += " First Military card is 2 cheaper."
if (senate_bonus)
@@ -3612,7 +3644,7 @@ function goto_grow_mobs() {
states.grow_mobs = {
prompt() {
- prompt("Grow Mobs in each province you govern.")
+ prompt("End of Turn: Add a mob in each province you govern with mob and no amphitheater.")
view.color = POPULACE
for (let where = 0; where < 12; ++where)
if ((game.count & (1 << where)) === 0)
@@ -3639,7 +3671,7 @@ function goto_flip_inactive_barbarians() {
states.flip_inactive_barbarians = {
prompt() {
- prompt("Flip all inactive barbarians in your provinces to their active side.")
+ prompt("End of Turn: Flip all inactive barbarians in your provinces to their active side.")
view.color = POPULACE
let tribe_count = get_tribe_count()
for (let where = 0; where < 12; ++where) {
@@ -3663,14 +3695,18 @@ states.flip_inactive_barbarians = {
}
function goto_refill_hand() {
+ if (game.end) {
+ end_refill_hand()
+ return
+ }
if (current_draw().length === 0)
- flip_discard_to_available(game.current)
+ flip_discard_to_available()
game.state = "refill_hand"
}
states.refill_hand = {
prompt() {
- view.prompt = "Refill your hand."
+ prompt("End of Turn: Draw cards.")
let hand = current_hand()
let draw = current_draw()
if (hand.length < 5 && draw.length > 0) {
@@ -3687,7 +3723,7 @@ states.refill_hand = {
set_delete(draw, c)
set_add(hand, c)
if (draw.length === 0)
- flip_discard_to_available(game.current)
+ flip_discard_to_available()
},
done() {
clear_undo()
@@ -3837,6 +3873,7 @@ exports.setup = function (seed, scenario, options) {
killed: 0,
placed: 0,
battled: 0,
+ mbattled: 0,
count: 0,
where: 0,
battle: null,
@@ -3856,9 +3893,10 @@ exports.setup = function (seed, scenario, options) {
governors: new Array(6 * player_count).fill(UNAVAILABLE),
generals: new Array(6 * player_count).fill(UNAVAILABLE),
legions: new Array(LEGION_COUNT).fill(AVAILABLE),
- barbarians: new Array(BARBARIAN_COUNT).fill(AVAILABLE),
+ barbarians: new Array(BARBARIAN_COUNT[player_count - 2]).fill(AVAILABLE),
rival_emperors: [ UNAVAILABLE, UNAVAILABLE, UNAVAILABLE ],
+ crisis: 0,
dice: [ 0, 0, 0, 0 ], // first two are crisis table dice, second two are barbarian homeland dice
market: null,
@@ -3908,7 +3946,7 @@ exports.setup = function (seed, scenario, options) {
update_neutral_italia()
game.first = game.current = random(player_count)
- log("First Player is " + PLAYER_NAMES[game.first] + "!")
+ log("First player " + PLAYER_NAMES[game.first] + ".")
return save_game()
}