mirror of
https://github.com/goonstation/goonstation-2020.git
synced 2026-07-15 17:12:21 +01:00
303 lines
7.4 KiB
Plaintext
303 lines
7.4 KiB
Plaintext
/datum/targetable/spell/phaseshift
|
|
name = "Phase Shift"
|
|
desc = "Become incorporeal and move through walls."
|
|
icon_state = "phaseshift"
|
|
targeted = 0
|
|
cooldown = 300
|
|
requires_robes = 1
|
|
cooldown_staff = 1
|
|
restricted_area_check = 1
|
|
voice_grim = "sound/voice/wizard/MistFormGrim.ogg"
|
|
voice_fem = "sound/voice/wizard/MistFormFem.ogg"
|
|
voice_other = "sound/voice/wizard/MistFormLoud.ogg"
|
|
|
|
cast()
|
|
if(!holder)
|
|
return
|
|
if (spell_invisibility(holder.owner, 1, 0, 1, 1) != 1) // Dry run. Can we phaseshift?
|
|
return 1
|
|
|
|
holder.owner.say("PHEE CABUE")
|
|
..()
|
|
|
|
var/SPtime = 35
|
|
if(holder.owner.wizard_spellpower())
|
|
SPtime = 50
|
|
else
|
|
boutput(holder.owner, "<span style=\"color:red\">Your spell doesn't last as long without a staff to focus it!</span>")
|
|
playsound(holder.owner.loc, "sound/effects/mag_phase.ogg", 25, 1, -1)
|
|
spell_invisibility(holder.owner, SPtime, 0, 1)
|
|
|
|
// Merged some stuff from wizard and vampire phaseshift for easy of use (Convair880).
|
|
/proc/spell_invisibility(var/mob/H, var/time, var/check_for_watchers = 0, var/stop_burning = 0, var/dry_run_only = 0)
|
|
if (!H || !ismob(H))
|
|
return
|
|
if (!isturf(H.loc))
|
|
H.show_text("You can't seem to turn incorporeal here.", "red")
|
|
return
|
|
if (H.stat || H.getStatusDuration("paralysis") > 0)
|
|
H.show_text("You can't turn incorporeal when you are incapacitated.", "red")
|
|
return
|
|
|
|
var/turf/T = get_turf(H)
|
|
if (T && isrestrictedz(T.z))
|
|
H.show_text("You can't seem to turn incorporeal here.", "red")
|
|
return
|
|
|
|
if (check_for_watchers == 1)
|
|
if (H.client)
|
|
for (var/mob/living/L in view(H.client.view, H))
|
|
if (isalive(L) && L.sight_check(1) && L.ckey != H.ckey)
|
|
H.show_text("You can only use that when nobody can see you!", "red")
|
|
return
|
|
|
|
if (dry_run_only)
|
|
return 1 // Return 1 if we got this far in the test run.
|
|
|
|
if (stop_burning == 1)
|
|
var/mob/living/carbon/human/HH = H
|
|
if (istype(HH) && HH.getStatusDuration("burning"))
|
|
boutput(HH, "<span style=\"color:blue\">The flames sputter out as you phase shift.</span>")
|
|
HH.delStatus("burning")
|
|
|
|
SPAWN_DBG(0)
|
|
var/mobloc = get_turf(H.loc)
|
|
var/obj/dummy/spell_invis/holder = new /obj/dummy/spell_invis( mobloc )
|
|
var/atom/movable/overlay/animation = new /atom/movable/overlay( mobloc )
|
|
animation.name = "water"
|
|
animation.set_density(0)
|
|
animation.anchored = 1
|
|
animation.icon = 'icons/mob/mob.dmi'
|
|
animation.icon_state = "liquify"
|
|
animation.layer = EFFECTS_LAYER_BASE
|
|
animation.master = holder
|
|
flick("liquify",animation)
|
|
H.set_loc(holder)
|
|
var/datum/effects/system/steam_spread/steam = unpool(/datum/effects/system/steam_spread)
|
|
steam.set_up(10, 0, mobloc)
|
|
steam.start()
|
|
sleep(time)
|
|
mobloc = get_turf(H.loc)
|
|
animation.set_loc(mobloc)
|
|
steam.location = mobloc
|
|
steam.start()
|
|
H.canmove = 0
|
|
H.restrain_time = world.timeofday + 40
|
|
sleep(20)
|
|
flick("reappear",animation)
|
|
sleep(5)
|
|
H.set_loc(mobloc)
|
|
H.canmove = 1
|
|
H.restrain_time = 0
|
|
qdel(animation)
|
|
for (var/obj/junk_to_dump in holder.contents)
|
|
junk_to_dump.set_loc(mobloc)
|
|
|
|
qdel(holder)
|
|
|
|
/obj/dummy/spell_invis
|
|
name = "water"
|
|
icon = 'icons/effects/effects.dmi'
|
|
icon_state = "nothing"
|
|
invisibility = 101
|
|
var/canmove = 1
|
|
density = 0
|
|
anchored = 1
|
|
|
|
/obj/dummy/spell_invis/relaymove(var/mob/user, direction, delay)
|
|
if (!src.canmove) return
|
|
switch(direction)
|
|
if(NORTH)
|
|
src.y++
|
|
if(SOUTH)
|
|
src.y--
|
|
if(EAST)
|
|
src.x++
|
|
if(WEST)
|
|
src.x--
|
|
if(NORTHEAST)
|
|
src.y++
|
|
src.x++
|
|
if(NORTHWEST)
|
|
src.y++
|
|
src.x--
|
|
if(SOUTHEAST)
|
|
src.y--
|
|
src.x++
|
|
if(SOUTHWEST)
|
|
src.y--
|
|
src.x--
|
|
src.canmove = 0
|
|
SPAWN_DBG(2 DECI SECONDS) src.canmove = 1
|
|
|
|
/obj/dummy/spell_invis/ex_act(blah)
|
|
return
|
|
|
|
/obj/dummy/spell_invis/bullet_act(blah,blah)
|
|
return
|
|
|
|
|
|
|
|
/proc/spell_batpoof(var/mob/H, var/cloak = 0)
|
|
if (!H || !ismob(H))
|
|
return
|
|
if (!isturf(H.loc))
|
|
H.show_text("You can't seem to transform in here.", "red")
|
|
return
|
|
|
|
|
|
//usecloak == check abilityholder
|
|
new /obj/dummy/spell_batpoof( get_turf(H), H , cloak)
|
|
|
|
/obj/dummy/spell_batpoof
|
|
name = "bat"
|
|
icon = 'icons/misc/critter.dmi'
|
|
icon_state = "vampbat"
|
|
density = 0
|
|
flags = TABLEPASS | DOORPASS
|
|
|
|
var/mob/living/carbon/owner = 0
|
|
var/datum/abilityHolder/vampire/vampholder = 0
|
|
//var/image/overlay_image
|
|
var/use_cloakofdarkness = 0
|
|
|
|
New(loc,ownermob,cloak)
|
|
..()
|
|
src.owner = ownermob
|
|
src.owner.set_loc(src)
|
|
|
|
use_cloakofdarkness = cloak
|
|
|
|
if (isvampire(owner))
|
|
vampholder = owner.get_ability_holder(/datum/abilityHolder/vampire)
|
|
|
|
var/obj/itemspecialeffect/poof/P = unpool(/obj/itemspecialeffect/poof)
|
|
P.setup(src.loc)
|
|
playsound(src.loc,"sound/effects/poff.ogg", 50, 1, pitch = 1)
|
|
|
|
//overlay_image = image("icon" = 'icons/effects/genetics.dmi', "icon_state" = "aurapulse", layer = MOB_LIMB_LAYER)
|
|
//overlay_image.color = "#333333"
|
|
|
|
if (use_cloakofdarkness)
|
|
if (!(src in processing_items))
|
|
processing_items.Add(src)
|
|
|
|
SPAWN_DBG(-1)
|
|
var/reduc_count = 0
|
|
while(src && !src.qdeled && owner && owner.stamina >= STAMINA_SPRINT && owner.client && owner.client.check_key(KEY_RUN))
|
|
reduc_count++
|
|
if (reduc_count >= 4)
|
|
reduc_count = 0
|
|
owner.remove_stamina(1)
|
|
sleep(1)
|
|
|
|
if (src && !src.qdeled)
|
|
dispel()
|
|
|
|
disposing()
|
|
if(owner)
|
|
owner.set_loc(src.loc)
|
|
owner = 0
|
|
//overlay_image = 0
|
|
if (use_cloakofdarkness)
|
|
processing_items.Remove(src)
|
|
..()
|
|
|
|
proc/process()
|
|
..()
|
|
update_cloak_status()
|
|
|
|
proc/update_cloak_status()
|
|
var/turf/T = get_turf(owner)
|
|
if (T)
|
|
var/area/A = get_area(T)
|
|
if (T.turf_flags & CAN_BE_SPACE_SAMPLE || A.name == "Emergency Shuttle" || A.name == "Space" || A.name == "Ocean")
|
|
src.set_cloaked(0)
|
|
|
|
else
|
|
if (T.RL_GetBrightness() < 0.2 && can_act(owner))
|
|
src.set_cloaked(1)
|
|
else
|
|
src.set_cloaked(0)
|
|
else
|
|
src.set_cloaked(0)
|
|
|
|
|
|
proc/set_cloaked(var/cloaked = 1)
|
|
if (use_cloakofdarkness)
|
|
if (cloaked == 1)
|
|
src.invisibility = 1
|
|
src.alpha = 120
|
|
//src.UpdateOverlays(overlay_image, "batpoof_cloak")
|
|
else
|
|
src.invisibility = 0
|
|
src.alpha = 250
|
|
//src.UpdateOverlays(null, "batpoof_cloak")
|
|
|
|
proc/dispel(var/forced = 0)
|
|
if (forced)
|
|
owner.stamina = max(owner.stamina - 40, STAMINA_SPRINT)
|
|
|
|
var/obj/itemspecialeffect/poof/P = unpool(/obj/itemspecialeffect/poof)
|
|
P.setup(src.loc, forced)
|
|
|
|
playsound(src.loc,"sound/effects/poff.ogg", 50, 1, pitch = 1.3)
|
|
|
|
qdel(src)
|
|
|
|
relaymove(var/mob/user, direction, delay)//all relaymove should accept delay
|
|
delay = max(delay,1) //0.75 sprint 1.25 run
|
|
var/glide = ((32 / delay) * world.tick_lag)
|
|
src.glide_size = glide
|
|
src.animate_movement = SLIDE_STEPS
|
|
|
|
user.animate_movement = SYNC_STEPS
|
|
user.glide_size = glide
|
|
|
|
step(src, direction)
|
|
|
|
src.glide_size = glide
|
|
src.animate_movement = SLIDE_STEPS
|
|
|
|
user.glide_size = glide
|
|
|
|
owner.remove_stamina(round(STAMINA_COST_SPRINT*0.75))
|
|
|
|
update_cloak_status()
|
|
|
|
if (vampholder && isturf(src.loc))
|
|
var/i = 0
|
|
for (var/atom in src.loc)
|
|
if (ishuman(atom) && vampholder.can_bite(atom, is_pointblank = 0))
|
|
vampholder.do_bite(atom, mult = 0.25)
|
|
playsound(src.loc,"sound/impact_sounds/Flesh_Crush_1.ogg", 35, 1, pitch = 1.3)
|
|
break
|
|
if (src.loc:checkingcanpass)
|
|
if (istype(atom,/obj/machinery/door))
|
|
var/obj/machinery/door/D = atom
|
|
//D.bumpopen(owner)
|
|
D.try_force_open(owner)
|
|
i++
|
|
if (i > 20)
|
|
break
|
|
|
|
actions.interrupt(user, INTERRUPT_MOVE)
|
|
|
|
.= delay
|
|
|
|
ex_act(severity)
|
|
dispel(1)
|
|
owner.ex_act(severity)
|
|
|
|
bullet_act()
|
|
.= owner
|
|
dispel(1)
|
|
|
|
attackby(obj/item/W, mob/M)
|
|
dispel(1)
|
|
owner.attackby(W,M)
|
|
|
|
attack_hand(mob/M)
|
|
dispel(1)
|
|
owner.attackby(M)
|