From 9101a9c46689f233495527aaa704e109fb6227dd Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:43:02 +0100 Subject: allow dynamic roles list (Tor) --- rtt-module.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'rtt-module.js') diff --git a/rtt-module.js b/rtt-module.js index 5c7e3c6..e035ed7 100755 --- a/rtt-module.js +++ b/rtt-module.js @@ -42,10 +42,14 @@ module.exports.fuzz = function(fuzzerInputData) { // TODO randomize options const options = {} + let roles = RULES.roles + if (typeof roles === "function") + roles = roles(scenario, options) + const ctx = { data: fuzzerInputData, - player_count: RULES.roles.length, - players: RULES.roles.map(r => ({role: r, name: "rtt-fuzzer"})), + player_count: roles.length, + players: roles.map(r => ({role: r, name: "rtt-fuzzer"})), scenario, options, replay: [], @@ -70,7 +74,7 @@ module.exports.fuzz = function(fuzzerInputData) { ctx.active = ctx.state.active if (ctx.active === 'Both' || ctx.active === 'All') { // If multiple players can act, we'll pick a random player to go first. - ctx.active = data.pickValue(RULES.roles) + ctx.active = data.pickValue(roles) } const state_freeze = JSON.stringify(ctx.state) -- cgit v1.2.3