For my school project I'm making a little NFC based game on Android. The concept is simple, on each phone you create a character and you can fight with other people through NFC.
The character will have have a set of attributes, like strength, agility, etc which are represented as short (only 2 bytes => for NFC communication). A character must have a race (human, dwarf, ...) and a class (warrior, wizard, ...). Each race has attribute advantages (ex : + 2 strength for dwarf) and a passive bonus ex : +5% gold after a fight. Each class can wear different weapon and will have a different attack() methods.
My problem is that I don't know how I should create my character class and allow it to have a race and a class.
Does anyone have an idea of how I can accomplish this ?
Enum
to store the class and another to store the race. \$\endgroup\$Race
and theClass
classes. You don't want all that data stuck in the sameCharacter
class, and you'll need a way to differentiate theattack
methods. \$\endgroup\$Race
classes inherit myCharacter
class. I don't know how to link myClass
classes with it. \$\endgroup\$