From d7dbba27646650a040efb6fde644a037a6f037ef Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Tue, 15 Jun 2021 18:05:49 +0200 Subject: [PATCH] added ask_bool for throwing stuff away --- pokete.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pokete.py b/pokete.py index f03bc35f..d5fc970e 100755 --- a/pokete.py +++ b/pokete.py @@ -876,7 +876,7 @@ def ask_bool(map, text): if ev == "'y'": ret = True break - elif ev == "'n'": + elif ev in ["'n'", "Key.esc", "'q'"]: ret = False break std_loop() @@ -916,15 +916,16 @@ def inv(): time.sleep(0.05) movemap.show() elif ev == "'r'": - figure.remove_item(items[invbox.index.index].name) - inv_remove(obs) - items, obs = inv_add() - if obs == []: + if ask_bool(movemap, f"Do you really want to throw {items[invbox.index.index].pretty_name} away?"): + figure.remove_item(items[invbox.index.index].name) inv_remove(obs) - return - if invbox.index.index >= len(obs): - invbox.index.index = len(obs)-1 - invbox.set_index(obs) + items, obs = inv_add() + if obs == []: + inv_remove(obs) + return + if invbox.index.index >= len(obs): + invbox.index.index = len(obs)-1 + invbox.set_index(obs) ev = "" std_loop() time.sleep(0.05) @@ -1243,7 +1244,7 @@ def deck(pokes, label="Your full deck", in_fight=False): decksubmap.full_show() elif ev == "'3'": ev = "" - if ask_bool(decksubmap, f"Do you realy want to free {figure.pokes[deck_index.index].name}?"): + if ask_bool(decksubmap, f"Do you really want to free {figure.pokes[deck_index.index].name}?"): for poke in pokes: deck_remove(poke) figure.pokes[deck_index.index] = Poke("__fallback__", 10, 0)