summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-11 00:22:39 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-11 00:22:39 -0300
commita0f64244cfc0ff5f36c1d9baab7783afd11d33c7 (patch)
tree34b5c96006e761d11c70ab8cd93b8beafc8d5e1c
parent69683a1f984f6ea12ed62cd22e6a0014d6d35bcc (diff)
downloadserver-a0f64244cfc0ff5f36c1d9baab7783afd11d33c7.tar.gz
server-a0f64244cfc0ff5f36c1d9baab7783afd11d33c7.tar.bz2
server-a0f64244cfc0ff5f36c1d9baab7783afd11d33c7.tar.xz
server-a0f64244cfc0ff5f36c1d9baab7783afd11d33c7.zip
Fix bugs
-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)