From 94759db4c8b985dfce73ca7315df8408276dc66c Mon Sep 17 00:00:00 2001
From: Nukechickenu64 <92064523+Nukechickenu64@users.noreply.github.com>
Date: Sat, 1 Oct 2022 20:04:53 -0400
Subject: [PATCH] Bloodsucker Fledgeling quirk and quirk ability section in
code
adds a vampiric quirk that makes you only be able to gain nutrients from blood and be able to bite, along with their problems, also adds section to add in abilities for neutral quirks
---
code/__DEFINES/mobs/innate_abilities.dm | 2 +
code/__DEFINES/traits.dm | 1 +
code/datums/traits/neutral.dm | 87 +++++++++++++++++++
code/modules/mob/innate_abilities.dm | 3 +-
.../chemistry/reagents/other_reagents.dm | 4 +-
5 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/code/__DEFINES/mobs/innate_abilities.dm b/code/__DEFINES/mobs/innate_abilities.dm
index d2d3dbbc67..05253387b0 100644
--- a/code/__DEFINES/mobs/innate_abilities.dm
+++ b/code/__DEFINES/mobs/innate_abilities.dm
@@ -14,6 +14,8 @@
/// limb regrowth
#define INNATE_ABILITY_LIMB_REGROWTH "limb_regrowth"
+#define INNATE_ABILITY_VBITE "vbite"
+
/// ability properties
// customization/body change
/// is this silent?
diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm
index 222dc5cd39..69707e910b 100644
--- a/code/__DEFINES/traits.dm
+++ b/code/__DEFINES/traits.dm
@@ -73,6 +73,7 @@
/// Prevents voluntary movement.
#define TRAIT_IMMOBILIZED "immobilized"
/// Prevents usage of manipulation appendages (picking, holding or using items, manipulating storage).
+#define BLOODFLEDGE "BloodFledge"
#define TRAIT_HANDS_BLOCKED "handsblocked"
#define TRAIT_BLIND "blind"
#define TRAIT_MUTE "mute"
diff --git a/code/datums/traits/neutral.dm b/code/datums/traits/neutral.dm
index aebe6ec7fa..14f5b79907 100644
--- a/code/datums/traits/neutral.dm
+++ b/code/datums/traits/neutral.dm
@@ -186,3 +186,90 @@
value = 0
medical_record_text = "Patient should not come into contact with sodium."
mob_trait = TRAIT_SALT_SENSITIVE
+
+/datum/quirk/vampire
+ name = "Bloodsucker Fledgeling"
+ desc = "you need blood for nutriment, you have fangs to aid with this, the church does not harm you"
+ value = 3
+ medical_record_text = "this person was partially infected by a bloodsucker"
+ mob_trait = BLOODFLEDGE
+ gain_text = "You feel an otherworldly thirst."
+ lose_text = "you feel an otherworldy burden remove itself"
+ processing_quirk = TRUE
+
+/datum/quirk/vampire/on_spawn()
+ . = ..()
+ var/mob/living/carbon/human/H = quirk_holder
+ var/mob/living/carbon/C = quirk_holder
+ ADD_TRAIT(H,TRAIT_NO_PROCESS_FOOD,SPECIES_TRAIT)
+ ADD_TRAIT(H,TRAIT_COLDBLOODED,SPECIES_TRAIT)
+ ADD_TRAIT(H,TRAIT_NOBREATH,SPECIES_TRAIT)
+ ADD_TRAIT(H,TRAIT_NOTHIRST,SPECIES_TRAIT)
+ if(!C.dna.skin_tone_override)
+ H.skin_tone = "albino"
+ H.grant_ability_from_source(list(INNATE_ABILITY_VBITE),ABILITY_SOURCE_SPECIES)//gives the ability, check innate_abilities for defining new abilities
+
+/datum/quirk/vampire/on_process()
+ . = ..()
+ var/mob/living/carbon/C = quirk_holder
+ var/area/A = get_area(C)
+ if(istype(A, /area/service/chapel) && C.mind?.assigned_role != "Chaplain")
+ to_chat(C, "You don't belong here!")
+ C.adjustFireLoss(5)
+ C.adjust_fire_stacks(6)
+
+/// quirk actions ///
+
+//vampire bite
+/datum/action/vbite
+ name = "Bite Victim"
+ button_icon_state = "power_feed"
+ icon_icon = 'icons/mob/actions/bloodsucker.dmi'
+ desc = "bite the person you are grabbing with your fangs"
+
+#define VAMP_DRAIN_AMOUNT 50
+
+/datum/action/vbite/Trigger()
+ . = ..()
+ var/drain_cooldown = 0
+ if(iscarbon(owner))
+ var/mob/living/carbon/H = owner
+ if(H.nutrition >= 800)
+ to_chat(H, "You are too full to drain any more.")
+ return
+ if(drain_cooldown >= world.time)
+ to_chat(H, "You just drained blood, wait a few seconds.")
+ return
+ if(H.pulling && iscarbon(H.pulling))
+ var/mob/living/carbon/victim = H.pulling
+ drain_cooldown = world.time + 40
+ if(victim.anti_magic_check(FALSE, TRUE, FALSE, 0))
+ to_chat(victim, "[H] tries to bite you, but stops before touching you!")
+ to_chat(H, "[victim] is blessed! You stop just in time to avoid catching fire.")
+ return
+ //Here we check now for both the garlic cloves on the neck and for blood in the victims bloodstream.
+ if(!blood_sucking_checks(victim, TRUE, TRUE))
+ return
+ if(!do_after(H, 30, target = victim))
+ return
+ var/blood_volume_difference = BLOOD_VOLUME_MAXIMUM - H.blood_volume //How much capacity we have left to absorb blood
+ var/drained_blood = min(victim.blood_volume, VAMP_DRAIN_AMOUNT, blood_volume_difference)
+ H.reagents.add_reagent(/datum/reagent/blood/, drained_blood)
+ to_chat(victim, "[H] is draining your blood!")
+ H.visible_message("[H] Bites down on [victim]'s neck!")
+ to_chat(H, "You drain some blood!")
+ playsound(H, 'sound/items/drink.ogg', 30, 1, -2)
+ victim.blood_volume = clamp(victim.blood_volume - drained_blood, 0, BLOOD_VOLUME_MAXIMUM)
+ if(!victim.blood_volume)
+ to_chat(H, "You finish off [victim]'s blood supply!")
+
+/datum/action/vbite/New(Target)//defines the button
+ link_to(Target)
+ button = new
+ button.linked_action = src
+ button.name = name
+ button.actiontooltipstyle = buttontooltipstyle
+ if(desc)
+ button.desc = desc
+
+//put next quirk action here
diff --git a/code/modules/mob/innate_abilities.dm b/code/modules/mob/innate_abilities.dm
index aa2a924abe..579fc98d5c 100644
--- a/code/modules/mob/innate_abilities.dm
+++ b/code/modules/mob/innate_abilities.dm
@@ -18,7 +18,8 @@ GLOBAL_LIST_INIT(innate_ability_typepaths, all_innate_ability_typepaths())
return list(
INNATE_ABILITY_HUMANOID_CUSTOMIZATION = /datum/action/innate/ability/humanoid_customization,
INNATE_ABILITY_SLIME_BLOBFORM = /datum/action/innate/ability/slime_blobform,
- INNATE_ABILITY_LIMB_REGROWTH = /datum/action/innate/ability/limb_regrowth
+ INNATE_ABILITY_LIMB_REGROWTH = /datum/action/innate/ability/limb_regrowth,
+ INNATE_ABILITY_VBITE = /datum/action/vbite
)
/**
diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm
index 601ac81f0f..8c39013fa0 100644
--- a/code/modules/reagents/chemistry/reagents/other_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm
@@ -57,9 +57,11 @@
/datum/reagent/blood/on_mob_life(mob/living/carbon/C) //Because lethals are preferred over stamina. damnifino.
var/blood_id = C.get_blood_id()
- if((blood_id in GLOB.blood_reagent_types) && !HAS_TRAIT(C, TRAIT_NOMARROW))
+ if((blood_id in GLOB.blood_reagent_types) && !HAS_TRAIT(C, TRAIT_NOMARROW) && !HAS_TRAIT(C, BLOODFLEDGE))
if(!data || !(data["blood_type"] in get_safe_blood(C.dna.blood_type))) //we only care about bloodtype here because this is where the poisoning should be
C.adjustToxLoss(rand(2,8)*REAGENTS_EFFECT_MULTIPLIER, TRUE, TRUE) //forced to ensure people don't use it to gain beneficial toxin as slime person
+ if(HAS_TRAIT(C,BLOODFLEDGE))
+ C.adjust_nutrition(20)
..()
/datum/reagent/blood/reaction_obj(obj/O, volume)