D10d3 icon

inventory-structure.py

D10d3 | PRO | 11/14/16 01:22:24 AM UTC | 0 ⭐ | 451 👁️ | Never ⏰ | []
Python |

10 KB

|

None

|

0 👍

/

0 👎

#This is where I'm assembling notes on how to build my 
#inventory structures and laying it out.    
 
""" Crazy ideas:
Do classes, wizard can cast spells, fighter can have a shield and choose to slash (dam+reduce target AC) or thrust (dam+dam-player AC) 
or defend (plus dam+player AC), thief can hear when a wandering monster is in the next room and hide in the shadows (check room exits vs wandering 
monster locations) 
 
Monsters: Monsters come in two flavours: Static and mobile(mob). If I can, I should just write Mobs and limit their range to one room if I 
want them to be static. Mobs will have a territory list, which is a truncated version of the room list. Each round they will pick a random 
exit from where they are at, if it is not on their room list they will pick again until it is. Monsters will have movement speed: each mob 
will have a movement timer variable, each round it will drop by one, when it reaches zero moving=True and we reset the variable to it's max 
figure. Try not to have monsters who move every round, as they will be impossible to follow if they flee, or uh maybe have an exception to 
that rule, a theif who if he flees is impossible to catch and must be randomly encountered later (love this idea, he can also rob the player 
zork style). Also, let's limit mobs to one per room, A mob will NOT wander into another mobs room (that way we can have a single monster 
variable for each room). Monsters can flee combat if they are cowardly, have them check if they are in the room with the player, if their 
injuries have reached a threshold, and if they are cowards (even HOW cowardly on a scale). If they have reached their fear threshold 
they will roll each round to see if they flee. 
 
Mob Loot: If I have an economy based game where players can sell loot and buy things I will make loot table and assign them to mobs
If I do not make an economy based game then I will use the event handler to tie some item drops to specific monsters (you need to kill the 
wizard to get the key to hit inner sanctum.
 
To handle Mob Stats: There are two ways to handle this, either create a system to spawn monsters at random, or (which would be easier) just create
a system database of all monsters in the game at start (init at game start), we can then just update their DBs per round to know where they have
moved, if they have taken damage, and if they are dead.
"""
 
    
"""all three classes if inventory item will be handled in much the same way as the map DB. At the bottom of the inventory_items super class
    there will be a reference dictionary for each of the inventory categories. The format of the dict will be:
        gear_list = {
            "thing" : thing,
            "stuff" : stuff
            }
    Ect for each inventory class.
    
    """ 
class items():
    
    #Gear items: anything that can be equipped
        # gear classes
        # gear size is the amount of space gear take up in player inventory when NOT equipped
        # equipped gear takes no bag space
        # all armor and damage values for equipped gear are tallied to determine player stats
        # Add a routine to the equipment swap function that will check is a gear slot of empty
        # if a slot is empty it will place the default gear there.
        
    default_head = {
        "name" : "bare-head",
        "desc" : "You aren't wearing anything on your head",
        "type" : "head",
        "damage" : 0,
        "armor" : 0,
        "size" : 0,
        "bag_space" = 0,
        }
    default_hand = {
        "name" : "empty-hands",
        "desc" : "You don't have anything readied in your hands.",
        "type" : "hand",
        "damage" : 1, #fist
        "armor" : 0,
        "size" : 0,
        "bag_space" : 1, #held in off hand
        }
    default_body : {
        "name" : "loin-cloth",
        "desc" : "While it lacks in protection it at least protects your modesty",
        "type" : "body",
        "damage" : 0,
        "armor" : 0,
        "size" : 0,
        "bag_space" : 0,
        }
    default_bag : {
        "name" : "No-bag",
        "desc" : "No-bag",
        "type" : "bag",
        "damage" : 0,
        "armor" : 0,
        "size" : 0,
        "bag_space" : 0,
        }
    default_special : {
        "name" : "quick-wit",
        "desc" : "Mom always said you were smart",
        "type": "special",
        "damage": 0,
        "armor": 0,
        "size": 0,
        "bag_space" : 0,
        }
        
    wizard_hat : {
        "name" : "wizard-hat",
        "desc" : "This enchanted blue hat is embroidered with stars",
        "type": "head",
        "damage": 1 #+1 "damage"from enchantment,
        "size": 1   ,
        }
    wand : {
        "name" : "wand",
        "desc" : "This wand is finely carved from a dark wood and inscribed with runes",
        "type": "hand",
        "size": 1,
        "damage": 4,
        }
    robes : {
        "name" : "robes",
        "desc" : "While somewhat travel worn, these blue robes are quite comfy.",
        "type": "body",
        "size": 1,
        "armor": 1,
        }
    satchel : {
        "name" : "satchel",
        "desc" : "This is a brown leather satchel with a shoulder strap.",
        "type": "bag",
        "size": 2,
        "bag_space" : 6, 
        "inventory":None
        }
    ring_protection : {
            "name" : "ring-protection",
            "desc" : "An old wizard gave you this ring, it's enchantment helps deflect blows",
            "type": "special",
            "damage": 0,
            "armor": 1,
            "size": 0, #small objects don't effect bag space
            }
    #Inventory Items:   : anything that can be carried
    # item = {
        # "name":"",
        # "desc":"",
        # "placed":"",
        # "event":""
        # }
    record = {
        "name":"record",
        "desc":"This is a resin platter record in a sleeve labeled 'Blue Danube'",
        "placed":"There is a record here",
        "event":None
        }
    Emma = {
        "name":"Emma",
        "desc":"This fat grey tabby cat has a tag that reads 'Emma'",
        "placed":"There is a cat curled up here named Emma",
        "event":None
        }
    Tidbit= {
        "name":"Tidbit",
        "desc":"This is black and white cat who loves cheese",
        "placed":"There is a cat named Tidbit here.",
        "event":None
        }
    guitar = {
        "name":"guitar",
        "desc":"It's a 1968 Harmoy Rocket hollow body guitar",
        "placed":"A guitar leans against the sofa.",
        "event":None
        }
    pledge = {
        "name":"pledge",
        "desc":"It's can of a lemony all all purpose surface cleaner",
        "placed":"There's a can of pledge sitting on the floor",
        "event":None
        }
    Noosa = {
            "name":"Noosa",
            "desc":"Noosa is a fluffy white cat with blue eyes.",
            "placed":"A white cat is sitting here, her tag reads 'Noosa'.",
            "event":None
            }
        
            
#STATIC Items: things that can't move but can be interacted with
        """the eventual layout of static objects will be determined by the event 
        handler. For now they just have a name and a description. 
        The event variable is just a place holder for future formatting. 
        """
    #static = {
        # "name":"",
        # "desc":"",
        # "event":None,
        # "container":False,
        # "inventory":"",
        # "space":0
        # }
    chair = {
        "name":"chair"
        "desc":"This is a large wingback style chair upholstered in red velvet."
        "event":None,
        "container":True,
        "inventory":[],
        "space":1
        }
    phonograph = {
        "name":"phonograph"
        "desc":"This is a cabinet style phonograph with a large hand-crank."
        "event":None,
        "inventory":[]
        "space":1
        }
    Sofa = {
        "name":"Sofa",
        "desc":"It's a Victorian style sofa with grey and dark grey vertical stripes",
        "event":None,
        "container":False,
        "inventory":"",
        "space":0
        }
    rug = {
        "name":"rug",
        "desc":"This oriental rug has excellent knot work and patterns",
        "event":None,
        "container":False,
        "inventory":"",
        "space":0
        }
    fireplace = {
        "name":"fireplace",
        "desc":"The brick hearth fireplace has several logs burning in it",
        "event":None,
        "container":False,
        "inventory":"",
        "space":0
        }
    piano = {
        "name":"piano",
        "desc":"It is a black baby grand piano",
        "event":None,
        "container":False,
        "inventory":"",
        "space":0
        }
    tardis = {
        "name":"tardis",
        "desc":"It's a blue policebox, it may travel in time and space",
        "event":None,
        "container":False,
        "inventory":"",
        "space":0
        }
    policebox = tardis
    police = tardis
    
    gear = [
        default_head,
        default_hand,
        default_body,
        default_bag,
        default_special,
        wizard_hat,
        wand,
        robes,
        satchel,
        ring_protection]
    inventory = [
        record,
        Emma,
        Tidbit,
        guitar,
        pledge,
        Noosa]
    static = [
        chair,
        phonograph,
        sofa,
        rug,
        fireplace,
        piano,
        tardis,
        policebox,
        police]
 
    
class events():
    """
    While I am sketching out the event system here, it will be housed in the engine when complete
    An event is anything that happens because of player input
    Each event may have to be a hand coded routine, but at least most of the major actions can be handled 
    by some standardized functions"""
    event functions:
        change room:                                #Moving north, south, ect
        add or remove player_inventory:     #Picking something up, dropping it, or "The shady person brushes past you, your bag feels lighter"
        placing item:                           #"Put jewel in box"
        add or remove an exit:              #lock or unlock doors, reveal hidden doors ect..
        add or remove static objects:       #this can be used to replace a locked box static with an open box static, as well as revealing hidden items ect..
        add or remove room_inventory:       #you place the jewel on the alter and it shatters in a flash of light
        add or remove mob:                  #you pull the lever and a goblin jumps out of hidding!
        change room descriptions:           #after setting off the bomb the room is described as having cracked walls and piles of rubble.
        change player health:               #healing shrines, traps, falling down a pit ect...
        initiate combat:                        #player or mobs can initiate combat, or a triggered event can dump the player in combat "Ravenous Squirrels descend from the trees!"
        initiate conversation:              #dialogue tree style conversation with NPCs/Mobs. Can be effected by items "Oh! You brought my spell book!"
 
        
class combat():
    """
    Combat will be it's own loop within the over all game loop. The game loop will not continue until there
    is either a victor or one party has fled. a parser routine will check to see if either the player or a mob
    has initiated combat, and if True it will dump them both into the combat loop.
    The combat loop will be housed in the engine
    """

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎