since I am new to Unreal I have a question about how to create my code / Blueprints for spells. Whenever the character casts a spell, it can have various effects. Possible outcomes:
- Create area of effect that damages players
- Create a projectile that damages a player on hit
- Enchant a player with various effects
So right now I am mostly wondering how to design enchantments of other players. For example I want to create an enchantment that prevents any damage that exceeds 10% of the players max health points.
For this I want to create a base class that has a function like
float CheckDamage(APawn* Target, float Damage) that can be overriden and implemented by my spells, e.g. in this scenario to only return 10% of the max health of the target.
Now my question is, what should my spell class derive from? Should it be an actor and should I attach it to the target? All spells have a visual animation or effect so it could make sense to implement them as actors. But the effect will last even when the visual part is complete, so keeping this functionality as an actor attached to another actor might be overkill, when I don’t need it for the animation anymore.
Would it be better to create a separate class and derive from UObject for these kinds of enchantments, that live separated from the animation?
Thanks in advance