obj/weapon/verb/Equip()
set src in usr
if(usr.weapon)
usr << "You already have a weapon equiped"
return
else if(usr.class != src.classneed)
usr << "You may not equip this"
return
else
usr.overlays += src
usr << "You equip [src]"
usr.strength += src.weaponstr
usr.weapon = "[src.name]"
usr.weapon1 = src
usr.weaponlvl = src.lvl
if(src.name == "Wind Staff")
var/obj/spells/S = new /obj/spells/wind/cutter()
var/obj/spells/S2 = new /obj/spells/wind/current_cutter()
var/obj/spells/S3 = new /obj/spells/wind/gust()
if(usr.lvl != S.requiredlvl)
del(S)
return
if(usr.lvl != S2.requiredlvl)
del(S2)
return
if(usr.lvl != S3.requiredlvl)
del(S3)
return
else
usr.spell = "[S.name]"
usr.spell1 = S
usr.spelllvl = S.lvl
usr.spell2 = S2
usr.spelllvl2 = S2.lvl
usr.spell13 = S3
usr.spelllvl3 = S3.lvl
I have the spells defined as objs. And a Fire() proc that fires the spell that is selected. Well that's that. I think seeing this might help as well.
mob
Stat()
if(!client)
return null
else
statpanel("[src.name]")
stat("Class: [src.class]")
stat("Level: [src.lvl]")
stat("Experience: [src.exp]/[src.expneed]")
stat("HP: [src.hp]/[src.maxhp]")
stat("Mp: [src.mp]/[src.maxmp]")
stat("Strength: [src.strength]")
stat("Defense: [src.defense]")
stat("Intelligence: [src.intelligence]")
stat("Magic Defense: [src.magicdef]")
stat("Evasion: [src.evasion]")
stat("Gold: [src.gold]")
statpanel("Weapon/Spell")
if(src.weapon)
stat("Weapon")
stat(src.weapon1)
stat("lvl: [src.weaponlvl]")
else
stat("No weapon equiped")
if(src.spell)
stat("")
stat("Spell")
stat(src.spell1)
stat("lvl: [src.spelllvl]")
else
stat("No spell is being used")
statpanel("Inventory")
stat(src.contents)
I thought that might help to see what I'm trying to do exacetely. So any help maybe making the spell stuff in equip better would be nice.
Resonating Light
<code>for (var/spelltype in typesof(/obj/spells)) var/obj/spell/S=new spelltype(usr) if (usr.lvl < S.requiredlvl) del S</code>
You may need to change your code to get rid of those messy "spell2", "spelllvl2", etc. vars, and to use the objects properly to determine which spell is which (hint: Try locate()-ing a /obj/spell/whatever in the mob's contents). There's not much point taking a nice clean object-orientated approach to spellcasting without doing it properly. =)