Skip to content

Commit

Permalink
balance: antag paradise mode tweaks (#4620)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimach authored Mar 12, 2024
1 parent 1824342 commit b13b4f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
7 changes: 7 additions & 0 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@
return picked
return null

//Pick a random element by weight from the list and remove it from the list.
/proc/pick_weight_n_take(list/listfrom)
if(listfrom.len > 0)
var/picked = pick_weight_classic(listfrom)
listfrom -= picked
return picked
return null

/**
* Picks multiple unique elements from the suplied list.
Expand Down
11 changes: 6 additions & 5 deletions code/controllers/configuration/entries/config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,14 @@
min_val = 0


/datum/config_entry/str_list/antag_paradise_main_antags
/datum/config_entry/keyed_list/antag_paradise_main_antags
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_NUM
default = list(
ROLE_TRAITOR,
ROLE_VAMPIRE,
ROLE_CHANGELING,
ROLE_TRAITOR = 60,
ROLE_VAMPIRE = 20,
ROLE_CHANGELING = 20,
)
lowercase = TRUE

/datum/config_entry/keyed_list/antag_paradise_special_antags_weights
key_mode = KEY_MODE_TEXT
Expand Down
16 changes: 9 additions & 7 deletions code/game/gamemodes/antag_paradise/antag_paradise.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
pre_double_antags = list()

var/players = roundstart ? num_players() : num_station_players()
calculate_antags(players)
var/scale = CONFIG_GET(number/traitor_scaling) ? CONFIG_GET(number/traitor_scaling) : 10
var/antags_amount
var/special_antag_amount
Expand Down Expand Up @@ -94,7 +93,7 @@
special_antag.special_role = SPECIAL_ROLE_THIEF
special_antag.restricted_roles = restricted_jobs
pre_antags[special_antag] = ROLE_THIEF
antags_amount--
//antags_amount--

if(ROLE_MALF_AI)
if(special_antag_amount)
Expand Down Expand Up @@ -210,9 +209,12 @@
antag_possibilities[ROLE_TRAITOR] = get_players_for_role(ROLE_TRAITOR)
antag_possibilities[ROLE_THIEF] = get_players_for_role(ROLE_THIEF, list("Vox" = 4))

calculate_antags()

return roll_antagonists(antag_possibilities, TRUE)

/datum/game_mode/antag_paradise/proc/calculate_antags(players)
/datum/game_mode/antag_paradise/proc/calculate_antags()
var/players = num_players()
var/list/special_antags_list
if(GLOB.antag_paradise_special_weights)
special_antags_list = GLOB.antag_paradise_special_weights
Expand All @@ -231,7 +233,7 @@

antags_weights = list()

var/list/antag_weight_config = CONFIG_GET(str_list/antag_paradise_main_antags)
var/list/antag_weight_config = CONFIG_GET(keyed_list/antag_paradise_main_antags)
antag_weight_config = antag_weight_config.Copy()

for(var/antag in antag_weight_config)
Expand All @@ -248,13 +250,13 @@
return

var/list/subtype_weights = CONFIG_GET(keyed_list/antag_paradise_subtype_weights)
antags_weights[pick_n_take(antag_weight_config)] = subtype_weights[ANTAG_SINGLE]
antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_SINGLE]
if(!length(antag_weight_config) || mode_type == ANTAG_SINGLE)
return
antags_weights[pick_n_take(antag_weight_config)] = subtype_weights[ANTAG_DOUBLE]
antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_DOUBLE]
if(!length(antag_weight_config) || mode_type == ANTAG_DOUBLE)
return
antags_weights[pick_n_take(antag_weight_config)] = subtype_weights[ANTAG_TRIPPLE]
antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_TRIPPLE]


/datum/game_mode/antag_paradise/post_setup()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@
if(GLOB.antag_paradise_weights)
antags_list = GLOB.antag_paradise_weights
else
antags_list = CONFIG_GET(str_list/antag_paradise_main_antags)
antags_list = CONFIG_GET(keyed_list/antag_paradise_main_antags)
antags_list = antags_list.Copy()
for(var/key in list(ROLE_TRAITOR, ROLE_VAMPIRE, ROLE_CHANGELING, ROLE_THIEF))
antags_list[key] = !!(key in antags_list)
Expand Down Expand Up @@ -1299,7 +1299,7 @@

else if(findtext(command, "weights_normal_"))
if(!GLOB.antag_paradise_weights)
var/list/antags_list = CONFIG_GET(str_list/antag_paradise_main_antags)
var/list/antags_list = CONFIG_GET(keyed_list/antag_paradise_main_antags)
antags_list = antags_list.Copy()
for(var/key in list(ROLE_TRAITOR, ROLE_VAMPIRE, ROLE_CHANGELING, ROLE_THIEF))
antags_list[key] = !!(key in antags_list)
Expand Down

0 comments on commit b13b4f3

Please sign in to comment.