Skip to content

Commit

Permalink
adds previous round weighting to events, so that we aren't as likely …
Browse files Browse the repository at this point in the history
…to double roll large events like blood cult
  • Loading branch information
dwasint committed Oct 16, 2023
1 parent 3344851 commit b5291a6
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions code/__HELPERS/roundend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ GLOBAL_LIST_INIT(round_end_images, world.file2list("data/image_urls.txt"))
//Set news report and mode result
mode.set_round_result()
SSgamemode.round_end_report()
SSgamemode.store_roundend_data() // store data on roundend for next round

to_chat(world, span_infoplain(span_big(span_bold("<BR><BR><BR>The round has ended."))))
log_game("The round has ended.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/datum/round_event_control/antagonist
reoccurence_penalty_multiplier = 0
track = EVENT_TRACK_ROLESET
///list of required roles, needed for this to form
var/list/exclusive_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
min_players = 30
roundstart = TRUE
earliest_start = 0 SECONDS
weight = 4

/datum/round_event/antagonist/solo/bloodcult
excute_round_end_reports = TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)
exclusive_roles = list(JOB_AI)
required_enemies = 4
weight = 2
weight = 4

/datum/round_event_control/antagonist/solo/malf/trim_candidates(list/candidates)
for(var/mob/living/player in candidates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
min_players = 35
roundstart = TRUE
earliest_start = 0 SECONDS
weight = 4

/datum/round_event/antagonist/solo/nuclear_operative
excute_round_end_reports = TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
min_players = 35
roundstart = TRUE
earliest_start = 0 SECONDS
weight = 4

/datum/antagonist/rev/head/event_trigger
remove_clumsy = TRUE
Expand Down
28 changes: 28 additions & 0 deletions monkestation/code/modules/storytellers/gamemode_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ SUBSYSTEM_DEF(gamemode)

var/wizardmode = FALSE

var/datum/round_event_control/current_roundstart_event
var/list/last_round_events = list()
var/ran_roundstart = FALSE
var/list/triggered_round_events = list()

/datum/controller/subsystem/gamemode/Initialize(time, zlevel)
// Populate event pools
Expand Down Expand Up @@ -170,6 +172,8 @@ SUBSYSTEM_DEF(gamemode)
continue
event_pools[event.track] += event //Add it to the categorized event pools

load_roundstart_data()

// return ..()


Expand Down Expand Up @@ -1088,3 +1092,27 @@ SUBSYSTEM_DEF(gamemode)
if(!istype(event))
continue
event.round_end_report()


/datum/controller/subsystem/gamemode/proc/store_roundend_data()
var/congealed_string = ""
for(var/event_name as anything in triggered_round_events)
congealed_string += event_name
congealed_string += ","
text2file(congealed_string, "data/last_round_events.txt")

/datum/controller/subsystem/gamemode/proc/load_roundstart_data()
var/massive_string = trim(file2text("data/last_round_events.txt"))
if(fexists("data/last_round_events.txt"))
fdel("data/last_round_events.txt")
if(!massive_string)
return
last_round_events = splittext(massive_string, ",")

if(!length(last_round_events))
return
for(var/event_name as anything in last_round_events)
for(var/datum/round_event_control/listed as anything in control)
if(listed.name != event_name)
continue
listed.occurrences++
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@
if(bought_event.roundstart)
if(!ignores_roundstart)
SSgamemode.ran_roundstart = TRUE
SSgamemode.current_roundstart_event = bought_event
mode.TriggerEvent(bought_event, forced)
else
mode.schedule_event(bought_event, (rand(3, 4) MINUTES), total_cost, _forced = forced)
SSgamemode.triggered_round_events |= bought_event.name

/// Calculates the weights of the events from a passed track.
/datum/storyteller/proc/calculate_weights(track)
Expand Down

0 comments on commit b5291a6

Please sign in to comment.