-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.py
More file actions
53 lines (48 loc) · 1.69 KB
/
Player.py
File metadata and controls
53 lines (48 loc) · 1.69 KB
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
from TypeChart import *
from Pokemon import *
from Item import *
from Func import *
from copy import deepcopy
class Player:
def __init__(self, Name, Loadout, Inventory):
self.Name = Name
self.Loadout = Loadout
self.Inventory = Inventory
protagonist = Player('Jayden', {'slot1':deepcopy(bulbasaur),'slot2':None,'slot3':deepcopy(charmander),'slot4':None,'slot5':None,'slot6':None}, [pokeball,pokeball,pokeball,pokeball,pokeball])
def battleInventory(selectedPythonmon, wildPythonmon):
while True:
while True:
inventoryChoice = {}
index = 0
end = 1
clearConsole()
print("Your Inventory")
# Assigns a number to each inventory item
for space in protagonist.Inventory:
index += 1
end += 1
inventoryChoice.update({str(index): space})
print(f"[ {index} ] {space.Name}")
choice = input(f"\n[ {end} ] Leave Inventory\n")
clearConsole()
if choice in inventoryChoice or choice == str(end):
# If the last number is inputted leaves inventory
if choice == str(end):
return False
inventoryChoice = inventoryChoice[choice]
break
while True:
clearConsole()
print(f"{inventoryChoice.Name}\n{inventoryChoice.Description}\n")
choice2 = input("[1]Use\n[2]Leave\n")
if choice2 not in ["1","2"]:
continue
if choice2 == "1" and 'battleInventory' in inventoryChoice.Uses:
clearConsole()
inventoryChoice.Effect(inventoryChoice.Name,selectedPythonmon,wildPythonmon,protagonist)
protagonist.Inventory.remove(inventoryChoice)
clearConsole()
return True
elif choice2 == "2":
clearConsole()
return False