Ability Wrappers

Ability wrappers are used as a bridge between abilities and NPC goals in order to merge these two systems and make them work together, they are only used for NPCs.

The main entry point for them is AbilityWrapperGoal and it handles a lot of the core functionality of abilities such as unlocking, equipping and using them automatically unlike manually as a human player would normally interact with them. Generally speaking there's more things an NPC can't handle the same way a user has, most notably here "looking" around with the mouse, for these case by case situations the class also exposes a series of abstract methods called after all the defaults are taking care of.

For example the canUseWrapper method is called at the end of the canUse method after checking if the NPC can use this ability, these checks are meant to be generic and not opinionated, so in this example some of the checks include checking to see if the NPC is stunned, alive or if the ability's canUse succeeds.

The difference between an ability's canUse and an ability wrapper's canUseWrapper is that the ability's canUse should handle all the cases as generically as possibly, for both human and player cases, the canUseWrapper method however will only handle NPC possibilities.

At the end of the day there's nothing fancy about the AbilityWrapperGoal that couldn't be reimplemented by another dev for their more specific needs. It is meant as a set of sane defaults and to cut down on the boilerplate code for when handling an NPC's abilities.

Last change: 2025-01-06