Consider the following code:
This returns a composite that will cast the given spell if the requirements are met. I am currently working with custom cooldowns implemented with timers. I need to be able to reset those timers if and only if the spell is actually cast. The way this is done in the Exile CR is the timer is reset during the calculation of "reqs". Are all requirements across the entire PrioritySelector evaluated on every tick? Or are they evaluated one by one until an action's requirements are met, the action is executed, and the tick ends? Unfortunately my testing points toward the former - please let me know if I'm wrong.
Regardless, there are definitely many instances where you provide reqs that evaluate to true but the spell is not actually cast. Since the timer was set during the calculation of reqs and not after the spell was actually cast, we bot needs to wait the duration of the timer to even attempt the cast again.
I have attempted to get around this by doing what the flask logic does: use a decorator with a set of requirements and a corresponding set of actions. The flask logic uses the Use() method in the action, but I cannot figure out how to do the equivalent with a spell. I have tried to use SpellManager.Cast(), but this does not seem to work. Here is an example:
So I guess it all boils down to this: How do I run some my timer logic if and only if a certain action (spell cast) is selected by the priority selector and it is successfully performed?
Thanks,
Ben
Code:
SpellManager.CreateSpellCastComposite(spell, reqs, location);
This returns a composite that will cast the given spell if the requirements are met. I am currently working with custom cooldowns implemented with timers. I need to be able to reset those timers if and only if the spell is actually cast. The way this is done in the Exile CR is the timer is reset during the calculation of "reqs". Are all requirements across the entire PrioritySelector evaluated on every tick? Or are they evaluated one by one until an action's requirements are met, the action is executed, and the tick ends? Unfortunately my testing points toward the former - please let me know if I'm wrong.
Regardless, there are definitely many instances where you provide reqs that evaluate to true but the spell is not actually cast. Since the timer was set during the calculation of reqs and not after the spell was actually cast, we bot needs to wait the duration of the timer to even attempt the cast again.
I have attempted to get around this by doing what the flask logic does: use a decorator with a set of requirements and a corresponding set of actions. The flask logic uses the Use() method in the action, but I cannot figure out how to do the equivalent with a spell. I have tried to use SpellManager.Cast(), but this does not seem to work. Here is an example:
Code:
private Composite CreateDefenseLogic()
{
return new PrioritySelector(
new Decorator(ret => _wallCd.IsFinished,
new Action(ret =>
{
SpellManager.Cast("Frost Wall", MainTarget);
_wallCd.Reset();
})
)
);
}
So I guess it all boils down to this: How do I run some my timer logic if and only if a certain action (spell cast) is selected by the priority selector and it is successfully performed?
Thanks,
Ben
Last edited: