GilMUD Plan
Inheritance system
This is my rough plan for how the inheritance system/thing system should work.
Thing
Has these variables:
``` string name string desc
set attrs dict specialattrs
list contents
Thing location ```
And these functions:
save(file f) # Dump to open file f
load(file f) # Load from open file f
moveInto(Thing dest) # Check if "container" in attrs to see if this works
hear(string, color) # This function does nothing
Has attrs: obvious
Person (derived from Thing)
Has these variables:
```
Combat variables
string combatTarget bool inCombat string oldTarget int combatTimer
bool meditating bool resting
string race
dict charSheet = { "level": 1, "statpoints": 0, "hp": 0, "maxhp": 0, "mana": 0, "maxmana": 0,
"xp": 0,
"spells": [],
"gold": 0,
"dodge": 0,
"accuracy": 0,
"threat": 0,
}
dict eq = { "armor": None, "weapon": None, } ```
Has these functions:
``` raceMaker() # Set the player stats based on race tick() # Perform combat, meditation, and resting prompt() # Sends status to self.hear()
save() # An extension of Thing.save which saves the additional attributes defined in Player load() ```
Has additional attrs: person
Mob (derived from Person)
Has these functions:
tick() # Calls mobAI.py
Has additional attrs: mob
Player (derived from Person)
Player.playerlist
contains a list of all players in the MUD.
Has these variables:
``` playerConn conn dict settings
```
Has these functions:
``` takeInventory() hear(string, color) overrides Thing.hear() # Send through conn with appropriate color createChar() # Step-by-step character creation
save() load() ```
Has additional attrs: player
Room
Has these variables:
dict exits
Has these functions:
``` broadcast(msg, msgcolor, *ignorelist)
load(f) save(f) ```
Has additional attrs: room