mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
143 lines
4.6 KiB
Plaintext
143 lines
4.6 KiB
Plaintext
/**
|
|
* # Energy Katana
|
|
*
|
|
* The space ninja's katana.
|
|
*
|
|
* The katana that only space ninja spawns with. Comes with 30 force and throwforce, along with a signature special jaunting system.
|
|
* Upon clicking on a tile with the dash on, the user will teleport to that tile.
|
|
* The katana has 5 dashes stored at maximum, and upon using the dash, it will return 20 seconds after it was used.
|
|
* It also has a special feature where if it is tossed at a space ninja who owns it (determined by the ninja suit), the ninja will catch the katana instead of being hit by it.
|
|
*
|
|
*/
|
|
|
|
/obj/item/energy_katana
|
|
name = "energy katana"
|
|
desc = "A katana infused with strong energy."
|
|
icon_state = "energy_katana"
|
|
item_state = "energy_katana"
|
|
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
|
|
force = 30
|
|
throwforce = 30
|
|
block_chance = 50
|
|
armour_penetration = 50
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
hitsound = 'sound/weapons/bladeslice.ogg'
|
|
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
|
block_chance = 50
|
|
slot_flags = ITEM_SLOT_BACK|ITEM_SLOT_BELT
|
|
sharpness = SHARP_EDGED
|
|
max_integrity = 200
|
|
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
|
|
icon = 'icons/obj/weapons/swords.dmi'
|
|
var/datum/effect_system/spark_spread/spark_system
|
|
var/datum/action/innate/dash/ninja/jaunt
|
|
var/dash_toggled = TRUE
|
|
|
|
/obj/item/energy_katana/Initialize()
|
|
. = ..()
|
|
jaunt = new(src)
|
|
spark_system = new /datum/effect_system/spark_spread()
|
|
spark_system.set_up(5, 0, src)
|
|
spark_system.attach(src)
|
|
|
|
/obj/item/energy_katana/attack_self(mob/user)
|
|
dash_toggled = !dash_toggled
|
|
to_chat(user, span_notice("You [dash_toggled ? "enable" : "disable"] the dash function on [src]."))
|
|
|
|
/obj/item/energy_katana/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
|
. = ..()
|
|
if(dash_toggled)
|
|
jaunt.Teleport(user, target)
|
|
if(proximity_flag && (isobj(target) || issilicon(target)))
|
|
spark_system.start()
|
|
playsound(user, "sparks", 50, 1)
|
|
playsound(user, 'sound/weapons/blade1.ogg', 50, 1)
|
|
target.emag_act(user)
|
|
|
|
/obj/item/energy_katana/pickup(mob/living/carbon/human/user)
|
|
. = ..()
|
|
if(!is_ninja(user)) //stolen directly from the bloody bastard sword
|
|
if(HAS_TRAIT (user, TRAIT_SHOCKIMMUNE))
|
|
to_chat(user, span_warning("[src] attempts to shock you."))
|
|
user.electrocute_act(15,src)
|
|
return
|
|
if(user.gloves)
|
|
if(!user.gloves.siemens_coefficient)
|
|
to_chat(user, span_warning("[src] attempts to shock you."))
|
|
user.electrocute_act(15,src)
|
|
return
|
|
to_chat(user, span_userdanger("[src] shocks you!")) //duplicate code because wearing gloves did nothing beforehand
|
|
user.emote("scream")
|
|
user.electrocute_act(15,src)
|
|
user.dropItemToGround(src, TRUE)
|
|
user.Paralyze(50)
|
|
return
|
|
else
|
|
to_chat(user, span_userdanger("[src] shocks you!"))
|
|
user.emote("scream")
|
|
user.electrocute_act(15,src)
|
|
user.dropItemToGround(src, TRUE)
|
|
user.Paralyze(50)
|
|
return
|
|
jaunt.Grant(user, src)
|
|
user.update_icons()
|
|
playsound(src, 'sound/items/unsheath.ogg', 25, 1)
|
|
|
|
/obj/item/energy_katana/dropped(mob/user)
|
|
. = ..()
|
|
jaunt.Remove(user)
|
|
user.update_icons()
|
|
|
|
//If we hit the Ninja who owns this Katana, they catch it.
|
|
//Works for if the Ninja throws it or it throws itself or someone tries
|
|
//To throw it at the ninja
|
|
/obj/item/energy_katana/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
|
if(ishuman(hit_atom))
|
|
var/mob/living/carbon/human/H = hit_atom
|
|
if(istype(H.wear_suit, /obj/item/clothing/suit/space/space_ninja))
|
|
var/obj/item/clothing/suit/space/space_ninja/SN = H.wear_suit
|
|
if(SN.energyKatana == src)
|
|
returnToOwner(H, 0, 1)
|
|
return
|
|
|
|
..()
|
|
|
|
/obj/item/energy_katana/proc/returnToOwner(mob/living/carbon/human/user, doSpark = 1, caught = 0)
|
|
if(!istype(user))
|
|
return
|
|
forceMove(get_turf(user))
|
|
|
|
if(doSpark)
|
|
spark_system.start()
|
|
playsound(get_turf(src), "sparks", 50, 1)
|
|
|
|
var/msg = ""
|
|
|
|
if(user.put_in_hands(src))
|
|
msg = "Your Energy Katana teleports into your hand!"
|
|
else if(user.equip_to_slot_if_possible(src, SLOT_BELT, 0, 1, 1))
|
|
msg = "Your Energy Katana teleports back to you, sheathing itself as it does so!</span>"
|
|
else
|
|
msg = "Your Energy Katana teleports to your location!"
|
|
|
|
if(caught)
|
|
if(loc == user)
|
|
msg = "You catch your Energy Katana!"
|
|
else
|
|
msg = "Your Energy Katana lands at your feet!"
|
|
|
|
if(msg)
|
|
to_chat(user, span_notice("[msg]"))
|
|
|
|
|
|
/obj/item/energy_katana/Destroy()
|
|
QDEL_NULL(spark_system)
|
|
return ..()
|
|
|
|
/datum/action/innate/dash/ninja //Holds a good amount of charges, but charges them slowly. Use them wisely.
|
|
current_charges = 5
|
|
max_charges = 5
|
|
charge_rate = 200
|
|
recharge_sound = null
|