path-of-the-loner/controllers/PveController.py
2025-03-03 16:47:07 +01:00

47 lines
1.3 KiB
Python

# pveController
from views.PVP.chooseCharacterUI import ChooseCharacterUI
from views.PVE.roomUI import RoomUI
from sty import fg
# pour éviter les pb d'import circulaire
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from controllers.mainController import MainController
class PveController:
def __init__(self, mController: "MainController") -> None:
self.mController = mController
self.db = self.mController.db
MAX_HEROES = 3
self.heroes = []
choice = -1
while choice < 1 or choice > MAX_HEROES:
print(f"How many heroes do you want in your team ?")
print(f"Choose between {fg.blue}1{fg.rs} and {fg.blue}{MAX_HEROES}{fg.rs}")
try:
choice = int(input("How many heroes do you want: "))
except ValueError:
print(f"{fg.red} Input a valid number {fg.rs}")
continue
if choice < 1 or choice > MAX_HEROES:
print(f"{fg.red}Invalid choice. Try again {fg.rs}")
for i in range(0, choice):
self.heroes.append(ChooseCharacterUI(self, False).hero)
RoomUI(self, 50, self.heroes)
RoomUI(self, 100, self.heroes)
RoomUI(self, 150, self.heroes)
RoomUI(self, 200, self.heroes)
if self.heroes:
print("You passed all rooms")