Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from colorama import Fore, Style, Back
- from pyfiglet import Figlet
- import random
- class Inventory(object):
- def __init__(self):
- self.items = {}
- def add_item(self, item):
- if item in self.items:
- self.items[item] += 1
- else:
- self.items.update({item:1})
- def drop_item(self, item):
- self.items[item] -= 1
- if self.items[item] <= 0:
- del self.items[item]
- def InspectInventory(self):
- print('\t'.join(['Name', 'Description', 'Damage', 'Healing', 'Stat Boost']))
- for i in self.items.keys():
- print("["+str(self.items[i])+"] "+ (i.ItemName + ". " + i.ItemDescription + "."))
- print("""This item does """ + str(i.ItemDamage)+""" damage.""")
- print("""This item does """ + str(i.ItemHeal) + """ healing. """)
- print("""This item boosts all stats by """ + str(i.StatBoost))
- class Player:
- def __init__(self):
- self.stats = {'health':100,
- 'sanity':100,
- 'mana':100,
- 'speed':random.randint(45, 100),
- }
- self.location = ''
- self.inventory = Inventory()
- self.moves = {"Thrust": (25, 30),
- "Slash": (10, 65),
- "Heal": (25, 40)}
- # Following attributes are score components
- self.score = {'dmg_done':0,
- 'dmg_taken':0,
- 'amount_healed':0,
- 'sanity_lost':0}
- class Room:
- def __init__(self, number, description, directions, enemy, contents):
- self.number = number
- self.description = description
- self.directions = directions
- self.enemy = enemy
- self.contents = contents
- def LocationCheck(self):
- print(Fore.WHITE + self.directions)
- if self.enemy != "none":
- print(Fore.YELLOW + "You see a " + str(self.enemy))
- if self.contents != "none":
- print(Fore.WHITE + "This room contains a " + str(self.contents) + ".")
- def PrintDirections(self):
- print(self.directions)
- class Item(object):
- def __init__(self, name, description, properties):
- self.name = name
- self.description = description
- self.properties = properties
- def InspectItem(self): # This method will be used to inspect items in the inventory or on pickup
- print("This item is a " + self.name + ". " + "It is " + self.description)
- if self.damage > 0:
- print("This item does " + str(self.damage) + " damage.")
- if self.heal > 0:
- print("This item restores " + str(self.heal) + " health.")
- if self.stat_boost > 0:
- print("This item boosts your stats by " + str(self.stat_boost))
- class Enemy:
- def __init__(self, name, description, stats, moves):
- self.name = name
- self.description = description
- self.stats = stats
- self.moves = moves
- def encounter(self):
- print("")
- print("It's speed is " + str(self.speed) + ", your speed is " + str(player.player_speed) + ".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement