diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-23 23:35:05 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | 2e94f6aa63f2bbb75c68ddf19f14116dc293a71a (patch) | |
tree | 12595ca07c3f4ad3a7380762d1fa59209ccdc43a | |
parent | 975bfb9dedc4fa0e0b3584bc9f54bb793add790b (diff) | |
download | crusader-rex-2e94f6aa63f2bbb75c68ddf19f14116dc293a71a.tar.gz |
Update RNG.
-rw-r--r-- | rules.js | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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; } |