|
|
|
@@ -127,6 +127,8 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
var/only_ruleset_executed = FALSE
|
|
|
|
|
/// Antags rolled by rules so far, to keep track of and discourage scaling past a certain ratio of crew/antags especially on lowpop.
|
|
|
|
|
var/antags_rolled = 0
|
|
|
|
|
// Arbitrary threat addition, for fudging purposes.
|
|
|
|
|
var/added_threat = 50
|
|
|
|
|
|
|
|
|
|
/datum/game_mode/dynamic/New() // i have NO IDEA if this is the proper way to do this.
|
|
|
|
|
..()
|
|
|
|
@@ -172,9 +174,9 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
else
|
|
|
|
|
dat += "none.<br>"
|
|
|
|
|
dat += "<br>Injection Timers: (<b>[storyteller.get_injection_chance(TRUE)]%</b> chance)<BR>"
|
|
|
|
|
dat += "Latejoin: [(latejoin_injection_cooldown-world.time)>60*10 ? "[round((latejoin_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(latejoin_injection_cooldown-world.time)] seconds"] <a href='?src=\ref[src];[HrefToken()];injectlate=1'>\[Now!\]</a><BR>"
|
|
|
|
|
dat += "Midround: [(midround_injection_cooldown-world.time)>60*10 ? "[round((midround_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(midround_injection_cooldown-world.time)] seconds"] <a href='?src=\ref[src];[HrefToken()];injectmid=1'>\[Now!\]</a><BR>"
|
|
|
|
|
dat += "Event: [(event_injection_cooldown-world.time)>60*10 ? "[round((event_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(event_injection_cooldown-world.time)] seconds"] <a href='?src=\ref[src];[HrefToken()];forceevent=1'>\[Now!\]</a><BR>"
|
|
|
|
|
dat += "Latejoin: [(latejoin_injection_cooldown-world.time)>60*10 ? "[round((latejoin_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(latejoin_injection_cooldown-world.time)/10] seconds"] <a href='?src=\ref[src];[HrefToken()];injectlate=1'>\[Now!\]</a><BR>"
|
|
|
|
|
dat += "Midround: [(midround_injection_cooldown-world.time)>60*10 ? "[round((midround_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(midround_injection_cooldown-world.time)/10] seconds"] <a href='?src=\ref[src];[HrefToken()];injectmid=1'>\[Now!\]</a><BR>"
|
|
|
|
|
dat += "Event: [(event_injection_cooldown-world.time)>60*10 ? "[round((event_injection_cooldown-world.time)/60/10,0.1)] minutes" : "[(event_injection_cooldown-world.time)/10] seconds"] <a href='?src=\ref[src];[HrefToken()];forceevent=1'>\[Now!\]</a><BR>"
|
|
|
|
|
usr << browse(dat.Join(), "window=gamemode_panel;size=500x500")
|
|
|
|
|
|
|
|
|
|
/datum/game_mode/dynamic/Topic(href, href_list)
|
|
|
|
@@ -511,7 +513,7 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
starting_rule.trim_candidates()
|
|
|
|
|
starting_rule.scale_up(extra_rulesets_amount, threat)
|
|
|
|
|
if (starting_rule.pre_execute())
|
|
|
|
|
log_threat("[starting_rule.ruletype] - <b>[starting_rule.name]</b> -[starting_rule.cost + starting_rule.scaled_times * starting_rule.scaling_cost] threat", verbose = TRUE)
|
|
|
|
|
log_threat("[starting_rule.ruletype] - <b>[starting_rule.name]</b> [starting_rule.cost + starting_rule.scaled_times * starting_rule.scaling_cost] threat", verbose = TRUE)
|
|
|
|
|
if(starting_rule.flags & HIGHLANDER_RULESET)
|
|
|
|
|
highlander_executed = TRUE
|
|
|
|
|
else if(starting_rule.flags & ONLY_RULESET)
|
|
|
|
@@ -605,7 +607,7 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
if ((forced || (new_rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level) && new_rule.cost <= threat)))
|
|
|
|
|
new_rule.trim_candidates()
|
|
|
|
|
if (new_rule.ready(forced))
|
|
|
|
|
log_threat("[new_rule.ruletype] - <b>[new_rule.name]</b> -[new_rule.cost] threat", verbose = TRUE)
|
|
|
|
|
log_threat("[new_rule.ruletype] - <b>[new_rule.name]</b> [new_rule.cost] threat", verbose = TRUE)
|
|
|
|
|
if (new_rule.execute()) // This should never fail since ready() returned 1
|
|
|
|
|
if(new_rule.flags & HIGHLANDER_RULESET)
|
|
|
|
|
highlander_executed = TRUE
|
|
|
|
@@ -625,7 +627,7 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
var/datum/dynamic_ruleset/rule = sent_rule
|
|
|
|
|
if (rule.execute())
|
|
|
|
|
log_game("DYNAMIC: Injected a [rule.ruletype == "latejoin" ? "latejoin" : "midround"] ruleset [rule.name].")
|
|
|
|
|
log_threat("[rule.ruletype] [rule.name] spent [rule.cost]", verbose = TRUE)
|
|
|
|
|
log_threat("[rule.ruletype] [rule.name] added [rule.cost]", verbose = TRUE)
|
|
|
|
|
if(rule.flags & HIGHLANDER_RULESET)
|
|
|
|
|
highlander_executed = TRUE
|
|
|
|
|
else if(rule.flags & ONLY_RULESET)
|
|
|
|
@@ -712,8 +714,7 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
current_players[CURRENT_OBSERVERS].Add(M)
|
|
|
|
|
continue
|
|
|
|
|
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() + 50 // 50 is the centerpoint, so we want it to be around 50
|
|
|
|
|
|
|
|
|
|
threat = storyteller.calculate_threat() + added_threat
|
|
|
|
|
/// Removes type from the list
|
|
|
|
|
/datum/game_mode/dynamic/proc/remove_from_list(list/type_list, type)
|
|
|
|
|
for(var/I in type_list)
|
|
|
|
@@ -766,20 +767,20 @@ GLOBAL_VAR_INIT(dynamic_storyteller_type, /datum/dynamic_storyteller/classic)
|
|
|
|
|
/// Increase the threat level.
|
|
|
|
|
/datum/game_mode/dynamic/proc/create_threat(gain)
|
|
|
|
|
threat_level += gain
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",gain,"Created threat")
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",gain,"Created threat level")
|
|
|
|
|
log_threat("[gain] created. Threat level is now [threat_level].", verbose = TRUE)
|
|
|
|
|
|
|
|
|
|
/// Decrease the threat level.
|
|
|
|
|
/datum/game_mode/dynamic/proc/remove_threat(loss)
|
|
|
|
|
threat_level -= loss
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",loss,"Removed threat")
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",loss,"Removed threat level")
|
|
|
|
|
log_threat("[loss] removed. Threat level is now [threat_level].", verbose = TRUE)
|
|
|
|
|
|
|
|
|
|
/// Fill up more of the threat level.
|
|
|
|
|
/datum/game_mode/dynamic/proc/spend_threat(cost)
|
|
|
|
|
threat += cost
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",cost,"Threat spent")
|
|
|
|
|
log_threat("[cost] spent. Threat is now [threat].", verbose = TRUE)
|
|
|
|
|
added_threat += cost
|
|
|
|
|
SSblackbox.record_feedback("tally","dynamic_threat",cost,"Threat added")
|
|
|
|
|
log_threat("[cost] added. Threat is now [threat].", verbose = TRUE)
|
|
|
|
|
|
|
|
|
|
/// Turns the value generated by lorentz distribution to threat value between 0 and 100.
|
|
|
|
|
/datum/game_mode/dynamic/proc/lorentz_to_threat(x)
|
|
|
|
|