This commit is contained in:
2026-06-25 15:40:40 -04:00
parent fc81a46dd9
commit 988ddf1ebf
5 changed files with 51 additions and 3 deletions

29
untitled/screens/shop.py Normal file
View File

@@ -0,0 +1,29 @@
from untitled import ui, content, model, rules
def shop(save: model.Save):
print("Welcome to the shop!")
while True:
match ui.select("What do you want to do?", ["Buy items", "Leave"]):
case "Buy items":
while True:
print(f"You have ${save.player.money}.")
item = ui.select(
"Please choose an item to buy:",
[
ui.Choice(f"{item.capitalize()}: ${price}", (item, price))
for item, price in content.ITEMS.items()
]
+ ["Back"],
)
if item == "Back":
break
if ui.confirm(
f"Are you sure you want to buy {item[0]} for ${item[1]}?"
):
if rules.buy(save.player, item[0], item[1]):
print("Done!")
else:
print("You don't have enough money!")
case "Leave":
break