From 92463a3dfba374813c9631f40033b5737481820f Mon Sep 17 00:00:00 2001 From: homexp13 Date: Mon, 2 Sep 2024 20:25:58 +0300 Subject: [PATCH] xeno_balancer_000 --- code/datums/gamemodes/_game_mode.dm | 15 +++++++++++++++ code/datums/gamemodes/distress.dm | 3 +++ code/datums/gamemodes/extermination.dm | 10 +++++++++- code/datums/gamemodes/infestation.dm | 4 ++++ code/datums/gamemodes/points_defence.dm | 8 ++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/code/datums/gamemodes/_game_mode.dm b/code/datums/gamemodes/_game_mode.dm index 523b76c7cf1..6582e0a5fa2 100644 --- a/code/datums/gamemodes/_game_mode.dm +++ b/code/datums/gamemodes/_game_mode.dm @@ -1112,3 +1112,18 @@ GLOBAL_LIST_INIT(bioscan_locations, list( new_predator.apply_assigned_role_to_spawn(job) job.after_spawn(new_predator) qdel(pred_candidate) + +/datum/game_mode/proc/get_scaling_offset() + var/json_file = file("data/scaling_offset/[config_tag].json") + if(!fexists(json_file)) + return 0 + return json_decode(file2text(json_file)) + +/datum/game_mode/proc/save_scaling_offset(scaling = 0) + var/json_file = file("data/scaling_offset/[config_tag].json") + fdel(json_file) + WRITE_FILE(json_file, json_encode(scaling)) + +/datum/game_mode/proc/adjust_scaling_offset(scaling = 0) + var/scaling_offset = get_scaling_offset() + scaling + save_scaling_offset(scaling_offset) diff --git a/code/datums/gamemodes/distress.dm b/code/datums/gamemodes/distress.dm index 6706c3f063f..eb5c0aa471f 100644 --- a/code/datums/gamemodes/distress.dm +++ b/code/datums/gamemodes/distress.dm @@ -46,6 +46,9 @@ if(isxenolarva(xeno)) // Larva xeno.evolution_stored = xeno.xeno_caste.evolution_threshold //Immediate roundstart evo for larva. + var/offset = get_scaling_offset() + silo_scaling += offset + /datum/game_mode/infestation/distress/scale_roles(initial_players_assigned) . = ..() if(!.) diff --git a/code/datums/gamemodes/extermination.dm b/code/datums/gamemodes/extermination.dm index 65f5cfb9463..c046a986a98 100644 --- a/code/datums/gamemodes/extermination.dm +++ b/code/datums/gamemodes/extermination.dm @@ -14,7 +14,7 @@ ///Multiplier for xenos, increases over time var/xeno_factor = 1 ///How much xeno_factor you get for progress on discs - var/xeno_factor_per_progress_on_disk = 0.1 + var/xeno_factor_per_progress_on_disk = 0.05 /datum/game_mode/infestation/distress/extermination/post_setup() . = ..() @@ -26,6 +26,9 @@ RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_DIFFUSED, PROC_REF(on_nuclear_diffuse)) RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_START, PROC_REF(on_nuke_started)) + var/offset = get_scaling_offset() + xeno_factor += offset + ///Receive notifications about disks generation progress /datum/game_mode/infestation/distress/extermination/proc/increase_xeno_factor(datum/source, obj/machinery/computer/nuke_disk_generator/generatingcomputer) SIGNAL_HANDLER @@ -52,11 +55,13 @@ if(round_stage == INFESTATION_DROPSHIP_CAPTURED_XENOS) message_admins("Round finished: [MODE_INFESTATION_X_MINOR]") round_finished = MODE_INFESTATION_X_MINOR + adjust_scaling_offset(-0.01) return TRUE if(planet_nuked == INFESTATION_NUKE_COMPLETED) message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines managed to nuke the colony round_finished = MODE_INFESTATION_M_MAJOR + adjust_scaling_offset(0.01) return TRUE if(!num_humans) @@ -66,6 +71,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped out ALL the marines without hijacking, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE if(!num_xenos) if(round_stage == INFESTATION_MARINE_CRASHING) @@ -74,6 +80,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines win big round_finished = MODE_INFESTATION_M_MAJOR + adjust_scaling_offset(0.01) return TRUE if(round_stage == INFESTATION_MARINE_CRASHING && !num_humans_ship) if(SSevacuation.human_escaped > SSevacuation.initial_human_on_ship * 0.5) @@ -82,6 +89,7 @@ return message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped our marines, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE return FALSE diff --git a/code/datums/gamemodes/infestation.dm b/code/datums/gamemodes/infestation.dm index ea863b419d7..bc7368c284d 100644 --- a/code/datums/gamemodes/infestation.dm +++ b/code/datums/gamemodes/infestation.dm @@ -177,6 +177,7 @@ if(round_stage == INFESTATION_DROPSHIP_CAPTURED_XENOS) message_admins("Round finished: [MODE_INFESTATION_X_MINOR]") round_finished = MODE_INFESTATION_X_MINOR + adjust_scaling_offset(-0.01) return TRUE if(!num_humans) @@ -186,6 +187,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped out ALL the marines without hijacking, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE if(!num_xenos) if(round_stage == INFESTATION_MARINE_CRASHING) @@ -194,6 +196,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines win big round_finished = MODE_INFESTATION_M_MAJOR + adjust_scaling_offset(0.01) return TRUE if(round_stage == INFESTATION_MARINE_CRASHING && !num_humans_ship) if(SSevacuation.human_escaped > SSevacuation.initial_human_on_ship * 0.5) @@ -202,6 +205,7 @@ return message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped our marines, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE return FALSE diff --git a/code/datums/gamemodes/points_defence.dm b/code/datums/gamemodes/points_defence.dm index 11d55b068b5..8005bf2abf7 100644 --- a/code/datums/gamemodes/points_defence.dm +++ b/code/datums/gamemodes/points_defence.dm @@ -137,6 +137,9 @@ new /obj/structure/xeno/core(T) GLOB.xenoden_cores_locs -= T + var/offset = get_scaling_offset() + firts_stage_xeno_factor += offset + #ifdef TESTING marine_victory_point = points_to_win xeno_victory_point = points_to_win @@ -163,6 +166,7 @@ if(round_stage == INFESTATION_DROPSHIP_CAPTURED_XENOS) message_admins("Round finished: [MODE_INFESTATION_X_MINOR]") round_finished = MODE_INFESTATION_X_MINOR + adjust_scaling_offset(-0.01) return TRUE if(round_stage == INFESTATION_MARINE_MINOR) @@ -173,6 +177,7 @@ if(round_stage == INFESTATION_MARIN_RUSH_MAJOR) message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") round_finished = MODE_INFESTATION_M_MAJOR + adjust_scaling_offset(0.01) return TRUE if(!num_humans) @@ -182,6 +187,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped out ALL the marines without hijacking, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE if(!num_xenos) if(round_stage == INFESTATION_MARINE_CRASHING) @@ -190,6 +196,7 @@ return TRUE message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines win big round_finished = MODE_INFESTATION_M_MAJOR + adjust_scaling_offset(0.01) return TRUE if(round_stage == INFESTATION_MARINE_CRASHING && !num_humans_ship) if(SSevacuation.human_escaped > SSevacuation.initial_human_on_ship * 0.5) @@ -198,6 +205,7 @@ return message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped our marines, xeno major victory round_finished = MODE_INFESTATION_X_MAJOR + adjust_scaling_offset(-0.01) return TRUE return FALSE