Files
CHOMPStation2/code/datums/spells/blink.dm
uporotiy 16ca227fdc Reworked Spellcasting System v0.9
- Very flexible - you can edit some of the spell's vars on the fly, or hardcode variations of the core spells.
 - Everyone can access it - you could even have observers with spells.
 - Slightly better UI - no longer will the spell verbs blink in and out of your verb panel.
1.0 will convert the existing spell sources (ie wizard spellbook) to this system and convert the last two spells to it.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@860 316c924e-a436-60f5-8080-3fe189b3f50e
2011-01-16 00:25:45 +00:00

50 lines
1.7 KiB
Plaintext

/obj/spell/blink
name = "Blink"
desc = "This spell randomly teleports you a short distance."
school = "abjuration"
recharge = 20
clothes_req = 1
invocation = "none"
invocation_type = "none"
range = -1 //can affect only the user by default, but with var editing can be a teleport other spell
var/outer_teleport_radius = 6 //the radius of the area in which it picks turfs to teleport to
var/inner_teleport_radius = 0 //so with var fuckery you can have it teleport in a ring, not in a circle
var/smoke_spread = 1 //if set to 0, no smoke spreads when teleporting
/obj/spell/blink/Click()
..()
if(!cast_check())
return
var/mob/M
if(range>=0)
M = input("Choose whom to blink", "ABRAKADABRA") as mob in view(usr,range)
else
M = usr
invocation()
var/list/turfs = new/list()
for(var/turf/T in orange(M,outer_teleport_radius))
if(T in orange(M,inner_teleport_radius)) continue
if(istype(T,/turf/space)) continue
if(T.density) continue
if(T.x>world.maxx-outer_teleport_radius || T.x<outer_teleport_radius) continue //putting them at the edge is dumb
if(T.y>world.maxy-outer_teleport_radius || T.y<outer_teleport_radius) continue
turfs += T
if(!turfs.len)
var/list/turfs_to_pick_from = list()
for(var/turf/T in orange(M,outer_teleport_radius))
if(!(T in orange(M,inner_teleport_radius)))
turfs_to_pick_from += T
turfs += pick(/turf in turfs_to_pick_from)
if(smoke_spread)
var/datum/effects/system/harmless_smoke_spread/smoke = new /datum/effects/system/harmless_smoke_spread()
smoke.set_up(10, 0, M.loc)
smoke.start()
var/turf/picked = pick(turfs)
if(!isturf(picked)) return
M.loc = picked