-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforge.py
91 lines (87 loc) · 4.23 KB
/
forge.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
class Forge:
def __init__(self, player):
self.player = player
self.shard_no = 0
def craft_weapon(self, player):
weapon_choice = input("What weapon would you like to craft?\n1. Iron Sword(4 Iron Shard)\n2. Crystal Sword(4 Crystal Shard)\nYour choice: ")
if weapon_choice == "1":
for item in self.player.inventory:
if item == "Iron Shard":
self.shard_no += 1
if self.shard_no >= 4:
print("You have crafted an Iron Sword!\n")
self.player.inventory.append("Iron Sword")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.shard_no = 0
else:
print("You don't have enough Iron Shards!\n")
elif weapon_choice == "2":
for item in self.player.inventory:
if item == "Crystal Shard":
self.shard_no += 1
if self.shard_no >= 4:
print("You have crafted a Crystal Sword!\n")
self.player.inventory.append("Crystal Sword")
self.player.inventory.remove("Crystal Shard")
self.player.inventory.remove("Crystal Shard")
self.player.inventory.remove("Crystal Shard")
self.player.inventory.remove("Crystal Shard")
self.shard_no = 0
else:
print("You don't have enough Crystal Shards!\n")
def craft_armour(self, player):
armour_choice = input("What armour would you like to craft?\n1. Leather Armour(5 Leather Tunic)\n2. Iron Armour(5 Iron Shard)\nYour choice: ")
if armour_choice == "1":
for item in self.player.inventory:
if item == "Leather Tunic":
self.shard_no += 1
if self.shard_no >= 5:
print("You have crafted Leather Armour!\n")
self.player.inventory.append("Leather Armour")
self.player.inventory.remove("Leather Tunic")
self.player.inventory.remove("Leather Tunic")
self.player.inventory.remove("Leather Tunic")
self.player.inventory.remove("Leather Tunic")
self.player.inventory.remove("Leather Tunic")
self.shard_no = 0
else:
print("You don't have enough Leather Tunics!\n")
elif armour_choice == "2":
for item in self.player.inventory:
if item == "Iron Shard":
self.shard_no += 1
if self.shard_no >= 5:
print("You have crafted Iron Armour!\n")
self.player.inventory.append("Iron Armour")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.player.inventory.remove("Iron Shard")
self.shard_no = 0
else:
print("You don't have enough Iron Shards!\n")
def equip_item(self, player):
print("Your inventory:")
for i, item in enumerate(player.inventory, start=1):
print(f"{i}. {item}")
print("\n")
item_number = int(input("Which item would you like to equip? "))
print("\n")
if player.inventory[item_number - 1] == "Iron Sword":
player.weapon_multiplier = 2
print("You have equipped an Iron Sword!\n")
elif player.inventory[item_number - 1] == "Crystal Sword":
player.weapon_multiplier = 5
print("You have equipped a Crystal Sword!\n")
elif player.inventory[item_number - 1] == "Leather Armour":
player.armour_multiplier = 0.5
print("You have equipped Leather Armour!\n")
elif player.inventory[item_number - 1] == "Iron Armour":
player.armour_multiplier = 0.1
print("You have equipped Iron Armour!\n")
else:
print("You can't equip that!\n")