Hello!
I am currently working on a roguelike and I have started on an upgrade system but I feel like there is a better way of doing things.
This is what I want to accomplish:
I want the player to have a certain number of skill slots that can be filled with different skills over the course of the run. Imagine it like a build your own MOBA character.
Then I want to be able to upgrade these skills in unique ways.
One of the skills is a straightforward projectile that flies from the character in the direction of the cursor that deals damage when it hits an enemy and disappears either when it hits the enemy or travels max distance.
I want it to have three different upgrade paths. The first path splits the projectile into three projectile while reducing the damage. The second path makes it so that the projectile can penetrate x number of targets before disappearing. The third path is for the projectile to seek out the nearest enemy.
I want these paths to be exclusive so when you have chosen one of these three you cant choose the other two.
However I also want it to be that there are generic upgrades for the entire skill, such as applying bleeding on hit but also special upgrades for the different paths such as increasing the damage based on amount of enemies penetrated when it comes to upgrade path 2.
The issue that I am having is making this system scalable and modular.
The current way I have solved it:
I have a abstract skill superclass that handles the cooldown of the skill and has an Activate() method that happens when you press the assigned key. I have my different skills inherit from this class and then I just add the functionality to my Activate() method to do what I want. In the case with the projectile I instantiate a prefab that has everything it needs attached to it and the projectile flies like it should.
I have another class attached to the player object that handles the different abilities and upgrades. Basically I have an array with available skill and upgrades which has a class that has the script names of the abilities or upgrade names together which upgrades should become available next and which upgrades to remove. Then when the player chooses that upgrade/ability it gets moved to a current skills and upgrades array. It also adds any new upgrades that become available after picking that upgrade/skill.
Then in the projectile class I check the array if I have that current upgrade as a string.
Even though this method works it is not very scalable. As you can probably tell that means that if I have the projectile as I mentioned previously the projectile script needs to cover all the possible outcomes such as either just going straight forward or honing in on an enemy or penetrating extra targets. Or the skill script needs to accommodate for spawning extra swords if I have that upgrade even though for two of the upgrades that is completely unnecessary!
What is a better way of doing a system like this? Do you guys have any recommendations?
Sorry for the long post and thank you in advance!