def get_item(self): rand = random.randint(0, 14) if rand == 1: return items.Dagger(1) elif rand == 2: return items.Sword(1) elif rand == 3: return items.Bow(1) elif rand == 4: return items.Axe(1) elif rand == 5: return items.Leather_ChestPlate(1) elif rand == 6: return items.Wooden_Shield(1) elif rand == 7: return items.Leather_Cap(1) elif rand == 8: return items.Iron_Shield(1) elif rand == 9: return items.Chainmail_Cap(1) elif rand == 10: return items.Chainmail_ChestPlate(1) elif rand == 11: return items.Iron_Cap(1) elif rand == 12: return items.Iron_ChestPlate(1) elif rand == 13: return items.SmallPotion(1) else: return items.Dagger(1)
def __init__(self): self.inventory = [items.Rock(), items.Axe(), items.StaleBread()] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.hp = 100 self.gold = 5 self.victory = False
def __init__(self): self.name = "Blacksmith" self.gold = 120 self.inventory = [items.Dagger(), items.RustySword(), items.Axe(), items.CrossBow(),]
def find_loot(self, player): rand = random.randint(1, 1000) if 1 < rand < 10: Option.modify_player(Option, player, items.Sword(1)) print(">A shiny sword is behind a desk, you take it.") elif rand == 1: Option.modify_player(Option, player, items.Axe(1)) print(">You found a Axe hanging from the wall.") elif 10 < rand < 100: Option.modify_player(Option, player, items.Gold(5)) print(">There are 5 golden Coins") elif 300 < rand < 400: Option.modify_player(Option, player, items.Gold(7)) print(">A tiny bag of gold Coins") elif 500 < rand: print(">There is nothing here")
def __init__(self, x, y): super().__init__(x, y, items.Axe())
def modify_player(self, player): if not self.item_claimed: self.item_claimed = True player.inventory.append(items.Axe()) #Add to the list player.inventory using list.append(item) print("{} added to inventory.".format(self.item))