Chillu1 / ModiBuff

Buff/Debuff/Modifier library focused on feature set and performance, while maintaining 0 GC. Fully pooled
Mozilla Public License 2.0
139 stars 4 forks source link

ModiBuff.Units Unit casting #21

Closed Chillu1 closed 10 months ago

Chillu1 commented 11 months ago

Currently, casting is done through two means: IModifierOwner.TryCast and IStatusEffectModifierOwner.TryCast.

But both of these methods skip the user as a caster to some degree. Instead, the unit should call its event list List<IEffect> _onCastEffects when casting, as well as the other checks. Just like we do for example how _whenAttackedEffects trigger when the unit gets attacked.

The cast should also check if we can cast (LegalAction), and if we can cast that modifier ModifierController.CanCastModifier.

The method should be directly implemented in the Unit class in ModiBuff.Units.

A unit test or two should be made to check that it works correctly, mention @Chillu1 for help with this.