Skip to content

Commit

Permalink
[MIRROR] Blade creation ritual returns lost blades (#2482)
Browse files Browse the repository at this point in the history
* Blade creation ritual returns lost blades (#82592)

## About The Pull Request

Blade ritual now break first created blade if limit and create new one.
If someone was on a tile with a blade, their hand would be cut off

"updated video"
https://youtu.be/fdMhrW2aoto

## Why It's Good For The Game

If heretic loses his blades, then due to the limit on creating new
blades, he will not be able to make new blades for himself. Now, you can
return your blades.

🆑
balance: Heretic now can return his stolen blades by using blade
creation ritual again.
/:cl:

---------

Co-authored-by: Ghom <[email protected]>

* Blade creation ritual returns lost blades

---------

Co-authored-by: Xackii <[email protected]>
Co-authored-by: Ghom <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
4 people authored and StealsThePRs committed May 15, 2024
1 parent bfe01ad commit dc36f56
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
5 changes: 5 additions & 0 deletions code/modules/antagonists/heretic/heretic_antag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
var/high_value_sacrifices = 0
/// Lazy assoc list of [refs to humans] to [image previews of the human]. Humans that we have as sacrifice targets.
var/list/mob/living/carbon/human/sac_targets
/// List of all sickly blades linked with heretic mind.
var/list/obj/item/melee/sickly_blade/blades_list
/// List of all sacrifice target's names, used for end of round report
var/list/all_sac_targets = list()
/// Whether we're drawing a rune or not
Expand Down Expand Up @@ -82,6 +84,9 @@

/datum/antagonist/heretic/Destroy()
LAZYNULL(sac_targets)
for(var/obj/item/melee/sickly_blade/blade as anything in blades_list)
blade.owner = null
LAZYNULL(blades_list)
return ..()

/datum/antagonist/heretic/ui_data(mob/user)
Expand Down
40 changes: 38 additions & 2 deletions code/modules/antagonists/heretic/heretic_knowledge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@
var/limit = 1
/// A list of weakrefs to all items we've created.
var/list/datum/weakref/created_items
/// if we have all the blades then we don’t want to tear our hands off
var/valid_blades = FALSE

/datum/heretic_knowledge/limited_amount/Destroy(force)
LAZYCLEARLIST(created_items)
Expand All @@ -237,17 +239,51 @@
LAZYREMOVE(created_items, ref)

if(LAZYLEN(created_items) >= limit)
loc.balloon_alert(user, "ritual failed, at limit!")
return FALSE
for(var/obj/item/melee/sickly_blade/is_blade_ritual as anything in result_atoms)
valid_blades = blades_limit_check(user)
break
if(valid_blades)
return TRUE
else
loc.balloon_alert(user, "ritual failed, at limit!")
return FALSE

return TRUE

/datum/heretic_knowledge/limited_amount/on_finished_recipe(mob/living/user, list/selected_atoms, turf/loc)
for(var/result in result_atoms)
var/atom/created_thing = new result(loc)
LAZYADD(created_items, WEAKREF(created_thing))
if(istype(created_thing, /obj/item/melee/sickly_blade))
add_to_list_sickly_blade(user, created_thing)
return TRUE

/datum/heretic_knowledge/limited_amount/proc/add_to_list_sickly_blade(mob/living/heretic, obj/item/melee/sickly_blade/created_blade)
var/obj/item/melee/sickly_blade/blade_check = created_blade
var/datum/antagonist/heretic/our_heretic = IS_HERETIC(heretic)
if(!isnull(our_heretic))
blade_check.owner = our_heretic
LAZYADD(our_heretic.blades_list, blade_check)

/datum/heretic_knowledge/limited_amount/proc/blades_limit_check(mob/living/heretic)
var/datum/antagonist/heretic/our_heretic = IS_HERETIC(heretic)
var/success_check = FALSE
for(var/obj/item/melee/sickly_blade/blades_in_list as anything in our_heretic.blades_list)
if(get_turf(heretic) == get_turf(blades_in_list))
continue
success_check = TRUE
LAZYREMOVE(our_heretic.blades_list, blades_in_list)
var/mob/living/living_target = recursive_loc_check(src, /mob/living)
if(living_target)
living_target.apply_damage(15)
var/obj/item/bodypart/thief_hand = living_target.get_bodypart(BODY_ZONE_L_ARM)
if(!isnull(thief_hand))
thief_hand.dismember(BRUTE)
to_chat(living_target, span_boldwarning("You feel severe pain in your hand as if otherworldly powers tore it from inside. [blades_in_list] collapse and disappeared.. maybe it never existed?"))
qdel(blades_in_list)
break
return success_check

/**
* A knowledge subtype for limited_amount knowledge
* used for base knowledge (the ones that make blades)
Expand Down
8 changes: 8 additions & 0 deletions code/modules/antagonists/heretic/items/heretic_blades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
attack_verb_continuous = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "rends")
attack_verb_simple = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "rend")
var/after_use_message = ""
//set owner to find where blade linked
var/datum/antagonist/heretic/owner

/obj/item/melee/sickly_blade/Destroy()
if(!isnull(owner))
LAZYREMOVE(owner.blades_list, src)
owner = null
return ..()

/obj/item/melee/sickly_blade/attack(mob/living/M, mob/living/user)
if(!IS_HERETIC_OR_MONSTER(user))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,4 @@ GLOBAL_LIST_INIT(heretic_start_knowledge, initialize_starting_knowledge())
body.do_jitter_animation()
body.visible_message(span_danger("An awful ripping sound is heard as [ripped_thing]'s [exterior_text] is ripped straight out, wrapping around [le_book || "the book"], turning into an eldritch shade of blue!"))
return ..()

0 comments on commit dc36f56

Please sign in to comment.