diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-11-30 11:38:38 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:37 +0100 |
commit | 9550b91ec8b349faf0e5f67e0a6699009be87b4e (patch) | |
tree | c98bf8603541f3816d4fc1fb29bb3a38e467ed8e /rules.js | |
parent | ea86df143b5fd3235557657405cd810de4e3dfb3 (diff) | |
download | nevsky-9550b91ec8b349faf0e5f67e0a6699009be87b4e.tar.gz |
Revert "Rename game.lords -> game.pieces"
This reverts commit f100ccb81feb1919c366a7ccb13e9fd498d6f6ac.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 78 |
1 files changed, 39 insertions, 39 deletions
@@ -279,35 +279,35 @@ function enemy_player() { } function get_lord_locale(lord) { - return game.pieces.locale[lord] + return game.lords.locale[lord] } function get_lord_service(lord) { - return game.pieces.service[lord] + return game.lords.service[lord] } function get_lord_capability(lord, n) { - return game.pieces.capabilities[(lord << 1) + n] + return game.lords.cards[(lord << 1) + n] } function set_lord_capability(lord, n, x) { - game.pieces.capabilities[(lord << 1) + n] = x + game.lords.cards[(lord << 1) + n] = x } function get_lord_assets(lord, n) { - return pack4_get(game.pieces.assets[lord], n) + return pack4_get(game.lords.assets[lord], n) } function get_lord_forces(lord, n) { - return pack4_get(game.pieces.forces[lord], n) + return pack4_get(game.lords.forces[lord], n) } function get_lord_routed_forces(lord, n) { - return pack4_get(game.pieces.routed[lord], n) + return pack4_get(game.lords.routed[lord], n) } function set_lord_locale(lord, locale) { - game.pieces.locale[lord] = locale + game.lords.locale[lord] = locale } function set_lord_service(lord, service) { @@ -315,7 +315,7 @@ function set_lord_service(lord, service) { service = 0 if (service > 17) service = 17 - game.pieces.service[lord] = service + game.lords.service[lord] = service } function add_lord_service(lord, n) { @@ -327,7 +327,7 @@ function set_lord_assets(lord, n, x) { x = 0 if (x > 8) x = 8 - game.pieces.assets[lord] = pack4_set(game.pieces.assets[lord], n, x) + game.lords.assets[lord] = pack4_set(game.lords.assets[lord], n, x) } function add_lord_assets(lord, n, x) { @@ -339,7 +339,7 @@ function set_lord_forces(lord, n, x) { x = 0 if (x > 15) x = 15 - game.pieces.forces[lord] = pack4_set(game.pieces.forces[lord], n, x) + game.lords.forces[lord] = pack4_set(game.lords.forces[lord], n, x) } function add_lord_forces(lord, n, x) { @@ -351,7 +351,7 @@ function set_lord_routed_forces(lord, n, x) { x = 0 if (x > 15) x = 15 - game.pieces.routed[lord] = pack4_set(game.pieces.routed[lord], n, x) + game.lords.routed[lord] = pack4_set(game.lords.routed[lord], n, x) } function add_lord_routed_forces(lord, n, x) { @@ -373,15 +373,15 @@ function set_lord_vassal_service(lord, n, x) { } function clear_lords_moved() { - game.pieces.moved = 0 + game.lords.moved = 0 } function get_lord_moved(lord) { - return pack2_get(game.pieces.moved, lord) + return pack2_get(game.lords.moved, lord) } function set_lord_moved(lord, x) { - game.pieces.moved = pack2_set(game.pieces.moved, lord, x) + game.lords.moved = pack2_set(game.lords.moved, lord, x) } function set_lord_unfed(lord, n) { @@ -475,7 +475,7 @@ function is_card_in_use(c) { return true if (set_has(game.capabilities, c)) return true - if (game.pieces.capabilities.includes(c)) + if (game.lords.cards.includes(c)) return true if (c === 18 || c === 19 || c === 20) return true @@ -490,15 +490,15 @@ function is_lord_on_map(lord) { } function is_lord_besieged(lord) { - return pack1_get(game.pieces.besieged, lord) + return pack1_get(game.lords.besieged, lord) } function is_lord_unbesieged(lord) { - return !pack1_get(game.pieces.besieged, lord) + return !pack1_get(game.lords.besieged, lord) } function set_lord_besieged(lord, x) { - game.pieces.besieged = pack1_set(game.pieces.besieged, lord, x) + game.lords.besieged = pack1_set(game.lords.besieged, lord, x) } function is_lord_on_calendar(lord) { @@ -634,39 +634,39 @@ function can_add_transport(who, what) { } function is_upper_lord(lord) { - return map_has(game.pieces.lieutenants, lord) + return map_has(game.lords.lieutenants, lord) } function is_lower_lord(lord) { - for (let i = 1; i < game.pieces.lieutenants.length; i += 2) - if (game.pieces.lieutenants[i] === lord) + for (let i = 1; i < game.lords.lieutenants.length; i += 2) + if (game.lords.lieutenants[i] === lord) return true return false } function get_upper_lord(lower) { - for (let i = 0; i < game.pieces.lieutenants.length; i += 2) - if (game.pieces.lieutenants[i+1] === lower) + for (let i = 0; i < game.lords.lieutenants.length; i += 2) + if (game.lords.lieutenants[i+1] === lower) return i return NOBODY } function get_lower_lord(upper) { - return map_get(game.pieces.lieutenants, upper, NOBODY) + return map_get(game.lords.lieutenants, upper, NOBODY) } function set_lower_lord(upper, lower) { - map_set(game.pieces.lieutenants, upper, lower) + map_set(game.lords.lieutenants, upper, lower) } function add_lieutenant(upper) { - map_set(game.pieces.lieutenants, upper, NOBODY) + map_set(game.lords.lieutenants, upper, NOBODY) } function remove_lieutenant(lord) { - for (let i = 0; i < game.pieces.lieutenants.length; i += 2) { - if(game.pieces.lieutenants[i] === lord || game.pieces.lieutenants[i+1] === lord) { - array_remove_pair(game.pieces.lieutenants, i) + for (let i = 0; i < game.lords.lieutenants.length; i += 2) { + if(game.lords.lieutenants[i] === lord || game.lords.lieutenants[i+1] === lord) { + array_remove_pair(game.lords.lieutenants, i) return } } @@ -750,7 +750,7 @@ exports.setup = function (seed, scenario, options) { assets: Array(lord_count).fill(0), forces: Array(lord_count).fill(0), routed: Array(lord_count).fill(0), - capabilities: Array(lord_count << 1).fill(NOTHING), + cards: Array(lord_count << 1).fill(NOTHING), moved: 0, besieged: 0, lieutenants: [], @@ -1667,11 +1667,11 @@ states.campaign_plan = { } function end_campaign_plan() { - if (game.pieces.lieutenants.length > 0) { + if (game.lords.lieutenants.length > 0) { log(`Lieutenants`) - for (let i = 0; i < game.pieces.lieutenants.length; i += 2) { - let upper = game.pieces.lieutenants[i] - let lower = game.pieces.lieutenants[i + 1] + for (let i = 0; i < game.lords.lieutenants.length; i += 2) { + let upper = game.lords.lieutenants[i] + let lower = game.lords.lieutenants[i + 1] log(`>L${upper} over L${lower}`) } } @@ -2203,9 +2203,9 @@ function disband_lord(lord) { set_lord_capability(lord, 0, NOTHING) set_lord_capability(lord, 1, NOTHING) - game.pieces.assets[lord] = 0 - game.pieces.forces[lord] = 0 - game.pieces.routed[lord] = 0 + game.lords.assets[lord] = 0 + game.lords.forces[lord] = 0 + game.lords.routed[lord] = 0 set_lord_besieged(lord, 0) set_lord_moved(lord, 0) @@ -2390,7 +2390,7 @@ exports.view = function (state, current) { log: game.log, turn: game.turn, - pieces: game.pieces, + lords: game.lords, vassals: game.vassals, events: game.events, capabilities: game.capabilities, |