-
-
Notifications
You must be signed in to change notification settings - Fork 1
Data models
The main models is defined by a member
document stored on Mongo database containing the attributes and values saved for a member. This document, as a dict is used to magically construct a duck typed Player
object, which contains battle logic, such as calculate damage taken and checkout if the player is alive. The Player
class has a composition relation with Skill
class that constructs member skills, used internally on combat logics.
The class diagram below describes the relations of the models:
The member instances are stored in a mongo collection named by the discord server id under a key member
and its value is the member id. This is the main filter for recovering members from mongo collection: {member: <member_id>}
The database structure shou looks like:
{
<server_id>: [
{
"member": "123456789",
"objectId": "skdahsdkjasbdjvgadsvgdashdvasgdgdgas",
"lv": 1,
"max_hp": 200,
"max_mp": 100,
"current_hp": 200,
"current_mp": 100,
"strength": 10,
"defense": 10,
"magic": 10,
"skillset": [],
"learned_skills": [],
"items": [],
"skill_points": 0,
"kills": 0,
"deaths": 0,
"resets": 0,
"next_lv": 1,
}
]
}