ID:67874
 
Keywords: modular, spells
I made this for a friend quite some time ago, and figured I had lost it when my computer died. Luckily enough, I had emailed it to him and I was able to recover it. Have a look, and see what you think.

Danny Roe's Modular Spell System

Like it? Yay me.
Don't like? Nay me and tell me all my faults. </3
Neat method. Wish I had thought of that before I began Stick World 2... my spells code is a big delicious pile of spaghetti.
Cool!
Thanks, I'll eventually update it to include enemy spell casting.
You should make use of datums, or if you wanted to you could define all of these into one list like I've done below. This will make adding and removing spells alot easier without manually defining all of those variables.

mob
@var/list/spells
@New()
@@..()
@@spells=new() @proc/addspell(s_name as text,s_mp as num,s_min as num,s_max as num)
@@if(!spells.Find(s_name))
@@@spells.Add(s_name) @@spells[s_name]="mp=[s_mp]&min=[s_min]&max=[s_max]"

@verb/cast(spell in spells)
@@var/tmp/list/spell_params=params2list(spells[spell])
@@var/tmp/dmg=rand(text2num(spell_params["min"]) , text2num(spell_params["max"]))
@@world<<"[usr] casts [spell] costing [spell_params["mp"]] and dealing [dmg] damage!"


Not entirely sure if DM tags work in comments by the way... lol

EDIT... I guess it won't work and it won't allow indentation. So I'll add @ signs to depict indentation.
Heh, kind of reminds me of what Shadowdarke has set up for DarkeDungeon
Thanks guys, and Ken, I was intending to add a method of players making their own "Custom" spells. Your example is a very neat way of doing so, thanks.
No problem. Funny thing is I just learned how to do that about a week ago. It's amazing how many new things I'm learning, just to have a decent working interface.