summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-12-01 20:06:56 +0100
committerTor Andersson <tor@ccxvii.net>2024-12-01 20:08:12 +0100
commit8ddf616e7dd79a38053a770c5f669c22d485d8c1 (patch)
tree3dbcdd6adb865c232fddab84428340c34d828d45
parent8fcb1c3e4f093946f46e35f05e94979acdc1698a (diff)
downloadmaria-8ddf616e7dd79a38053a770c5f669c22d485d8c1.tar.gz
Rename game.victory to game.conquest.
-rw-r--r--rules.js58
1 files changed, 29 insertions, 29 deletions
diff --git a/rules.js b/rules.js
index cac0bed..a022fff 100644
--- a/rules.js
+++ b/rules.js
@@ -1066,7 +1066,7 @@ function is_friendly_controlled_fortress(s) {
function is_power_controlled_fortress(pow, s) {
let owner = map_get(game.elector, s, -1)
if (owner < 0)
- owner = map_get(game.victory, s, -1)
+ owner = map_get(game.conquest, s, -1)
if (owner < 0)
return set_has(all_home_country_fortresses[pow], s)
return owner === pow
@@ -1087,9 +1087,9 @@ function set_control_of_fortress(s, pow) {
}
if (is_enemy_home_country(s) || is_friendly_minor_home_country(s) || set_has(all_silesian_fortresses, s))
- map_set(game.victory, s, pow)
+ map_set(game.conquest, s, pow)
else
- map_delete(game.victory, s)
+ map_delete(game.conquest, s)
}
function is_space_protected_by_piece(s, p) {
@@ -1099,7 +1099,7 @@ function is_space_protected_by_piece(s, p) {
function is_protected_from_conquest(s) {
let owner = map_get(game.elector, s, -1)
if (owner < 0)
- owner = map_get(game.victory, s, -1)
+ owner = map_get(game.conquest, s, -1)
if (owner < 0)
owner = get_home_power(s)
for (let p of all_coop_generals(owner))
@@ -4458,8 +4458,8 @@ function count_victory_markers(pow) {
if (pow === P_PRAGMATIC) {
if (elector_majority() === P_PRAGMATIC) ++n
}
- for (let i = 0; i < game.victory.length; i += 2)
- if (game.victory[i+1] === pow)
+ for (let i = 0; i < game.conquest.length; i += 2)
+ if (game.conquest[i+1] === pow)
++n
return n
}
@@ -4470,7 +4470,7 @@ function count_victory_markers_in_pool(pow) {
function count_victory_markers_in_country(pow, country) {
let n = 0
- map_for_each(game.victory, (vspace, vpow) => {
+ map_for_each(game.conquest, (vspace, vpow) => {
if (vpow === pow && set_has(country, vspace))
++n
})
@@ -5570,9 +5570,9 @@ function goto_saxony_becomes_neutral(reason) {
// Return all victory markers
log("Removed victory markers.")
for (let s of all_home_country_fortresses[P_SAXONY]) {
- let pow = map_get(game.victory, s, -1)
+ let pow = map_get(game.conquest, s, -1)
if (pow >= 0) {
- map_delete(game.victory, s)
+ map_delete(game.conquest, s)
}
}
@@ -5767,7 +5767,7 @@ function has_prussia_conquered_silesia() {
if (has_prussia_annexed_silesia())
return false
for (let s of all_silesian_fortresses) {
- let pow = map_get(game.victory, s)
+ let pow = map_get(game.conquest, s)
if (pow !== P_PRUSSIA)
return false
}
@@ -5819,9 +5819,9 @@ function goto_annex_silesia() {
// remove all austrian markers in prussia
for (let s of all_prussian_and_silesian_fortresses) {
- let pow = map_get(game.victory, s, -1)
+ let pow = map_get(game.conquest, s, -1)
if (pow === P_AUSTRIA) {
- map_delete(game.victory, s)
+ map_delete(game.conquest, s)
}
}
log("Removed all Austrian victory markers in Prussia.")
@@ -5829,9 +5829,9 @@ function goto_annex_silesia() {
// set aside half prussian markers in prussia
let n = 0
for (let s of all_core_austria_fortresses) {
- let pow = map_get(game.victory, s, -1)
+ let pow = map_get(game.conquest, s, -1)
if (pow === P_PRUSSIA) {
- map_delete(game.victory, s)
+ map_delete(game.conquest, s)
++n
}
}
@@ -5998,7 +5998,7 @@ function goto_france_reduces_military_objectives() {
function count_french_victory_markers_in_core_austria() {
let n = 0
- map_for_each(game.victory, (s, pow) => {
+ map_for_each(game.conquest, (s, pow) => {
if (pow === P_FRANCE && set_has(all_core_austria_cities, s))
++n
})
@@ -6026,9 +6026,9 @@ states.france_reduces_military_objectives = {
game.flags |= F_FRANCE_REDUCED
let n = 0
for (let s of all_core_austria_fortresses) {
- let pow = map_get(game.victory, s, -1)
+ let pow = map_get(game.conquest, s, -1)
if (pow === P_FRANCE) {
- map_delete(game.victory, s)
+ map_delete(game.conquest, s)
++n
}
}
@@ -7062,7 +7062,7 @@ exports.setup = function (seed, scenario, _options) {
oos: 0,
supreme: 0,
troops: setup_troops.slice(),
- victory: [],
+ conquest: [],
elector: [],
moved: [],
@@ -7103,13 +7103,13 @@ exports.setup = function (seed, scenario, _options) {
map_set(game.elector, KOLN, P_FRANCE)
map_set(game.elector, MANNHEIM, P_FRANCE)
- map_set(game.victory, LIEGNITZ, P_PRUSSIA)
- map_set(game.victory, GLOGAU, P_PRUSSIA)
- map_set(game.victory, BRESLAU, P_AUSTRIA)
- map_set(game.victory, BRIEG, P_AUSTRIA)
- map_set(game.victory, GLATZ, P_AUSTRIA)
- map_set(game.victory, NEISSE, P_AUSTRIA)
- map_set(game.victory, COSEL, P_AUSTRIA)
+ map_set(game.conquest, LIEGNITZ, P_PRUSSIA)
+ map_set(game.conquest, GLOGAU, P_PRUSSIA)
+ map_set(game.conquest, BRESLAU, P_AUSTRIA)
+ map_set(game.conquest, BRIEG, P_AUSTRIA)
+ map_set(game.conquest, GLATZ, P_AUSTRIA)
+ map_set(game.conquest, NEISSE, P_AUSTRIA)
+ map_set(game.conquest, COSEL, P_AUSTRIA)
// Deal initial cards
for (let pow of all_powers) {
@@ -7319,7 +7319,7 @@ exports.view = function (state, player) {
russia: game.russia,
italy: game.italy,
flags: game.flags,
- victory: game.victory,
+ victory: game.conquest,
elector: game.elector,
pos: game.pos,
@@ -7356,7 +7356,7 @@ exports.view = function (state, player) {
view.political = game.political
if (game.state === "game_over") {
- view.prompt = game.victory_reason
+ view.prompt = game.victory
view.troops = game.troops
view.hand1 = game.hand1
view.hand2 = game.hand2
@@ -7434,8 +7434,8 @@ function goto_game_over(result, victory_reason) {
game.active = "None"
game.state = "game_over"
game.result = result
- game.victory_reason = victory_reason
- log(game.victory_reason)
+ game.victory = victory_reason
+ log(victory_reason)
return true
}