Hey guys, i’m creating a browser game where battles between monsters and users(pvp) take place. The Monster model has all the functions that relate to the battle against monsters. I’m now creating the PvP system and the battle system is the same as in Monsters. So, i was thinking of creating some sort of an abstract presentation of the battle, maybe a Combatable Model (?) and make a polymorphic association.
Do you think this is the strategy i should follow, or i could do it in a better manner ?
I would say that you should create a Combatant class or module that you can inherit from or include in your Person and Monster classes, but you shouldn’t persist a polymorphic association into the database. You should only use two tables: people and monsters.