I’m working on a RPG using django and am considering different options for implementing part of the skill system.
Say I have a base skill class ie, something like:
class Skill (models.Model):
name = models.CharField()
cost = models.PositiveIntegerField()
blah blah blah
What would be some approaches to implementing specific skills? The first option that comes to mind is:
1) Each skill extends Skill class and
overrides specific functions:
Not sure how this would work in django. Seems like having a db table for each skill would be overkill. Could the child class be abstract while the Skill class have an entry? Doesn’t sound right. How about using a proxy class?
What are some other options. I’d like to avoid a scripted approach for a pure django approach.
Perhaps you might consider separating a skill and it’s associated effect. More that likely, skills will end up having one or more effect associated with them, and that effect could potentially be used by multiple skills.
For example, an effect could be “Does N frost damage to current target”. That effect could be used by the skills “Blizzard Bolt”, “Frost Blast”, and “Icy Nova”.
models.py
effects\spells.py