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
Show file tree
Hide file tree
Changes from all 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 @@ -423,7 +423,7 @@
action_type = XENO_ACTION_CLICK
ability_primacy = XENO_PRIMARY_ACTION_5

/datum/action/xeno_action/activable/place_construction/queen_macro //so it doesn't screw other macros up
/datum/action/xeno_action/activable/place_construction/not_primary //so it doesn't screw other macros up
ability_primacy = XENO_NOT_PRIMARY_ACTION

/datum/action/xeno_action/activable/xeno_spit
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/castes/Queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
/datum/action/xeno_action/onclick/regurgitate,
/datum/action/xeno_action/watch_xeno,
/datum/action/xeno_action/activable/tail_stab,
/datum/action/xeno_action/activable/place_construction/queen_macro, //normally fifth macro but not as important for queen
/datum/action/xeno_action/activable/place_construction/not_primary, //normally fifth macro but not as important for queen
/datum/action/xeno_action/activable/corrosive_acid,
/datum/action/xeno_action/onclick/emit_pheromones,
/datum/action/xeno_action/onclick/queen_word,
Expand Down Expand Up @@ -321,7 +321,7 @@
/datum/action/xeno_action/onclick/regurgitate,
/datum/action/xeno_action/watch_xeno,
/datum/action/xeno_action/activable/tail_stab,
/datum/action/xeno_action/activable/place_construction/queen_macro, //normally fifth macro but not as important for queen
/datum/action/xeno_action/activable/place_construction/not_primary, //normally fifth macro but not as important for queen
/datum/action/xeno_action/activable/corrosive_acid,
/datum/action/xeno_action/onclick/emit_pheromones,
/datum/action/xeno_action/onclick/queen_word,
Expand Down Expand Up @@ -797,7 +797,7 @@
// These already have their placement locked in:
/datum/action/xeno_action/onclick/regurgitate,
/datum/action/xeno_action/watch_xeno,
/datum/action/xeno_action/activable/place_construction/queen_macro,
/datum/action/xeno_action/activable/place_construction/not_primary,
/datum/action/xeno_action/onclick/emit_pheromones,
/datum/action/xeno_action/onclick/queen_word,
/datum/action/xeno_action/onclick/psychic_whisper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@
/datum/action/xeno_action/activable/secrete_resin,
/datum/action/xeno_action/onclick/choose_resin,
/datum/action/xeno_action/activable/transfer_plasma,
/datum/action/xeno_action/activable/place_construction, // so it doesn't use fifth macro
/datum/action/xeno_action/onclick/plant_weeds, // so it doesn't break order
)
mutator_actions_to_add = list(
/datum/action/xeno_action/activable/place_construction/not_primary, // so it doesn't use fifth macro
/datum/action/xeno_action/onclick/plant_weeds, // so it doesn't break order
/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 @@ -137,8 +142,10 @@
to_chat(target_xeno, SPAN_XENOWARNING("[src] covers your wounds with a regenerative resin salve. You feel reinvigorated!"))
to_chat(src, SPAN_XENOWARNING("You regurgitate your vital fluids and some plasma to create a regenerative resin salve and apply it to [target_xeno]'s wounds. You feel weakened..."))
playsound(src, "alien_drool", 25)
var/datum/behavior_delegate/drone_healer/healer_delegate = src.behavior_delegate
var/datum/behavior_delegate/drone_healer/healer_delegate = 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 +155,9 @@
var/salve_applied_recently = FALSE
var/mutable_appearance/salve_applied_icon

var/transferred_amount = 0
var/required_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 +183,125 @@
/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)
transferred_amount += amount

/datum/behavior_delegate/drone_healer/append_to_stat()
. = list()
. += "Transferred health amount: [transferred_amount]"
if(transferred_amount >= required_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 = min(round((transferred_amount / required_transferred_amount) * 100, 10), 100)
if(percentage_transferred)
holder.overlays += image('icons/mob/hud/hud.dmi', "xenoenergy[percentage_transferred]")

/datum/behavior_delegate/drone_healer/handle_death(mob/M)
var/image/holder = bound_xeno.hud_list[PLASMA_HUD]
holder.overlays.Cut()

/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 = TRUE
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("[target] is already at max health!"))
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.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)

target.visible_message(SPAN_XENONOTICE("[xeno] explodes in a deluge of regenerative resin salve, covering [target] in it!"))
xeno_message(SPAN_XENOANNOUNCE("[xeno] sacrifices itself to heal [target]!"), 2, target.hive.hivenumber)

var/datum/behavior_delegate/drone_healer/behavior_delegate = xeno.behavior_delegate
if(istype(behavior_delegate) && behavior_delegate.transferred_amount >= behavior_delegate.required_transferred_amount && xeno.client && xeno.hive)
var/datum/hive_status/hive_status = xeno.hive
var/turf/spawning_turf = get_turf(xeno)
if(!hive_status.hive_location)
addtimer(CALLBACK(xeno.hive, TYPE_PROC_REF(/datum/hive_status, respawn_on_turf), xeno.client, spawning_turf), 0.5 SECONDS)
else
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.transferred_amount < behavior_delegate.required_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."))