summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-10 23:47:18 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-10 23:47:18 -0300
commitdcc36cfe809796d5ae2c08516d52647677838100 (patch)
tree90c4b1ebd4b9dfe25f1a38c82bd73f6a6cfcc079
parent3fd94b26028d817a0ed0c6cb14a5f2646022811f (diff)
downloadserver-dcc36cfe809796d5ae2c08516d52647677838100.tar.gz
server-dcc36cfe809796d5ae2c08516d52647677838100.tar.bz2
server-dcc36cfe809796d5ae2c08516d52647677838100.tar.xz
server-dcc36cfe809796d5ae2c08516d52647677838100.zip
Make _action() take more params so EVERYONE knows it is messy :>
-rw-r--r--battle/main.py15
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: