From 1fa133db0afdc702afb6976e91489539da5e8893 Mon Sep 17 00:00:00 2001 From: Zwei <35403274+Gottfrei@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:29:58 +0300 Subject: [PATCH] tweak: Antag Paradise Changeling Weight Adjustment (#5114) * Antag Paradise Changeling Weight Adjustment * Typo * Shift --- .../configuration/entries/config.dm | 34 +++++++++++- .../antag_paradise/antag_paradise.dm | 53 +++++++++++++------ code/modules/admin/topic.dm | 6 +-- config/example/config.txt | 26 +++++++-- 4 files changed, 93 insertions(+), 26 deletions(-) diff --git a/code/controllers/configuration/entries/config.dm b/code/controllers/configuration/entries/config.dm index 4f0c3146d42..beed3b6b075 100644 --- a/code/controllers/configuration/entries/config.dm +++ b/code/controllers/configuration/entries/config.dm @@ -422,15 +422,47 @@ min_val = 0 -/datum/config_entry/keyed_list/antag_paradise_main_antags +/datum/config_entry/str_list/antag_paradise_random_antags_whitelist + lowercase = TRUE + default = list( + ROLE_TRAITOR, + ROLE_VAMPIRE, + ) + + +/datum/config_entry/keyed_list/antag_paradise_single_antags_weights + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + default = list( + ROLE_TRAITOR = 60, + ROLE_THIEF = 0, + ROLE_VAMPIRE = 20, + ROLE_CHANGELING = 0, + ) + + +/datum/config_entry/keyed_list/antag_paradise_double_antags_weights key_mode = KEY_MODE_TEXT value_mode = VALUE_MODE_NUM default = list( ROLE_TRAITOR = 60, + ROLE_THIEF = 0, ROLE_VAMPIRE = 20, ROLE_CHANGELING = 20, ) + +/datum/config_entry/keyed_list/antag_paradise_tripple_antags_weights + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + default = list( + ROLE_TRAITOR = 60, + ROLE_THIEF = 0, + ROLE_VAMPIRE = 20, + ROLE_CHANGELING = 20, + ) + + /datum/config_entry/keyed_list/antag_paradise_special_antags_weights key_mode = KEY_MODE_TEXT value_mode = VALUE_MODE_NUM diff --git a/code/game/gamemodes/antag_paradise/antag_paradise.dm b/code/game/gamemodes/antag_paradise/antag_paradise.dm index 1c30562f55b..1d2c015694b 100644 --- a/code/game/gamemodes/antag_paradise/antag_paradise.dm +++ b/code/game/gamemodes/antag_paradise/antag_paradise.dm @@ -233,30 +233,51 @@ antags_weights = list() - 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) - if(players < antag_required_players[antag]) - antag_weight_config -= antag - - if(!length(antag_weight_config)) - return - var/mode_type = pick_weight_classic(CONFIG_GET(keyed_list/antag_paradise_mode_subtypes)) if(mode_type == ANTAG_RANDOM) - for(var/antag in antag_weight_config) + var/list/random_mode_whitelist = CONFIG_GET(str_list/antag_paradise_random_antags_whitelist) + for(var/antag in list(ROLE_TRAITOR, ROLE_VAMPIRE, ROLE_CHANGELING, ROLE_THIEF)) + if(!(antag in random_mode_whitelist)) + continue antags_weights[antag] = rand(1, 100) return + var/list/single_weights_config = CONFIG_GET(keyed_list/antag_paradise_single_antags_weights) + single_weights_config = single_weights_config.Copy() + for(var/antag in single_weights_config) + if(players < antag_required_players[antag] || single_weights_config[antag] <= 0) + single_weights_config -= antag + if(!length(single_weights_config)) + return var/list/subtype_weights = CONFIG_GET(keyed_list/antag_paradise_subtype_weights) - antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_SINGLE] - if(!length(antag_weight_config) || mode_type == ANTAG_SINGLE) + var/list/choosen_antags = list() + var/single_antag = pick_weight_classic(single_weights_config) + choosen_antags += single_antag + antags_weights[single_antag] = subtype_weights[ANTAG_SINGLE] + if(mode_type == ANTAG_SINGLE) return - antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_DOUBLE] - if(!length(antag_weight_config) || mode_type == ANTAG_DOUBLE) + + var/list/double_weights_config = CONFIG_GET(keyed_list/antag_paradise_double_antags_weights) + double_weights_config = double_weights_config.Copy() - choosen_antags + for(var/antag in double_weights_config) + if(players < antag_required_players[antag] || double_weights_config[antag] <= 0) + double_weights_config -= antag + if(!length(double_weights_config)) + return + var/double_antag = pick_weight_classic(double_weights_config) + choosen_antags += double_antag + antags_weights[double_antag] = subtype_weights[ANTAG_DOUBLE] + if(mode_type == ANTAG_DOUBLE) + return + + var/list/tripple_weights_config = CONFIG_GET(keyed_list/antag_paradise_tripple_antags_weights) + tripple_weights_config = tripple_weights_config.Copy() - choosen_antags + for(var/antag in tripple_weights_config) + if(players < antag_required_players[antag] || tripple_weights_config[antag] <= 0) + tripple_weights_config -= antag + if(!length(tripple_weights_config)) return - antags_weights[pick_weight_n_take(antag_weight_config)] = subtype_weights[ANTAG_TRIPPLE] + antags_weights[pick_weight_classic(tripple_weights_config)] = subtype_weights[ANTAG_TRIPPLE] /datum/game_mode/antag_paradise/post_setup() diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 452c723a966..af88acd4105 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1248,10 +1248,8 @@ if(GLOB.antag_paradise_weights) antags_list = GLOB.antag_paradise_weights else - antags_list = CONFIG_GET(keyed_list/antag_paradise_main_antags) + antags_list = CONFIG_GET(keyed_list/antag_paradise_single_antags_weights) 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) for(var/antag in antags_list) dat += {"