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

Adds a new spellblade enchantment: Temporal. Also adds lightning knockdown back. #27314

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@

#define STATUS_EFFECT_C_FOAMED /datum/status_effect/c_foamed

#define STATUS_EFFECT_TEMPORAL_SLASH /datum/status_effect/temporal_slash

#define STATUS_EFFECT_TEMPORAL_SLASH_FINISHER /datum/status_effect/temporal_slash_finisher

//#define STATUS_EFFECT_NECROPOLIS_CURSE /datum/status_effect/necropolis_curse
//#define CURSE_BLINDING 1 //makes the edges of the target's screen obscured
//#define CURSE_SPAWNING 2 //spawns creatures that attack the target only
Expand Down
61 changes: 61 additions & 0 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1406,3 +1406,64 @@
duration = 5 SECONDS
alert_type = null
status_type = STATUS_EFFECT_REPLACE

/// This is the threshold where the attack will stun on the last hit. Why? Because it is cool, that's why.
#define FINISHER_THRESHOLD 7

/datum/status_effect/temporal_slash
id = "temporal_slash"
duration = 3 SECONDS
status_type = STATUS_EFFECT_REFRESH
alert_type = null
/// How many times the user has been cut. Each cut adds a damage value below
var/cuts = 1
/// How much damage the blade will do each slice
var/damage_per_cut = 20

/datum/status_effect/temporal_slash/on_creation(mob/living/new_owner, cut_damage = 20)
. = ..()
damage_per_cut = cut_damage

/datum/status_effect/temporal_slash/refresh()
cuts++
return ..()

/datum/status_effect/temporal_slash/on_remove()
owner.apply_status_effect(STATUS_EFFECT_TEMPORAL_SLASH_FINISHER, cuts, damage_per_cut) //We apply this to a new status effect, to avoid refreshing while on_remove happens.

/datum/status_effect/temporal_slash_finisher
id = "temporal_slash_finisher"
status_type = STATUS_EFFECT_UNIQUE
alert_type = null
tick_interval = 0.25 SECONDS
/// How many times the user has been cut. Each cut adds a damage value below
var/cuts = 1
/// How much damage the blade will do each slice
var/damage_per_cut = 20
/// Have we done enough damage to trigger the finisher?
var/finishing_cuts = FALSE

/datum/status_effect/temporal_slash_finisher/on_creation(mob/living/new_owner, final_cuts = 1, cut_damage = 20)
. = ..()
cuts = final_cuts
damage_per_cut = cut_damage
if(ismegafauna(owner))
damage_per_cut *= 4 //This will deal 40 damage bonus per cut on megafauna as a miner, and 80 as a wizard. To kill a megafauna, you need to hit it 48 times. You don't get the buffs of a crusher though. Also you already killed bubblegum, so, you know.
if(cuts >= FINISHER_THRESHOLD)
finishing_cuts = TRUE
new /obj/effect/temp_visual/temporal_slash(get_turf(owner), owner)

/datum/status_effect/temporal_slash_finisher/tick()
. = ..()
owner.visible_message("<span class='danger'>[owner] gets slashed by a cut through spacetime!</span>", "<span class='userdanger'>You get slashed by a cut through spacetime!</span>")
playsound(owner, 'sound/weapons/rapierhit.ogg', 50, TRUE)
owner.apply_damage(damage_per_cut, BRUTE, pick(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_ARM, BODY_ZONE_R_LEG), 0, TRUE, null, FALSE)
cuts--
if(cuts <= 0)
if(finishing_cuts)
owner.Weaken(7 SECONDS)
qdel(src)
else
new /obj/effect/temp_visual/temporal_slash(get_turf(owner), owner)

#undef FINISHER_THRESHOLD
72 changes: 66 additions & 6 deletions code/game/objects/items/weapons/melee/melee_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,13 @@
var/static/list/options = list("Lightning" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "chain_lightning"),/// todo add icons for these
"Fire" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "fire"),
"Bluespace" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "blink"),
"Forcewall" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "shield"),)
"Forcewall" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "shield"),
"Temporal Slash" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "spacetime"),)
var/static/list/options_to_type = list("Lightning" = /datum/enchantment/lightning,
"Fire" = /datum/enchantment/fire,
"Bluespace" = /datum/enchantment/bluespace,
"Forcewall" = /datum/enchantment/forcewall,)
"Forcewall" = /datum/enchantment/forcewall,
"Temporal Slash" = /datum/enchantment/time_slash,)

var/choice = show_radial_menu(user, src, options)
if(!choice)
Expand All @@ -349,6 +351,7 @@
/obj/item/melee/spellblade/proc/add_enchantment(new_enchant, mob/living/user, intentional = TRUE)
var/datum/enchantment/E = new new_enchant
enchant = E
E.on_apply_to_blade(src)
E.on_gain(src, user)
E.power *= power
if(intentional)
Expand Down Expand Up @@ -378,6 +381,8 @@
var/cooldown = -1
/// If the spellblade has traits, has it applied them?
var/applied_traits = FALSE
/// A modifier that can be appled to the cooldown after the enchantment has been initialized. Used by the forcewall spellblade
var/cooldown_multiplier = 1

/datum/enchantment/proc/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S)
if(world.time < cooldown)
Expand All @@ -388,7 +393,7 @@
return FALSE
if(!ranged && !proximity)
return FALSE
cooldown = world.time + initial(cooldown)
cooldown = world.time + (initial(cooldown) * cooldown_multiplier)
return TRUE

/datum/enchantment/proc/on_gain(obj/item/melee/spellblade, mob/living/user)
Expand All @@ -397,9 +402,12 @@
/datum/enchantment/proc/toggle_traits(obj/item/I, mob/living/user)
return

/datum/enchantment/proc/on_apply_to_blade(obj/item/melee/spellblade)
return

/datum/enchantment/lightning
name = "lightning"
desc = "this blade conducts arcane energy to arc between its victims. It also makes the user immune to shocks."
desc = "this blade conducts arcane energy to arc between its victims. It also makes the user immune to shocks"
// the damage of the first lighting arc.
power = 20
cooldown = 3 SECONDS
Expand Down Expand Up @@ -428,6 +436,7 @@
source.Beam(target, "lightning[rand(1,12)]", 'icons/effects/effects.dmi', time = 2 SECONDS, maxdistance = 7, beam_type = /obj/effect/ebeam/chain)
if(!target.electrocute_act(voltage, "lightning", flags = SHOCK_TESLA)) // if it fails to shock someone, break the chain
return
target.KnockDown(4 SECONDS * (power / 20)) //Power is 20 by default, 10 in a random blade
protected_mobs += target
addtimer(CALLBACK(src, PROC_REF(arc), target, voltage, protected_mobs), 2.5 SECONDS)

Expand Down Expand Up @@ -473,6 +482,11 @@
name = "forcewall"
desc = "this blade will partially shield you against attacks and stuns for a short duration after striking a foe"
cooldown = 4 SECONDS
// multiplier for how much the cooldown is reduced by. A miner spellblade can only buff every 4 seconds, making it more vunerable, the wizard one is much more consistant.
power = 2

/datum/enchantment/forcewall/on_apply_to_blade(obj/item/melee/spellblade)
cooldown_multiplier /= power

/datum/enchantment/forcewall/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S)
. = ..()
Expand All @@ -482,7 +496,7 @@

/datum/enchantment/bluespace
name = "bluespace"
desc = "this the fabric of space, transporting its wielder over medium distances to strike foes"
desc = "this blade will cut through the fabric of space, transporting its wielder over medium distances to strike foes"
cooldown = 2.5 SECONDS
ranged = TRUE
// the number of deciseconds of stun applied by the teleport strike
Expand Down Expand Up @@ -511,6 +525,51 @@
S.melee_attack_chain(user, target)
target.Weaken(power)

/datum/enchantment/time_slash
name = "temporal"
desc = "this blade will slice faster but weaker, and will curse the target, slashing them a few seconds after they have not been swinged at for each hit"
power = 15 // This should come out to 40 damage per hit. However, delayed.

/datum/enchantment/time_slash/on_apply_to_blade(obj/item/melee/spellblade)
spellblade.force /= 2

/datum/enchantment/time_slash/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S)
user.changeNext_move(CLICK_CD_MELEE * 0.5)
. = ..()
if(!.)
return
target.apply_status_effect(STATUS_EFFECT_TEMPORAL_SLASH, power)

/obj/effect/temp_visual/temporal_slash
name = "temporal slash"
desc = "A cut through spacetime"
icon = 'icons/obj/projectiles.dmi'
icon_state = "arcane_barrage"
layer = FLY_LAYER
plane = GRAVITY_PULSE_PLANE
appearance_flags = PIXEL_SCALE|LONG_GLIDE
duration = 0.5 SECONDS
mouse_opacity = MOUSE_OPACITY_TRANSPARENT // Let us not have this visual block clicks
/// Who we are orbiting
var/target
/// A funky colour matrix to recolor the slash to
var/list/funky_colour_matrix = list(0.4,0,0,0, 0,1.1,0,0, 0,0,1.65,0, -0.3,0.15,0,1, 0,0,0,0)

/obj/effect/temp_visual/temporal_slash/Initialize(mapload, new_target)
. = ..()
target = new_target
INVOKE_ASYNC(src, TYPE_PROC_REF(/atom/movable, orbit), target, 0, FALSE, 0, 0, FALSE, TRUE)
var/matrix/M = matrix()
M.Scale(1, 2)
M.Turn(rand(0, 360))
transform = M
addtimer(CALLBACK(src, PROC_REF(animate_slash)), 0.25 SECONDS)

/obj/effect/temp_visual/temporal_slash/proc/animate_slash()
plane = -1
color = funky_colour_matrix
animate(src, alpha = 0, time = duration, easing = EASE_OUT)

/obj/item/melee/spellblade/random
power = 0.5

Expand All @@ -519,6 +578,7 @@
var/list/options = list(/datum/enchantment/lightning,
/datum/enchantment/fire,
/datum/enchantment/forcewall,
/datum/enchantment/bluespace,)
/datum/enchantment/bluespace,
/datum/enchantment/time_slash,)
var/datum/enchantment/E = pick(options)
add_enchantment(E, intentional = FALSE)
Binary file modified icons/effects/spellblade.dmi
Binary file not shown.