D10d3

inventory-structure.py

Nov 13th, 2016
133
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #This is where I'm assembling notes on how to build my
  2. #inventory structures and laying it out.   
  3.  
  4. """ Crazy ideas:
  5. 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)
  6. 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
  7. monster locations)
  8.  
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. injuries have reached a threshold, and if they are cowards (even HOW cowardly on a scale). If they have reached their fear threshold
  18. they will roll each round to see if they flee.
  19.  
  20. 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
  21. 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
  22. wizard to get the key to hit inner sanctum.
  23.  
  24. 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
  25. 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
  26. moved, if they have taken damage, and if they are dead.
  27. """
  28.  
  29.    
  30. """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
  31.     there will be a reference dictionary for each of the inventory categories. The format of the dict will be:
  32.         gear_list = {
  33.             "thing" : thing,
  34.             "stuff" : stuff
  35.             }
  36.     Ect for each inventory class.
  37.    
  38.     """
  39. class items():
  40.    
  41.     #Gear items: anything that can be equipped
  42.         # gear classes
  43.         # gear size is the amount of space gear take up in player inventory when NOT equipped
  44.         # equipped gear takes no bag space
  45.         # all armor and damage values for equipped gear are tallied to determine player stats
  46.         # Add a routine to the equipment swap function that will check is a gear slot of empty
  47.         # if a slot is empty it will place the default gear there.
  48.        
  49.     default_head = {
  50.         "name" : "bare-head",
  51.         "desc" : "You aren't wearing anything on your head",
  52.         "type" : "head",
  53.         "damage" : 0,
  54.         "armor" : 0,
  55.         "size" : 0,
  56.         "bag_space" = 0,
  57.         }
  58.     default_hand = {
  59.         "name" : "empty-hands",
  60.         "desc" : "You don't have anything readied in your hands.",
  61.         "type" : "hand",
  62.         "damage" : 1, #fist
  63.         "armor" : 0,
  64.         "size" : 0,
  65.         "bag_space" : 1, #held in off hand
  66.         }
  67.     default_body : {
  68.         "name" : "loin-cloth",
  69.         "desc" : "While it lacks in protection it at least protects your modesty",
  70.         "type" : "body",
  71.         "damage" : 0,
  72.         "armor" : 0,
  73.         "size" : 0,
  74.         "bag_space" : 0,
  75.         }
  76.     default_bag : {
  77.         "name" : "No-bag",
  78.         "desc" : "No-bag",
  79.         "type" : "bag",
  80.         "damage" : 0,
  81.         "armor" : 0,
  82.         "size" : 0,
  83.         "bag_space" : 0,
  84.         }
  85.     default_special : {
  86.         "name" : "quick-wit",
  87.         "desc" : "Mom always said you were smart",
  88.         "type": "special",
  89.         "damage": 0,
  90.         "armor": 0,
  91.         "size": 0,
  92.         "bag_space" : 0,
  93.         }
  94.        
  95.     wizard_hat : {
  96.         "name" : "wizard-hat",
  97.         "desc" : "This enchanted blue hat is embroidered with stars",
  98.         "type": "head",
  99.         "damage": 1 #+1 "damage"from enchantment,
  100.         "size": 1   ,
  101.         }
  102.     wand : {
  103.         "name" : "wand",
  104.         "desc" : "This wand is finely carved from a dark wood and inscribed with runes",
  105.         "type": "hand",
  106.         "size": 1,
  107.         "damage": 4,
  108.         }
  109.     robes : {
  110.         "name" : "robes",
  111.         "desc" : "While somewhat travel worn, these blue robes are quite comfy.",
  112.         "type": "body",
  113.         "size": 1,
  114.         "armor": 1,
  115.         }
  116.     satchel : {
  117.         "name" : "satchel",
  118.         "desc" : "This is a brown leather satchel with a shoulder strap.",
  119.         "type": "bag",
  120.         "size": 2,
  121.         "bag_space" : 6,
  122.         "inventory":None
  123.         }
  124.     ring_protection : {
  125.             "name" : "ring-protection",
  126.             "desc" : "An old wizard gave you this ring, it's enchantment helps deflect blows",
  127.             "type": "special",
  128.             "damage": 0,
  129.             "armor": 1,
  130.             "size": 0, #small objects don't effect bag space
  131.             }
  132.     #Inventory Items:   : anything that can be carried
  133.     # item = {
  134.         # "name":"",
  135.         # "desc":"",
  136.         # "placed":"",
  137.         # "event":""
  138.         # }
  139.     record = {
  140.         "name":"record",
  141.         "desc":"This is a resin platter record in a sleeve labeled 'Blue Danube'",
  142.         "placed":"There is a record here",
  143.         "event":None
  144.         }
  145.     Emma = {
  146.         "name":"Emma",
  147.         "desc":"This fat grey tabby cat has a tag that reads 'Emma'",
  148.         "placed":"There is a cat curled up here named Emma",
  149.         "event":None
  150.         }
  151.     Tidbit= {
  152.         "name":"Tidbit",
  153.         "desc":"This is black and white cat who loves cheese",
  154.         "placed":"There is a cat named Tidbit here.",
  155.         "event":None
  156.         }
  157.     guitar = {
  158.         "name":"guitar",
  159.         "desc":"It's a 1968 Harmoy Rocket hollow body guitar",
  160.         "placed":"A guitar leans against the sofa.",
  161.         "event":None
  162.         }
  163.     pledge = {
  164.         "name":"pledge",
  165.         "desc":"It's can of a lemony all all purpose surface cleaner",
  166.         "placed":"There's a can of pledge sitting on the floor",
  167.         "event":None
  168.         }
  169.     Noosa = {
  170.             "name":"Noosa",
  171.             "desc":"Noosa is a fluffy white cat with blue eyes.",
  172.             "placed":"A white cat is sitting here, her tag reads 'Noosa'.",
  173.             "event":None
  174.             }
  175.        
  176.            
  177. #STATIC Items: things that can't move but can be interacted with
  178.         """the eventual layout of static objects will be determined by the event
  179.         handler. For now they just have a name and a description.
  180.         The event variable is just a place holder for future formatting.
  181.         """
  182.     #static = {
  183.         # "name":"",
  184.         # "desc":"",
  185.         # "event":None,
  186.         # "container":False,
  187.         # "inventory":"",
  188.         # "space":0
  189.         # }
  190.     chair = {
  191.         "name":"chair"
  192.         "desc":"This is a large wingback style chair upholstered in red velvet."
  193.         "event":None,
  194.         "container":True,
  195.         "inventory":[],
  196.         "space":1
  197.         }
  198.     phonograph = {
  199.         "name":"phonograph"
  200.         "desc":"This is a cabinet style phonograph with a large hand-crank."
  201.         "event":None,
  202.         "inventory":[]
  203.         "space":1
  204.         }
  205.     Sofa = {
  206.         "name":"Sofa",
  207.         "desc":"It's a Victorian style sofa with grey and dark grey vertical stripes",
  208.         "event":None,
  209.         "container":False,
  210.         "inventory":"",
  211.         "space":0
  212.         }
  213.     rug = {
  214.         "name":"rug",
  215.         "desc":"This oriental rug has excellent knot work and patterns",
  216.         "event":None,
  217.         "container":False,
  218.         "inventory":"",
  219.         "space":0
  220.         }
  221.     fireplace = {
  222.         "name":"fireplace",
  223.         "desc":"The brick hearth fireplace has several logs burning in it",
  224.         "event":None,
  225.         "container":False,
  226.         "inventory":"",
  227.         "space":0
  228.         }
  229.     piano = {
  230.         "name":"piano",
  231.         "desc":"It is a black baby grand piano",
  232.         "event":None,
  233.         "container":False,
  234.         "inventory":"",
  235.         "space":0
  236.         }
  237.     tardis = {
  238.         "name":"tardis",
  239.         "desc":"It's a blue policebox, it may travel in time and space",
  240.         "event":None,
  241.         "container":False,
  242.         "inventory":"",
  243.         "space":0
  244.         }
  245.     policebox = tardis
  246.     police = tardis
  247.    
  248.     gear = [
  249.         default_head,
  250.         default_hand,
  251.         default_body,
  252.         default_bag,
  253.         default_special,
  254.         wizard_hat,
  255.         wand,
  256.         robes,
  257.         satchel,
  258.         ring_protection]
  259.     inventory = [
  260.         record,
  261.         Emma,
  262.         Tidbit,
  263.         guitar,
  264.         pledge,
  265.         Noosa]
  266.     static = [
  267.         chair,
  268.         phonograph,
  269.         sofa,
  270.         rug,
  271.         fireplace,
  272.         piano,
  273.         tardis,
  274.         policebox,
  275.         police]
  276.  
  277.    
  278. class events():
  279.     """
  280.     While I am sketching out the event system here, it will be housed in the engine when complete
  281.     An event is anything that happens because of player input
  282.     Each event may have to be a hand coded routine, but at least most of the major actions can be handled
  283.     by some standardized functions"""
  284.     event functions:
  285.         change room:                                #Moving north, south, ect
  286.         add or remove player_inventory:     #Picking something up, dropping it, or "The shady person brushes past you, your bag feels lighter"
  287.         placing item:                           #"Put jewel in box"
  288.         add or remove an exit:              #lock or unlock doors, reveal hidden doors ect..
  289.         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..
  290.         add or remove room_inventory:       #you place the jewel on the alter and it shatters in a flash of light
  291.         add or remove mob:                  #you pull the lever and a goblin jumps out of hidding!
  292.         change room descriptions:           #after setting off the bomb the room is described as having cracked walls and piles of rubble.
  293.         change player health:               #healing shrines, traps, falling down a pit ect...
  294.         initiate combat:                        #player or mobs can initiate combat, or a triggered event can dump the player in combat "Ravenous Squirrels descend from the trees!"
  295.         initiate conversation:              #dialogue tree style conversation with NPCs/Mobs. Can be effected by items "Oh! You brought my spell book!"
  296.  
  297.        
  298. class combat():
  299.     """
  300.     Combat will be it's own loop within the over all game loop. The game loop will not continue until there
  301.     is either a victor or one party has fled. a parser routine will check to see if either the player or a mob
  302.     has initiated combat, and if True it will dump them both into the combat loop.
  303.     The combat loop will be housed in the engine
  304.     """
RAW Paste Data