diff options
Diffstat (limited to 'battle')
-rw-r--r-- | battle/main.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/battle/main.py b/battle/main.py index c503f62..6911935 100644 --- a/battle/main.py +++ b/battle/main.py @@ -162,8 +162,11 @@ def begin_quest(args, token, client_side=True): return sjson -# Action -def _action(token, bat, bt, spheres, idx): + +######################################################### +# Battle Action +# Could use a rewrite/optimization +def _action(token, bat, bt, spheres, idx, act=ACT_NONE): global Battle # The dead can't fight if (bat["hp"] <= 0): @@ -171,7 +174,7 @@ def _action(token, bat, bt, spheres, idx): # Will they use a sphere? stdout("Execute index %d" % idx, 2) - if (bt["sphere"][idx] == ACT_SPHERE): + if act == ACT_SPHERE: # Remove the sphere spheres[idx]=SPH_NONE sphere_attack(token, bat, Battle[token]["spheres"][idx], idx) @@ -270,7 +273,7 @@ def battle(args, token): for i, j in enumerate(bt["action"]): bat = Battle[token]["party"][i] if j == ACT_SPHERE: - _action(token, bat, bt, spheres, i) + _action(token, bat, bt, spheres, i, j) # HOLD THAT! Handle victory/defeat conditions check = conditions(token, spheres) if check is not None: @@ -280,7 +283,7 @@ def battle(args, token): for i, j in enumerate(bt["action"]): bat = Battle[token]["party"][i] if j == ACT_SKILL: - _action(token, bat, bt, spheres, i) + _action(token, bat, bt, spheres, i, j) # HOLD THAT! Handle victory/defeat conditions check = conditions(token, spheres) if check is not None: @@ -290,7 +293,7 @@ def battle(args, token): for i, j in enumerate(bt["action"]): bat = Battle[token]["party"][i] if j == ACT_NONE: - _action(token, bat, bt, spheres, i) + _action(token, bat, bt, spheres, i, j) # HOLD THAT! Handle victory/defeat conditions check = conditions(token, spheres) if check is not None: |