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
This commit is contained in:
Rykka Stormheart
2023-04-02 15:38:44 -07:00
parent 8e3aca8562
commit 3b4af60d9a
2 changed files with 19 additions and 3 deletions
+12 -2
View File
@@ -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)
@@ -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