From 2e94f6aa63f2bbb75c68ddf19f14116dc293a71a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 23 Jun 2022 23:35:05 +0200 Subject: Update RNG. --- rules.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3