summaryrefslogtreecommitdiff
path: root/battle/spheres.py
diff options
context:
space:
mode:
Diffstat (limited to 'battle/spheres.py')
-rw-r--r--battle/spheres.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/battle/spheres.py b/battle/spheres.py
index d0e42b4..594636f 100644
--- a/battle/spheres.py
+++ b/battle/spheres.py
@@ -25,6 +25,7 @@ from battle.common import find_target, attackall, calc_dmg
def sphere_attack(token, unit, sphere, idx=0):
stdout("%s is attacking" % str(unit), 2)
stdout("Sphere selected: %d" % sphere, 2)
+ dmg = 0
# Select the enemy which should be attacked
target_id=find_target(token, "enemy")
@@ -37,15 +38,18 @@ def sphere_attack(token, unit, sphere, idx=0):
attackall(token, unit, "enemy")
elif (sphere == SPH_PIERCE):
# Pierce sphere (100% critical chance)
- target["hp"]-=calc_dmg(token, unit, target, unit["atk"], 1.0)
+ dmg = calc_dmg(token, unit, target, unit["atk"], 1.0)
+ target["hp"]-=dmg
elif (sphere == SPH_ASSAULT):
# Assault sphere (50% critical chance)
- target["hp"]-=calc_dmg(token, unit, target, unit["atk"], 0.5)
+ dmg = calc_dmg(token, unit, target, unit["atk"], 0.5)
+ target["hp"]-=dmg
elif (sphere == SPH_HEAL):
# Heal sphere (30% healing). Need to redefine target
target_id=find_target(token, "party")
target=Battle[token]["party"][target_id]
- target["hp"]+=int(target["max_hp"]*0.3)
+ dmg=-int(target["max_hp"]*0.3)
+ target["hp"]-=dmg
if (target["hp"] > target["max_hp"]):
target["hp"]=0+target["max_hp"]
elif (sphere == SPH_HEALALL):
@@ -56,7 +60,8 @@ def sphere_attack(token, unit, sphere, idx=0):
elif (sphere == SPH_NONE):
# Normal Attack
stdout("It's a normal attack!", 2)
- target["hp"]-=calc_dmg(token, unit, target, unit["atk"])
+ dmg=calc_dmg(token, unit, target, unit["atk"])
+ target["hp"]-=dmg
elif (sphere == SPH_ATKUP):
# Attack up sphere: Add SC_ATKUP to all members (even dead ones)
for target in Battle[token]["party"]:
@@ -74,6 +79,6 @@ def sphere_attack(token, unit, sphere, idx=0):
# We are done!
#stdout("Attack completed")
- Battle[token]["log"].append(["party", idx, sphere, "enemy", target_id])
+ Battle[token]["log"].append(["party", idx, sphere, dmg, "enemy", target_id])
return True