/*
This file contains the arcane tome files.
*/
/obj/item/weapon/tome
name = "arcane tome"
desc = "An old, dusty tome with frayed edges and a sinister-looking cover."
icon_state ="tome"
throw_speed = 2
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
/obj/item/weapon/tome/Initialize()
. = ..()
if(!LAZYLEN(GLOB.rune_types))
GLOB.rune_types = list()
var/static/list/non_revealed_runes = (subtypesof(/obj/effect/rune) - /obj/effect/rune/malformed)
for(var/i_can_do_loops_now_thanks_remie in non_revealed_runes)
var/obj/effect/rune/R = i_can_do_loops_now_thanks_remie
GLOB.rune_types[initial(R.cultist_name)] = R //Uses the cultist name for displaying purposes
/obj/item/weapon/tome/examine(mob/user)
..()
if(iscultist(user) || isobserver(user))
to_chat(user, "The scriptures of the Geometer. Allows the scribing of runes and access to the knowledge archives of the cult of Nar-Sie.")
to_chat(user, "Striking a cult structure will unanchor or reanchor it.")
to_chat(user, "Striking another cultist with it will purge holy water from them.")
to_chat(user, "Striking a noncultist, however, will sear their flesh.")
/obj/item/weapon/tome/attack(mob/living/M, mob/living/user)
if(!istype(M))
return
if(!iscultist(user))
return ..()
if(iscultist(M))
if(M.reagents && M.reagents.has_reagent("holywater")) //allows cultists to be rescued from the clutches of ordained religion
to_chat(user, "You remove the taint from [M]." )
var/holy2unholy = M.reagents.get_reagent_amount("holywater")
M.reagents.del_reagent("holywater")
M.reagents.add_reagent("unholywater",holy2unholy)
add_logs(user, M, "smacked", src, " removing the holy water from them")
return
M.take_bodypart_damage(0, 15) //Used to be a random between 5 and 20
playsound(M, 'sound/weapons/sear.ogg', 50, 1)
M.visible_message("[user] strikes [M] with the arcane tome!", \
"[user] strikes you with the tome, searing your flesh!")
flick("tome_attack", src)
user.do_attack_animation(M)
add_logs(user, M, "smacked", src)
/obj/item/weapon/tome/attack_self(mob/user)
if(!iscultist(user))
to_chat(user, "[src] seems full of unintelligible shapes, scribbles, and notes. Is this some sort of joke?")
return
open_tome(user)
/obj/item/weapon/tome/proc/open_tome(mob/user)
var/choice = alert(user,"You open the tome...",,"Scribe Rune","More Information","Cancel")
switch(choice)
if("More Information")
read_tome(user)
if("Scribe Rune")
scribe_rune(user)
if("Cancel")
return
/obj/item/weapon/tome/proc/read_tome(mob/user)
var/text = ""
text += "
Archives of the Dark One
"
text += "A rune's name and effects can be revealed by examining the rune.<
"
text += "Create Talisman
This rune is one of the most important runes the cult has, being the only way to create new talismans. A blank sheet of paper must be on top of the rune. After \
invoking it and choosing which talisman you desire, the paper will be converted, after some delay into a talisman.
"
text += "Teleport
This rune is unique in that it requires a keyword before the scribing can begin. When invoked, it will find any other Teleport runes; \
If any are found, the user can choose which rune to send to. Upon activation, the rune teleports everything above it to the selected rune, provided the selected rune is unblocked.
"
text += "Offer
This rune is necessary to achieve your goals. Placing a noncultist above it will convert them if it can and sacrifice them otherwise. \
It requires two invokers to convert a target and three to sacrifice a living target or the sacrifice target.
\
Successful conversions will produce a tome for the new cultist, in addition to healing them.
\
Successful sacrifices will please the Geometer, can complete your objective if it sacrificed the sacrifice target, and will attempt to place the target into a soulstone.
"
text += "Raise Dead
This rune requires the corpse of a cultist placed upon the rune, and one person sacrificed for each revival you wish to do.\
Provided there are remaining revivals from those sacrificed, invoking the rune will revive the cultist placed upon it.
"
text += "Electromagnetic Disruption
Robotic lifeforms have time and time again been the downfall of fledgling cults. This rune may allow you to gain the upper \
hand against these pests. By using the rune, a large electromagnetic pulse will be emitted from the rune's location. The size of the EMP will grow significantly for each additional adjacent cultist when the \
rune is activated.
"
text += "Astral Communion
This rune is perhaps the most ingenious rune that is usable by a single person. Upon invoking the rune, the \
user's spirit will be ripped from their body. In this state, the user's physical body will be locked in place to the rune itself - any attempts to move it will result in the rune pulling it back. \
The body will also take constant damage while in this form, and may even die. The user's spirit will contain their consciousness, and will allow them to freely wander the station as a ghost. This may \
also be used to commune with the dead.
"
text += "Form Barrier
While simple, this rune serves an important purpose in defense and hindering passage. When invoked, the rune will draw a small amount of blood from the user \
and make the space above the rune completely dense, rendering it impassable for about a minute and a half. This effect will spread to other nearby Barrier Runes. \
The rune may be invoked again to undo this effect and allow passage again.
"
text += "Summon Cultist
This rune allows the cult to free other cultists with ease. When invoked, it will allow the user to summon a single cultist to the rune from \
any location. It requires two invokers, and will damage each invoker slightly.
"
text += "Blood Boil
When invoked, this rune will rapidly do a massive amount of damage to all non-cultist viewers, but it will also emit a burst of flame once it finishes. \
It requires three invokers.
"
text += "Drain Life
This rune will drain the life of every living creature above the rune, healing the invoker for each creature drained by it.
"
text += "Manifest Spirit
This rune allows you to summon spirits as humanoid fighters. When invoked, a spirit above the rune will be brought to life as a human, wearing nothing, that seeks only to serve you and the Geometer. \
However, the spirit's link to reality is fragile - you must remain on top of the rune, and you will slowly take damage. Upon stepping off the rune, all summoned spirits will dissipate, dropping their items to the ground. You may manifest \
multiple spirits with one rune, but you will rapidly take damage in doing so.
"
text += "Summon Nar-Sie
This rune is necessary to achieve your goals. On attempting to scribe it, it will produce shields around you and alert everyone you are attempting to scribe it; it takes a very long time to scribe, \
and does massive damage to the one attempting to scribe it.
Invoking it requires 9 invokers and the sacrifice of a specific crewmember, and once invoked, will summon the Geometer, Nar-Sie herself. \
This will complete your objectives.
"
text += "Talisman of Teleportation
The talisman form of the Teleport rune will transport the invoker to a selected Teleport rune once.
"
text += "Talisman of Construction
This talisman is the main way of creating construct shells. To use it, one must strike 25 sheets of metal with the talisman. The sheets will then be twisted into a construct shell, ready to receive a soul to occupy it.
"
text += "Talisman of Tome Summoning
This talisman will produce a single tome at your feet.
"
text += "Talisman of Veiling/Revealing
This talisman will hide runes on its first use, and on the second, will reveal runes.
"
text += "Talisman of Disguising
This talisman will permanently disguise all nearby runes as crayon runes.
"
text += "Talisman of Electromagnetic Pulse
This talisman will EMP anything else nearby. It disappears after one use.
"
text += "Talisman of Stunning
Attacking a target will knock them down for a long duration in addition to inhibiting their speech. \
Robotic lifeforms will suffer the effects of a heavy electromagnetic pulse instead.
"
text += "Talisman of Armaments
The Talisman of Arming will equip the user with armored robes, a backpack, an eldritch longsword, an empowered bola, and a pair of boots. Any items that cannot \
be equipped will not be summoned. Attacking a fellow cultist with it will instead equip them.
"
text += "Talisman of Horrors
The Talisman of Horror must be applied directly to the victim, it will shatter your victim's mind with visions of the endtimes that may incapitate them.
"
text += "Talisman of Shackling
The Talisman of Shackling must be applied directly to the victim, it has 4 uses and cuffs victims with magic shackles that disappear when removed.
"
text += "In addition to these runes, the cult has a small selection of equipment and constructs.
"
text += "Equipment:
"
text += "Cult Blade
Cult blades are sharp weapons that, notably, cannot be used by noncultists. These blades are produced by the Talisman of Arming.
"
text += "Cult Bola
Cult bolas are strong bolas, useful for snaring targets. These bolas are produced by the Talisman of Arming.
"
text += "Cult Robes
Cult robes are heavily armored robes. These robes are produced by the Talisman of Arming.
"
text += "Soulstone
A soulstone is a simple piece of magic, produced either via the starter talisman or by sacrificing humans. Using it on an unconscious or dead human, or on a Shade, will trap their soul in the stone, allowing its use in construct shells. \
The soul within can also be released as a Shade by using it in-hand.
"
text += "Construct Shell
A construct shell is useless on its own, but placing a filled soulstone within it allows you to produce your choice of a Wraith, a Juggernaut, or an Artificer. \
Each construct has uses, detailed below in Constructs. Construct shells can be produced via the starter talisman or the Rite of Fabrication.
"
text += "Constructs:
"
text += "Shade
While technically not a construct, the Shade is produced when released from a soulstone. It is quite fragile and has weak melee attacks, but is fully healed when recaptured by a soulstone.
"
text += "Wraith
The Wraith is a fast, lethal melee attacker which can jaunt through walls. However, it is only slightly more durable than a shade.
"
text += "Juggernaut
The Juggernaut is a slow, but durable, melee attacker which can produce temporary forcewalls. It will also reflect most lethal energy weapons.
"
text += "Artificer
The Artificer is a weak and fragile construct, able to heal other constructs, shades, or itself, produce more soulstones and construct shells, \
construct fortifying cult walls and flooring, and finally, it can release a few indiscriminate stunning missiles.
"
text += "Harvester
If you see one, know that you have done all you can and your life is void.
"
var/datum/browser/popup = new(user, "tome", "", 800, 600)
popup.set_content(text)
popup.open()
return 1
/obj/item/weapon/tome/proc/scribe_rune(mob/living/user)
var/turf/Turf = get_turf(user)
var/chosen_keyword
var/obj/effect/rune/rune_to_scribe
var/entered_rune_name
var/list/shields = list()
var/area/A = get_area(src)
if(!check_rune_turf(Turf, user))
return
entered_rune_name = input(user, "Choose a rite to scribe.", "Sigils of Power") as null|anything in GLOB.rune_types
if(!src || QDELETED(src) || !Adjacent(user) || user.incapacitated() || !check_rune_turf(Turf, user))
return
rune_to_scribe = GLOB.rune_types[entered_rune_name]
if(!rune_to_scribe)
return
if(initial(rune_to_scribe.req_keyword))
chosen_keyword = stripped_input(user, "Enter a keyword for the new rune.", "Words of Power")
if(!chosen_keyword)
scribe_rune(user) //Go back a menu!
return
Turf = get_turf(user) //we may have moved. adjust as needed...
A = get_area(src)
if(!src || QDELETED(src) || !Adjacent(user) || user.incapacitated() || !check_rune_turf(Turf, user))
return
if(ispath(rune_to_scribe, /obj/effect/rune/narsie))
if(SSticker.mode.name == "cult")
var/datum/game_mode/cult/cult_mode = SSticker.mode
if(!("eldergod" in cult_mode.cult_objectives))
to_chat(user, "Nar-Sie does not wish to be summoned!")
return
if(cult_mode.sacrifice_target && !(cult_mode.sacrifice_target in GLOB.sacrificed))
to_chat(user, "The sacrifice is not complete. The portal would lack the power to open if you tried!")
return
if(!cult_mode.eldergod)
to_chat(user, "\"I am already here. There is no need to try to summon me now.\"")
return
if((loc.z && loc.z != ZLEVEL_STATION) || !A.blob_allowed)
to_chat(user, "The Geometer is not interested in lesser locations; the station is the prize!")
return
var/confirm_final = alert(user, "This is the FINAL step to summon Nar-Sie, it is a long, painful ritual and the crew will be alerted to your presence", "Are you prepared for the final battle?", "My life for Nar-Sie!", "No")
if(confirm_final == "No")
to_chat(user, "You decide to prepare further before scribing the rune.")
return
Turf = get_turf(user)
A = get_area(src)
if(!check_rune_turf(Turf, user) || (loc.z && loc.z != ZLEVEL_STATION)|| !A.blob_allowed)
return
priority_announce("Figments from an eldritch god are being summoned by [user] into [A.map_name] from an unknown dimension. Disrupt the ritual at all costs!","Central Command Higher Dimensionsal Affairs", 'sound/AI/spanomalies.ogg')
for(var/B in spiral_range_turfs(1, user, 1))
var/obj/structure/emergency_shield/sanguine/N = new(B)
shields += N
else
to_chat(user, "Nar-Sie does not wish to be summoned!")
return
user.visible_message("[user] [user.blood_volume ? "cuts open their arm and begins writing in their own blood":"begins sketching out a strange design"]!", \
"You [user.blood_volume ? "slice open your arm and ":""]begin drawing a sigil of the Geometer.")
if(user.blood_volume)
user.apply_damage(initial(rune_to_scribe.scribe_damage), BRUTE, pick("l_arm", "r_arm"))
if(!do_after(user, initial(rune_to_scribe.scribe_delay), target = get_turf(user)))
for(var/V in shields)
var/obj/structure/emergency_shield/sanguine/S = V
if(S && !QDELETED(S))
qdel(S)
return
if(!check_rune_turf(Turf, user))
return
user.visible_message("[user] creates a strange circle[user.blood_volume ? " in their own blood":""].", \
"You finish drawing the arcane markings of the Geometer.")
for(var/V in shields)
var/obj/structure/emergency_shield/S = V
if(S && !QDELETED(S))
qdel(S)
var/obj/effect/rune/R = new rune_to_scribe(Turf, chosen_keyword)
R.add_mob_blood(user)
to_chat(user, "The [lowertext(R.cultist_name)] rune [R.cultist_desc]")
feedback_add_details("cult_runes_scribed", R.cultist_name)
/obj/item/weapon/tome/proc/check_rune_turf(turf/T, mob/user)
var/area/A = get_area(T)
if(isspaceturf(T))
to_chat(user, "You cannot scribe runes in space!")
return FALSE
if(locate(/obj/effect/rune) in T)
to_chat(user, "There is already a rune here.")
return FALSE
if(T.z != ZLEVEL_STATION && T.z != ZLEVEL_MINING)
to_chat(user, "The veil is not weak enough here.")
return FALSE
if(istype(A, /area/shuttle))
to_chat(user, "Interference from hyperspace engines disrupts the Geometer's power on shuttles.")
return FALSE
return TRUE