Object Spell System v1.0

It is now fully implemented, though I might continue work on it (especially with all the bugs no doubt present in the code). To turn on wizards spawning with an spellbook that gives object spells as opposed to verb spells, uncomment the FEATURE_OBJECT_SPELL_SYSTEM line in config.txt
For the end user, the vanilla (without spell var editing) wizard, the only two differences are having to click spells to use them (not being able to right-click stuff and cast spells that way or type them in the command line) and having a nice little countdown for a spell's recharge time.
 Changelog
It is now less horribly blue on white and more nicely black on white.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1381 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
uporotiy
2011-04-05 20:34:41 +00:00
parent 6fb2e86a5c
commit be85fc280d
21 changed files with 445 additions and 351 deletions

View File

@@ -1,29 +1,40 @@
var/list/spells = list(/obj/spell/blind,/obj/spell/blink,/obj/spell/conjure,/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
var/list/spells = list(/obj/spell/blind,/obj/spell/blink,/obj/spell/conjure,/obj/spell/disable_tech,/obj/spell/disintegrate,/obj/spell/ethereal_jaunt,/obj/spell/fireball,/obj/spell/forcewall,/obj/spell/knock,/obj/spell/magic_missile,/obj/spell/mind_transfer,/obj/spell/mutate,/obj/spell/smoke,/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/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions
var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges"
var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges"
var/clothes_req = 1 //see if it requires clothes
var/stat_allowed = 0 //see if it requires being conscious
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
/obj/spell/proc/cast_check() //checks if the spell can be cast based on its settings
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
switch(charge_type)
if("recharge")
if(charge_counter != charge_max)
usr << "[name] is still recharging."
return 0
if("charges")
if(!charge_counter)
usr << "[name] has no charges left."
return 0
if(usr.stat && !stat_allowed)
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."
@@ -37,14 +48,7 @@ var/list/spells = list(/obj/spell/blind,/obj/spell/blink,/obj/spell/conjure,/obj
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
/obj/spell/proc/invocation() //spelling the spell out and setting it on recharge/reducing charges amount
switch(invocation_type)
if("shout")
@@ -54,4 +58,20 @@ var/list/spells = list(/obj/spell/blind,/obj/spell/blink,/obj/spell/conjure,/obj
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)
usr.whisper(invocation)
switch(charge_type)
if("recharge")
charge_counter = 0
spawn(0)
while(charge_counter < charge_max)
sleep(1)
charge_counter++
if("charges")
charge_counter--
/obj/spell/New()
..()
charge_counter = charge_max