/
boost.dm
85 lines (65 loc) · 1.89 KB
/
boost.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
79
80
81
82
83
84
85
/obj/item/organ/internal/augment/boost
icon_state = "booster"
augment_slots = AUGMENT_HEAD
/// Unique ID for collecting the right effect in skill handling
var/id
/// Which abilities does this impact?
var/list/buffs = list()
/// If organ is damaged, should we reduce anything?
var/list/injury_debuffs = list()
/// Only subtypes of /datum/skill_buff/augment
var/buffpath = /datum/skill_buff/augment
/// Mostly to control if we should remove buffs when we go
var/active = FALSE
/// If we applied a debuff
var/debuffing = FALSE
/obj/item/organ/internal/augment/boost/Initialize()
. = ..()
id = "[/obj/item/organ/internal/augment/boost]_[sequential_id(/obj/item/organ/internal/augment/boost)]"
/obj/item/organ/internal/augment/boost/onInstall()
if (length(buffs))
var/datum/skill_buff/augment/A
A = owner.buff_skill(buffs, 0, buffpath)
if (A && istype(A))
active = TRUE
A.id = id
/obj/item/organ/internal/augment/boost/onRemove()
debuffing = FALSE
if (!active)
return
for (var/datum/skill_buff/augment/D as anything in owner.fetch_buffs_of_type(buffpath, 0))
if (D.id != id)
continue
D.remove()
return
/obj/item/organ/internal/augment/boost/proc/debuff()
if (!length(injury_debuffs))
return FALSE
for (var/datum/skill_buff/augment/D as anything in owner.fetch_buffs_of_type(buffpath, 0))
if (D.id != id)
continue
D.recalculate(injury_debuffs)
debuffing = TRUE
return TRUE
return FALSE
/obj/item/organ/internal/augment/boost/proc/buff()
if (!length(buffs))
return FALSE
for (var/datum/skill_buff/augment/D as anything in owner.fetch_buffs_of_type(buffpath, 0))
if (D.id != id)
continue
D.recalculate(buffs)
debuffing = FALSE
return TRUE
return FALSE
/obj/item/organ/internal/augment/boost/Process()
..()
if (!owner)
return
if (!debuffing)
if (is_broken())
debuff()
else if (!is_broken())
buff()
/datum/skill_buff/augment
var/id