I have about 60 skills within my game, which are loaded from a JSON
file. Each skill is a subclass of a skill object and has attributes like range, cost, target type, etc. Currently each skill has an integer index to identify the skill. Warrior skills begin at 100, wizard at 200, rogue at 300, etc.
Now I'm at a point where I'm implementing the mechanics of what these skills actually do, I have created an enumerated type with 60 integers corresponding to the indices from within a JSON file. And what I have right now is a switch
statement with 60 cases:
enum SkillsEnum
{
sPowerAttack = 100,
//59 more enums with skill names
}
-(void)doSkillActionWithTarget:(CharacterModel*)target
{
DLog(@"Skill activated");
switch (self.skillIndex) {
case sPowerAttack:
{
//apply skill effect here
break;
}
//59 more skills
}
}
I'm working in Objective-C, an object oriented language and am interested if there's a better or more flexible to refer to skills within the game engine?
In other words, would there be any benefit from creating more specialized separate class hierarchies for skills, or passing them around as Maps/Dictionaries?