summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--battle/main.py57
1 files changed, 36 insertions, 21 deletions
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)