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 494c418..c0a9055 100644
--- a/rules.js
+++ b/rules.js
@@ -86,7 +86,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 log(s) {
@@ -3745,11 +3747,17 @@ exports.setup = function (seed, scenario, options) {
who: null,
where: null,
}
+
+ // Old RNG for ancient replays
+ if (options.rng)
+ game.rng = options.rng
+
if (options && options.iron_bridge) {
game.iron_bridge = 1;
log("Iron Bridge:\nThe road between Antioch and Harim has a move limit of 3.");
log("");
}
+
setup_game();
return game;
}