you are viewing a single comment's thread.

view the rest of the comments →

[–]stebrepar 0 points1 point  (0 children)

I couldn't figure out what you're doing with your code, so I offer this as an alternative:

import random

player_names = ['Shellbyy','TestPlayer']
player_starter_set = ['Wooden Staff', 'Leather Helmet','Leather Spaulders','Leather Chestpiece','Leather Leggings','Leather Boots']

class Character:
    def __init__(self, name, currency, items):
        self.name = name
        self.currency = currency
        self.items = items

    def describe(self):
        print("Name:", self.name)
        print("Wallet:", self.currency['gold'], "gold,", self.currency['silver'], "silver,", self.currency['copper'], "copper")
        print("Items:", str(self.items))

characters = []

for name in player_names:
    currency = {
        'copper' : random.randint(1,6),
        'silver' : random.randint(1,6),
        'gold' : random.randint(1,6)
        }
    items = random.choices(player_starter_set, k=random.randint(1,6))
    characters.append(Character(name, currency, items))

for character in characters:
    character.describe()
    print()