Cancel buy something

This commit is contained in:
2026-04-13 17:47:58 -04:00
parent 4df79550ea
commit 157bdba5fd
2 changed files with 19 additions and 18 deletions

View File

@@ -48,7 +48,7 @@ def debug_menu():
while True: while True:
match select( match select(
"choose ur way of breaking the game", "choose ur way of breaking the game",
["Breakpoint", "Fix hash", "Back"], ["Breakpoint", "Fix hash", "Debug settings", "Back"],
hide_debug=True, hide_debug=True,
): ):
case "Breakpoint": case "Breakpoint":

View File

@@ -78,27 +78,28 @@ def shop(cat: Cat):
[ [
ui.Choice(title=f"{name} - ${price}", value=name) ui.Choice(title=f"{name} - ${price}", value=name)
for name, price in data.text.SHOP_ITEMS.items() for name, price in data.text.SHOP_ITEMS.items()
], ]
+ ["Cancel"],
) )
item_price = data.text.SHOP_ITEMS[item] if item != "Cancel":
item_price = data.text.SHOP_ITEMS[item]
if item_price > cat.money: if item_price > cat.money:
print( print(
f"You don't have enough money to buy this! You need {item_price-cat.money} more dollars." f"You don't have enough money to buy this! You need {item_price-cat.money} more dollars."
) )
else:
if ui.confirm(
f"Are you sure you want to buy {item} for ${item_price}? You will have ${cat.money-item_price} left over."
):
cat.money -= item_price
cat.inventory[item] = cat.inventory.get(item, 0) + 1
print(f"You bought {item}.")
else: else:
print("Cancelled.") if ui.confirm(
f"Are you sure you want to buy {item} for ${item_price}? You will have ${cat.money-item_price} left over."
):
cat.money -= item_price
cat.inventory[item] = cat.inventory.get(item, 0) + 1
print(f"You bought {item}.")
else:
print("Cancelled.")
# TODO: idea, each item, when selected in house storage menu, call a item menu thing thats specific for each item # TODO: idea, each item, when selected in house storage menu, call a item menu thing thats specific for each item
# TODO: make toy mouse that increases happyness (so also add emotions and sicknesses maybe) but has a 25% chance of getting lost under the couch and makes the cat tired possibly # TODO: make toy mouse that increases happyness (so also add emotions and sicknesses maybe) but has a 25% chance of getting lost under the couch and makes the cat tired possibly
pass
case "Leave the shop": case "Leave the shop":
print("Goodbye!") print("Goodbye!")
break break