diff --git a/code/game/objects/items/weapons/melee/melee_misc.dm b/code/game/objects/items/weapons/melee/melee_misc.dm index 4e012fe50bb..fa9c89feb8d 100644 --- a/code/game/objects/items/weapons/melee/melee_misc.dm +++ b/code/game/objects/items/weapons/melee/melee_misc.dm @@ -310,6 +310,7 @@ force = 25 armour_penetration_flat = 50 sharp = TRUE + new_attack_chain = TRUE ///enchantment holder, gives it unique on hit effects. var/datum/enchantment/enchant = null ///the cooldown and power of enchantments are multiplied by this var when its applied @@ -319,29 +320,37 @@ . = ..() AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = ALL_ATTACK_TYPES) - /obj/item/melee/spellblade/Destroy() QDEL_NULL(enchant) return ..() -/obj/item/melee/spellblade/afterattack__legacy__attackchain(atom/target, mob/user, proximity, params) - . = ..() - enchant?.on_hit(target, user, proximity, src) +/obj/item/melee/spellblade/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers) + enchant?.pre_hit(target, user, src) -/obj/item/melee/spellblade/attack_self__legacy__attackchain(mob/user) +/obj/item/melee/spellblade/after_attack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + enchant?.on_hit(target, user, src) + +/obj/item/melee/spellblade/activate_self(mob/user) + if(..()) + return if(enchant) return - 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"), - "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, - "Temporal Slash" = /datum/enchantment/time_slash,) + var/static/list/options = list( + "Lightning" = image(icon = 'icons/effects/spellblade.dmi', icon_state = "chain_lightning"), + "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"), + "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, + "Temporal Slash" = /datum/enchantment/time_slash, + ) var/choice = show_radial_menu(user, src, options) if(!choice) @@ -362,12 +371,6 @@ if(enchant && (iswizard(user) || IS_CULTIST(user))) // only wizards and cultists understand runes . += "The runes along the side read; [enchant.desc]." - -/obj/item/melee/spellblade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(attack_type == PROJECTILE_ATTACK) - final_block_chance = 0 - return ..() - /datum/enchantment /// used for blackbox logging var/name = "You shouldn't be seeing this, file an issue report." @@ -383,24 +386,23 @@ var/applied_traits = FALSE COOLDOWN_DECLARE(enchant_cooldown) -/datum/enchantment/proc/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) - if(!COOLDOWN_FINISHED(src, enchant_cooldown)) - return FALSE - if(!istype(target)) - return FALSE - if(target.stat == DEAD) - return FALSE - if(!ranged && !proximity) +/datum/enchantment/proc/on_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) + if(!COOLDOWN_FINISHED(src, enchant_cooldown) || !istype(target) || target.stat == DEAD) return FALSE return TRUE -/datum/enchantment/proc/on_gain(obj/item/melee/spellblade, mob/living/user) +/datum/enchantment/proc/pre_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) + if(!ranged || !COOLDOWN_FINISHED(src, enchant_cooldown) || !istype(target) || target.stat == DEAD) + return FALSE + return TRUE + +/datum/enchantment/proc/on_gain(obj/item/melee/spellblade/S, mob/living/user) return /datum/enchantment/proc/toggle_traits(obj/item/I, mob/living/user) return -/datum/enchantment/proc/on_apply_to_blade(obj/item/melee/spellblade) +/datum/enchantment/proc/on_apply_to_blade(obj/item/melee/spellblade/S) return /datum/enchantment/lightning @@ -416,8 +418,7 @@ if(user) toggle_traits(S, user) - -/datum/enchantment/lightning/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) +/datum/enchantment/lightning/on_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) . = ..() if(.) zap(target, user, list(user), power) @@ -471,7 +472,7 @@ ADD_TRAIT(user, TRAIT_NOFIRE, "[enchant_ID]") applied_traits = TRUE -/datum/enchantment/fire/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) +/datum/enchantment/fire/on_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) . = ..() if(.) fireflash_s(target, 4, 8000 * power, 500) @@ -484,10 +485,10 @@ // 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) +/datum/enchantment/forcewall/on_apply_to_blade(obj/item/melee/spellblade/S) cooldown /= power -/datum/enchantment/forcewall/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) +/datum/enchantment/forcewall/on_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) . = ..() if(.) user.apply_status_effect(STATUS_EFFECT_FORCESHIELD) @@ -501,29 +502,26 @@ // the number of deciseconds of stun applied by the teleport strike power = 5 -/datum/enchantment/bluespace/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) - if(proximity) // don't put it on cooldown if adjacent - return +/datum/enchantment/bluespace/pre_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) . = ..() - if(!.) - return - var/turf/user_turf = get_turf(user) - if(get_dist(user_turf, get_turf(target)) > 9) //blocks cameras without blocking xray or thermals - return - if(!((target in view(9, user)) || user.sight & SEE_MOBS)) - return - var/list/turfs = list() - for(var/turf/T in orange(1, get_turf(target))) - if(is_blocked_turf(T, TRUE)) - continue - turfs += T + if(.) + var/turf/user_turf = get_turf(user) + if(get_dist(user_turf, get_turf(target)) > 9) //blocks cameras without blocking xray or thermals + return + if(!((target in view(9, user)) || user.sight & SEE_MOBS)) + return + var/list/turfs = list() + for(var/turf/T in orange(1, get_turf(target))) + if(is_blocked_turf(T, TRUE)) + continue + turfs += T - var/target_turf = pick(turfs) - user_turf.Beam(target_turf, "warp_beam", time = 0.3 SECONDS) - user.forceMove(target_turf) - S.melee_attack_chain(user, target) - target.Weaken(power) - COOLDOWN_START(src, enchant_cooldown, cooldown) + var/target_turf = pick(turfs) + user_turf.Beam(target_turf, "warp_beam", time = 0.3 SECONDS) + user.forceMove(target_turf) + S.melee_attack_chain(user, target) + target.Weaken(power) + COOLDOWN_START(src, enchant_cooldown, cooldown) /datum/enchantment/bluespace/on_apply_to_blade(obj/item/melee/spellblade/S) cooldown /= S.power @@ -533,10 +531,10 @@ 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 = 20 // This should come out to 32.5 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_apply_to_blade(obj/item/melee/spellblade/S) + S.force /= 2 -/datum/enchantment/time_slash/on_hit(mob/living/target, mob/living/user, proximity, obj/item/melee/spellblade/S) +/datum/enchantment/time_slash/on_hit(mob/living/target, mob/living/user, obj/item/melee/spellblade/S) user.changeNext_move(CLICK_CD_MELEE * 0.5) . = ..() if(.)