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

Refactors several changeling abilities to status effects and ports "Darkness Adaptation" #3839

Merged
merged 26 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
14 changes: 11 additions & 3 deletions code/datums/mutations/chameleon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@
power_coeff = 1

/datum/mutation/human/chameleon/on_acquiring(mob/living/carbon/human/owner)
if(..())
. = ..() // monkestation edit
if(.) // monkestation edit
return
owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
RegisterSignal(owner, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, PROC_REF(on_attack_hand))

/datum/mutation/human/chameleon/on_life(seconds_per_tick, times_fired)
/datum/mutation/human/chameleon/process(seconds_per_tick) // monkestation edit, also do NOT move this to animate() as it *WILL* get interrupted constantly
owner.alpha = max(owner.alpha - (12.5 * (GET_MUTATION_POWER(src)) * seconds_per_tick), 0)

//Upgraded mutation of the base variant, used for changelings. No instability and better power_coeff
/datum/mutation/human/chameleon/changeling
instability = 0
power_coeff = 2.5
locked = TRUE

/**
* Resets the alpha of the host to the chameleon default if they move.
*
Expand Down Expand Up @@ -51,7 +58,8 @@
owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY

/datum/mutation/human/chameleon/on_losing(mob/living/carbon/human/owner)
if(..())
. = ..() // monkestation edit
if(.) // monkestation edit
return
owner.alpha = 255
UnregisterSignal(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_HUMAN_EARLY_UNARMED_ATTACK))
3 changes: 2 additions & 1 deletion code/datums/status_effects/_status_effect.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/// When set initially / in on_creation, this is how long between [proc/tick] calls in deciseconds.
/// While processing, this becomes the world.time when the next tick will occur.
/// -1 = will stop processing, if duration is also unlimited (-1).
/// 0 = passes processing straight to tick(), generally not that bad of an idea.
var/tick_interval = 1 SECONDS
/// The mob affected by the status effect.
VAR_FINAL/mob/living/owner
Expand Down Expand Up @@ -59,7 +60,7 @@
linked_alert = new_alert //so we can reference the alert, if we need to
update_shown_duration()

if(duration > 0 || initial(tick_interval) > 0) //don't process if we don't care
if(duration > 0 || initial(tick_interval) >= 0) // don't process if we don't care | MONKESTATION EDIT
switch(processing_speed)
if(STATUS_EFFECT_FAST_PROCESS)
START_PROCESSING(SSfastprocess, src)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/buffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
/datum/status_effect/blooddrunk
id = "blooddrunk"
duration = 10
tick_interval = 0
tick_interval = -1 // monkestation edit
alert_type = /atom/movable/screen/alert/status_effect/blooddrunk

/atom/movable/screen/alert/status_effect/blooddrunk
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Largely negative status effects go here, even if they have small benificial effects
//STUN EFFECTS
/datum/status_effect/incapacitating
tick_interval = 0
tick_interval = -1 // monkestation edit
status_type = STATUS_EFFECT_REPLACE
alert_type = null
remove_on_fullheal = TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/neutral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
/datum/status_effect/caltropped
id = "caltropped"
duration = 1 SECONDS
tick_interval = INFINITY
tick_interval = -1 // monkestation edit
status_type = STATUS_EFFECT_REFRESH
alert_type = null

Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/wound_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/datum/status_effect/limp
id = "limp"
status_type = STATUS_EFFECT_REPLACE
tick_interval = 0
tick_interval = -1 // monkestation edit
on_remove_on_mob_delete = TRUE
alert_type = /atom/movable/screen/alert/status_effect/limp
var/msg_stage = 0//so you dont get the most intense messages immediately
Expand Down
15 changes: 10 additions & 5 deletions code/modules/antagonists/changeling/powers/adrenaline.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/datum/action/changeling/adrenaline
name = "Adrenaline Sacs"
desc = "We evolve additional sacs of adrenaline throughout our body. Costs 30 chemicals."
helptext = "Removes all stuns instantly and adds a short-term reduction in further stuns. Can be used while unconscious. Continued use poisons the body."
desc = "We evolve additional sacs of adrenaline throughout our body. Costs 20 chemicals." // monkestation edit
helptext = "Makes you stun immune for 20 seconds and grants you a burst of speed. Can be used while unconscious. Mildly toxic. Maximum stack duration of a minute." // monkestation edit
button_icon_state = "adrenaline"
chemical_cost = 30
chemical_cost = 20 // monkestation edit
dna_cost = 2
req_human = TRUE
req_stat = UNCONSCIOUS
Expand All @@ -12,9 +12,14 @@
//Recover from stuns.
/datum/action/changeling/adrenaline/sting_action(mob/living/user)
..()
user.apply_status_effect(/datum/status_effect/changeling_adrenaline) // monkestation addition
/* MONKESTATION REMOVAL START
to_chat(user, span_notice("Energy rushes through us."))
user.SetKnockdown(0)
user.set_resting(FALSE)
if(HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, STAMINA))
user.exit_stamina_stun()
user.SetAllImmobility(0) // monkestation edit
user.set_resting(FALSE, silent = TRUE, instant = TRUE) // monkestation edit
user.reagents.add_reagent(/datum/reagent/medicine/changelingadrenaline, 4) //20 seconds
user.reagents.add_reagent(/datum/reagent/medicine/changelinghaste, 3) //6 seconds, for a really quick burst of speed
MONKESTATION REMOVAL END */
return TRUE
4 changes: 2 additions & 2 deletions code/modules/antagonists/changeling/powers/biodegrade.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/datum/action/changeling/biodegrade
name = "Biodegrade"
desc = "Dissolves restraints or other objects preventing free movement. Costs 30 chemicals."
desc = "Dissolves restraints or other objects preventing free movement. Costs 20 chemicals." // monkestation edit
helptext = "This is obvious to nearby people, and can destroy standard restraints and closets."
button_icon_state = "biodegrade"
chemical_cost = 30 //High cost to prevent spam
chemical_cost = 20 // monkestation edit
dna_cost = 2
req_human = TRUE
disabled_by_fire = FALSE
Expand Down
20 changes: 10 additions & 10 deletions code/modules/antagonists/changeling/powers/chameleon_skin.dm
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/datum/action/changeling/chameleon_skin
name = "Chameleon Skin"
desc = "Our skin pigmentation rapidly changes to suit our current environment. Costs 25 chemicals."
desc = "Our skin pigmentation rapidly changes to suit our current environment. Costs 10 chemicals."
helptext = "Allows us to become invisible after a few seconds of standing still. Can be toggled on and off."
button_icon_state = "chameleon_skin"
dna_cost = 2
chemical_cost = 25
dna_cost = 1
chemical_cost = 10
req_human = TRUE

/datum/action/changeling/chameleon_skin/sting_action(mob/user)
var/mob/living/carbon/human/H = user //SHOULD always be human, because req_human = TRUE
if(!istype(H)) // req_human could be done in can_sting stuff.
var/mob/living/carbon/human/cling = user //SHOULD always be human, because req_human = TRUE
if(!istype(cling)) // req_human could be done in can_sting stuff.
return
..()
if(H.dna.get_mutation(/datum/mutation/human/chameleon))
H.dna.remove_mutation(/datum/mutation/human/chameleon)
if(cling.dna.get_mutation(/datum/mutation/human/chameleon/changeling))
cling.dna.remove_mutation(/datum/mutation/human/chameleon/changeling)
else
H.dna.add_mutation(/datum/mutation/human/chameleon)
cling.dna.add_mutation(/datum/mutation/human/chameleon/changeling, MUT_OTHER) // monkestation edit
return TRUE

/datum/action/changeling/chameleon_skin/Remove(mob/user)
if(user.has_dna())
var/mob/living/carbon/C = user
C.dna.remove_mutation(/datum/mutation/human/chameleon)
var/mob/living/carbon/cling = user
cling.dna.remove_mutation(/datum/mutation/human/chameleon/changeling)
..()
82 changes: 82 additions & 0 deletions code/modules/antagonists/changeling/powers/darkness_adaptation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/datum/action/changeling/darkness_adaptation
name = "Darkness Adaptation"
desc = "Our skin pigmentation and eyes rapidly change to suit the darkness. Requires 10 available chemicals and slightly slows down chemical regeneration." // monkestation edit
helptext = "Makes us translucent. Works best in dark enviroments and garments. Makes our eyes more sensitive to flashes." // monkestation edit
button_icon_state = "darkness_adaptation"
dna_cost = 2
chemical_cost = 10

req_human = TRUE
//// is ability active (we are invisible)?
var/is_active = FALSE
/// How much we slow chemical regeneration while active, in chems per second
var/recharge_slowdown = 0.15

/datum/action/changeling/darkness_adaptation/on_purchase(mob/user, is_respec)
. = ..()
RegisterSignal(user, COMSIG_CARBON_GAIN_ORGAN, PROC_REF(eye_implanted))
RegisterSignal(user, COMSIG_CARBON_LOSE_ORGAN, PROC_REF(eye_removed))

/datum/action/changeling/darkness_adaptation/sting_action(mob/living/carbon/human/cling) //SHOULD always be human, because req_human = TRUE
..()
is_active = !is_active
if(is_active)
enable_ability(cling)
else
disable_ability(cling)

/datum/action/changeling/darkness_adaptation/Remove(mob/living/carbon/human/cling)
..()
disable_ability(cling)

/datum/action/changeling/darkness_adaptation/proc/enable_ability(mob/living/carbon/human/cling) //Enable the adaptation
animate(cling, alpha = 65,time = 3 SECONDS)
cling.visible_message(span_warning("[cling]'s skin suddenly starts becoming translucent!"), \
span_notice("We are now far more stealthy and better at seeing in the dark."))
animate(cling, color = COLOR_DARK, time = 3 SECONDS) // Darkens their overall appearance
var/datum/antagonist/changeling/changeling_data = cling.mind?.has_antag_datum(/datum/antagonist/changeling)
changeling_data?.chem_recharge_slowdown -= recharge_slowdown //Slows down chem regeneration
var/obj/item/organ/internal/eyes/eyes = cling.get_organ_by_type(/obj/item/organ/internal/eyes)
if(!istype(eyes))
return
eyes.lighting_cutoff = LIGHTING_CUTOFF_MEDIUM // Adds barely usable, kinda shit night vision
eyes.flash_protect = max(eyes.flash_protect += -1, FLASH_PROTECTION_HYPER_SENSITIVE) // Reduces flash protection by one level
cling.update_sight() // Update the display

/datum/action/changeling/darkness_adaptation/proc/disable_ability(mob/living/carbon/human/cling) //Restore the adaptation
animate(cling, alpha = 255, time = 3 SECONDS)
cling.visible_message(
span_warning("[cling] appears from thin air!"),
span_notice("We are now appearing normal and lost the ability to see in the dark."),
)
animate(cling, color = null, time = 3 SECONDS)
var/datum/antagonist/changeling/changeling_data = cling.mind?.has_antag_datum(/datum/antagonist/changeling)
changeling_data?.chem_recharge_slowdown += recharge_slowdown
var/obj/item/organ/internal/eyes/eyes = cling.get_organ_by_type(/obj/item/organ/internal/eyes)
if(!istype(eyes))
return
eyes.lighting_cutoff = LIGHTING_CUTOFF_VISIBLE
eyes.flash_protect = max(eyes.flash_protect += 1, FLASH_PROTECTION_WELDER)
cling.update_sight()

/// Signal proc to grant the correct level of flash sensitivity
/datum/action/changeling/darkness_adaptation/proc/eye_implanted(mob/living/source, obj/item/organ/gained, special)
SIGNAL_HANDLER

var/obj/item/organ/internal/eyes/eyes = gained
if(!istype(eyes))
return
if(is_active)
eyes.flash_protect = max(eyes.flash_protect += -1, FLASH_PROTECTION_HYPER_SENSITIVE)
else
eyes.flash_protect = max(eyes.flash_protect += 1, FLASH_PROTECTION_WELDER)

/// Signal proc to remove flash sensitivity when the eyes are removed
/datum/action/changeling/darkness_adaptation/proc/eye_removed(mob/living/source, obj/item/organ/removed, special)
SIGNAL_HANDLER

var/obj/item/organ/internal/eyes/eyes = removed
if(!istype(eyes))
return
eyes.flash_protect = initial(eyes.flash_protect)
// We don't need to bother about removing or adding night vision, fortunately, because they can't see anyways
2 changes: 1 addition & 1 deletion code/modules/antagonists/changeling/powers/fleshmend.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/datum/action/changeling/fleshmend
name = "Fleshmend"
desc = "Our flesh rapidly regenerates, healing our burns, bruises, and shortness of breath, as well as hiding all of our scars. Costs 20 chemicals."
helptext = "If we are on fire, the healing effect will not function. Does not regrow limbs or restore lost blood. Functions while unconscious."
helptext = "Lasts for 10 seconds and does not stack. If we are on fire, the healing effect wont function. Does not regrow limbs or restore lost blood. Functions while unconscious." // monkestation edit
button_icon_state = "fleshmend"
chemical_cost = 20
dna_cost = 2
Expand Down
6 changes: 3 additions & 3 deletions code/modules/antagonists/changeling/powers/lesserform.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/datum/action/changeling/lesserform
name = "Lesser Form"
desc = "We debase ourselves and become lesser. We become a monkey. Costs 5 chemicals."
helptext = "The transformation greatly reduces our size, allowing us to slip out of cuffs and climb through vents."
desc = "We debase ourselves and become lesser. We become a monkey. Costs 15 chemicals." // monkestation edit
helptext = "We become much smaller, allowing us to slip out of cuffs and climb through vents. Right-click to drop items."
button_icon_state = "lesser_form"
chemical_cost = 20 // monkestation edit
chemical_cost = 15 // monkestation edit
dna_cost = 1
/// Whether to allow the transformation animation to play
var/transform_instantly = FALSE
Expand Down
11 changes: 7 additions & 4 deletions code/modules/antagonists/changeling/powers/panacea.dm
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/datum/action/changeling/panacea
name = "Anatomic Panacea"
desc = "Expels impurifications from our form; curing diseases, removing parasites, sobering us, purging toxins and radiation, curing traumas and brain damage, and resetting our genetic code completely. Costs 20 chemicals."
helptext = "Can be used while unconscious."
desc = "Expels impurifications from our form; curing diseases, removing parasites, sobering us, purging chemicals and radiation, curing traumas and brain damage, and resetting our genetic code completely. Costs 20 chemicals." // monkestation edit
helptext = "Lasts for a minute. Can be used while unconscious. Will purge helpful things as well. Maximum stack duration of 2 minutes." // monkestation edit
button_icon_state = "panacea"
chemical_cost = 20
dna_cost = 1
req_stat = HARD_CRIT

//Heals the things that the other regenerative abilities don't.
/datum/action/changeling/panacea/sting_action(mob/user)
to_chat(user, span_notice("We cleanse impurities from our form."))
/datum/action/changeling/panacea/sting_action(mob/living/user) // monkestation edit
//to_chat(user, span_notice("We cleanse impurities from our form."))
..()
user.apply_status_effect(/datum/status_effect/changeling_panacea) // monkestation addition
/* MONKESTATION REMOVAL START
var/list/bad_organs = list(
user.get_organ_by_type(/obj/item/organ/internal/body_egg),
user.get_organ_by_type(/obj/item/organ/internal/legion_tumour),
Expand Down Expand Up @@ -52,4 +54,5 @@
continue
D.cure()
*/
MONKESTATION REMOVAL END */
return TRUE
73 changes: 25 additions & 48 deletions code/modules/antagonists/changeling/powers/strained_muscles.dm
Original file line number Diff line number Diff line change
@@ -1,64 +1,41 @@
//Strained Muscles: Temporary speed boost at the cost of rapid damage
//Limited because of space suits and such; ideally, used for a quick getaway

//////////////////////
// MONKE REFACTORED //
//////////////////////

/datum/action/changeling/strained_muscles
name = "Strained Muscles"
desc = "We evolve the ability to reduce the acid buildup in our muscles, allowing us to move much faster."
helptext = "The strain will make us tired, and we will rapidly become fatigued. Standard weight restrictions, like space suits, still apply. Cannot be used in lesser form."
desc = "We evolve the ability to reduce the acid buildup in our muscles, allowing us to move much faster. Costs 10 chemicals to activate."
helptext = "Causes us to become fatigued over time. Cannot be used in lesser form or while unconscious. Overuse will lead to us collapsing."
button_icon_state = "strained_muscles"
chemical_cost = 0
chemical_cost = 10
dna_cost = 1
req_human = TRUE
var/stacks = 0 //Increments every 5 seconds; damage increases over time
active = FALSE //Whether or not you are a hedgehog
disabled_by_fire = FALSE

/datum/action/changeling/strained_muscles/sting_action(mob/living/carbon/user)
..()
active = !active
if(active)
to_chat(user, span_notice("Our muscles tense and strengthen."))
else
user.remove_movespeed_modifier(/datum/movespeed_modifier/strained_muscles)
to_chat(user, span_notice("Our muscles relax."))
if(stacks >= 10)
to_chat(user, span_danger("We collapse in exhaustion."))
user.Paralyze(60)
user.emote("gasp")

INVOKE_ASYNC(src, PROC_REF(muscle_loop), user)
/// How long this has been on in seconds.
var/accumulation = 0

return TRUE
/// Whether we've warned the user about their exhaustion.
var/warning_given = FALSE

/datum/action/changeling/strained_muscles/Remove(mob/user)
user.remove_movespeed_modifier(/datum/movespeed_modifier/strained_muscles)
/datum/action/changeling/strained_muscles/can_sting(mob/living/user, mob/living/target)
var/has_effect = user.has_status_effect(/datum/status_effect/changeling_muscles)
chemical_cost = has_effect ? 0 : 10
return ..()

/datum/action/changeling/strained_muscles/proc/muscle_loop(mob/living/carbon/user)
while(active)
if(QDELETED(src) || QDELETED(user))
return

user.add_movespeed_modifier(/datum/movespeed_modifier/strained_muscles)
if(user.stat != CONSCIOUS || user.staminaloss >= 90)
active = !active
to_chat(user, span_notice("Our muscles relax without the energy to strengthen them."))
user.Paralyze(40)
user.remove_movespeed_modifier(/datum/movespeed_modifier/strained_muscles)
break

stacks++

user.stamina.adjust(-stacks * 1.3) //At first the changeling may regenerate stamina fast enough to nullify fatigue, but it will stack

if(stacks == 11) //Warning message that the stacks are getting too high
to_chat(user, span_warning("Our legs are really starting to hurt..."))

sleep(4 SECONDS)

while(!active && stacks) //Damage stacks decrease fairly rapidly while not in sanic mode
if(QDELETED(src) || QDELETED(user))
return
/datum/action/changeling/strained_muscles/sting_action(mob/living/user)
..()
var/has_effect = user.has_status_effect(/datum/status_effect/changeling_muscles)
if(has_effect)
user.remove_status_effect(/datum/status_effect/changeling_muscles)
else
user.apply_status_effect(/datum/status_effect/changeling_muscles)
return TRUE

stacks--
sleep(2 SECONDS)
/datum/action/changeling/strained_muscles/Remove(mob/living/user)
user.remove_status_effect(/datum/status_effect/changeling_muscles)
return ..()
Loading
Loading