Merge pull request #11868 from Arturlang/tackling_and_lunge

Ports TG Tackling and uses it to rework bloodsucker lunge
This commit is contained in:
Ghom
2020-04-21 15:50:44 +02:00
committed by GitHub
46 changed files with 794 additions and 151 deletions
@@ -3,7 +3,7 @@
/datum/action/bloodsucker/fortitude
name = "Fortitude"//"Cellular Emporium"
name = "Fortitude"
desc = "Withstand egregious physical wounds and walk away from attacks that would stun, pierce, and dismember lesser beings. You cannot run while active."
button_icon_state = "power_fortitude"
bloodcost = 30
@@ -11,28 +11,27 @@
bloodsucker_can_buy = TRUE
amToggle = TRUE
warn_constant_cost = TRUE
var/was_running
var/this_resist // So we can raise and lower your brute resist based on what your level_current WAS.
var/fortitude_resist // So we can raise and lower your brute resist based on what your level_current WAS.
/datum/action/bloodsucker/fortitude/ActivatePower()
var/datum/antagonist/bloodsucker/bloodsuckerdatum = owner.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER)
var/datum/antagonist/bloodsucker/B = owner.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER)
var/mob/living/user = owner
to_chat(user, "<span class='notice'>Your flesh, skin, and muscles become as steel.</span>")
// Traits & Effects
ADD_TRAIT(user, TRAIT_PIERCEIMMUNE, "fortitude")
ADD_TRAIT(user, TRAIT_NODISMEMBER, "fortitude")
ADD_TRAIT(user, TRAIT_STUNIMMUNE, "fortitude")
ADD_TRAIT(user, TRAIT_NORUNNING, "fortitude")
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
this_resist = max(0.3, 0.7 - level_current * 0.1)
H.physiology.brute_mod *= this_resist//0.5
H.physiology.burn_mod *= this_resist//0.5
// Stop Running (Taken from /datum/quirk/nyctophobia in negative.dm)
var/was_running = (user.m_intent == MOVE_INTENT_RUN)
fortitude_resist = max(0.3, 0.7 - level_current * 0.1)
H.physiology.brute_mod *= fortitude_resist
H.physiology.burn_mod *= fortitude_resist
was_running = (user.m_intent == MOVE_INTENT_RUN)
if(was_running)
user.toggle_move_intent()
while(bloodsuckerdatum && ContinueActive(user) || user.m_intent == MOVE_INTENT_RUN)
while(B && ContinueActive(user) || user.m_intent == MOVE_INTENT_RUN)
if(istype(user.buckled, /obj/vehicle)) //We dont want people using fortitude being able to use vehicles
var/obj/vehicle/V = user.buckled
var/datum/component/riding/VRD = V.GetComponent(/datum/component/riding)
@@ -44,20 +43,21 @@
to_chat(user, "<span class='notice'>You fall off the [V], your weight making you too heavy to be supported by it.</span>")
// Pay Blood Toll (if awake)
if(user.stat == CONSCIOUS)
bloodsuckerdatum.AddBloodVolume(-0.5) // Used to be 0.3 blood per 2 seconds, but we're making it more expensive to keep on.
B.AddBloodVolume(-0.5)
sleep(20) // Check every few ticks that we haven't disabled this power
// Return to Running (if you were before)
if(was_running && user.m_intent != MOVE_INTENT_RUN)
user.toggle_move_intent()
/datum/action/bloodsucker/fortitude/DeactivatePower(mob/living/user = owner, mob/living/target)
..()
// Restore Traits & Effects
REMOVE_TRAIT(user, TRAIT_PIERCEIMMUNE, "fortitude")
REMOVE_TRAIT(user, TRAIT_NODISMEMBER, "fortitude")
REMOVE_TRAIT(user, TRAIT_STUNIMMUNE, "fortitude")
REMOVE_TRAIT(user, TRAIT_NORUNNING, "fortitude")
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
H.physiology.brute_mod /= this_resist//0.5
H.physiology.burn_mod /= this_resist//0.5
if(!ishuman(owner))
return
var/mob/living/carbon/human/H = owner
H.physiology.brute_mod /= fortitude_resist
H.physiology.burn_mod /= fortitude_resist
if(was_running && user.m_intent == MOVE_INTENT_WALK)
user.toggle_move_intent()
@@ -1,88 +1,46 @@
// Level 1: Grapple level 2
// Level 2: Grapple 3 from Behind
// Level 3: Grapple 3 from Shadows
/datum/action/bloodsucker/targeted/lunge
/datum/action/bloodsucker/lunge
name = "Predatory Lunge"
desc = "Spring at your target and aggressively grapple them without warning. Attacks from concealment or the rear may even knock them down."
desc = "Prepare the strenght to grapple your prey."
button_icon_state = "power_lunge"
bloodcost = 10
cooldown = 120
target_range = 3
power_activates_immediately = TRUE
message_Trigger = "Whom will you ensnare within your grasp?"
must_be_capacitated = TRUE
cooldown = 30
bloodsucker_can_buy = TRUE
warn_constant_cost = TRUE
amToggle = TRUE
var/leap_skill_mod = 5
/datum/action/bloodsucker/targeted/lunge/CheckCanUse(display_error)
if(!..(display_error))// DEFAULT CHECKS
return FALSE
// Being Grabbed
if(owner.pulledby && owner.pulledby.grab_state >= GRAB_AGGRESSIVE)
if(display_error)
to_chat(owner, "<span class='warning'>You're being grabbed!</span>")
return FALSE
if(!owner.has_gravity(owner.loc))//TODO figure out how to check if theyre able to move while in nograv
if(display_error)
to_chat(owner, "<span class='warning'>You cant lunge while floating!</span>")
return FALSE
return TRUE
/datum/action/bloodsucker/lunge/New()
. = ..()
/datum/action/bloodsucker/targeted/lunge/CheckValidTarget(atom/A)
return iscarbon(A)
/datum/action/bloodsucker/lunge/Destroy()
. = ..()
UnregisterSignal(owner, COMSIG_CARBON_TACKLED)
/datum/action/bloodsucker/targeted/lunge/CheckCanTarget(atom/A, display_error)
// Check: Self
if(target == owner)
return FALSE
// Check: Range
//if (!(target in view(target_range, get_turf(owner))))
// if (display_error)
// to_chat(owner, "<span class='warning'>Your victim is too far away.</span>")
// return FALSE
// DEFAULT CHECKS (Distance)
if(!..())
return FALSE
// Check: Turf
var/mob/living/L = A
if(!isturf(L.loc))
return FALSE
return TRUE
/datum/action/bloodsucker/lunge/ActivatePower()
var/mob/living/carbon/user = owner
var/datum/antagonist/bloodsucker/B = user.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER)
var/datum/component/tackler/T = user.LoadComponent(/datum/component/tackler)
T.stamina_cost = 50
T.base_knockdown = 3 SECONDS
T.range = 4
T.speed = 0.8
T.skill_mod = 5 //Monstrous tackling
T.min_distance = 2
active = TRUE
user.toggle_throw_mode()
RegisterSignal(user, COMSIG_CARBON_TACKLED, .proc/DelayedDeactivatePower)
while(B && ContinueActive(user))
B.AddBloodVolume(-0.1)
sleep(5)
/datum/action/bloodsucker/targeted/lunge/FireTargetedPower(atom/A)
// set waitfor = FALSE <---- DONT DO THIS!We WANT this power to hold up ClickWithPower(), so that we can unlock the power when it's done.
var/mob/living/carbon/target = A
var/turf/T = get_turf(target)
var/mob/living/L = owner
// Clear Vars
owner.pulling = null
// Will we Knock them Down?
var/do_knockdown = !is_A_facing_B(target,owner) || owner.alpha <= 0 || istype(owner.loc, /obj/structure/closet)
// CAUSES: Target has their back to me, I'm invisible, or I'm in a Closet
// Step One: Heatseek toward Target's Turf
addtimer(CALLBACK(GLOBAL_PROC, .proc/_walk, owner, 0), 2 SECONDS)
target.playsound_local(get_turf(owner), 'sound/bloodsucker/lunge_warn.ogg', 60, FALSE, pressure_affected = FALSE) // target-only telegraphing
owner.playsound_local(owner, 'sound/bloodsucker/lunge_warn.ogg', 60, FALSE, pressure_affected = FALSE) // audio feedback to the user
if(do_mob(owner, owner, 7, TRUE, TRUE))
walk_towards(owner, T, 0.1, 10) // yes i know i shouldn't use this but i don't know how to work in anything better
if(get_turf(owner) != T && !(isliving(target) && target.Adjacent(owner)) && owner.incapacitated() && !CHECK_MOBILITY(L, MOBILITY_STAND))
var/send_dir = get_dir(owner, T)
new /datum/forced_movement(owner, get_ranged_target_turf(owner, send_dir, 1), 1, FALSE)
owner.spin(10)
// Step Two: Check if I'm at/adjectent to Target's CURRENT turf (not original...that was just a destination)
for(var/i in 1 to 6)
if (target.Adjacent(owner))
// LEVEL 2: If behind target, mute or unconscious!
if(do_knockdown) // && level_current >= 1)
target.Knockdown(15 + 10 * level_current,1)
target.adjustStaminaLoss(40 + 10 * level_current)
// Cancel Walk (we were close enough to contact them)
walk(owner, 0)
target.Stun(10,1) //Without this the victim can just walk away
target.grabbedby(owner) // Taken from mutations.dm under changelings
target.grippedby(owner, instant = TRUE) //instant aggro grab
break
sleep(3)
//Without this, the leap component would get removed too early, causing the normal crash into effects.
/datum/action/bloodsucker/lunge/proc/DelayedDeactivatePower()
addtimer(CALLBACK(src, .proc/DeactivatePower), 1 SECONDS, TIMER_UNIQUE)
/datum/action/bloodsucker/targeted/lunge/DeactivatePower(mob/living/user = owner, mob/living/target)
..() // activate = FALSE
user.update_mobility()
/datum/action/bloodsucker/lunge/DeactivatePower(mob/living/user = owner)
. = ..()
qdel(user.GetComponent(/datum/component/tackler))
UnregisterSignal(user, COMSIG_CARBON_TACKLED)