Made the previous-round weight-adjust based on max instead of average.

This commit is contained in:
Putnam
2020-12-19 20:34:28 -08:00
parent a3f2ae3333
commit f9edd8e8ac
3 changed files with 10 additions and 1 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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()