summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 344feb5..12d9630 100644
--- a/rules.js
+++ b/rules.js
@@ -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