From 3b4af60d9a2616bd9ee6d24fcfe51074846c8b3d Mon Sep 17 00:00:00 2001 From: Rykka Stormheart Date: Sun, 2 Apr 2023 15:38:44 -0700 Subject: [PATCH] Adds support for mobs enraging Mobs can now INCREASE how fast they move and how fast they attack by injury level if they have injury_enrages set TRUE --- code/modules/mob/living/simple_mob/combat.dm | 14 ++++++++++++-- code/modules/mob/living/simple_mob/simple_mob.dm | 8 +++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/simple_mob/combat.dm b/code/modules/mob/living/simple_mob/combat.dm index 0efc987f8cc..7c8ccfadc5c 100644 --- a/code/modules/mob/living/simple_mob/combat.dm +++ b/code/modules/mob/living/simple_mob/combat.dm @@ -14,7 +14,12 @@ handle_attack_delay(A, melee_attack_delay) // This will sleep this proc for a bit, which is why waitfor is false. // Cooldown testing is done at click code (for players) and interface code (for AI). - setClickCooldown(get_attack_speed() + ((injury_level / 2) SECONDS)) // VOREStation Edit: Delay how fast we can attack by our injury level / 2 + // VOREStation Edit Start: Simplemob Injury + if(injury_enrages) + setClickCooldown(get_attack_speed() - ((injury_level / 2) SECONDS)) // Increase how fast we can attack by our injury level / 2 + else + setClickCooldown(get_attack_speed() + ((injury_level / 2) SECONDS)) // Delay how fast we can attack by our injury level / 2 + // VOREStation Edit Stop: Simplemob Injury // Returns a value, but will be lost if . = do_attack(A, their_T) @@ -90,7 +95,12 @@ if(!istype(A) || QDELETED(A)) return - setClickCooldown(get_attack_speed() + ((injury_level / 2) SECONDS)) // VOREStation Edit: Delay how fast we can attack by our injury level / 2 + // VOREStation Edit Start: Simplemob Injury + if(injury_enrages) + setClickCooldown(get_attack_speed() - ((injury_level / 2) SECONDS)) // Increase how fast we can attack by our injury level / 2 + else + setClickCooldown(get_attack_speed() + ((injury_level / 2) SECONDS)) // Delay how fast we can attack by our injury level / 2 + // VOREStation Edit Stop: Simplemob Injury face_atom(A) diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index 7113ae8925e..019d254c41a 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -172,6 +172,7 @@ var/damage_fatigue_mult = 1 // Our multiplier for how heavily mobs are affected by injury. [UPDATE THIS IF THE FORMULA CHANGES]: Formula = injury_level = round(rand(2,6) * damage_fatigue_mult * clamp(((rand(2,5) * (health / getMaxHealth())) - rand(0,2)), 1, 20)) var/injury_level = 0 // What our injury level is. Rather than being the flat damage, this is the amount added to various delays to simulate injuries in a manner as lightweight as possible. var/threshold = 0.6 // When we start slowing down. Configure this setting per-mob. Default is 60% + var/injury_enrages = 0 // Do injuries enrage (aka strengthen) our mob? If yes, we'll interpret how hurt we are differently. // VOREStation Add End /mob/living/simple_mob/Initialize() @@ -264,7 +265,12 @@ if(m_intent == "walk") . *= 1.5 - . += injury_level // VOREStation Edit: Adding our injury level delay to our total + // VOREStation Edit Start + if(injury_enrages) // If we enrage, then do this, else + . -= injury_level + else + . += injury_level + // VOREStation Edit Stop . += config.animal_delay