/
vampire_powers.dm
353 lines (303 loc) · 12 KB
/
vampire_powers.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
//This should hold all the vampire related powers
/mob/living/proc/affects_vampire(mob/user)
//Other vampires and thralls aren't affected
if(mind?.has_antag_datum(/datum/antagonist/vampire) || mind?.has_antag_datum(/datum/antagonist/mindslave/thrall))
return FALSE
//Vampires who have reached their full potential can affect nearly everything
var/datum/antagonist/vampire/V = user?.mind.has_antag_datum(/datum/antagonist/vampire)
if(V?.get_ability(/datum/vampire_passive/full))
return TRUE
//Holy characters are resistant to vampire powers
if(HAS_MIND_TRAIT(src, TRAIT_HOLY))
return FALSE
return TRUE
/datum/spell/vampire
panel = "Vampire"
school = "vampire"
action_background_icon_state = "bg_vampire"
human_req = TRUE
clothes_req = FALSE
/// How much blood this ability costs to use
var/required_blood
var/deduct_blood_on_cast = TRUE
/datum/spell/vampire/create_new_handler()
var/datum/spell_handler/vampire/H = new
H.required_blood = required_blood
H.deduct_blood_on_cast = deduct_blood_on_cast
return H
/datum/spell/vampire/self/create_new_targeting()
return new /datum/spell_targeting/self
/datum/vampire_passive
var/gain_desc
var/mob/living/owner = null
/datum/vampire_passive/New()
..()
if(!gain_desc)
gain_desc = "You can now use [src]."
/datum/vampire_passive/Destroy(force, ...)
owner = null
return ..()
/datum/vampire_passive/proc/on_apply(datum/antagonist/vampire/V)
owner.update_sight() // Life updates conditionally, so we need to update sight here in case the vamp gets new vision based on his powers. Maybe one day refactor to be more OOP and on the vampire's ability datum.
return
/datum/spell/vampire/self/rejuvenate
name = "Rejuvenate"
desc = "Use reserve blood to enliven your body, removing any incapacitating effects."
action_icon_state = "vampire_rejuvinate"
base_cooldown = 20 SECONDS
stat_allowed = UNCONSCIOUS
/datum/spell/vampire/self/rejuvenate/cast(list/targets, mob/user = usr)
var/mob/living/U = user
U.SetWeakened(0)
U.SetStunned(0)
U.SetKnockDown(0)
U.SetParalysis(0)
U.SetSleeping(0)
U.SetConfused(0)
U.adjustStaminaLoss(-100)
U.stand_up(TRUE)
SEND_SIGNAL(U, COMSIG_LIVING_CLEAR_STUNS)
to_chat(user, "<span class='notice'>You instill your body with clean blood and remove any incapacitating effects.</span>")
var/datum/antagonist/vampire/V = U.mind.has_antag_datum(/datum/antagonist/vampire)
var/rejuv_bonus = V.get_rejuv_bonus()
if(rejuv_bonus)
INVOKE_ASYNC(src, PROC_REF(heal), U, rejuv_bonus)
/datum/spell/vampire/self/rejuvenate/proc/heal(mob/living/user, rejuv_bonus)
for(var/i in 1 to 5)
user.adjustBruteLoss(-2 * rejuv_bonus)
user.adjustOxyLoss(-5 * rejuv_bonus)
user.adjustToxLoss(-2 * rejuv_bonus)
user.adjustFireLoss(-2 * rejuv_bonus)
for(var/datum/reagent/R in user.reagents.reagent_list)
if(!R.harmless)
user.reagents.remove_reagent(R.id, 2 * rejuv_bonus)
sleep(35)
/datum/antagonist/vampire/proc/get_rejuv_bonus()
var/rejuv_multiplier = 0
if(!get_ability(/datum/vampire_passive/regen))
return rejuv_multiplier
if(subclass?.improved_rejuv_healing)
rejuv_multiplier = clamp((100 - owner.current.health) / 20, 1, 5) // brute and burn healing between 5 and 50
return rejuv_multiplier
return TRUE
/datum/spell/vampire/self/specialize
name = "Choose Specialization"
desc = "Choose what sub-class of vampire you want to evolve into."
gain_desc = "You can now choose what specialization of vampire you want to evolve into."
base_cooldown = 2 SECONDS
action_icon_state = "select_class"
/datum/spell/vampire/self/specialize/cast(mob/user)
ui_interact(user)
/datum/spell/vampire/self/specialize/ui_state(mob/user)
return GLOB.always_state
/datum/spell/vampire/self/specialize/ui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "SpecMenu", "Specialisation Menu")
ui.set_autoupdate(FALSE)
ui.open()
/datum/spell/vampire/self/specialize/ui_data(mob/user)
var/datum/antagonist/vampire/vamp = user.mind.has_antag_datum(/datum/antagonist/vampire)
var/list/data = list("subclasses" = vamp.subclass)
return data
/datum/spell/vampire/self/specialize/ui_act(action, list/params)
if(..())
return
var/datum/antagonist/vampire/vamp = usr.mind.has_antag_datum(/datum/antagonist/vampire)
if(vamp.subclass)
vamp.upgrade_tiers -= type
vamp.remove_ability(src)
return
switch(action)
if("umbrae")
vamp.add_subclass(SUBCLASS_UMBRAE)
vamp.upgrade_tiers -= type
vamp.remove_ability(src)
if("hemomancer")
vamp.add_subclass(SUBCLASS_HEMOMANCER)
vamp.upgrade_tiers -= type
vamp.remove_ability(src)
if("gargantua")
vamp.add_subclass(SUBCLASS_GARGANTUA)
vamp.upgrade_tiers -= type
vamp.remove_ability(src)
if("dantalion")
vamp.add_subclass(SUBCLASS_DANTALION)
vamp.upgrade_tiers -= type
vamp.remove_ability(src)
/datum/antagonist/vampire/proc/add_subclass(subclass_to_add, announce = TRUE, log_choice = TRUE)
var/datum/vampire_subclass/new_subclass = new subclass_to_add
subclass = new_subclass
check_vampire_upgrade(announce)
if(log_choice)
SSblackbox.record_feedback("nested tally", "vampire_subclasses", 1, list("[new_subclass.name]"))
/datum/spell/vampire/glare
name = "Glare"
desc = "Your eyes flash, stunning and silencing anyone in front of you. It has lesser effects for those around you."
action_icon_state = "vampire_glare"
base_cooldown = 30 SECONDS
stat_allowed = UNCONSCIOUS
/datum/spell/vampire/glare/create_new_targeting()
var/datum/spell_targeting/aoe/T = new
T.allowed_type = /mob/living
T.range = 1
return T
/datum/spell/vampire/glare/create_new_cooldown()
var/datum/spell_cooldown/charges/C = new
C.max_charges = 2
C.recharge_duration = base_cooldown
C.charge_duration = 2 SECONDS
return C
/// No deviation at all. Flashed from the front or front-left/front-right. Alternatively, flashed in direct view.
#define DEVIATION_NONE 3
/// Partial deviation. Flashed from the side. Alternatively, flashed out the corner of your eyes.
#define DEVIATION_PARTIAL 2
/// Full deviation. Flashed from directly behind or behind-left/behind-rack. Not flashed at all.
#define DEVIATION_FULL 1
/datum/spell/vampire/glare/cast(list/targets, mob/living/user = usr)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(istype(H.glasses, /obj/item/clothing/glasses/sunglasses/blindfold))
var/obj/item/clothing/glasses/sunglasses/blindfold/B = H.glasses
if(B.tint)
to_chat(user, "<span class='warning'>You're blindfolded!</span>")
return
user.mob_light(LIGHT_COLOR_BLOOD_MAGIC, 3, _duration = 2)
user.visible_message("<span class='warning'>[user]'s eyes emit a blinding flash!</span>")
for(var/mob/living/target in targets)
if(!target.affects_vampire(user))
continue
var/deviation
if(IS_HORIZONTAL(user))
deviation = DEVIATION_PARTIAL
else
deviation = calculate_deviation(target, user)
if(deviation == DEVIATION_FULL)
target.Confused(6 SECONDS)
target.apply_damage(20, STAMINA)
else if(deviation == DEVIATION_PARTIAL)
target.KnockDown(5 SECONDS)
target.Confused(6 SECONDS)
target.apply_damage(40, STAMINA)
else
target.Confused(10 SECONDS)
target.apply_damage(70, STAMINA)
target.KnockDown(12 SECONDS)
target.AdjustSilence(8 SECONDS)
target.flash_eyes(1, TRUE, TRUE)
to_chat(target, "<span class='warning'>You are blinded by [user]'s glare.</span>")
add_attack_logs(user, target, "(Vampire) Glared at")
/datum/spell/vampire/glare/proc/calculate_deviation(mob/victim, mob/attacker)
// If the victim was looking at the attacker, this is the direction they'd have to be facing.
var/attacker_to_victim = get_dir(attacker, victim)
// The victim's dir is necessarily a cardinal value.
var/attacker_dir = attacker.dir
// - - -
// - V - Attacker facing south
// # # #
// Attacker within 45 degrees of where the victim is facing.
if(attacker_dir & attacker_to_victim)
return DEVIATION_NONE
// Are they on the same tile? This is probably the victim crawling under the vampire, and looking down shouldn't be too tough.
if(victim.loc == attacker.loc)
return DEVIATION_NONE
// # # #
// - V - Attacker facing south
// - - -
// Victim at 135 or more degrees of where the victim is facing.
if(attacker_dir & reverse_direction(attacker_to_victim))
return DEVIATION_FULL
// - - -
// # V # Attacker facing south
// - - -
// Victim lateral to the victim.
return DEVIATION_PARTIAL
#undef DEVIATION_NONE
#undef DEVIATION_PARTIAL
#undef DEVIATION_FULL
/datum/vampire_passive/regen
gain_desc = "Your rejuvenation abilities have improved and will now heal you over time when used."
/datum/vampire_passive/vision
gain_desc = "Your vampiric vision has improved."
var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
var/see_in_dark = 1
var/vision_flags = SEE_MOBS
/datum/vampire_passive/vision/advanced
gain_desc = "Your vampiric vision now allows you to see everything in the dark!"
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
see_in_dark = 3
vision_flags = SEE_MOBS
/datum/vampire_passive/vision/full
gain_desc = "Your vampiric vision has reached its full strength!"
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
see_in_dark = 6
vision_flags = SEE_MOBS
/datum/vampire_passive/full
gain_desc = "You have reached your full potential. You are no longer weak to the effects of anything holy."
/datum/spell/vampire/raise_vampires
name = "Raise Vampires"
desc = "Summons deadly vampires from bluespace."
school = "transmutation"
base_cooldown = 100
clothes_req = FALSE
human_req = TRUE
invocation = "none"
invocation_type = "none"
cooldown_min = 20
action_icon_state = "revive_thrall"
sound = 'sound/magic/wandodeath.ogg'
gain_desc = "You have gained the ability to Raise Vampires. This extremely powerful AOE ability affects all humans near you. Vampires/thralls are healed. Corpses are raised as vampires. Others are stunned, then brain damaged, then killed."
/datum/spell/vampire/raise_vampires/create_new_targeting()
var/datum/spell_targeting/aoe/T = new
T.range = 3
return T
/datum/spell/vampire/raise_vampires/cast(list/targets, mob/user = usr)
new /obj/effect/temp_visual/cult/sparks(user.loc)
var/turf/T = get_turf(user)
to_chat(user, "<span class='warning'>You call out within bluespace, summoning more vampiric spirits to aid you!</span>")
for(var/mob/living/carbon/human/H in targets)
T.Beam(H, "sendbeam", 'icons/effects/effects.dmi', time = 30, maxdistance = 7, beam_type = /obj/effect/ebeam)
new /obj/effect/temp_visual/cult/sparks(H.loc)
raise_vampire(user, H)
/datum/spell/vampire/raise_vampires/proc/raise_vampire(mob/M, mob/living/carbon/human/H)
if(!istype(M) || !istype(H))
return
if(!H.mind)
H.visible_message("[H] looks to be too stupid to understand what is going on.")
return
if(H.dna && (NO_BLOOD in H.dna.species.species_traits) || H.dna.species.exotic_blood || !H.blood_volume)
H.visible_message("[H] looks unfazed!")
return
if(H.mind.has_antag_datum(/datum/antagonist/vampire) || H.mind.special_role == SPECIAL_ROLE_VAMPIRE || H.mind.special_role == SPECIAL_ROLE_VAMPIRE_THRALL)
H.visible_message("<span class='notice'>[H] looks refreshed!</span>")
H.adjustBruteLoss(-60)
H.adjustFireLoss(-60)
for(var/obj/item/organ/external/E in H.bodyparts)
if(prob(25))
E.mend_fracture()
E.fix_internal_bleeding()
E.fix_burn_wound()
return
if(H.stat != DEAD)
if(H.IsWeakened())
H.visible_message("<span class='warning'>[H] looks to be in pain!</span>")
H.adjustBrainLoss(60)
else
H.visible_message("<span class='warning'>[H] looks to be stunned by the energy!</span>")
H.Weaken(40 SECONDS)
return
for(var/obj/item/bio_chip/mindshield/L in H)
if(L && L.implanted)
qdel(L)
for(var/obj/item/bio_chip/traitor/T in H)
if(T && T.implanted)
qdel(T)
H.visible_message("<span class='warning'>[H] gets an eerie red glow in their eyes!</span>")
var/datum/objective/protect/protect_objective = new
protect_objective.target = M.mind
protect_objective.explanation_text = "Protect [M.real_name]."
H.mind.add_mind_objective(protect_objective)
add_attack_logs(M, H, "Vampire-sired")
H.mind.make_vampire()
H.revive()
H.Weaken(40 SECONDS)