From a0f64244cfc0ff5f36c1d9baab7783afd11d33c7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Aug 2021 00:22:39 -0300 Subject: Fix bugs --- battle/main.py | 57 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'battle') diff --git a/battle/main.py b/battle/main.py index ad2a67a..48f95c9 100644 --- a/battle/main.py +++ b/battle/main.py @@ -271,33 +271,48 @@ def battle(args, token): ## Spheres for i, j in enumerate(bt["action"]): - bat = Battle[token]["party"][i] - if j == ACT_SPHERE: - _action(token, bat, bt, spheres, i, j) - # HOLD THAT! Handle victory/defeat conditions - check = conditions(token, spheres) - if check is not None: - return check + try: + bat = Battle[token]["party"][i] + if j == ACT_SPHERE: + _action(token, bat, bt, spheres, i, j) + # HOLD THAT! Handle victory/defeat conditions + check = conditions(token, spheres) + if check is not None: + return check + except IndexError: + pass + except: + traceback.print_exc() ## Skills for i, j in enumerate(bt["action"]): - bat = Battle[token]["party"][i] - if j == ACT_SKILL: - _action(token, bat, bt, spheres, i, j) - # HOLD THAT! Handle victory/defeat conditions - check = conditions(token, spheres) - if check is not None: - return check + try: + bat = Battle[token]["party"][i] + if j == ACT_SKILL: + _action(token, bat, bt, spheres, i, j) + # HOLD THAT! Handle victory/defeat conditions + check = conditions(token, spheres) + if check is not None: + return check + except IndexError: + pass + except: + traceback.print_exc() ## Normal Attacks for i, j in enumerate(bt["action"]): - bat = Battle[token]["party"][i] - if j == ACT_NONE: - _action(token, bat, bt, spheres, i, j) - # HOLD THAT! Handle victory/defeat conditions - check = conditions(token, spheres) - if check is not None: - return check + try: + bat = Battle[token]["party"][i] + if j == ACT_NONE: + _action(token, bat, bt, spheres, i, j) + # HOLD THAT! Handle victory/defeat conditions + check = conditions(token, spheres) + if check is not None: + return check + except IndexError: + pass + except: + traceback.print_exc() ## Anything unrecognized is ignored stdout("Friends executed", 2) -- cgit v1.2.3-70-g09d2