summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js107
1 files changed, 47 insertions, 60 deletions
diff --git a/rules.js b/rules.js
index 2c866d6..6259195 100644
--- a/rules.js
+++ b/rules.js
@@ -24,8 +24,6 @@ const P4 = "Green"
exports.scenarios = [ "Standard" ]
exports.roles = function (scenario, options) {
- if (options.players == 1)
- return [ "Solo" ]
if (options.players == 2)
return [ P1, P2 ]
if (options.players == 3)
@@ -42,7 +40,6 @@ const PLAYER_INDEX = {
[P2]: 1,
[P3]: 2,
[P4]: 3,
- "Solo": 4,
"Observer": -1,
}
@@ -61,17 +58,18 @@ const GALLIA = 2
const MACEDONIA = 3
const PANNONIA = 4
const THRACIA = 5
-const AEGYPTUS = 6
-const AFRICA = 7
-const HISPANIA = 8
-const BRITANNIA = 9
-const GALATIA = 10
-const SYRIA = 11
+const BRITANNIA = 6
+const GALATIA = 7
+const SYRIA = 8
+const AEGYPTUS = 9
+const AFRICA = 10
+const HISPANIA = 11
+
const ALAMANNI_HOMELAND = 12
const FRANKS_HOMELAND = 13
const GOTHS_HOMELAND = 14
-const NOMADS_HOMELAND = 15
-const SASSANIDS_HOMELAND = 16
+const SASSANIDS_HOMELAND = 15
+const NOMADS_HOMELAND = 16
const MARE_OCCIDENTALE = 17
const MARE_ORIENTALE = 18
const OCEANUS_ATLANTICUS = 19
@@ -87,17 +85,17 @@ const REGION_NAME = [
"Macedonia",
"Pannonia",
"Thracia",
- "Aegyptus",
- "Africa",
- "Hispania",
"Britannia",
"Galatia",
"Syria",
+ "Aegyptus",
+ "Africa",
+ "Hispania",
"Alamanni Homeland",
"Franks Homeland",
"Goths Homeland",
- "Nomads Homeland",
"Sassanids Homeland",
+ "Nomads Homeland",
"Mare Occidentale",
"Mare Orientale",
"Oceanus Atlanticus",
@@ -113,17 +111,17 @@ const ADJACENT = [
/* MACEDONIA */ [ PANNONIA, THRACIA, MARE_OCCIDENTALE, MARE_ORIENTALE ],
/* PANNONIA */ [ ITALIA, GALLIA, MACEDONIA, THRACIA, ALAMANNI_HOMELAND, FRANKS_HOMELAND, MARE_OCCIDENTALE ],
/* THRACIA */ [ ASIA, MACEDONIA, PANNONIA, ALAMANNI_HOMELAND, GOTHS_HOMELAND, MARE_ORIENTALE, PONTUS_EUXINUS ],
- /* AEGYPTUS */ [ AFRICA, SYRIA, NOMADS_HOMELAND, MARE_ORIENTALE ],
- /* AFRICA */ [ AEGYPTUS, HISPANIA, NOMADS_HOMELAND, MARE_OCCIDENTALE, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
- /* HISPANIA */ [ GALLIA, AFRICA, MARE_OCCIDENTALE, OCEANUS_ATLANTICUS ],
/* BRITANNIA */ [ OCEANUS_ATLANTICUS ],
/* GALATIA */ [ ASIA, SYRIA, SASSANIDS_HOMELAND, MARE_ORIENTALE, PONTUS_EUXINUS ],
/* SYRIA */ [ AEGYPTUS, GALATIA, SASSANIDS_HOMELAND, MARE_ORIENTALE ],
+ /* AEGYPTUS */ [ AFRICA, SYRIA, NOMADS_HOMELAND, MARE_ORIENTALE ],
+ /* AFRICA */ [ AEGYPTUS, HISPANIA, NOMADS_HOMELAND, MARE_OCCIDENTALE, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
+ /* HISPANIA */ [ GALLIA, AFRICA, MARE_OCCIDENTALE, OCEANUS_ATLANTICUS ],
/* ALAMANNI_HOMELAND */ [ PANNONIA, THRACIA, FRANKS_HOMELAND, GOTHS_HOMELAND ],
/* FRANKS_HOMELAND */ [ GALLIA, PANNONIA, ALAMANNI_HOMELAND ],
/* GOTHS_HOMELAND */ [ THRACIA, ALAMANNI_HOMELAND, PONTUS_EUXINUS ],
- /* NOMADS_HOMELAND */ [ AEGYPTUS, AFRICA, OCEANUS_ATLANTICUS ],
/* SASSANIDS_HOMELAND */ [ GALATIA, SYRIA, PONTUS_EUXINUS ],
+ /* NOMADS_HOMELAND */ [ AEGYPTUS, AFRICA, OCEANUS_ATLANTICUS ],
/* MARE_OCCIDENTALE */ [ ITALIA, GALLIA, MACEDONIA, PANNONIA, AFRICA, HISPANIA, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
/* MARE_ORIENTALE */ [ ASIA, MACEDONIA, THRACIA, AEGYPTUS, AFRICA, GALATIA, SYRIA, MARE_OCCIDENTALE ],
/* OCEANUS_ATLANTICUS */ [ GALLIA, AFRICA, HISPANIA, BRITANNIA, NOMADS_HOMELAND, MARE_OCCIDENTALE ],
@@ -137,17 +135,17 @@ const PRETENDER_ADJACENT = [
/* MACEDONIA */ [ PANNONIA, THRACIA, MARE_OCCIDENTALE, MARE_ORIENTALE ],
/* PANNONIA */ [ ITALIA, GALLIA, MACEDONIA, THRACIA, ALAMANNI_HOMELAND, FRANKS_HOMELAND, MARE_OCCIDENTALE ],
/* THRACIA */ [ ASIA, MACEDONIA, PANNONIA, ALAMANNI_HOMELAND, GOTHS_HOMELAND, MARE_ORIENTALE, PONTUS_EUXINUS ],
- /* AEGYPTUS */ [ AFRICA, SYRIA, NOMADS_HOMELAND, MARE_ORIENTALE ],
- /* AFRICA */ [ AEGYPTUS, HISPANIA, NOMADS_HOMELAND, MARE_OCCIDENTALE, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
- /* HISPANIA */ [ GALLIA, AFRICA, MARE_OCCIDENTALE, OCEANUS_ATLANTICUS ],
/* BRITANNIA */ [ GALLIA, OCEANUS_ATLANTICUS ],
/* GALATIA */ [ ASIA, SYRIA, SASSANIDS_HOMELAND, MARE_ORIENTALE, PONTUS_EUXINUS ],
/* SYRIA */ [ AEGYPTUS, GALATIA, SASSANIDS_HOMELAND, MARE_ORIENTALE ],
+ /* AEGYPTUS */ [ AFRICA, SYRIA, NOMADS_HOMELAND, MARE_ORIENTALE ],
+ /* AFRICA */ [ AEGYPTUS, HISPANIA, NOMADS_HOMELAND, MARE_OCCIDENTALE, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
+ /* HISPANIA */ [ GALLIA, AFRICA, MARE_OCCIDENTALE, OCEANUS_ATLANTICUS ],
/* ALAMANNI_HOMELAND */ [ PANNONIA, THRACIA, FRANKS_HOMELAND, GOTHS_HOMELAND ],
/* FRANKS_HOMELAND */ [ GALLIA, PANNONIA, ALAMANNI_HOMELAND ],
/* GOTHS_HOMELAND */ [ THRACIA, ALAMANNI_HOMELAND, PONTUS_EUXINUS ],
- /* NOMADS_HOMELAND */ [ AEGYPTUS, AFRICA, OCEANUS_ATLANTICUS ],
/* SASSANIDS_HOMELAND */ [ GALATIA, SYRIA, PONTUS_EUXINUS ],
+ /* NOMADS_HOMELAND */ [ AEGYPTUS, AFRICA, OCEANUS_ATLANTICUS ],
/* MARE_OCCIDENTALE */ [ ITALIA, GALLIA, MACEDONIA, PANNONIA, AFRICA, HISPANIA, MARE_ORIENTALE, OCEANUS_ATLANTICUS ],
/* MARE_ORIENTALE */ [ ASIA, MACEDONIA, THRACIA, AEGYPTUS, AFRICA, GALATIA, SYRIA, MARE_OCCIDENTALE ],
/* OCEANUS_ATLANTICUS */ [ GALLIA, AFRICA, HISPANIA, BRITANNIA, NOMADS_HOMELAND, MARE_OCCIDENTALE ],
@@ -159,11 +157,11 @@ const PRETENDER_ADJACENT = [
const ALAMANNI = 0
const FRANKS = 1
const GOTHS = 2
-const NOMADS = 3
-const SASSANIDS = 4
+const SASSANIDS = 3
+const NOMADS = 4
-const first_barbarian = [ 0, 10, 20, 31, 41 ]
-const last_barbarian = [ 9, 19, 30, 40, 52 ]
+const first_barbarian = [ 0, 10, 20, 31, 43 ]
+const last_barbarian = [ 9, 19, 30, 42, 52 ]
const CNIVA = first_barbarian[GOTHS] + 0
const ARDASHIR = first_barbarian[SASSANIDS] + 0
@@ -188,16 +186,16 @@ const BARBARIAN_NAME = [
"Alamanni",
"Franks",
"Goths",
- "Nomads",
"Sassanids",
+ "Nomads",
]
const BARBARIAN_HOMELAND = [
ALAMANNI_HOMELAND,
FRANKS_HOMELAND,
GOTHS_HOMELAND,
- NOMADS_HOMELAND,
SASSANIDS_HOMELAND,
+ NOMADS_HOMELAND,
]
const BARBARIAN_INVASION = [
@@ -218,16 +216,16 @@ const BARBARIAN_INVASION = [
[ 3, 4, [ ASIA, MACEDONIA ] ],
[ 5, 6, [ GALATIA, SYRIA ] ],
],
- // Nomads
- [
- [ 1, 3, [ AFRICA, HISPANIA ] ],
- [ 4, 6, [ AEGYPTUS, SYRIA ] ],
- ],
// Sassanids
[
[ 1, 3, [ GALATIA, ASIA ] ],
[ 4, 6, [ SYRIA, AEGYPTUS ] ],
],
+ // Nomads
+ [
+ [ 1, 3, [ AFRICA, HISPANIA ] ],
+ [ 4, 6, [ AEGYPTUS, SYRIA ] ],
+ ],
]
const CRISIS_TABLE_4P = [
@@ -1046,9 +1044,9 @@ function eliminate_militia(where) {
remove_militia_castra(where)
}
-function flip_discard_to_available() {
- game.draw[game.current] = game.discard[game.current]
- game.discard[game.current] = []
+function flip_discard_to_available(p) {
+ game.draw[p] = game.discard[p]
+ game.discard[p] = []
}
function assign_hit_to_legion(id) {
@@ -1113,7 +1111,7 @@ states.setup_province = {
view.selected_governor = game.current * 6
view.selected_general = game.current * 6
view.color = SENATE
- for (let where = 2; where <= 12; ++where)
+ for (let where = 1; where < 12; ++where)
if (is_neutral_province(where) && !is_no_place_governor(where))
gen_action("capital", where)
},
@@ -1520,7 +1518,7 @@ states.ludi_saeculares = {
},
card(c) {
push_undo()
- set_remove(current_hand(), c)
+ set_delete(current_hand(), c)
set_add(current_discard(), c)
award_legacy(game.current, "Ludi Saeculares", 2 * card_value(c))
game.state = "ludi_saeculares_done"
@@ -3641,7 +3639,7 @@ states.flip_inactive_barbarians = {
function goto_refill_hand() {
if (current_draw().length === 0)
- flip_discard_to_available()
+ flip_discard_to_available(game.current)
game.state = "refill_hand"
}
@@ -3664,7 +3662,7 @@ states.refill_hand = {
set_delete(draw, c)
set_add(hand, c)
if (draw.length === 0)
- flip_discard_to_available()
+ flip_discard_to_available(game.current)
},
done() {
clear_undo()
@@ -3735,7 +3733,7 @@ function goto_game_over(result, victory) {
game.active = "None"
game.result = result
game.victory = victory
- log_h1("Game Over")
+ log_br()
log(game.victory)
return true
}
@@ -3792,10 +3790,7 @@ function setup_barbarians(tribe, home) {
}
exports.setup = function (seed, scenario, options) {
- let real_player_count = options.players || 4
- let player_count = real_player_count
- if (player_count === 1)
- player_count = 4
+ let player_count = options.players || 4
game = {
seed: seed,
@@ -3850,9 +3845,6 @@ exports.setup = function (seed, scenario, options) {
discard: [],
}
- if (real_player_count === 1)
- game.solo = 1
-
game.events = setup_events()
game.market = [
@@ -3872,14 +3864,14 @@ exports.setup = function (seed, scenario, options) {
setup_barbarians(GOTHS, GOTHS_HOMELAND)
if (player_count >= 3)
- setup_barbarians(NOMADS, NOMADS_HOMELAND)
+ setup_barbarians(SASSANIDS, SASSANIDS_HOMELAND)
else
- setup_barbarians(NOMADS, UNAVAILABLE)
+ setup_barbarians(SASSANIDS, UNAVAILABLE)
if (player_count >= 4)
- setup_barbarians(SASSANIDS, SASSANIDS_HOMELAND)
+ setup_barbarians(NOMADS, NOMADS_HOMELAND)
else
- setup_barbarians(SASSANIDS, UNAVAILABLE)
+ setup_barbarians(NOMADS, UNAVAILABLE)
for (let player = 0; player < player_count; ++player) {
game.hand[player] = []
@@ -3901,10 +3893,7 @@ function load_game(state) {
}
function save_game() {
- if (game.solo)
- game.active = "Solo"
- else
- game.active = PLAYER_NAMES[game.current]
+ game.active = PLAYER_NAMES[game.current]
return game
}
@@ -3932,8 +3921,6 @@ exports.view = function (state, player_name) {
load_game(state)
let player = PLAYER_INDEX[player_name]
- if (game.solo)
- player = game.current
let player_count = game.legacy.length
view = {
@@ -3972,7 +3959,7 @@ exports.view = function (state, player_name) {
if (game.state === "game_over") {
view.prompt = game.victory
- } else if (player !== game.current && player_name !== "Solo") {
+ } else if (game.current !== player) {
let inactive = states[game.state].inactive || game.state
view.prompt = `Waiting for ${PLAYER_NAMES[game.current]} \u2014 ${inactive}...`
} else {