Files
GS13NG/code/modules/ninja/energy_katana.dm
2017-11-04 19:39:48 -05:00

106 lines
3.1 KiB
Plaintext

/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 = 40
throwforce = 20
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 = SLOT_BELT
sharpness = IS_SHARP
max_integrity = 200
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
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 class='notice'>You [dash_toggled ? "enable" : "disable"] the dash function on [src].</span>")
/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/user)
. = ..()
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)
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 class='notice'>[msg]</span>")
/obj/item/energy_katana/Destroy()
QDEL_NULL(spark_system)
return ..()
/datum/action/innate/dash/ninja
current_charges = 3
max_charges = 3
charge_rate = 30
recharge_sound = null