From d80c224f6e2015baf22c2413a04b319d17be046d Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@mailbox.org> Date: Tue, 21 Feb 2023 22:23:05 +0100 Subject: [PATCH] pit fights: Add expectation for varied fighters --- src/004-base/basePitFight.js | 12 ++++++++++++ src/events/scheduled/pitFight.js | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/004-base/basePitFight.js b/src/004-base/basePitFight.js index 38962ec438c..19a44d5ba2a 100644 --- a/src/004-base/basePitFight.js +++ b/src/004-base/basePitFight.js @@ -190,5 +190,17 @@ App.Facilities.Pit.Fights.FighterMap = class { const oldCount = this.fightCount(slaveId); this.map.set(slaveId, oldCount + 1); } + + fighterCount() { + return this.map.size; + } + + fightsCount() { + let count = 0; + this.map.forEach((v, k) => { + count += k; + }); + return count; + } }; diff --git a/src/events/scheduled/pitFight.js b/src/events/scheduled/pitFight.js index 08d895aca5e..56e29514dce 100644 --- a/src/events/scheduled/pitFight.js +++ b/src/events/scheduled/pitFight.js @@ -288,6 +288,21 @@ App.Events.SEPitFight = class SEPitFight extends App.Events.BaseEvent { } } + const fighterRatio = fighterMap.fighterCount() / fighterMap.fightsCount(); + if (fighterRatio > 0.95) { + r.push("The audience is <span class='green'>happy</span> seeing a lot of different fighters."); + totalSuccess *= 1.1; + } else if (fighterRatio > 0.8) { + // no reaction + } else { + if (fighterRatio > 0.5) { + r.push("The audience is <span class='red'>unhappy</span> seeing a lot the same fighters."); + } else { + r.push("Almost every fight had repeat fighters, <span class='red'>boring</span> the audience."); + } + totalSuccess *= 0.5 + 0.5 * (fighterRatio + 0.1); + } + totalSuccess *= 0.5 + 0.5 * V.pit.seats; if (V.pit.seats === 0) { r.push("The small visitors section <span class='red'>limited</span> the impact today's fights had."); -- GitLab