Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Healer Drone Ability: Sacrifice #4055

Closed
wants to merge 31 commits into from
Closed
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/datum/action/xeno_action/onclick/plant_resin_fruit, // Second macro. Resin fruits belong to Gardener, but Healer has a minor variant.
/datum/action/xeno_action/activable/apply_salve, //Third macro, heal over time ability.
/datum/action/xeno_action/activable/transfer_plasma/healer, //Fourth macro, an improved plasma transfer.
/datum/action/xeno_action/activable/healer_sacrifice, //Fifth macro, the ultimate ability to sacrifice yourself
)
keystone = TRUE
behavior_delegate_type = /datum/behavior_delegate/drone_healer
Expand Down Expand Up @@ -139,6 +140,8 @@
playsound(src, "alien_drool", 25)
var/datum/behavior_delegate/drone_healer/healer_delegate = src.behavior_delegate
healer_delegate.salve_applied_recently = TRUE
if(target_xeno.mutation_type != DRONE_HEALER && !isfacehugger(target_xeno)) // no cheap grinding
healer_delegate.modify_transferred(amount * damage_taken_mod)
update_icons()
addtimer(CALLBACK(healer_delegate, /datum/behavior_delegate/drone_healer/proc/un_salve), 10 SECONDS, TIMER_OVERRIDE|TIMER_UNIQUE)

Expand All @@ -148,6 +151,9 @@
var/salve_applied_recently = FALSE
var/mutable_appearance/salve_applied_icon

var/trasnferred_amount = 0
ihatethisengine marked this conversation as resolved.
Show resolved Hide resolved
var/max_transferred_amount = 10000

/datum/behavior_delegate/drone_healer/on_update_icons()
if(!salve_applied_icon)
salve_applied_icon = mutable_appearance('icons/mob/xenos/drone_strain_overlays.dmi',"Healer Drone Walking")
Expand All @@ -173,3 +179,118 @@
/datum/behavior_delegate/drone_healer/proc/un_salve()
salve_applied_recently = FALSE
bound_xeno.update_icons()

/*
SACRIFICE
*/

/datum/behavior_delegate/drone_healer/proc/modify_transferred(amount)
trasnferred_amount += amount
if(trasnferred_amount > max_transferred_amount)
trasnferred_amount = max_transferred_amount
if(trasnferred_amount < 0)
trasnferred_amount = 0

/datum/behavior_delegate/drone_healer/append_to_stat()
. = list()
. += "Trasnferred health amount: [trasnferred_amount]"
if(trasnferred_amount >= max_transferred_amount)
. += "Sacrifice will grant you new life."

/datum/behavior_delegate/drone_healer/on_life()
if(!bound_xeno)
return
if(bound_xeno.stat == DEAD)
return
var/image/holder = bound_xeno.hud_list[PLASMA_HUD]
holder.overlays.Cut()
var/percentage_transferred = round((trasnferred_amount / max_transferred_amount) * 100, 10)
if(percentage_transferred)
holder.overlays += image('icons/mob/hud/hud.dmi', "xenoenergy[percentage_transferred]")

/datum/action/xeno_action/activable/healer_sacrifice
name = "Sacrifice"
action_icon_state = "screech"
ability_name = "sacrifice"
var/max_range = 1
var/transfer_mod = 0.75 // only transfers 75% of current healer's health
macro_path = /datum/action/xeno_action/verb/verb_healer_sacrifice
action_type = XENO_ACTION_CLICK
ability_primacy = XENO_PRIMARY_ACTION_5

/datum/action/xeno_action/verb/verb_healer_sacrifice()
set category = "Alien"
set name = "Sacrifice"
set hidden = 1
ihatethisengine marked this conversation as resolved.
Show resolved Hide resolved
var/action_name = "Sacrifice"
handle_xeno_macro(src, action_name)

/datum/action/xeno_action/activable/healer_sacrifice/use_ability(atom/atom)
var/mob/living/carbon/xenomorph/xeno = owner
var/mob/living/carbon/xenomorph/target = atom

if(!istype(target))
return

if(target == xeno)
to_chat(xeno, "You can't heal yourself!")
return

if(isfacehugger(target) || islesserdrone(target))
to_chat(xeno, "It would be a waste...")
return

if(!xeno.check_state())
return

if(target.stat == DEAD)
to_chat(xeno, SPAN_WARNING("[target] is already dead!"))
return

if(target.health >= target.maxHealth)
to_chat(xeno, SPAN_WARNING("\The [target] is already at max health!"))
ihatethisengine marked this conversation as resolved.
Show resolved Hide resolved
return

if(!isturf(xeno.loc))
to_chat(xeno, SPAN_WARNING("You cannot transfer health from here!"))
return

if(get_dist(xeno, target) > max_range)
to_chat(xeno, SPAN_WARNING("You need to be closer to [target]."))
return

xeno.say(";MY LIFE FOR THE QUEEN!!!")
target.visible_message(SPAN_XENOHIGHDANGER("[xeno] sacrifices itself to heal [target]!"), SPAN_XENOHIGHDANGER("[xeno] sacrifices itself for you!"))

target.gain_health(xeno.health * transfer_mod)
target.updatehealth()

target.xeno_jitter(1 SECONDS)
target.flick_heal_overlay(3 SECONDS, "#44253d")

target.SetKnockDown(0)
target.SetStun(0)
target.SetKnockOut(0)
target.SetDaze(0)
target.SetSlow(0)
target.SetSuperslow(0)

var/datum/behavior_delegate/drone_healer/behavior_delegate = xeno.behavior_delegate
if(istype(behavior_delegate) && behavior_delegate.trasnferred_amount >= behavior_delegate.max_transferred_amount && xeno.client && xeno.hive)
addtimer(CALLBACK(xeno.hive, TYPE_PROC_REF(/datum/hive_status, free_respawn), xeno.client), 5 SECONDS)

xeno.gib("sacrificing itself")

/datum/action/xeno_action/activable/healer_sacrifice/action_activate()
..()
var/mob/living/carbon/xenomorph/xeno = owner
if(xeno.selected_ability != src)
return
var/datum/behavior_delegate/drone_healer/behavior_delegate = xeno.behavior_delegate
if(!istype(behavior_delegate))
return
if (behavior_delegate.trasnferred_amount < behavior_delegate.max_transferred_amount)
to_chat(xeno, SPAN_HIGHDANGER("Warning: [name] is a last measure skill. Using it will kill you."))
else
to_chat(xeno, SPAN_HIGHDANGER("Warning: [name] is a last measure skill. Using it will kill you, but new life will be granted for your hard work for the hive."))

Loading