diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-23 23:35:51 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:12:55 +0100 |
commit | e5cebd483c212d8b4aef41d720f50599956b8c21 (patch) | |
tree | 4db3a02adecd33932dbb1cde964c7cfd41c571c0 | |
parent | ab8fcb13d61ce3e73ef35ea8e2cf1766b7787d6c (diff) | |
download | richard-iii-e5cebd483c212d8b4aef41d720f50599956b8c21.tar.gz |
Update RNG.
-rw-r--r-- | rules.js | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -45,7 +45,9 @@ let states = {} let game = null function random(n) { - return Math.floor(((game.seed = game.seed * 48271 % 0x7fffffff) / 0x7fffffff) * n) + if (game.rng === 1) + return Math.floor(((game.seed = game.seed * 48271 % 0x7fffffff) / 0x7fffffff) * n) + return (game.seed = game.seed * 200105 % 34359738337) % n } function logbr() { @@ -3430,6 +3432,11 @@ exports.setup = function (seed, scenario, options) { where: null, killed_heirs: { Lancaster: 0, York: 0 }, } + + // Old RNG for ancient replays + if (options.rng) + game.rng = options.rng + if (scenario === "Wars of the Roses") setup_game() else if (scenario === "Kingmaker") @@ -3438,6 +3445,7 @@ exports.setup = function (seed, scenario, options) { setup_richard_iii() else throw new Error("Unknown scenario:", scenario) + log("Scenario: " + scenario) start_campaign() return game |