summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js119
1 files changed, 94 insertions, 25 deletions
diff --git a/rules.js b/rules.js
index 034fb49..62a91f5 100644
--- a/rules.js
+++ b/rules.js
@@ -6,6 +6,8 @@ const states = {}
const AUTO_PLAY_EVENTS = true
+const MOTD = "Send PLAYTEST feedback to\ntempus42@yahoo.com,\nwrayferrell@gmail.com,\njasoncarr@gmtgames.com"
+
const DELUXE = 2
const P1 = "Red"
@@ -2402,6 +2404,7 @@ states.take_actions = {
// IMPROVEMENT: PORT
states.use_port = {
+ inactive: "Port",
prompt() {
let from = get_general_location(game.selected_general)
view.prompt = "Use Port to sail to a distant province."
@@ -2642,10 +2645,12 @@ function place_governor(where, new_governor) {
if (old_governor >= 0) {
log("Replaced " + PLAYER_NAME[old_governor/6|0] + ".")
set_governor_location(old_governor, AVAILABLE)
+ trigger_monument(where)
if (where !== ITALIA && is_governor_of_emperor_player(old_governor))
reduce_support(ITALIA)
} else {
log("Replaced Neutral.")
+ trigger_monument(where)
}
set_governor_location(new_governor, where)
@@ -2658,7 +2663,6 @@ function place_governor(where, new_governor) {
else if (old_governor < 0)
adjust_neutral_italia(-1)
}
-
}
function count_units_in_capital(where) {
@@ -2877,6 +2881,8 @@ function auto_replace_neutral_governor(praetorian_guard) {
let need = calc_needed_votes(praetorian_guard)
let dice = calc_used_dice()
+ set_placed_governor(game.where)
+
log_br()
if (praetorian_guard)
log("Praetorian Guard in %" + game.where + ".")
@@ -3895,8 +3901,8 @@ states.force_march = {
}
}
if (is_deluxe())
- if (has_port(from) && !has_used_port(from) && is_own_province(from))
- gen_action_use_port(from)
+ if (has_port(where) && !has_used_port(where) && is_own_province(where))
+ gen_action_use_port(where)
}
// Free Action: Enter/Leave Capital
@@ -4092,16 +4098,16 @@ function can_play_demagogue() {
}
function play_demagogue() {
- if (is_classic())
- game.state = "demagogue_confirm"
- else
- throw "TODO"
+ game.state = "demagogue_confirm"
}
states.demagogue_confirm = {
inactive: "Demagogue",
prompt() {
- prompt("Demagogue: Force all other players to reveal and return a card.")
+ if (is_classic())
+ prompt("Demagogue: Force all other players to reveal and return a card.")
+ else
+ prompt("Demagogue: Force all other players to discard a card.")
view.actions.confirm = 1
},
confirm() {
@@ -4109,11 +4115,32 @@ states.demagogue_confirm = {
log_h3("Demagogue.")
game.demagogue = new Array(get_player_count()).fill(-1)
game.count = game.current
- game.state = "demagogue"
- game.current = next_player()
+ if (is_classic())
+ game.state = "demagogue"
+ else
+ game.state = "demagogue_v2"
+ goto_next_demagogue()
},
}
+function goto_next_demagogue() {
+ game.current = next_player()
+ if (game.current === game.count) {
+ goto_demagogue_reveal()
+ return
+ }
+
+ if (!is_classic()) {
+ let limit = 5
+ /* TODO: exception for Frumentarii?
+ if (game.frumentarii & (1 << game.current))
+ limit = 3
+ */
+ if (current_hand().length < limit)
+ goto_next_demagogue()
+ }
+}
+
states.demagogue = {
inactive: "Demagogue",
demagogue: true,
@@ -4131,6 +4158,33 @@ states.demagogue = {
},
}
+states.demagogue_v2 = {
+ inactive: "Demagogue",
+ demagogue: true,
+ prompt() {
+ prompt("Demagogue: Choose a card to discard (of value 2 or higher if possible).")
+ let only_ones = true
+ for (let c of current_hand()) {
+ if (card_value(c) > 1) {
+ only_ones = false
+ gen_action_card(c)
+ }
+ }
+ if (only_ones) {
+ for (let c of current_hand())
+ if (card_value(c) === 1)
+ gen_action_card(c)
+ }
+ },
+ card(c) {
+ push_undo()
+ set_delete(current_hand(), c)
+ set_add(current_discard(), c)
+ game.demagogue[game.current] = c
+ game.state = "demagogue_done"
+ },
+}
+
states.demagogue_done = {
inactive: "Demagogue",
demagogue: true,
@@ -4140,10 +4194,11 @@ states.demagogue_done = {
},
done() {
clear_undo()
- game.state = "demagogue"
- game.current = next_player()
- if (game.current === game.count)
- goto_demagogue_reveal()
+ if (is_classic())
+ game.state = "demagogue"
+ else
+ game.state = "demagogue_v2"
+ goto_next_demagogue()
},
}
@@ -4152,15 +4207,22 @@ function goto_demagogue_reveal() {
for (let p = 0; p < get_player_count(); ++p) {
if (p !== game.current) {
let c = game.demagogue[p]
- log(PLAYER_NAME[p] + " revealed " + card_name(c) + ".")
- // TODO: skip players who reveal a 1 but govern no provinces
- if (card_value(c) === 1)
- mobs = true
- else
- game.demagogue[p] = -1
+ if (c < 0) {
+ log(PLAYER_NAME[p] + " unaffected.")
+ } else {
+ if (is_classic())
+ log(PLAYER_NAME[p] + " revealed " + card_name(c) + ".")
+ else
+ log(PLAYER_NAME[p] + " discarded " + card_name(c) + ".")
+ // TODO: skip players who reveal a 1 but govern no provinces
+ if (card_value(c) === 1)
+ mobs = true
+ else
+ game.demagogue[p] = -1
+ }
}
}
- if (mobs)
+ if (is_classic() && mobs)
game.state = "demagogue_mobs"
else
end_demagogue()
@@ -4508,7 +4570,7 @@ function roll_spiculum_dice() {
game.combat.castra_used = 1
n -= 1
}
- if (game.combat.type === "barbarians" && get_barbarian_location(SHAPUR) === game.where) {
+ if (game.combat.type === "barbarians" && game.combat.target === SASSANIDS && get_barbarian_location(SHAPUR) === game.where) {
log("Shapur I reduced 1 hit.")
game.combat.castra_used = 1
n -= 1
@@ -4532,7 +4594,7 @@ function roll_attacker_dice() {
log("Castra reduced 1 hit.")
n -= 1
}
- if (game.combat.type === "barbarians" && get_barbarian_location(SHAPUR) === game.where) {
+ if (game.combat.type === "barbarians" && game.combat.target === SASSANIDS && get_barbarian_location(SHAPUR) === game.where) {
log("Shapur I reduced 1 hit.")
n -= 1
}
@@ -5764,6 +5826,8 @@ function goto_game_over(result, victory) {
game.victory = victory
log_br()
log(game.victory)
+ log_br()
+ log(MOTD)
return true
}
@@ -5881,7 +5945,9 @@ exports.setup = function (seed, scenario, options) {
log_h1("Time of Crisis")
if (options.deluxe) {
- log("Deluxe Edition PLAYTEST")
+ log("Deluxe Edition")
+ log_br()
+ log(MOTD)
log_br()
game.v = DELUXE
}
@@ -5983,7 +6049,10 @@ exports.setup = function (seed, scenario, options) {
reset_neutral_italia()
- game.first = random(player_count)
+ if (options.tournament)
+ game.first = 0
+ else
+ game.first = random(player_count)
if (is_classic())
game.current = first_player()