Files
Bubberstation/code/datums/elements/slow_target_click_cd_attack.dm
MrMelbert a2afa509aa Adds two fantasy affixes (#89257)
## About The Pull Request

- Adds a fantasy affix that makes your attacks with the item cause a
chain lightning, which shocks people. The damage, distance, and limit
are all based on quality.
- Adds a fantasy affix that makes your attacks with the item slow the
target's click cd, making them take longer between attacks. The penalty
is based on quality.

## Why It's Good For The Game

BiS for main tanks

## Changelog

🆑 Melbert
add: Adds two fantasy affixes
/🆑
2025-02-08 15:35:11 -08:00

55 lines
1.7 KiB
Plaintext

/// Applied to items: Applies a status effect to the target that slows their click CD
/datum/element/slow_target_click_cd_attack
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY
argument_hash_start_idx = 2
/// How much click CD to add to the target's clicks
var/reduction
/datum/element/slow_target_click_cd_attack/Attach(datum/target, reduction = 0.2 SECONDS)
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
src.reduction = reduction
RegisterSignal(target, COMSIG_ITEM_AFTERATTACK, PROC_REF(try_slow))
/datum/element/slow_target_click_cd_attack/Detach(datum/source, ...)
. = ..()
UnregisterSignal(source, COMSIG_ITEM_AFTERATTACK)
/datum/element/slow_target_click_cd_attack/proc/try_slow(obj/item/source, atom/hit, mob/user)
SIGNAL_HANDLER
if(!isliving(hit))
return
var/mob/living/target = hit
target.apply_status_effect(/datum/status_effect/cd_slow, reduction, REF(src))
/// Applied by [/datum/element/slow_target_click_cd_attack] to slow the target's click CD
/datum/status_effect/cd_slow
id = "cd_slow"
duration = 4 SECONDS
status_type = STATUS_EFFECT_MULTIPLE
alert_type = null
tick_interval = STATUS_EFFECT_NO_TICK
/// How much click CD to add to the target's clicks
var/reduction
/// The source of the slow, they don't stack
var/source
/datum/status_effect/cd_slow/on_creation(mob/living/new_owner, reduction, source)
src.reduction = reduction
src.source = source
return ..()
/datum/status_effect/cd_slow/on_apply()
for(var/datum/status_effect/cd_slow/slow in owner)
if(slow.source == src.source)
slow.reduction = max(slow.reduction, src.reduction)
return FALSE
return TRUE
/datum/status_effect/cd_slow/nextmove_adjust()
return reduction