From a2afa509aa544928bb28016de48e2b3bc88233e1 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:35:11 -0600 Subject: [PATCH] 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 :cl: Melbert add: Adds two fantasy affixes /:cl: --- code/datums/components/fantasy/prefixes.dm | 23 ++++++++ code/datums/components/fantasy/suffixes.dm | 17 ++++++ .../datums/elements/chain_lightning_attack.dm | 46 ++++++++++++++++ .../elements/slow_target_click_cd_attack.dm | 54 +++++++++++++++++++ code/game/objects/items.dm | 4 -- tgstation.dme | 2 + 6 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 code/datums/elements/chain_lightning_attack.dm create mode 100644 code/datums/elements/slow_target_click_cd_attack.dm diff --git a/code/datums/components/fantasy/prefixes.dm b/code/datums/components/fantasy/prefixes.dm index cd80a114313..711844ea8be 100644 --- a/code/datums/components/fantasy/prefixes.dm +++ b/code/datums/components/fantasy/prefixes.dm @@ -161,3 +161,26 @@ var/obj/item/master = comp.parent comp.appliedComponents += master.AddComponent(/datum/component/soul_stealer) return "soul-[pick("stealing", "hungering", "devouring")] [newName]" + +// On hitting a mob chain lightning will jump to another mob within 2 tiles of the original target +/datum/fantasy_affix/thunderfury + name = "Thunderfury" + placement = AFFIX_PREFIX + alignment = AFFIX_GOOD + weight = 3 + +/datum/fantasy_affix/thunderfury/apply(datum/component/fantasy/comp, newName) + comp.parent.AddElement(/datum/element/chain_lightning_attack, get_damage(comp), get_range(comp), get_limit(comp)) + return "Thunderfury, Blessed [newName]" + +/datum/fantasy_affix/thunderfury/remove(datum/component/fantasy/comp) + comp.parent.RemoveElement(/datum/element/chain_lightning_attack, get_damage(comp), get_range(comp), get_limit(comp)) + +/datum/fantasy_affix/thunderfury/proc/get_damage(datum/component/fantasy/comp) + return min(round(comp.quality, 2), 20) + +/datum/fantasy_affix/thunderfury/proc/get_range(datum/component/fantasy/comp) + return min(round(sqrt(comp.quality), 1), 3) + +/datum/fantasy_affix/thunderfury/proc/get_limit(datum/component/fantasy/comp) + return min(round(sqrt(comp.quality), 1), 3) diff --git a/code/datums/components/fantasy/suffixes.dm b/code/datums/components/fantasy/suffixes.dm index 997c9564592..cd9ca79ec00 100644 --- a/code/datums/components/fantasy/suffixes.dm +++ b/code/datums/components/fantasy/suffixes.dm @@ -290,3 +290,20 @@ /datum/fantasy_affix/doot/remove(datum/component/fantasy/comp) comp.parent.RemoveElement(/datum/element/spooky, too_spooky = comp.quality > 17, stam_damage_mult = comp.quality * 0.15) + +// On hitting a mob their click cd is slowed marginally +/datum/fantasy_affix/windseeker + name = "of the Windseeker" + placement = AFFIX_SUFFIX + alignment = AFFIX_GOOD + weight = 3 + +/datum/fantasy_affix/windseeker/apply(datum/component/fantasy/comp, newName) + comp.parent.AddElement(/datum/element/slow_target_click_cd_attack, get_cd_penalty(comp)) + return "[newName] of the Windseeker" + +/datum/fantasy_affix/windseeker/remove(datum/component/fantasy/comp) + comp.parent.RemoveElement(/datum/element/slow_target_click_cd_attack, get_cd_penalty(comp)) + +/datum/fantasy_affix/windseeker/proc/get_cd_penalty(datum/component/fantasy/comp) + return min(round(sqrt(comp.quality) * 0.1, 0.1), 0.4) // this gives you a small number, like 0.2 seconds diff --git a/code/datums/elements/chain_lightning_attack.dm b/code/datums/elements/chain_lightning_attack.dm new file mode 100644 index 00000000000..dc4d48c15f5 --- /dev/null +++ b/code/datums/elements/chain_lightning_attack.dm @@ -0,0 +1,46 @@ +/// Applied to an item: Causes the item to deal shock damage to a target and jump to other targets +/datum/element/chain_lightning_attack + element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY + argument_hash_start_idx = 2 + /// Damage dealt by the shock of the chain lightning + var/shock_damage + /// Range the shock will jump to another target + var/shock_range + /// Maximum number of jumps the chain lightning can make + var/chain_limit + +/datum/element/chain_lightning_attack/Attach(datum/target, shock_damage = 10, shock_range = 2, chain_limit = 3) + . = ..() + if(!isitem(target)) + return ELEMENT_INCOMPATIBLE + + src.shock_damage = shock_damage + src.shock_range = shock_range + src.chain_limit = chain_limit + RegisterSignal(target, COMSIG_ITEM_AFTERATTACK, PROC_REF(try_chain)) + +/datum/element/chain_lightning_attack/Detach(datum/source, ...) + . = ..() + UnregisterSignal(source, COMSIG_ITEM_AFTERATTACK) + +/datum/element/chain_lightning_attack/proc/try_chain(obj/item/source, atom/hit, mob/user) + SIGNAL_HANDLER + + if(!isliving(hit)) + return + do_chain(source, hit, user, list(user)) + +/datum/element/chain_lightning_attack/proc/do_chain(obj/item/source, mob/living/next_target, atom/last_target, list/dont_hit = list()) + if(!next_target.electrocute_act(shock_damage, source, flags = SHOCK_NOGLOVES|SHOCK_NOSTUN)) + return + if(last_target != next_target) + last_target.Beam(next_target, icon_state = "lightning[rand(1, 12)]", time = 0.5 SECONDS) + dont_hit += next_target + if(length(dont_hit) >= chain_limit + 1) + return + + for(var/mob/living/other_victim in view(next_target, shock_range)) + if(other_victim in dont_hit) + continue + do_chain(source, other_victim, next_target, dont_hit) + break diff --git a/code/datums/elements/slow_target_click_cd_attack.dm b/code/datums/elements/slow_target_click_cd_attack.dm new file mode 100644 index 00000000000..93403501a34 --- /dev/null +++ b/code/datums/elements/slow_target_click_cd_attack.dm @@ -0,0 +1,54 @@ +/// 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 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 2597f763e25..4760a898108 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -520,10 +520,6 @@ add_fingerprint(usr) return ..() -/obj/item/vv_get_dropdown() - . = ..() - VV_DROPDOWN_OPTION(VV_HK_ADD_FANTASY_AFFIX, "Add Fantasy Affix") - /obj/item/vv_do_topic(list/href_list) . = ..() diff --git a/tgstation.dme b/tgstation.dme index fd819ded948..695aaf5b253 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1462,6 +1462,7 @@ #include "code\datums\elements\can_barricade.dm" #include "code\datums\elements\can_shatter.dm" #include "code\datums\elements\caseless.dm" +#include "code\datums\elements\chain_lightning_attack.dm" #include "code\datums\elements\chemical_transfer.dm" #include "code\datums\elements\chewable.dm" #include "code\datums\elements\cleaning.dm" @@ -1578,6 +1579,7 @@ #include "code\datums\elements\skill_reward.dm" #include "code\datums\elements\skittish.dm" #include "code\datums\elements\slapcrafting.dm" +#include "code\datums\elements\slow_target_click_cd_attack.dm" #include "code\datums\elements\soft_landing.dm" #include "code\datums\elements\spooky.dm" #include "code\datums\elements\squish.dm"