Hey,
So the red boxes would be components (classes) that have the logic coded in them and you would simply use that.
I think overall you are simply overcomplicated this. Stop trying to create a 1 size fits all, because it will cause a lot more issues;
instead the system should include basic functionality for things like damage, range, mana cost, duration, etc. and then you will have to code
every unique functionality separately under a function named lets say SpawnSpell(AActor* Target). So if you needed to cast lets say a FireBall
that exploded at impact and does aoe dmg on spell death then you would code that under SpawnSpell (spawn a collision sphere at death location and applydamage to everyone in it that is not an ally).
Additonally, stop confusing weapons with abilities, there are just abilities and the weapons can/may augment those abilities that are on your spellbar. So lets say you have a weapon that spawns a projectile (the projectile in this sense is actually an abilitiy that is spawned when I click hotbar 1) that immobilizes the enemy target, you can have something like so:
Class Gun : Weapon : Interface Ability
// Gets the ability to use
void FireGun(){
GetAbility().Use(RangeComponent abilityRange);
}
Class BullsEye : Gun
// Bullet Type
- ImmobilizingBullet bulletToSpawn
Ability GetAbility(){
return ImmobilizingBullet;
}
Class ImmobilizingBullet : Ability
// Depending on the component type passed in, the spell will either be melee or ranged, etc.
void Use(RangeComponent abilityRange);
// Then under collision overlap call the following function, which will do the immobilizing logic
void SpawnSpell(AActor* Target)
So all you would have to do is extend Ability and create any component you want, like Teleport etc, and each component will know what to do etc. (Ofcourse you can expand this system to buff, damage, heal, etc)
This is just a quick example, its not that great but hopefully I got my point accross.
Here is a post that you find more helpful than mine (They talk about composition etc):
https://www.reddit.com/r/gamedev/comments/1bm5xs/programmers_how_dowould_you_implement_a/