This repository has been archived by the owner on Sep 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
soulstone.dm
354 lines (322 loc) · 15.1 KB
/
soulstone.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
354
/obj/item/soulstone
name = "soulstone shard"
icon = 'icons/obj/wizard.dmi'
icon_state = "soulstone"
item_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
layer = HIGH_OBJ_LAYER
desc = "A fragment of the legendary treasure known simply as the 'Soul Stone'. The shard still flickers with a fraction of the full artefact's power."
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
var/usability = FALSE
var/old_shard = FALSE
var/spent = FALSE
var/purified = FALSE
/obj/item/soulstone/proc/was_used()
if(old_shard)
spent = TRUE
name = "dull [name]"
desc = "A fragment of the legendary treasure known simply as \
the 'Soul Stone'. The shard lies still, dull and lifeless; \
whatever spark it once held long extinguished."
/obj/item/soulstone/anybody
usability = TRUE
/obj/item/soulstone/anybody/revolver
old_shard = TRUE
/obj/item/soulstone/anybody/purified
icon = 'icons/obj/wizard.dmi'
icon_state = "purified_soulstone"
purified = TRUE
/obj/item/soulstone/anybody/chaplain
name = "mysterious old shard"
old_shard = TRUE
/obj/item/soulstone/pickup(mob/living/user)
..()
if(!iscultist(user) && !iswizard(user) && !usability)
to_chat(user, "<span class='danger'>An overwhelming feeling of dread comes over you as you pick up the soulstone. It would be wise to be rid of this quickly.</span>")
/obj/item/soulstone/examine(mob/user)
. = ..()
if(usability || iscultist(user) || iswizard(user) || isobserver(user))
if (old_shard)
. += "<span class='cult'>A soulstone, used to capture a soul, either from dead humans or from freed shades.</span>"
else
. += "<span class='cult'>A soulstone, used to capture souls, either from unconscious or sleeping humans or from freed shades.</span>"
. += "<span class='cult'>The captured soul can be placed into a construct shell to produce a construct, or released from the stone as a shade.</span>"
if(spent)
. += "<span class='cult'>This shard is spent; it is now just a creepy rock.</span>"
/obj/item/soulstone/Destroy() //Stops the shade from being qdel'd immediately and their ghost being sent back to the arrival shuttle.
for(var/mob/living/simple_animal/shade/A in src)
A.death()
return ..()
/obj/item/soulstone/proc/hot_potato(mob/living/user)
to_chat(user, "<span class='userdanger'>Holy magics residing in \the [src] burn your hand!</span>")
var/obj/item/bodypart/affecting = user.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm")
affecting.receive_damage( 0, 10 ) // 10 burn damage
user.emote("scream")
user.update_damage_overlays()
user.dropItemToGround(src)
//////////////////////////////Capturing////////////////////////////////////////////////////////
/obj/item/soulstone/attack(mob/living/carbon/human/M, mob/living/user)
if(!iscultist(user) && !iswizard(user) && !usability)
user.Unconscious(100)
to_chat(user, "<span class='userdanger'>Your body is wracked with debilitating pain!</span>")
return
if(spent)
to_chat(user, "<span class='warning'>There is no power left in the shard.</span>")
return
if(!ishuman(M))//If target is not a human.
return ..()
if((M.mind && !M.mind.hasSoul) || is_devil(M))
to_chat(user, "<span class='warning'>This... thing has no soul! It's filled with evil!</span>")
return
if(iscultist(M))
if(iscultist(user))
to_chat(user, "<span class='cultlarge'>\"Come now, do not capture your bretheren's soul.\"</span>")
return
if(purified && iscultist(user))
hot_potato(user)
return
log_combat(user, M, "captured [M.name]'s soul", src)
transfer_soul("VICTIM", M, user)
///////////////////Options for using captured souls///////////////////////////////////////
/obj/item/soulstone/attack_self(mob/living/user)
if(!in_range(src, user))
return
if(!iscultist(user) && !iswizard(user) && !usability)
user.Unconscious(100)
to_chat(user, "<span class='userdanger'>Your body is wracked with debilitating pain!</span>")
return
if(purified && iscultist(user))
hot_potato(user)
return
release_shades(user)
/obj/item/soulstone/proc/release_shades(mob/user)
for(var/mob/living/simple_animal/shade/A in src)
A.forceMove(get_turf(user))
A.cancel_camera()
if(purified)
icon_state = "purified_soulstone"
A.icon_state = "shade_angelic"
A.name = "Purified [initial(A.name)]"
else
icon_state = "soulstone"
name = initial(name)
if(iswizard(user) || usability)
to_chat(A, "<b>You have been released from your prison, but you are still bound to [user.real_name]'s will. Help [user.p_them()] succeed in [user.p_their()] goals at all costs.</b>")
else if(iscultist(user))
to_chat(A, "<b>You have been released from your prison, but you are still bound to the cult's will. Help them succeed in their goals at all costs.</b>")
was_used()
///////////////////////////Transferring to constructs/////////////////////////////////////////////////////
/obj/structure/constructshell
name = "empty shell"
icon = 'icons/obj/wizard.dmi'
icon_state = "construct_cult"
desc = "A wicked machine used by those skilled in magical arts. It is inactive."
/obj/structure/constructshell/examine(mob/user)
. = ..()
if(iscultist(user) || iswizard(user) || user.stat == DEAD)
. += {"<span class='cult'>A construct shell, used to house bound souls from a soulstone.\n
Placing a soulstone with a soul into this shell allows you to produce your choice of the following:\n
An <b>Artificer</b>, which can produce <b>more shells and soulstones</b>, as well as fortifications.\n
A <b>Wraith</b>, which does high damage and can jaunt through walls, though it is quite fragile.\n
A <b>Juggernaut</b>, which is very hard to kill and can produce temporary walls, but is slow.</span>"}
/obj/structure/constructshell/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/soulstone))
var/obj/item/soulstone/SS = O
if(!iscultist(user) && !iswizard(user) && !SS.purified)
to_chat(user, "<span class='danger'>An overwhelming feeling of dread comes over you as you attempt to place the soulstone into the shell. It would be wise to be rid of this quickly.</span>")
user.Dizzy(30)
return
if(SS.purified && iscultist(user))
SS.hot_potato(user)
return
SS.transfer_soul("CONSTRUCT",src,user)
SS.was_used()
else
return ..()
////////////////////////////Proc for moving soul in and out off stone//////////////////////////////////////
/obj/item/soulstone/proc/transfer_soul(choice as text, target, mob/user)
switch(choice)
if("FORCE")
if(!iscarbon(target)) //TODO: Add sacrifice stoning for non-organics, just because you have no body doesnt mean you dont have a soul
return FALSE
if(contents.len)
return FALSE
var/mob/living/carbon/T = target
if(T.client != null)
for(var/obj/item/W in T)
T.dropItemToGround(W)
init_shade(T, user)
return TRUE
else
to_chat(user, "<span class='userdanger'>Capture failed!</span>: The soul has already fled its mortal frame. You attempt to bring it back...")
return getCultGhost(T,user)
if("VICTIM")
var/mob/living/carbon/human/T = target
var/datum/antagonist/cult/C = user.mind.has_antag_datum(/datum/antagonist/cult,TRUE)
if(C && C.cult_team.is_sacrifice_target(T.mind))
if(iscultist(user))
to_chat(user, "<span class='cult'><b>\"This soul is mine.</b></span> <span class='cultlarge'>SACRIFICE THEM!\"</span>")
else
to_chat(user, "<span class='danger'>The soulstone seems to reject this soul.</span>")
return FALSE
if(contents.len)
to_chat(user, "<span class='userdanger'>Capture failed!</span>: The soulstone is full! Free an existing soul to make room.")
else
if((!old_shard && T.stat != CONSCIOUS) || (old_shard && T.stat == DEAD))
if(T.client == null)
to_chat(user, "<span class='userdanger'>Capture failed!</span>: The soul has already fled its mortal frame. You attempt to bring it back...")
getCultGhost(T,user)
else
for(var/obj/item/W in T)
T.dropItemToGround(W)
init_shade(T, user, message_user = 1)
qdel(T)
else
to_chat(user, "<span class='userdanger'>Capture failed!</span>: Kill or maim the victim first!")
if("SHADE")
var/mob/living/simple_animal/shade/T = target
if(contents.len)
to_chat(user, "<span class='userdanger'>Capture failed!</span>: The soulstone is full! Free an existing soul to make room.")
else
T.AddComponent(/datum/component/soulstoned, src)
if(purified)
icon_state = "purified_soulstone2"
if(iscultist(T))
SSticker.mode.remove_cultist(T.mind, FALSE, FALSE)
else
icon_state = "soulstone2"
name = "soulstone: Shade of [T.real_name]"
to_chat(T, "<span class='notice'>Your soul has been captured by the soulstone. Its arcane energies are reknitting your ethereal form.</span>")
if(user != T)
to_chat(user, "<span class='info'><b>Capture successful!</b>:</span> [T.real_name]'s soul has been captured and stored within the soulstone.")
if("CONSTRUCT")
var/obj/structure/constructshell/T = target
var/mob/living/simple_animal/shade/A = locate() in src
if(A)
var/list/constructs = list(
"Juggernaut" = image(icon = 'icons/mob/cult.dmi', icon_state = "juggernaut"),
"Wraith" = image(icon = 'icons/mob/cult.dmi', icon_state = "wraith"),
"Artificer" = image(icon = 'icons/mob/cult.dmi', icon_state = "artificer")
)
var/construct_class = show_radial_menu(user, src, constructs, custom_check = CALLBACK(src, .proc/check_menu, user), require_near = TRUE, tooltips = TRUE)
if(!T || !T.loc)
return
switch(construct_class)
if("Juggernaut")
if(iscultist(user) || iswizard(user))
makeNewConstruct(/mob/living/simple_animal/hostile/construct/juggernaut, A, user, 0, T.loc)
else
if(purified)
makeNewConstruct(/mob/living/simple_animal/hostile/construct/juggernaut/angelic, A, user, 0, T.loc)
else
makeNewConstruct(/mob/living/simple_animal/hostile/construct/juggernaut/noncult, A, user, 0, T.loc)
if("Wraith")
if(iscultist(user) || iswizard(user))
makeNewConstruct(/mob/living/simple_animal/hostile/construct/wraith, A, user, 0, T.loc)
else
if(purified)
makeNewConstruct(/mob/living/simple_animal/hostile/construct/wraith/angelic, A, user, 0, T.loc)
else
makeNewConstruct(/mob/living/simple_animal/hostile/construct/wraith/noncult, A, user, 0, T.loc)
if("Artificer")
if(iscultist(user) || iswizard(user))
makeNewConstruct(/mob/living/simple_animal/hostile/construct/artificer, A, user, 0, T.loc)
else
if(purified)
makeNewConstruct(/mob/living/simple_animal/hostile/construct/artificer/angelic, A, user, 0, T.loc)
else
makeNewConstruct(/mob/living/simple_animal/hostile/construct/artificer/noncult, A, user, 0, T.loc)
else
return
for(var/datum/mind/B in SSticker.mode.cult)
if(B == A.mind)
SSticker.mode.remove_cultist(A.mind)
qdel(T)
qdel(src)
else
to_chat(user, "<span class='userdanger'>Creation failed!</span>: The soul stone is empty! Go kill someone!")
/obj/item/soulstone/proc/check_menu(mob/user)
if(!istype(user))
return FALSE
if(user.incapacitated() || !user.Adjacent(src))
return FALSE
return TRUE
/proc/makeNewConstruct(mob/living/simple_animal/hostile/construct/ctype, mob/target, mob/stoner = null, cultoverride = 0, loc_override = null)
if(QDELETED(target))
return
var/mob/living/simple_animal/hostile/construct/newstruct = new ctype((loc_override) ? (loc_override) : (get_turf(target)))
var/makeicon = newstruct.icon_state
var/holyness = newstruct.holy
flick("make_[makeicon][holyness]", newstruct)
playsound(newstruct, 'sound/effects/constructform.ogg', 50)
if(stoner)
newstruct.faction |= "[REF(stoner)]"
newstruct.master = stoner
var/datum/action/innate/seek_master/SM = new()
SM.Grant(newstruct)
newstruct.key = target.key
var/obj/screen/alert/bloodsense/BS
if(newstruct.mind && ((stoner && iscultist(stoner)) || cultoverride) && SSticker && SSticker.mode)
SSticker.mode.add_cultist(newstruct.mind, 0)
if(iscultist(stoner) || cultoverride)
to_chat(newstruct, "<b>You are still bound to serve the cult[stoner ? " and [stoner]":""], follow [stoner ? stoner.p_their() : "their"] orders and help [stoner ? stoner.p_them() : "them"] complete [stoner ? stoner.p_their() : "their"] goals at all costs.</b>")
else if(stoner)
to_chat(newstruct, "<b>You are still bound to serve your creator, [stoner], follow [stoner.p_their()] orders and help [stoner.p_them()] complete [stoner.p_their()] goals at all costs.</b>")
newstruct.clear_alert("bloodsense")
BS = newstruct.throw_alert("bloodsense", /obj/screen/alert/bloodsense)
if(BS)
BS.Cviewer = newstruct
newstruct.cancel_camera()
/obj/item/soulstone/proc/init_shade(mob/living/carbon/human/T, mob/user, message_user = 0 , mob/shade_controller)
if(!shade_controller)
shade_controller = T
new /obj/effect/decal/remains/human(T.loc) //Spawns a skeleton
T.stop_sound_channel(CHANNEL_HEARTBEAT)
T.invisibility = INVISIBILITY_ABSTRACT
T.dust_animation()
var/mob/living/simple_animal/shade/S = new /mob/living/simple_animal/shade(src)
S.AddComponent(/datum/component/soulstoned, src)
S.name = "Shade of [T.real_name]"
S.real_name = "Shade of [T.real_name]"
S.key = shade_controller.key
S.copy_languages(T, LANGUAGE_MIND)//Copies the old mobs languages into the new mob holder.
S.copy_languages(user, LANGUAGE_MASTER)
S.update_atom_languages()
grant_all_languages(FALSE, FALSE, TRUE) //Grants omnitongue
if(user)
S.faction |= "[REF(user)]" //Add the master as a faction, allowing inter-mob cooperation
if(user && iscultist(user))
SSticker.mode.add_cultist(S.mind, 0)
S.cancel_camera()
name = "soulstone: Shade of [T.real_name]"
if(purified)
icon_state = "purified_soulstone2"
else
icon_state = "soulstone2"
if(user && (iswizard(user) || usability))
to_chat(S, "Your soul has been captured! You are now bound to [user.real_name]'s will. Help [user.p_them()] succeed in [user.p_their()] goals at all costs.")
else if(user && iscultist(user))
to_chat(S, "Your soul has been captured! You are now bound to the cult's will. Help them succeed in their goals at all costs.")
if(message_user && user)
to_chat(user, "<span class='info'><b>Capture successful!</b>:</span> [T.real_name]'s soul has been ripped from [T.p_their()] body and stored within the soul stone.")
/obj/item/soulstone/proc/getCultGhost(mob/living/carbon/human/T, mob/user)
var/mob/dead/observer/chosen_ghost
chosen_ghost = T.get_ghost(TRUE,TRUE) //Try to grab original owner's ghost first
if(!chosen_ghost || !chosen_ghost.client) //Failing that, we grab a ghosts
var/list/consenting_candidates = pollGhostCandidates("Would you like to play as a Shade?", "Cultist", null, ROLE_CULTIST, 50, POLL_IGNORE_SHADE)
if(consenting_candidates.len)
chosen_ghost = pick(consenting_candidates)
if(!T)
return FALSE
if(!chosen_ghost || !chosen_ghost.client)
to_chat(user, "<span class='danger'>There were no spirits willing to become a shade.</span>")
return FALSE
if(contents.len) //If they used the soulstone on someone else in the meantime
return FALSE
for(var/obj/item/W in T)
T.dropItemToGround(W)
init_shade(T, user , shade_controller = chosen_ghost)
qdel(T)
return TRUE