From cda93af6431b2c2f9bb17ef7db6a741eb967c15b Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 01:41:42 -0700 Subject: [PATCH 1/9] Fixes dynamic... again. --- .../gamemodes/dynamic/dynamic_storytellers.dm | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_storytellers.dm b/code/game/gamemodes/dynamic/dynamic_storytellers.dm index 148de9568a..21178baa12 100644 --- a/code/game/gamemodes/dynamic/dynamic_storytellers.dm +++ b/code/game/gamemodes/dynamic/dynamic_storytellers.dm @@ -126,8 +126,9 @@ Property weights are: for(var/property in property_weights) if(property in rule.property_weights) // just treat it as 0 if it's not in there property_weight += rule.property_weights[property] * property_weights[property] - if(property_weight > 0) - drafted_rules[rule] = rule.get_weight() * property_weight * rule.weight_mult + var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult + if(calced_weight > 0) // negatives in the list might cause problems + drafted_rules[rule] = calced_weight return drafted_rules /datum/dynamic_storyteller/proc/midround_draft() @@ -144,21 +145,22 @@ Property weights are: for(var/property in property_weights) if(property in rule.property_weights) // just treat it as 0 if it's not in there property_weight += rule.property_weights[property] * property_weights[property] - if(property_weight > 0) - var/threat_weight = 1 - if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) // makes the traitor rulesets always possible anyway - var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) - /* Basically, the closer the cost is to the current threat-level-away-from-threat, the more likely it is to - pick this particular ruleset. - Let's use a toy example: there's 60 threat level and 10 threat spent. - We want to pick a ruleset that's close to that, so we run the below equation, on two rulesets. - Ruleset 1 has 30 cost, ruleset 2 has 5 cost. - When we do the math, ruleset 1's threat_weight is 0.538, and ruleset 2's is 0.238, meaning ruleset 1 - is 2.26 times as likely to be picked, all other things considered. - Of course, we don't want it to GUARANTEE the closest, that's no fun, so it's just a weight. - */ - threat_weight = abs(1-abs(1-LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) - drafted_rules[rule] = rule.get_weight() * property_weight * rule.weight_mult * threat_weight + var/threat_weight = 1 + if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) // makes the traitor rulesets always possible anyway + var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) + /* Basically, the closer the cost is to the current threat-level-away-from-threat, the more likely it is to + pick this particular ruleset. + Let's use a toy example: there's 60 threat level and 10 threat spent. + We want to pick a ruleset that's close to that, so we run the below equation, on two rulesets. + Ruleset 1 has 30 cost, ruleset 2 has 5 cost. + When we do the math, ruleset 1's threat_weight is 0.538, and ruleset 2's is 0.238, meaning ruleset 1 + is 2.26 times as likely to be picked, all other things considered. + Of course, we don't want it to GUARANTEE the closest, that's no fun, so it's just a weight. + */ + threat_weight = abs(1-abs(1-LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) + var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult * threat_weight + if(calced_weight > 0) + drafted_rules[rule] = calced_weight return drafted_rules /datum/dynamic_storyteller/proc/latejoin_draft(mob/living/carbon/human/newPlayer) @@ -180,12 +182,13 @@ Property weights are: for(var/property in property_weights) if(property in rule.property_weights) property_weight += rule.property_weights[property] * property_weights[property] - if(property_weight > 0) - var/threat_weight = 1 - if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) - var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) - threat_weight = 1-abs(1-(LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) - drafted_rules[rule] = rule.get_weight() * property_weight * rule.weight_mult * threat_weight + var/threat_weight = 1 + if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) + var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) + threat_weight = 1-abs(1-(LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) + var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult * threat_weight + if(calced_weight > 0) + drafted_rules[rule] = calced_weight return drafted_rules /datum/dynamic_storyteller/proc/event_draft() @@ -196,8 +199,9 @@ Property weights are: for(var/property in property_weights) if(property in rule.property_weights) property_weight += rule.property_weights[property] * property_weights[property] - if(property_weight > 0) - drafted_rules[rule] = rule.get_weight() + property_weight * rule.weight_mult + var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult + if(calced_weight > 0) + drafted_rules[rule] = calced_weight return drafted_rules From 126ebf1f5e08194763817c739bcb9a71b2f89161 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 01:50:22 -0700 Subject: [PATCH 2/9] Update dynamic_storytellers.dm --- code/game/gamemodes/dynamic/dynamic_storytellers.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_storytellers.dm b/code/game/gamemodes/dynamic/dynamic_storytellers.dm index 21178baa12..ba87342679 100644 --- a/code/game/gamemodes/dynamic/dynamic_storytellers.dm +++ b/code/game/gamemodes/dynamic/dynamic_storytellers.dm @@ -22,14 +22,14 @@ var/datum/game_mode/dynamic/mode = null // Cached as soon as it's made, by dynamic. /** -Property weights are: +Property weights are added to the config weight of the ruleset. They are: "story_potential" -- essentially how many different ways the antag can be played. "trust" -- How much it makes the crew trust each other. Negative values means they're suspicious. Team antags are like this. "chaos" -- How chaotic it makes the round. Has some overlap with "valid" and somewhat contradicts "extended". "valid" -- How likely the non-antag-enemy crew are to get involved, e.g. nukies encouraging the warden to let everyone into the armory, wizard moving around and being a nuisance, nightmare busting lights. "extended" -- How much the antag is conducive to a long round. Nukies and cults are bad for this; Wizard is less bad; and so on. -"conversion" -- Basically a bool. Conversion antags, well, convert. It's its own class for a good reason. +"conversion" -- Basically a bool. Conversion antags, well, convert. It's in its own class 'cause people kinda hate conversion. */ /datum/dynamic_storyteller/proc/start_injection_cooldowns() From 6725ced4536b668be76cf51bb346dd35bbed33dd Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 16:45:16 -0700 Subject: [PATCH 3/9] Makes heretics actually able to be edited in the config. --- code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm | 6 +++--- code/modules/antagonists/eldritch_cult/eldritch_antag.dm | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 766ddcefc7..21afaab261 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -151,15 +151,15 @@ /datum/dynamic_ruleset/roundstart/heretics name = "Heretics" - antag_flag = ROLE_HERETIC + antag_flag = "heretic" antag_datum = /datum/antagonist/heretic protected_roles = list("Prisoner","Security Officer", "Warden", "Detective", "Head of Security", "Captain") restricted_roles = list("AI", "Cyborg") required_candidates = 1 weight = 3 - cost = 20 + cost = 25 scaling_cost = 15 - requirements = list(50,45,45,40,35,20,20,15,10,10) + requirements = list(60,60,60,55,50,50,50,50,50,50) antag_cap = list(1,1,1,1,2,2,2,2,3,3) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm index 367710b110..476a3fed59 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm @@ -6,6 +6,7 @@ job_rank = ROLE_HERETIC antag_hud_type = ANTAG_HUD_HERETIC antag_hud_name = "heretic" + threat = 25 var/give_equipment = TRUE var/list/researched_knowledge = list() var/total_sacrifices = 0 From 9a4c76e7876e634e840d5957573b1fbaaaf5b30b Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 16:47:07 -0700 Subject: [PATCH 4/9] Added property weights to heretic, too. --- code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 21afaab261..34c9e73532 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -160,6 +160,7 @@ cost = 25 scaling_cost = 15 requirements = list(60,60,60,55,50,50,50,50,50,50) + property_weights = list("story_potential" = 1, "trust" = -1, "chaos" = 2, "extended" = -1, "valid" = 2) antag_cap = list(1,1,1,1,2,2,2,2,3,3) From 64e379c7ed68b2c18651791b45b82453162350c6 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 16:51:38 -0700 Subject: [PATCH 5/9] Added property weights to latejoin heretics, too --- code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm | 6 ++++-- code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm index 63574c6475..35da2aaa10 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm @@ -205,8 +205,10 @@ restricted_roles = list("AI","Cyborg") required_candidates = 1 weight = 4 - cost = 10 - requirements = list(40,30,20,10,10,10,10,10,10,10) + cost = 25 + requirements = list(60,60,60,55,50,50,50,50,50,50) + high_population_requirement = 50 + property_weights = list("story_potential" = 1, "trust" = -1, "chaos" = 2, "extended" = -1, "valid" = 2) repeatable = TRUE ////////////////////////////////////////////// diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 34c9e73532..db4ec99558 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -162,6 +162,7 @@ requirements = list(60,60,60,55,50,50,50,50,50,50) property_weights = list("story_potential" = 1, "trust" = -1, "chaos" = 2, "extended" = -1, "valid" = 2) antag_cap = list(1,1,1,1,2,2,2,2,3,3) + high_population_requirement = 50 /datum/dynamic_ruleset/roundstart/heretics/pre_execute() From d8d67d3d3e51ea60b36f3644e85f09f9bd592cab Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 16:51:57 -0700 Subject: [PATCH 6/9] And fixed their antag flag, too --- code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm index 35da2aaa10..d2fa8bcc70 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm @@ -200,7 +200,7 @@ /datum/dynamic_ruleset/latejoin/heretic_smuggler name = "Heretic Smuggler" antag_datum = /datum/antagonist/heretic - antag_flag = ROLE_HERETIC + antag_flag = "latejoin_heretic" protected_roles = list("Security Officer", "Warden", "Detective", "Head of Security", "Captain", "Head of Personnel", "Chief Engineer", "Chief Medical Officer", "Research Director", "Quartermaster") restricted_roles = list("AI","Cyborg") required_candidates = 1 From dd6be82e06cec40c501343bf4a62494ad09980dd Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 18:43:15 -0700 Subject: [PATCH 7/9] Made heretics scale dynamic threat with power. --- .../antagonists/eldritch_cult/eldritch_antag.dm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm index 476a3fed59..79dfbdd7c3 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm @@ -6,7 +6,7 @@ job_rank = ROLE_HERETIC antag_hud_type = ANTAG_HUD_HERETIC antag_hud_name = "heretic" - threat = 25 + threat = 10 var/give_equipment = TRUE var/list/researched_knowledge = list() var/total_sacrifices = 0 @@ -209,6 +209,14 @@ /datum/antagonist/heretic/proc/get_all_knowledge() return researched_knowledge +/datum/antagonist/heretic/threat() + . = ..() + for(var/X in researched_knowledge) + var/datum/eldritch_knowledge/EK = researched_knowledge[X] + . += EK.cost + if(ascended) + . += 20 + //////////////// // Objectives // //////////////// From 19b856aebfdf10476a43251e5c5b2b9eec037714 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 20:23:11 -0700 Subject: [PATCH 8/9] Removed story's curve. --- code/game/gamemodes/dynamic/dynamic_storytellers.dm | 6 ------ 1 file changed, 6 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_storytellers.dm b/code/game/gamemodes/dynamic/dynamic_storytellers.dm index ba87342679..d6d2c8de3e 100644 --- a/code/game/gamemodes/dynamic/dynamic_storytellers.dm +++ b/code/game/gamemodes/dynamic/dynamic_storytellers.dm @@ -331,12 +331,6 @@ Property weights are added to the config weight of the ruleset. They are: flags = USE_PREV_ROUND_WEIGHTS property_weights = list("story_potential" = 2) - -/datum/dynamic_storyteller/story/calculate_threat() - var/current_time = (world.time / SSautotransfer.targettime)*180 - mode.threat_level = round((mode.initial_threat_level*(sin(current_time)/2)+0.75),0.1) - return ..() - /datum/dynamic_storyteller/classic name = "Classic" config_tag = "classic" From 669bab841c813ad462495589a82ed455dc8dbdb5 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 29 Aug 2020 20:44:45 -0700 Subject: [PATCH 9/9] Made cost being more than threat delta more punished. --- code/game/gamemodes/dynamic/dynamic_storytellers.dm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_storytellers.dm b/code/game/gamemodes/dynamic/dynamic_storytellers.dm index d6d2c8de3e..dd281c456f 100644 --- a/code/game/gamemodes/dynamic/dynamic_storytellers.dm +++ b/code/game/gamemodes/dynamic/dynamic_storytellers.dm @@ -147,7 +147,7 @@ Property weights are added to the config weight of the ruleset. They are: property_weight += rule.property_weights[property] * property_weights[property] var/threat_weight = 1 if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) // makes the traitor rulesets always possible anyway - var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) + var/cost_difference = rule.cost-(mode.threat_level-mode.threat) /* Basically, the closer the cost is to the current threat-level-away-from-threat, the more likely it is to pick this particular ruleset. Let's use a toy example: there's 60 threat level and 10 threat spent. @@ -157,7 +157,9 @@ Property weights are added to the config weight of the ruleset. They are: is 2.26 times as likely to be picked, all other things considered. Of course, we don't want it to GUARANTEE the closest, that's no fun, so it's just a weight. */ - threat_weight = abs(1-abs(1-LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) + threat_weight = abs(1-abs(1-LOGISTIC_FUNCTION(2,0.05,abs(cost_difference),0))) + if(cost_difference > 0) + threat_weight /= (1+(cost_difference*0.1)) var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult * threat_weight if(calced_weight > 0) drafted_rules[rule] = calced_weight @@ -184,8 +186,10 @@ Property weights are added to the config weight of the ruleset. They are: property_weight += rule.property_weights[property] * property_weights[property] var/threat_weight = 1 if(!(rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)) - var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat)) - threat_weight = 1-abs(1-(LOGISTIC_FUNCTION(2,0.05,cost_difference,0))) + var/cost_difference = rule.cost-(mode.threat_level-mode.threat) + threat_weight = 1-abs(1-(LOGISTIC_FUNCTION(2,0.05,abs(cost_difference),0))) + if(cost_difference > 0) + threat_weight /= (1+(cost_difference*0.1)) var/calced_weight = (rule.get_weight() + property_weight) * rule.weight_mult * threat_weight if(calced_weight > 0) drafted_rules[rule] = calced_weight