Skip to content

Commit

Permalink
Pylons now count only groundside marines, xenos get major boost to ev…
Browse files Browse the repository at this point in the history
…o speed for 3 minutes after hijack (#5122)

# About the pull request
Pylons give larva only up to 50% of groundside (weighted) marines,
instead of 40% of all humans.
Xenos get major boost to evo speed for 3 minutes after hijack, also
hijacking removes ovi cd.

# Explain why it's good for the game
Larva surge works this way (but for shipside), and pylons were kinda
meant to work this way too. Current implementation encourages xenos to
delay hijack as long as possible to get the maximum larva, get evo etc.
which is not good. It shouldn't break balance too much, you should be
able to defeat marines if you have 40% of their force.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl: ihatethisengine
balance: Pylons give larva only up to 50% of groundside (weighted)
marines, instead of 40% of all humans.
balance: Xenos get major boost to evo speed for 3 minutes after hijack.
Hijacking resets ovi cooldown.
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
ihatethisengine and Drulikar authored Jan 6, 2024
1 parent 5eeb69f commit 30bd13c
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 20 deletions.
11 changes: 11 additions & 0 deletions code/__DEFINES/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@
/// The time until you can re-corrupt a comms relay after the last pylon was destroyed
#define XENO_PYLON_DESTRUCTION_DELAY (5 MINUTES)

/// Evolution boost during hijack
#define XENO_HIJACK_EVILUTION_BUFF 10

/// For how long the buff lasts
#define XENO_HIJACK_EVILUTION_TIME (3 MINUTES)

/// Xenos need to have their number to marines ratio lower than this to get larvae from pylons
#define ENDGAME_LARVA_CAP_MULTIPLIER 0.5

/// What percent of their numbers xeno get from pylons
#define LARVA_ADDITION_MULTIPLIER 0.10

/// The time against away_timer when an AFK xeno larva can be replaced
#define XENO_LEAVE_TIMER_LARVA 80 //80 seconds
Expand Down
11 changes: 11 additions & 0 deletions code/controllers/subsystem/x_evolution.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ SUBSYSTEM_DEF(xevolution)
var/time_ratio_modifier = 0.4

var/list/boost_power = list()
var/list/overridden_power = list()
var/force_boost_power = FALSE // Debugging only

/datum/controller/subsystem/xevolution/Initialize(start_timeofday)
var/datum/hive_status/HS
for(var/hivenumber in GLOB.hive_datum)
HS = GLOB.hive_datum[hivenumber]
boost_power[HS.hivenumber] = 1
overridden_power[HS.hivenumber] = FALSE
return SS_INIT_SUCCESS

/datum/controller/subsystem/xevolution/fire(resumed = FALSE)
Expand All @@ -27,6 +29,9 @@ SUBSYSTEM_DEF(xevolution)
if(!HS)
continue

if(overridden_power[HS.hivenumber])
continue

if(!HS.dynamic_evolution)
boost_power[HS.hivenumber] = HS.evolution_rate + HS.evolution_bonus
HS.hive_ui.update_burrowed_larva()
Expand Down Expand Up @@ -54,6 +59,12 @@ SUBSYSTEM_DEF(xevolution)
/datum/controller/subsystem/xevolution/proc/get_evolution_boost_power(hivenumber)
return boost_power[hivenumber]

/datum/controller/subsystem/xevolution/proc/override_power(hivenumber, power, override)
var/datum/hive_status/hive_status = GLOB.hive_datum[hivenumber]
boost_power[hivenumber] = power
overridden_power[hivenumber] = override
hive_status.hive_ui.update_burrowed_larva()

#undef EVOLUTION_INCREMENT_TIME
#undef BOOST_POWER_MIN
#undef BOOST_POWER_MAX
21 changes: 4 additions & 17 deletions code/modules/cm_aliens/structures/special/pylon_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
xeno_announcement(SPAN_XENOANNOUNCE("We have lost our control of the tall's communication relay at [get_area(src)]."), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has lost control of the tall's communication relay at [get_area(src)]."), hivenumber, XENO_GENERAL_ANNOUNCE)

linked_hive.hive_ui.update_pylon_status()
return ..()

/// Checks if all comms towers are connected and then starts end game content on all pylons if they are
Expand All @@ -177,11 +177,9 @@
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has harnessed the tall's communication relay at [get_area(src)].[linked_hive.faction_is_ally(checked_hive.name) ? "" : " Stop them!"]"), hivenumber, XENO_GENERAL_ANNOUNCE)

activated = TRUE
linked_hive.check_if_hit_larva_from_pylon_limit()
addtimer(CALLBACK(src, PROC_REF(give_larva)), XENO_PYLON_ACTIVATION_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_LOOP|TIMER_DELETE_ME)

#define ENDGAME_LARVA_CAP_MULTIPLIER 0.4
#define LARVA_ADDITION_MULTIPLIER 0.10

/// Looped proc via timer to give larva after time
/obj/effect/alien/resin/special/pylon/endgame/proc/give_larva()
if(!activated)
Expand All @@ -190,24 +188,13 @@
if(!linked_hive.hive_location || !linked_hive.living_xeno_queen)
return

var/list/hive_xenos = linked_hive.totalXenos.Copy()

for(var/mob/living/carbon/xenomorph/xeno in hive_xenos)
if(!xeno.counts_for_slots)
hive_xenos -= xeno

var/real_total_xeno_count = length(hive_xenos) + linked_hive.stored_larva

if(real_total_xeno_count > (length(GLOB.alive_human_list) * ENDGAME_LARVA_CAP_MULTIPLIER))
if(linked_hive.check_if_hit_larva_from_pylon_limit())
return

linked_hive.partial_larva += real_total_xeno_count * LARVA_ADDITION_MULTIPLIER
linked_hive.partial_larva += (linked_hive.get_real_total_xeno_count() + linked_hive.stored_larva) * LARVA_ADDITION_MULTIPLIER
linked_hive.convert_partial_larva_to_full_larva()
linked_hive.hive_ui.update_burrowed_larva()

#undef ENDGAME_LARVA_CAP_MULTIPLIER
#undef LARVA_ADDITION_MULTIPLIER

//Hive Core - Generates strong weeds, supports other buildings
/obj/effect/alien/resin/special/pylon/core
name = XENO_STRUCTURE_CORE
Expand Down
31 changes: 30 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/hive_status.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
var/hardcore = FALSE
/// Set to false if you want to prevent getting burrowed larva from latejoin marines
var/latejoin_burrowed = TRUE
/// If hit limit of larva from pylons
var/hit_larva_pylon_limit = FALSE

var/list/hive_inherant_traits

Expand Down Expand Up @@ -933,6 +935,30 @@

return TRUE

// Get amount of real xenos, don't count lessers/huggers
/datum/hive_status/proc/get_real_total_xeno_count()
var/count = 0
for(var/mob/living/carbon/xenomorph/xeno as anything in totalXenos)
if(xeno.counts_for_slots)
count++
return count

// Checks if we hit larva limit
/datum/hive_status/proc/check_if_hit_larva_from_pylon_limit()
var/groundside_humans_weighted_count = 0
for(var/mob/living/carbon/human/current_human as anything in GLOB.alive_human_list)
if(!(isspecieshuman(current_human) || isspeciessynth(current_human)))
continue
var/datum/job/job = GLOB.RoleAuthority.roles_for_mode[current_human.job]
if(!job)
continue
var/turf/turf = get_turf(current_human)
if(is_ground_level(turf?.z))
groundside_humans_weighted_count += GLOB.RoleAuthority.calculate_role_weight(job)
hit_larva_pylon_limit = (get_real_total_xeno_count() + stored_larva) > (groundside_humans_weighted_count * ENDGAME_LARVA_CAP_MULTIPLIER)
hive_ui.update_pylon_status()
return hit_larva_pylon_limit

///Called by /obj/item/alien_embryo when a host is bursting to determine extra larva per burst
/datum/hive_status/proc/increase_larva_after_burst()
var/extra_per_burst = CONFIG_GET(number/extra_larva_per_burst)
Expand Down Expand Up @@ -1230,7 +1256,6 @@
if(target_hive.allies[name]) //autobreak alliance on betrayal
target_hive.change_stance(name, FALSE)


/datum/hive_status/corrupted/change_stance(faction, should_ally)
. = ..()
if(allies[faction])
Expand Down Expand Up @@ -1283,6 +1308,10 @@
xeno_message(SPAN_XENOANNOUNCE("You sense that [english_list(defectors)] turned their backs against their sisters and the Queen in favor of their slavemasters!"), 3, hivenumber)
defectors.Cut()

/datum/hive_status/proc/override_evilution(evil, override)
if(SSxevolution)
SSxevolution.override_power(hivenumber, evil, override)

//Xeno Resin Mark Shit, the very best place for it too :0)
//Defines at the bottom of this list here will show up at the top in the mark menu
/datum/xeno_mark_define
Expand Down
14 changes: 14 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/hive_status_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var/hive_location
var/burrowed_larva
var/evilution_level
var/pylon_status

var/data_initialized = FALSE

Expand Down Expand Up @@ -104,6 +105,7 @@
update_xeno_vitals()
update_xeno_keys(FALSE)
update_xeno_info(FALSE)
update_pylon_status(FALSE)

if(send_update)
SStgui.update_uis(src)
Expand All @@ -113,8 +115,19 @@
data_initialized = TRUE
update_all_xeno_data(FALSE)
update_burrowed_larva(FALSE)
update_pylon_status(FALSE)
SStgui.update_uis(src)

/datum/hive_status_ui/proc/update_pylon_status(send_update = TRUE)
if(assoc_hive.get_structure_count(XENO_STRUCTURE_PYLON) < 1)
pylon_status = ""
else if(assoc_hive.hit_larva_pylon_limit)
pylon_status = "The hive's power has surpassed what the pylons can provide."
else
pylon_status = "Pylons are strengthening our numbers!"
if(send_update)
SStgui.update_uis(src)

/datum/hive_status_ui/ui_state(mob/user)
return GLOB.hive_state[assoc_hive.internal_faction]

Expand All @@ -141,6 +154,7 @@
.["hive_location"] = hive_location
.["burrowed_larva"] = burrowed_larva
.["evilution_level"] = evilution_level
.["pylon_status"] = pylon_status

var/mob/living/carbon/xenomorph/queen/Q = user
.["is_in_ovi"] = istype(Q) && Q.ovipositor
Expand Down
10 changes: 8 additions & 2 deletions code/modules/shuttle/computers/dropship_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@
return

/obj/structure/machinery/computer/shuttle/dropship/flight/proc/hijack(mob/user, force = FALSE)

// select crash location
var/turf/source_turf = get_turf(src)
var/obj/docking_port/mobile/marine_dropship/dropship = SSshuttle.getShuttle(shuttleId)
Expand Down Expand Up @@ -307,7 +306,14 @@
hivenumber = xeno.hivenumber
xeno_message(SPAN_XENOANNOUNCE("The Queen has commanded the metal bird to depart for the metal hive in the sky! Rejoice!"), 3, hivenumber)
xeno_message(SPAN_XENOANNOUNCE("The hive swells with power! You will now steadily gain pooled larva over time."), 2, hivenumber)
GLOB.hive_datum[hivenumber].abandon_on_hijack()
var/datum/hive_status/hive = GLOB.hive_datum[hivenumber]
hive.abandon_on_hijack()
var/original_evilution = hive.evolution_bonus
hive.override_evilution(XENO_HIJACK_EVILUTION_BUFF, TRUE)
if(hive.living_xeno_queen)
var/datum/action/xeno_action/onclick/grow_ovipositor/ovi_ability = get_xeno_action_by_type(hive.living_xeno_queen, /datum/action/xeno_action/onclick/grow_ovipositor)
ovi_ability.reduce_cooldown(ovi_ability.xeno_cooldown)
addtimer(CALLBACK(hive, TYPE_PROC_REF(/datum/hive_status, override_evilution), original_evilution, FALSE), XENO_HIJACK_EVILUTION_TIME)

// Notify the yautja too so they stop the hunt
message_all_yautja("The serpent Queen has commanded the landing shuttle to depart.")
Expand Down
6 changes: 6 additions & 0 deletions tgui/packages/tgui/interfaces/HiveStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const GeneralInformation = (props, context) => {
total_xenos,
burrowed_larva,
evilution_level,
pylon_status,
} = data;

return (
Expand Down Expand Up @@ -142,6 +143,11 @@ const GeneralInformation = (props, context) => {
<Flex.Item>
<i>Evilution: {evilution_level}</i>
</Flex.Item>
{pylon_status && (
<Flex.Item>
<i>{pylon_status}</i>
</Flex.Item>
)}
</Flex>
);
};
Expand Down

0 comments on commit 30bd13c

Please sign in to comment.