i'm creating a game which needs Spells like those seen in most Mmorpgs,
meaning area of effect spells and targeted spells/abilities.
About Three years have passed now and i'm still not at a point, where i'm satisfied with the system.
During those years i already had the game in a state where one could "cast spells" with his character.(
But the further i got it became obvious that on the server side i had to drop unity for a custom solution.
Now i'm writing the server in visual studio with Lidgren/c#.
And now i'm stuck.
Spells. I can not imagine how i could implement these. I tried many many ways, all of which failed.
In Unity it was simply a matter of instantiating an emtpy gameobject with a script on it which ran as the GO was created(i had many scripts, specific for each spell).
I'm by no means a professional programmer, more a hobbyist, so I'm stuck at translating this drag and drop like design to pure code.
For example at last i thought about having a dictionary where Spell is a Class implementing all the specific logic, and an interface for cast() and so on, and requesting that from the dictionary
class Fireball :Spell
{
}
But that didn't work for many reasons, like i dont know how to retrieve a new instance of this spell
(new (spell.GetType())() didnt work.
I also thought about having an all purpose Spell class with methods and fields for all possible things a spell could do and enabling specific behaviour through bools, enums and so on. But that was too much to keep track of.
I tried a few more things but in the end I'm as clueless as in the beginning, even before using unity as server.
So, how would a basic Spell/ability implementation/system look like? (Interfaces/abstract classes or whatever) when i need the spells to be attachable to any character and be refered to by id and also dont want to hardcode the spells into the player class.
I'm desperate, because i'm sitting on this problem for about 4months now,
so i'd be grateful for anything that helps.
Thank you very much.
P.S I'm not a native english speaker; i may have used strange combinations of words. And as for doing silly things with code, i'm constantly learning new things every day.