MUDL:is class primary for spell

From SlothMUD Wiki
Revision as of 22:56, 7 November 2018 by Teker (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Summary

Function Name is_class_primary_for_spell
Settable No
Returns Boolean


Parameter Options
PC Class (integer or string), Spell (integer or string)


This function returns True if the PC class is primary for a particular spell. This means that the class is able to cast the spell at a lower level than any other class. So for 'magic missile', 'magic-user' would return True and other classes would return False. For spells like 'spirit watcher' where multiple classes are able to cast the spell at level 20, those classes would all return True whereas non-caster classes would all return False.

A table of MUDL_PC_Class_Values is available.


Example

setproc <parent> # intercept_cast_i
# If not primary, fail the spell
if (is_pc(%a) AND !is_class_primary_for_spell(class(%a, 1), %1),
(
    msg_character(%a, 'Your spell fizzles!'),

    # Stop future processing of this command
    set(flag(%f, 'procedure-flags', 'overrode-command'), true),
    return(true)
)),

return(false)
@


setproc <parent> # PROC_ENABLED 1