-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathheal_react.dm
78 lines (65 loc) · 2.81 KB
/
heal_react.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/datum/component/heal_react
/datum/component/heal_react/Initialize()
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
/datum/component/heal_react/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_APPLY_HEALING, PROC_REF(on_heal))
RegisterSignal(parent, COMSIG_BODYPART_HEALED, PROC_REF(on_heal_limb))
/datum/component/heal_react/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_MOB_APPLY_HEALING)
UnregisterSignal(parent, COMSIG_BODYPART_HEALED)
/datum/component/heal_react/proc/on_heal(var/mob/living/target,amount,damtype)
/datum/component/heal_react/proc/on_heal_limb(var/mob/living/carbon/target,amount,damtype,var/obj/item/bodypart/BP)
/datum/component/heal_react/boost
///multiplicitive boost to incoming healing
var/boost_amount = 1
///types of damage this will effect
var/list/applies_to = list(BRUTE,BURN,TOX,OXY,CLONE,STAMINA)
///internal check for if we are being healed by ourselves, no double dipping
var/idiotcooldown = FALSE
/datum/component/heal_react/boost/Initialize(boost_set, list/damtype_set)
if(boost_set)
boost_amount = boost_set
if(damtype_set)
applies_to = damtype_set
return ..()
/datum/component/heal_react/boost/on_heal_limb(var/mob/living/carbon/target,amount,damtype,def_zone) //used to target the specific limb being healed, giving the impression it's getting healed more rather than twice
if(!(damtype in applies_to))
return
if(idiotcooldown)
return
idiotcooldown = TRUE
var/obj/item/bodypart/BP = target.get_bodypart(def_zone)
var/heal_amount = min(amount * boost_amount, BP.get_damage())
target.apply_damage(-heal_amount, damtype, def_zone)
idiotcooldown = FALSE
return heal_amount
/datum/component/heal_react/boost/on_heal(var/mob/living/target,amount,damtype)
if(!(damtype in applies_to))
return
if(idiotcooldown)
return
idiotcooldown = TRUE
var/heal_amount = min(-amount * boost_amount, target.maxHealth - target.health)
if(damtype != TOX)
target.apply_damage_type(-heal_amount, damtype, BODYPART_ANY)
else
target.adjustToxLoss(-heal_amount, forced = TRUE) // HELLO xenobio
idiotcooldown = FALSE
return heal_amount
/datum/component/heal_react/boost/holylight
applies_to = list(BRUTE,BURN,TOX,CLONE)
/datum/component/heal_react/boost/holylight/on_heal_limb(var/mob/living/carbon/target,amount,damtype,var/obj/item/bodypart/BP)
if(istype(get_area(target), /area/chapel))
boost_amount *= GLOB.religious_sect.chapel_buff_coeff
var/favor = ..()
boost_amount = initial(boost_amount)
if(favor)
GLOB.religious_sect.adjust_favor(round(favor/2, 0.1))
/datum/component/heal_react/boost/holylight/on_heal(var/mob/living/target,amount,damtype)
if(istype(get_area(target), /area/chapel))
boost_amount *= GLOB.religious_sect.chapel_buff_coeff
var/favor = ..()
boost_amount = initial(boost_amount)
if(favor)
GLOB.religious_sect.adjust_favor(round(favor/2, 0.1))