From f9edd8e8ac71e79d75cf06bfb7f797f3ca3ee297 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 19 Dec 2020 20:34:28 -0800 Subject: [PATCH] Made the previous-round weight-adjust based on max instead of average. --- code/controllers/subsystem/persistence.dm | 2 +- code/game/gamemodes/dynamic/dynamic.dm | 3 +++ code/game/gamemodes/dynamic/dynamic_storytellers.dm | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index e1b6e6f6e2..e39242aac3 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -422,7 +422,7 @@ SUBSYSTEM_DEF(persistence) saved_storytellers[3] = saved_storytellers[2] saved_storytellers[2] = saved_storytellers[1] saved_storytellers[1] = mode.storyteller.name - average_dynamic_threat = (mode.threat_average + average_dynamic_threat) / 2 + average_dynamic_threat = (mode.max_threat + average_dynamic_threat) / 2 var/json_file = file("data/RecentStorytellers.json") var/list/file_data = list() file_data["data"] = saved_storytellers + average_dynamic_threat diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index de85e2b5c5..6a16b62643 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -64,6 +64,8 @@ GLOBAL_VAR_INIT(dynamic_forced_storyteller, null) var/threat_average_weight = 0 /// Last time a threat average sample was taken. Used for weighting the rolling average. var/last_threat_sample_time = 0 + /// Maximum threat recorded so far, for cross-round chaos adjustment. + var/max_threat = 0 /// Things that cause a rolling threat adjustment to be displayed at roundend. var/list/threat_tallies = list() /// Running information about the threat. Can store text or datum entries. @@ -744,6 +746,7 @@ GLOBAL_VAR_INIT(dynamic_forced_storyteller, null) if(!M.voluntary_ghosted) current_players[CURRENT_DEAD_PLAYERS].Add(M) // Players who actually died (and admins who ghosted, would be nice to avoid counting them somehow) threat = storyteller.calculate_threat() + added_threat + max_threat = max(max_threat,threat) if(threat_average_weight) var/cur_sample_weight = world.time - last_threat_sample_time threat_average = ((threat_average * threat_average_weight) + (threat * cur_sample_weight)) / (threat_average_weight + cur_sample_weight) diff --git a/code/game/gamemodes/dynamic/dynamic_storytellers.dm b/code/game/gamemodes/dynamic/dynamic_storytellers.dm index 98bc922564..03aa9d174a 100644 --- a/code/game/gamemodes/dynamic/dynamic_storytellers.dm +++ b/code/game/gamemodes/dynamic/dynamic_storytellers.dm @@ -21,6 +21,7 @@ var/event_frequency_lower = 6 MINUTES // How rare events will be, at least. var/event_frequency_upper = 20 MINUTES // How rare events will be, at most. var/min_players = -1 // How many players are required for this one to start. + var/soft_antag_ratio_cap = 4 // how many players-per-antag there should be var/datum/game_mode/dynamic/mode = null // Cached as soon as it's made, by dynamic. /** @@ -105,6 +106,8 @@ Property weights are added to the config weight of the ruleset. They are: if(mode.forced_injection) mode.forced_injection = dry_run return TRUE + if(mode.current_players[CURRENT_LIVING_PLAYERS].len < (mode.current_players[CURRENT_LIVING_ANTAGS].len * soft_antag_ratio_cap)) + return FALSE return mode.threat < mode.threat_level /datum/dynamic_storyteller/proc/roundstart_draft() @@ -215,6 +218,7 @@ Property weights are added to the config weight of the ruleset. They are: event_frequency_lower = 2 MINUTES event_frequency_upper = 10 MINUTES max_chaos = 50 + soft_antag_ratio_cap = 1 flags = WAROPS_ALWAYS_ALLOWED | FORCE_IF_WON min_players = 30 var/refund_cooldown = 0 @@ -267,6 +271,7 @@ Property weights are added to the config weight of the ruleset. They are: config_tag = "random" weight = 1 max_chaos = 60 + soft_antag_ratio_cap = 1 desc = "No weighting at all; every ruleset has the same chance of happening. Cooldowns vary wildly. As random as it gets." /datum/dynamic_storyteller/random/on_start() @@ -380,6 +385,7 @@ Property weights are added to the config weight of the ruleset. They are: min_chaos = 30 weight = 3 dead_player_weight = 5 + soft_antag_ratio_cap = 8 property_weights = list("extended" = 2, "chaos" = -1, "valid" = -1, "conversion" = -10) /datum/dynamic_storyteller/liteextended/minor_start_chance()