Files
Bubberstation/code/datums/elements/lifesteal.dm
T
tralezabandGitHub bc813ab93d Cleans up + Improves bows, Sorts files, Adds the Divine Archer clothing, weapon, rite (#74811)
## About The Pull Request

### Divine Archer 🏹 


![image](https://user-images.githubusercontent.com/40974010/232647927-aace69ea-bda8-4ec9-9bf1-60140034fbb3.png)

Adds a new chaplain weapon and suit of armor, the divine archer. It's an
orderable set of armor, but provides less armor than the rest, but you
get more pieces of armor (boots, bracer, undersuit).

The divine bow comes with a quiver that holds holy arrows. The holy
arrows come with bane support, dealing critical damage to revenants.

### Bow Features  

- arrows can now be dipped in poison

### Bow Improvements 🔧 

- bows now drop their arrow when you put them on your back while nocking
a bow
- bows give feedback for trying to draw without a nocked arrow
- codewise, bows support subtypes much better. They still have
hard-sprited loaded arrows, but one day that'll change.

## Why It's Good For The Game

Yeah, we could add null rod #2342 that does almost the same as the
others, or we could have a unique bow weapon!

Player Dev Project thread:
https://discord.com/channels/326822144233439242/1093521091957370940/1093521091957370940

## Changelog
🆑 tralezab code, Drag for the commission and player project, cre#0484
for their spritework
add: Divine Archer Armor and Weapon
qol: Bows give more feedback when you're doing something wrong, like
trying to draw without a nocked arrow
code: Sorted files, cleaned bow code up to allow subtypes
/🆑
2023-04-29 02:07:44 +00:00

28 lines
1.1 KiB
Plaintext

/**
* Heals the user (if attached to an item) or the mob itself (if attached to a hostile simple mob)
* by a flat amount whenever a successful attack is performed against another living mob.
*/
/datum/element/lifesteal
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY|ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// heals a constant amount every time a hit occurs
var/flat_heal
/// static list shared that tells which order of damage types to prioritize
var/static/list/damage_heal_order = list(BRUTE, BURN, OXY)
/datum/element/lifesteal/Attach(datum/target, flat_heal = 10)
. = ..()
src.flat_heal = flat_heal
target.AddComponent(/datum/component/on_hit_effect, CALLBACK(src, PROC_REF(do_lifesteal)))
/datum/element/lifesteal/Detach(datum/target)
qdel(target.GetComponent(/datum/component/on_hit_effect))
return ..()
/datum/element/lifesteal/proc/do_lifesteal(datum/element_owner, atom/heal_target, atom/damage_target, hit_zone)
if(isliving(heal_target) && isliving(damage_target))
var/mob/living/healing = heal_target
var/mob/living/damaging = damage_target
if(damaging.stat != DEAD)
healing.heal_ordered_damage(flat_heal, damage_heal_order)