diff --git a/code/modules/antagonists/heretic/heretic_knowledge.dm b/code/modules/antagonists/heretic/heretic_knowledge.dm index df5217d6fea..653ee66286a 100644 --- a/code/modules/antagonists/heretic/heretic_knowledge.dm +++ b/code/modules/antagonists/heretic/heretic_knowledge.dm @@ -248,6 +248,17 @@ LAZYADD(created_items,created_thing.UID()) return TRUE +/datum/heretic_knowledge/limited_amount/proc/delete_items() + for(var/ref as anything in created_items) + var/atom/real_thing = locateUID(ref) + if(QDELETED(real_thing)) + LAZYREMOVE(created_items, ref) + continue + real_thing.visible_message("[real_thing] suddenly glows brightly and shatters into countless shards!", "Something loudly shatters nearby!") + playsound(real_thing, "shatter", 70, TRUE) + qdel(real_thing) + LAZYREMOVE(created_items, ref) + /** * A knowledge subtype for limited_amount knowledge * used for base knowledge (the ones that make blades) diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm index 8fc8415bbe7..b71a82d3d86 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm @@ -351,8 +351,9 @@ addtimer(CALLBACK(sac_target, TYPE_PROC_REF(/mob/living/carbon, do_jitter_animation)), SACRIFICE_SLEEP_DURATION * (1/3)) addtimer(CALLBACK(sac_target, TYPE_PROC_REF(/mob/living/carbon, do_jitter_animation)), SACRIFICE_SLEEP_DURATION * (2/3)) - // If our target is dead, try to revive them + // If our target is dead, try to revive them. We will restore their organs because they get ripped out alot. // and if we fail to revive them, don't proceede the chain + sac_target.check_and_regenerate_organs() if(sac_target.stat & DEAD) sac_target.adjustOxyLoss(-100, FALSE) if(!sac_target.heal_and_revive(50, SPAN_DANGER("[sac_target]'s heart begins to beat with an unholy force as they return from death!"))) @@ -393,6 +394,8 @@ if(!sac_target.client || !sac_target.mind) return + window_flash(sac_target.client) + // Send 'em to the destination. If the teleport fails, just disembowel them and stop the chain if(!destination || SEND_SIGNAL(sac_target, COMSIG_MOVABLE_TELEPORTING, destination) & COMPONENT_BLOCK_TELEPORT) disembowel_target(sac_target) diff --git a/code/modules/antagonists/heretic/knowledge/starting_lore.dm b/code/modules/antagonists/heretic/knowledge/starting_lore.dm index ea52e7bcfc9..e399cf3dd0e 100644 --- a/code/modules/antagonists/heretic/knowledge/starting_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/starting_lore.dm @@ -168,7 +168,18 @@ GLOBAL_LIST_INIT(heretic_start_knowledge, initialize_starting_knowledge()) our_new_heart.AddComponent(/datum/component/living_heart) to_chat(user, SPAN_WARNING("You feel your [our_new_heart.name] begin pulse faster and faster as it awakens!")) playsound(user, 'sound/misc/demon_consume.ogg', 50, TRUE) - return TRUE + + // Give them their knowledge button if they dont have one. + if(!find_menu(user, our_heretic)) + QDEL_NULL(our_heretic.our_menu) + our_heretic.our_menu = new() + our_heretic.our_menu.Grant(user) + +/datum/heretic_knowledge/living_heart/proc/find_menu(mob/living/user, datum/antagonist/heretic/heretic) + for(var/datum/action/A in user.actions) + if(A == heretic.our_menu) + return TRUE + return FALSE /// Checks if the passed heart is a valid heart to become a living heart /datum/heretic_knowledge/living_heart/proc/is_valid_heart(obj/item/organ/new_heart) @@ -338,3 +349,48 @@ GLOBAL_LIST_INIT(heretic_start_knowledge, initialize_starting_knowledge()) var/drain_message = pick_list(HERETIC_INFLUENCE_FILE, "drain_message") to_chat(user, SPAN_HIEROPHANT("[drain_message]")) return . + +/** + * Allows the heretic to break all of their knives in the world. + * This requires a knowledge point and makes them go on knife cooldown. + */ +/datum/heretic_knowledge/destroy_knives + name = "Rite of Sunset's End" + desc = "Sacrifice a single point of knowledge to shatter all of your summoned blades. You will be unable to summon more for a while, but afterwards you will have all your potential summons again." + is_starting_knowledge = TRUE + priority = MAX_KNOWLEDGE_PRIORITY - 2 // Important, but shouldnt get in the way of more important rituals. + abstract_parent_type = /datum/heretic_knowledge/destroy_knives + required_atoms = list() + research_tree_icon_path = 'icons/obj/weapons/khopesh.dmi' + research_tree_icon_state = "eldritch_blade" + + /// Holds our knife knowledge so we dont have to search for it every time. + var/datum/heretic_knowledge/limited_amount/starting/knife_knowledge + +/datum/heretic_knowledge/destroy_knives/can_be_invoked(datum/antagonist/heretic/invoker) + if(!knife_knowledge) + for(var/knowledge_index in invoker.researched_knowledge) + if(istype(invoker.researched_knowledge[knowledge_index], /datum/heretic_knowledge/limited_amount/starting)) + knife_knowledge = invoker.get_knowledge(knowledge_index) + break + if(!knife_knowledge) + return FALSE + if(!length(knife_knowledge.created_items)) + return FALSE + return TRUE + +/datum/heretic_knowledge/destroy_knives/recipe_snowflake_check(mob/living/user, list/atoms, list/selected_atoms, turf/our_turf) + var/datum/antagonist/heretic/heretic = IS_HERETIC(user) + if(!heretic.knowledge_points) + to_chat(user, SPAN_HIEROPHANT("You lack a point of knowledge to offer the rite!")) + return FALSE + if(tgui_alert(user, "This will cost you a point of knowledge and will destroy all your linked blades. Are you sure?", "Rite of Sunset's End", list("Yes", "No")) != "Yes") + return FALSE + return TRUE + +/datum/heretic_knowledge/destroy_knives/on_finished_recipe(mob/living/user, list/selected_atoms, turf/our_turf) + var/datum/antagonist/heretic/heretic = IS_HERETIC(user) + knife_knowledge.delete_items() + user.apply_status_effect(/datum/status_effect/broken_blade, knife_knowledge.research_tree_icon_state) + heretic.knowledge_points-- + . = ..() diff --git a/code/modules/antagonists/heretic/status_effects/heretic_debuffs.dm b/code/modules/antagonists/heretic/status_effects/heretic_debuffs.dm index b5a286cc998..53c5cdbb574 100644 --- a/code/modules/antagonists/heretic/status_effects/heretic_debuffs.dm +++ b/code/modules/antagonists/heretic/status_effects/heretic_debuffs.dm @@ -310,8 +310,8 @@ return ..() /datum/status_effect/stacking/heretic_insanity/proc/update_greyscale() - var/stack_intensity = 1 - (0.66 * (stacks / max_stacks)) - var/inverse_intensity = 0.33 * (stacks / max_stacks) + var/stack_intensity = 1 - (0.66 * clamp((stacks / (max_stacks / 2)), 0, 1)) + var/inverse_intensity = 0.33 * clamp((stacks / (max_stacks / 2)), 0, 1) var/custom_greyscale = list(stack_intensity, inverse_intensity, inverse_intensity,\ inverse_intensity, stack_intensity, inverse_intensity,\ inverse_intensity, inverse_intensity, stack_intensity)