Files
Bubberstation/code/datums/elements/bane.dm
T
tralezab 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

81 lines
3.3 KiB
Plaintext

/// Deals extra damage to mobs of a certain type, species, or biotype.
/// This doesn't directly modify the normal damage of the weapon, instead it applies it's own damage seperatedly ON TOP of normal damage
/// ie. a sword that does 10 damage with a bane elment attacthed that has a 0.5 damage_multiplier will do:
/// 10 damage from the swords normal attack + 5 damage (50%) from the bane element
/datum/element/bane
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// can be a mob or a species.
var/target_type
/// multiplier of the extra damage based on the force of the item.
var/damage_multiplier
/// Added after the above.
var/added_damage
/// If it requires combat mode on to deal the extra damage or not.
var/requires_combat_mode
/// if we want it to only affect a certain mob biotype
var/mob_biotypes
/datum/element/bane/Attach(datum/target, target_type = /mob/living, mob_biotypes = NONE, damage_multiplier=1, added_damage = 0, requires_combat_mode = TRUE)
. = ..()
if(!ispath(target_type, /mob/living) && !ispath(target_type, /datum/species))
return ELEMENT_INCOMPATIBLE
src.target_type = target_type
src.damage_multiplier = damage_multiplier
src.added_damage = added_damage
src.requires_combat_mode = requires_combat_mode
src.mob_biotypes = mob_biotypes
target.AddComponent(/datum/component/on_hit_effect, CALLBACK(src, PROC_REF(do_bane)), CALLBACK(src, PROC_REF(check_bane)))
/datum/element/bane/Detach(datum/target)
qdel(target.GetComponent(/datum/component/on_hit_effect))
return ..()
/datum/element/bane/proc/check_bane(mob/living/bane_applier, atom/target)
if(!isliving(target))
return
var/mob/living/living_target = target
if(bane_applier)
if(requires_combat_mode && !bane_applier.combat_mode)
return
var/is_correct_biotype = living_target.mob_biotypes & mob_biotypes
if(mob_biotypes && !(is_correct_biotype))
return FALSE
if(ispath(target_type, /mob/living))
return istype(living_target, target_type)
else //species type
return is_species(living_target, target_type)
/datum/element/bane/proc/do_bane(datum/element_owner, mob/living/bane_applier, mob/living/baned_target, hit_zone)
var/force_boosted
var/applied_dam_type
if(isitem(element_owner))
var/obj/item/item_owner = element_owner
force_boosted = item_owner.force
applied_dam_type = item_owner.damtype
else if(isprojectile(element_owner))
var/obj/projectile/projectile_owner = element_owner
force_boosted = projectile_owner.damage
applied_dam_type = projectile_owner.damage_type
else if (isliving(element_owner))
var/mob/living/living_owner = element_owner
force_boosted = (living_owner.melee_damage_lower + living_owner.melee_damage_upper) / 2
//commence crying. yes, these really are the same check. FUCK.
if(isbasicmob(living_owner))
var/mob/living/basic/basic_owner = living_owner
applied_dam_type = basic_owner.melee_damage_type
else if(isanimal(living_owner))
var/mob/living/simple_animal/simple_owner = living_owner
applied_dam_type = simple_owner.melee_damage_type
else
return
else
return
var/extra_damage = max(0, (force_boosted * damage_multiplier) + added_damage)
baned_target.apply_damage(extra_damage, applied_dam_type, hit_zone)
SEND_SIGNAL(baned_target, COMSIG_LIVING_BANED, bane_applier, baned_target) // for extra effects when baned.