Implement `is` function and store modifiers per-cast.
noobanidus opened this issue ยท 0 comments
The concept here is to do the following:
- Before the actual
cast
function is called, call instead a different function which stores the modifiers in thetempModifiers
field of the SpellBase instance. - That function then calls the default function that we usually use.
- Within the context of this function (whether it is the single cast or it is the continuous cast), the modifiers should always be available as
tempModifiers
. - This means that instead of passing the modifiers as a parameter to the
cast
function (which can indeed still be done), and using thehas
function forhas(MODIFIER, modifiers)
, it's possible to instead dois(MODIFIER)
orhas(MODIFIER)
. - Things that would improve this would be, per-spell, renaming the modifiers to be roughly closer to what they actual do. i.e.,
has(FIRE)
. - Obviously, the
is
function can and should throw an exception iftempModifiers
aren't available. As theEntitySpellModifiable
relies on the instance'shas
function, it would make sense forhas(IModifier)
to be a shortcut forhas(modifier, this.tempModifiers)
and handle null functionality in that function.