Skip to content

Commit

Permalink
xeno_balancer_000
Browse files Browse the repository at this point in the history
  • Loading branch information
homexp13 committed Sep 2, 2024
1 parent a2c7189 commit 92463a3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
15 changes: 15 additions & 0 deletions code/datums/gamemodes/_game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions code/datums/gamemodes/distress.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(!.)
Expand Down
10 changes: 9 additions & 1 deletion code/datums/gamemodes/extermination.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
. = ..()
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions code/datums/gamemodes/infestation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand Down
8 changes: 8 additions & 0 deletions code/datums/gamemodes/points_defence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 92463a3

Please sign in to comment.