I'm implementing a series of feats that a character can take to give bonuses to certain minions.
The way I did this at first was to use a foreach loop to look for qualifying minions and apply the effects. This works, but I don't like doing it. I've got several such feats and having them all iterate through every minion on a pet-heavy character is the sort of thing that makes ShadowChemosh appear in your bathroom mirror right before you're never heard from again.
So instead I created a Simple object to act as a helper, bootstrapped that to the minion, and moved the feats' logic to that helper (one script for each feat it implements). Here's an example what that looks like:
Quote:
~ This script only runs for minions
doneif (hero.isminion <> 1)
~ Stop if the master doesn't have the feat we're looking for
perform master.findchild[BaseFeat, "IsFeat.myFeatID & !Helper.FtDisable & !Helper.SpcDisable"].setfocus
doneif (state.isfocus <> 1)
~ do stuff ~
|
The problem with this approach is that it keeps up with adding/removing the feat, but not with disabling/reenabling it (say, via the "Feat/Trait Disable" Adjustment) unless I reload the system or trigger a full evaluation. I'm not sure why. Doesn't seem like a matter of my script running too early or else it would never work. Is there some aspect of the master/minion loading order that I'm not accounting for?