summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-11-29 18:49:58 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-11-29 18:49:58 +0000
commit93d735ddca82f009e52652d84c0ec74233cc72b7 (patch)
treeb94e58ad0ac79dc7f452bd60ccea729f80fb9503 /rules.js
parent30870e62d951633fc4d1c43dc0db230373a7b3ae (diff)
download1989-dawn-of-freedom-93d735ddca82f009e52652d84c0ec74233cc72b7.tar.gz
Add socio-economic constants
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js41
1 files changed, 26 insertions, 15 deletions
diff --git a/rules.js b/rules.js
index 3a610a4..84c3d83 100644
--- a/rules.js
+++ b/rules.js
@@ -247,6 +247,17 @@ const S_HUNGARY = [37,38,39,40,41,42,43,44,45,46,47,48]
const S_ROMANIA = [49,50,51,52,53,54,55,56,57,58,59,60,61,62]
const S_BULGARIA = [63,64,65,66,67,68,69,70,71,72,73,74]
+// SOCIO_ECONOMIC CONSTANTS
+
+const SOCIO_ELITE = 1
+const SOCIO_BUREAUCRACY = 2
+const SOCIO_FARMER = 3
+const SOCIO_WORKER = 4
+const SOCIO_INTELLECTUAL = 5
+const SOCIO_STUDENT = 6
+const SOCIO_CHURCH = 7
+const SOCIO_MINORITY = 8
+
exports.scenarios = [
"Standard",
"Democrat +1 SP",
@@ -1134,7 +1145,7 @@ states.draw_power_cards = {
if (game.persistent_events.includes(C_PEASANT_PARTIES_REVOLT)) {
let farmer_check
for (let space of spaces) {
- if (space && space.country === game.pwr_struggle_in && space.socio === 3 && check_dem_control(space.space_id)) {
+ if (space && space.country === game.pwr_struggle_in && space.socio === SOCIO_FARMER && check_dem_control(space.space_id)) {
farmer_check = true
}
}
@@ -2319,7 +2330,7 @@ function do_sc(space) {
}
// Events which modify SC rolls
- if (game.active === COM && game.persistent_events.includes(C_TEAR_GAS) && spaces[space].socio === 6) {
+ if (game.active === COM && game.persistent_events.includes(C_TEAR_GAS) && spaces[space].socio === SOCIO_STUDENT) {
roll ++
logi(`+1 from C${C_TEAR_GAS}`)
permanently_remove(C_TEAR_GAS)
@@ -2437,7 +2448,7 @@ function do_sc(space) {
if (
game.active === COM &&
game.persistent_events.includes(C_HELSINKI_FINAL_ACT) &&
- (spaces[space].socio === 5 || spaces[space].socio === 6)
+ (spaces[space].socio === SOCIO_INTELLECTUAL || spaces[space].socio === SOCIO_STUDENT)
) {
log('+1 VP from C' + C_HELSINKI_FINAL_ACT)
game.vp ++
@@ -3244,7 +3255,7 @@ function is_auto_resolve(card) {
return true
}
} else if (card === C_DISSIDENT_ARRESTED && game.active === DEM) {
- let dem_intellectual_infl = spaces.filter((space) => space.socio === 5 && game.demInfl[space.space_id] > 0).length
+ let dem_intellectual_infl = spaces.filter((space) => space.socio === SOCIO_INTELLECTUAL && game.demInfl[space.space_id] > 0).length
if (dem_intellectual_infl === 0) {
if (!game.state.startsWith('vm')) {
logi('No influence to remove')
@@ -3291,7 +3302,7 @@ function is_auto_resolve(card) {
return true
}
} else if (card === C_GOVERNMENT_RESIGNS && game.active === COM) {
- let uncontrolled_elites = spaces.filter(space => spaces[space.space_id].socio === 1 && game.comInfl[space.space_id] > 0 && !check_control(space.space_id)).length
+ let uncontrolled_elites = spaces.filter(space => spaces[space.space_id].socio === SOCIO_ELITE && game.comInfl[space.space_id] > 0 && !check_control(space.space_id)).length
if (uncontrolled_elites === 0) {
if (!game.state.startsWith('vm')) {
logi('No uncontrolled Elite spaces')
@@ -4600,8 +4611,8 @@ function vm_valid_spaces_solidarity_legalised() {
let space = spaces[i]
let uncontrolled = !check_control(i) && !check_opp_control(i)
if (
- (space.country === 'Poland' && uncontrolled && space.socio === 3) ||
- (space.country === 'Poland' && uncontrolled && space.socio === 4)
+ (space.country === 'Poland' && uncontrolled && space.socio === SOCIO_WORKER) ||
+ (space.country === 'Poland' && uncontrolled && space.socio === SOCIO_FARMER)
) {
valid_spaces.push(space.space_id)
}
@@ -5225,7 +5236,7 @@ function vm_goodbye_lenin() {
function vm_government_resigns() {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- if (space.socio === 1 && game.comInfl[i] > 0 && !check_control(i)) {
+ if (space.socio === SOCIO_ELITE && game.comInfl[i] > 0 && !check_control(i)) {
game.valid_spaces.push(i)
}
}
@@ -5772,14 +5783,14 @@ function vm_workers_revolt() {
if (game.active === DEM) {
for (let space of spaces) {
let country = space.country
- if (!game.revolutions[find_country_index(country)] && game.comInfl[space.space_id] > 0 && space.socio === 4) {
+ if (!game.revolutions[find_country_index(country)] && game.comInfl[space.space_id] > 0 && space.socio === SOCIO_WORKER) {
game.valid_spaces.push(space.space_id)
}
}
} else {
for (let space of spaces) {
let country = space.country
- if (game.revolutions[find_country_index(country)] && game.demInfl[space.space_id] > 0 && space.socio === 4) {
+ if (game.revolutions[find_country_index(country)] && game.demInfl[space.space_id] > 0 && space.socio === SOCIO_WORKER) {
game.valid_spaces.push(space.space_id)
}
}
@@ -6359,7 +6370,7 @@ states.vm_adamec = {
clear_undo()
let roll = roll_d6()
log(`Roll: D${roll}`)
- let worker_spaces = spaces.filter(space => space && space.country === 'Czechoslovakia' && space.socio === 4 && check_dem_control(space.space_id)).length
+ let worker_spaces = spaces.filter(space => space && space.country === 'Czechoslovakia' && space.socio === SOCIO_WORKER && check_dem_control(space.space_id)).length
if (worker_spaces > 0) {
logi(`-${worker_spaces} from Democrat controlled worker spaces`)
roll -= worker_spaces
@@ -7328,7 +7339,7 @@ states.vm_nomenklatura = {
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- if (space.socio === 1 && game.demInfl[i] > 0) {
+ if (space.socio === SOCIO_ELITE && game.demInfl[i] > 0) {
game.valid_spaces.push(space.space_id)
}
}
@@ -7340,7 +7351,7 @@ states.vm_nomenklatura = {
push_undo()
game.valid_spaces = []
for (let space of spaces) {
- if (space.socio === 1) {
+ if (space.socio === SOCIO_ELITE) {
game.valid_spaces.push(space.space_id)
}
}
@@ -7487,7 +7498,7 @@ states.vm_shock_therapy = {
space &&
space.country === game.vm_active_country &&
check_com_control(space.space_id) &&
- (space.socio === 3 || space.socio === 4)
+ (space.socio === SOCIO_WORKER || space.socio === SOCIO_FARMER)
) {
worker_farmer++
}
@@ -7784,7 +7795,7 @@ states.vm_warsaw_pact_summit = {
push_undo()
for (let i = 0; i < spaces.length; i++) {
let space = spaces[i]
- if (game.demInfl[i] > 0 && (space.socio === 5 || space.socio === 6)) {
+ if (game.demInfl[i] > 0 && (space.socio === SOCIO_INTELLECTUAL || space.socio === SOCIO_STUDENT)) {
game.valid_spaces.push(space.space_id)
}
}