Files
CHOMPStation2/code/datums/spell.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

56 lines
2.7 KiB
Plaintext

var/list/spells = list(/obj/spell/blind,/obj/spell/blink,/obj/spell/disintegrate,/obj/spell/ethereal_jaunt,/obj/spell/fireball,/obj/spell/forcewall,/obj/spell/knock,/obj/spell/magic_missile,/obj/spell/mutate,/obj/spell/teleport) //needed for the badmin verb for now
/obj/spell
name = "Spell"
desc = "A wizard spell"
var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?
var/recharge = 100 //recharge time in deciseconds
var/clothes_req = 1 //see if it requires clothes
var/invocation = "HURP DURP" //what is uttered when the wizard casts the spell
var/invocation_type = "none" //can be none, whisper and shout
var/range = 7 //the range of the spell
var/cast = 0 //the only way I could think of making it temporarily disable
var/message = "derp herp" //whatever it says to the guy affected by it. not always needed
/obj/spell/proc/cast_check() //checks if the spell can be cast based on its settings, plus handles chanting and recharge
if(!(src in usr.spell_list))
usr << "\red You shouldn't have this spell! Something's wrong."
return 0
if(cast)
usr << "[name] is still recharging."
return 0
if(usr.stat)
usr << "Not when you're incapacitated."
return 0
if(clothes_req) //clothes check
if(!istype(usr:wear_suit, /obj/item/clothing/suit/wizrobe))
usr << "I don't feel strong enough without my robe."
return 0
if(!istype(usr:shoes, /obj/item/clothing/shoes/sandal))
usr << "I don't feel strong enough without my sandals."
return 0
if(!istype(usr:head, /obj/item/clothing/head/wizard))
usr << "I don't feel strong enough without my hat."
return 0
return 1
/obj/spell/proc/invocation() //spelling the spell out and setting it on recharge
src.cast = 1
var/old_name = src.name
src.name += " (cast)"
spawn(recharge)
src.cast = 0
src.name = old_name
switch(invocation_type)
if("shout")
usr.say(invocation)
if(usr.gender=="male")
playsound(usr.loc, pick('vs_chant_conj_hm.wav','vs_chant_conj_lm.wav','vs_chant_ench_hm.wav','vs_chant_ench_lm.wav','vs_chant_evoc_hm.wav','vs_chant_evoc_lm.wav','vs_chant_illu_hm.wav','vs_chant_illu_lm.wav','vs_chant_necr_hm.wav','vs_chant_necr_lm.wav'), 100, 1)
else
playsound(usr.loc, pick('vs_chant_conj_hf.wav','vs_chant_conj_lf.wav','vs_chant_ench_hf.wav','vs_chant_ench_lf.wav','vs_chant_evoc_hf.wav','vs_chant_evoc_lf.wav','vs_chant_illu_hf.wav','vs_chant_illu_lf.wav','vs_chant_necr_hf.wav','vs_chant_necr_lf.wav'), 100, 1)
if("whisper")
usr.whisper(invocation)