~ This procedure tests if a character has a specific spell and sets the valid field
~ ===How to use this Procedure===
~ var PowerID as String
~ var HavePower as number
~ PowerID = "spCureLig1"
~ Call HavePower
~ @valid = HavePower
~ This procedure tests if a character has a specific spell and sets the valid field
~ ===How to use this Procedure===
~ var PowerID as String
~ var HavePower as number
~ PowerID = "spCureLig1"
~ Call HavePower
~ @valid = HavePower
var HavePower as number
var PowerID as string
var s2search as string
var s2classes as string
var X as number
~ Init fields here
X = 0
HavePower = 0
~ Add thingid to the spell id passed us
PowerID = "thingid." & PowerID
~ replace the | with |thingid. tag groups
PowerID = replace(PowerID,"|","|thingid.",0)
~ Get the classes that are valid for the spell ID(s) passed to us
foreach thing in BasePower where PowerID
~ only do anything if we a spell with classes
if (eachthing.tagis[sClass.?] <> 0) then
~ if loop counter not zero then add a seperator between strings
if ( X <> 0) then
~ add a seperator between each loop
s2classes &= "|"
endif
~ Build a search sting of all class tags
s2classes = eachthing.tagids[sClass.?,"|"]
~ increment loop counter
X += 1
endif
nexteach
~ Get the classes that are valid for the spell ID(s) passed to us
foreach pick in hero where PowerID
~ only do anything if we a spell with classes
if (eachpick.tagis[sClass.?] <> 0) then
~ if loop counter not zero then add a seperator between strings
if ( X <> 0) then
~ add a seperator between each loop
s2classes &= "|"
endif
~ Build a search sting of all class tags
s2classes = eachpick.tagids[sClass.?,"|"]
~ increment loop counter
X += 1
endif
nexteach
~ replace the sClass tags with thingid tag groups
s2search = replace(s2classes,"sClass","thingid",0)
~ Loop through classes and see if we have one of the classes
~ valid for casting CLW spells
foreach pick in hero where s2search
HavePower = 1
nexteach