summaryrefslogtreecommitdiff
path: root/game/gui/battle.rpy
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-25 12:10:01 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-25 12:10:01 -0300
commit0248a71aaa842a728e4375cad0bafdad737c0430 (patch)
tree53e21ef3dc5d19f3f8e9e3894ee660781c87dae9 /game/gui/battle.rpy
parent61a0b9b9fec3a390dca60db81e18f26ae2e821b7 (diff)
downloadclient-0248a71aaa842a728e4375cad0bafdad737c0430.tar.gz
client-0248a71aaa842a728e4375cad0bafdad737c0430.tar.bz2
client-0248a71aaa842a728e4375cad0bafdad737c0430.tar.xz
client-0248a71aaa842a728e4375cad0bafdad737c0430.zip
Fork code, replace some ifs with showifs in screen, add dummy structures.
Hopefully, code will be more stable from now on. It might still crash, but then I'll be sure the bug is on the draggroups.
Diffstat (limited to 'game/gui/battle.rpy')
-rw-r--r--game/gui/battle.rpy435
1 files changed, 220 insertions, 215 deletions
diff --git a/game/gui/battle.rpy b/game/gui/battle.rpy
index bdfb642..a22a515 100644
--- a/game/gui/battle.rpy
+++ b/game/gui/battle.rpy
@@ -85,9 +85,51 @@ label bl_context:
return
#############################################################################
+screen battle_mobs():
+ ####################################################
+ # Render enemies
+ fixed:
+ # Enemy 1
+ showif (en1["hp"] > 0):
+ add At("mob_"+str(en1["unit_id"]), enemy1)
+ vbox:
+ xalign 0.5
+ yanchor 0.5
+ ypos 0.24
+ xmaximum 180
+ ymaximum 20
+ text en1["name"]
+ bar value en1["hp"] range en1["max_hp"]
+
+ # Enemy 2
+ showif (en2["hp"] > 0):
+ add At("mob_"+str(en2["unit_id"]), enemy2)
+ vbox:
+ xalign 1.0
+ yanchor 0.5
+ ypos 0.24
+ xmaximum 180
+ ymaximum 20
+ text en2["name"]
+ bar value en2["hp"] range en2["max_hp"]
+
+ # Enemy 3
+ showif (en3["hp"] > 0):
+ add At("mob_"+str(en3["unit_id"]), enemy3)
+ vbox:
+ xalign 0.0
+ yanchor 0.5
+ ypos 0.24
+ xmaximum 180
+ ymaximum 20
+ text en3["name"]
+ bar value en3["hp"] range en3["max_hp"]
+
+#############################################################################
screen battle():
# Background
add "bg battle"
+ use battle_mobs
####################################################
# Render HUD
@@ -106,7 +148,7 @@ screen battle():
# Preferences button
null width 20
imagebutton auto "gfx/gui/cog_%s.png" action ShowMenu('preferences')
- textbutton _("Party") action Function(blayout)
+ #textbutton _("Party") action Function(blayout)
null width 20
text "%d " % (Battle["turn"])
text _(" Turn")
@@ -121,258 +163,221 @@ screen battle():
textbutton _("I'm ready") action Return()
####################################################
- # Render enemies
-
- # Enemy 1
- if (en1["hp"] > 0):
- add At("mob_"+str(en1["unit_id"]), enemy1)
- vbox:
- xalign 0.5
- yanchor 0.5
- ypos 0.24
- xmaximum 180
- ymaximum 20
- text en1["name"]
- bar value en1["hp"] range en1["max_hp"]
-
- # Enemy 2
- if (en2["hp"] > 0):
- add At("mob_"+str(en2["unit_id"]), enemy2)
- vbox:
- xalign 1.0
- yanchor 0.5
- ypos 0.24
- xmaximum 180
- ymaximum 20
- text en2["name"]
- bar value en2["hp"] range en2["max_hp"]
-
- # Enemy 3
- if (en3["hp"] > 0):
- add At("mob_"+str(en3["unit_id"]), enemy3)
- vbox:
- xalign 0.0
- yanchor 0.5
- ypos 0.24
- xmaximum 180
- ymaximum 20
- text en3["name"]
- bar value en3["hp"] range en3["max_hp"]
-
- ####################################################
# Render allies
# TODO: Gray out and unmovable if dead
# One drag group per party member defined in Battle
- draggroup:
- xpos 0.25
- xanchor 1.0
- yanchor 1.0
- ypos config.screen_height-10
- xmaximum 256
- ymaximum 480
- # Display the background
- drag:
- child At("gfx/action.png", party1)
- draggable False
- droppable False
- # Display the card (if there's one)
- if (fx1):
+ fixed:
+ draggroup:
+ xpos 0.25
+ xanchor 1.0
+ yanchor 1.0
+ ypos config.screen_height-10
+ xmaximum 256
+ ymaximum 480
+ # Display the background
drag:
- drag_name "party1"
- child At(fx1, c_party1)
+ child At("gfx/action.png", party1)
+ draggable False
droppable False
- if (Battle["party"][0]["hp"] > 0):
- dragged combat_action
- else:
+ # Display the card (if there's one)
+ if (fx1):
+ drag:
+ drag_name "party1"
+ child At(fx1, c_party1)
+ droppable False
+ if (Battle["party"][0]["hp"] > 0):
+ dragged combat_action
+ else:
+ draggable False
+ ypos 48
+ # The action areas
+ drag:
+ drag_name "Skill"
+ child At("gfx/actionarea.png", party1)
draggable False
- ypos 48
- # The action areas
- drag:
- drag_name "Skill"
- child At("gfx/actionarea.png", party1)
- draggable False
- ypos 0.0
+ ypos 0.0
+ drag:
+ drag_name "Sphere"
+ child At("gfx/actionarea.png", party1)
+ draggable False
+ yalign 1.0
+ # Display the sphere
drag:
- drag_name "Sphere"
- child At("gfx/actionarea.png", party1)
+ child ("gfx/sphere/"+str(Battle["spheres"][0])+".png")
draggable False
+ droppable False
yalign 1.0
- # Display the sphere
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][0])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
- if (fx1 and Battle["party"][0]["hp"] <= 0):
- add At("gfx/off.png", party1)
+ xalign 0.5
+ if (fx1 and Battle["party"][0]["hp"] <= 0):
+ add At("gfx/off.png", party1)
- # One drag group per party member defined in Battle
- draggroup:
- xpos 0.50
- xanchor 1.0
- yanchor 1.0
- ypos config.screen_height-10
- xmaximum 256
- ymaximum 480
- drag:
- child At("gfx/action.png", party2)
- draggable False
- droppable False
- if (fx2):
+ # One drag group per party member defined in Battle
+ draggroup:
+ xpos 0.50
+ xanchor 1.0
+ yanchor 1.0
+ ypos config.screen_height-10
+ xmaximum 256
+ ymaximum 480
drag:
- drag_name "party2"
- child At(fx2, c_party2)
+ child At("gfx/action.png", party2)
+ draggable False
droppable False
- if (Battle["party"][1]["hp"] > 0):
- dragged combat_action
- else:
+ if (fx2):
+ drag:
+ drag_name "party2"
+ child At(fx2, c_party2)
+ droppable False
+ if (Battle["party"][1]["hp"] > 0):
+ dragged combat_action
+ else:
+ draggable False
+ ypos 48
+ drag:
+ drag_name "Skill"
+ child At("gfx/actionarea.png", party2)
draggable False
- ypos 48
- drag:
- drag_name "Skill"
- child At("gfx/actionarea.png", party2)
- draggable False
- ypos 0.0
+ ypos 0.0
+ drag:
+ drag_name "Sphere"
+ child At("gfx/actionarea.png", party2)
+ draggable False
+ yalign 1.0
drag:
- drag_name "Sphere"
- child At("gfx/actionarea.png", party2)
+ child ("gfx/sphere/"+str(Battle["spheres"][1])+".png")
draggable False
+ droppable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][1])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
+ xalign 0.5
- if (fx2 and Battle["party"][1]["hp"] <= 0):
- add At("gfx/off.png", party2)
- # One drag group per party member defined in Battle
- draggroup:
- xpos 0.75
- xanchor 1.0
- yanchor 1.0
- ypos config.screen_height-10
- xmaximum 256
- ymaximum 480
- drag:
- child At("gfx/action.png", party3)
- draggable False
- droppable False
- if (fx3):
+ if (fx2 and Battle["party"][1]["hp"] <= 0):
+ add At("gfx/off.png", party2)
+ # One drag group per party member defined in Battle
+ draggroup:
+ xpos 0.75
+ xanchor 1.0
+ yanchor 1.0
+ ypos config.screen_height-10
+ xmaximum 256
+ ymaximum 480
drag:
- drag_name "party3"
- child At(fx3, c_party3)
+ child At("gfx/action.png", party3)
+ draggable False
droppable False
- if (Battle["party"][2]["hp"] > 0):
- dragged combat_action
- else:
+ if (fx3):
+ drag:
+ drag_name "party3"
+ child At(fx3, c_party3)
+ droppable False
+ if (Battle["party"][2]["hp"] > 0):
+ dragged combat_action
+ else:
+ draggable False
+ ypos 48
+ drag:
+ drag_name "Skill"
+ child At("gfx/actionarea.png", party3)
draggable False
- ypos 48
- drag:
- drag_name "Skill"
- child At("gfx/actionarea.png", party3)
- draggable False
- ypos 0.0
+ ypos 0.0
+ drag:
+ drag_name "Sphere"
+ child At("gfx/actionarea.png", party3)
+ draggable False
+ yalign 1.0
drag:
- drag_name "Sphere"
- child At("gfx/actionarea.png", party3)
+ child ("gfx/sphere/"+str(Battle["spheres"][2])+".png")
draggable False
+ droppable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][2])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
+ xalign 0.5
- if (fx3 and Battle["party"][2]["hp"] <= 0):
- add At("gfx/off.png", party3)
- # One drag group per party member defined in Battle
- draggroup:
- xpos 1.0
- xanchor 1.0
- yanchor 1.0
- ypos config.screen_height-10
- xmaximum 256
- ymaximum 480
- drag:
- child At("gfx/action.png", party4)
- draggable False
- droppable False
- if (fx4):
+ if (fx3 and Battle["party"][2]["hp"] <= 0):
+ add At("gfx/off.png", party3)
+ # One drag group per party member defined in Battle
+ draggroup:
+ xpos 1.0
+ xanchor 1.0
+ yanchor 1.0
+ ypos config.screen_height-10
+ xmaximum 256
+ ymaximum 480
drag:
- drag_name "party4"
- child At(fx4, c_party4)
+ child At("gfx/action.png", party4)
+ draggable False
droppable False
- if (Battle["party"][3]["hp"] > 0):
- dragged combat_action
- else:
+ if (fx4):
+ drag:
+ drag_name "party4"
+ child At(fx4, c_party4)
+ droppable False
+ if (Battle["party"][3]["hp"] > 0):
+ dragged combat_action
+ else:
+ draggable False
+ ypos 48
+ drag:
+ drag_name "Skill"
+ child At("gfx/actionarea.png", party4)
draggable False
- ypos 48
- drag:
- drag_name "Skill"
- child At("gfx/actionarea.png", party4)
- draggable False
- ypos 0.0
+ ypos 0.0
+ drag:
+ drag_name "Sphere"
+ child At("gfx/actionarea.png", party4)
+ draggable False
+ yalign 1.0
drag:
- drag_name "Sphere"
- child At("gfx/actionarea.png", party4)
+ child ("gfx/sphere/"+str(Battle["spheres"][3])+".png")
draggable False
+ droppable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][3])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
+ xalign 0.5
- if (fx4 and Battle["party"][3]["hp"] <= 0):
- add At("gfx/off.png", party4)
+ if (fx4 and Battle["party"][3]["hp"] <= 0):
+ add At("gfx/off.png", party4)
####################################################
# Render HPBARs
- if (fx1):
- frame:
- xpos 0.125
- xanchor 0.5
- yanchor 1.0
- ypos 1.0
- ymaximum 10
- xmaximum 256
- bar value Battle["party"][0]["hp"] range Battle["party"][0]["max_hp"] xmaximum 256
+ fixed:
+ showif (fx1):
+ frame:
+ xpos 0.125
+ xanchor 0.5
+ yanchor 1.0
+ ypos 1.0
+ ymaximum 10
+ xmaximum 256
+ bar value Battle["party"][0]["hp"] range Battle["party"][0]["max_hp"] xmaximum 256
- if (fx2):
- frame:
- xpos 0.375
- xanchor 0.5
- yanchor 1.0
- ypos 1.0
- ymaximum 10
- xmaximum 256
- bar value Battle["party"][1]["hp"] range Battle["party"][1]["max_hp"] xmaximum 256
+ showif (fx2):
+ frame:
+ xpos 0.375
+ xanchor 0.5
+ yanchor 1.0
+ ypos 1.0
+ ymaximum 10
+ xmaximum 256
+ bar value Battle["party"][1]["hp"] range Battle["party"][1]["max_hp"] xmaximum 256
- if (fx3):
- frame:
- xpos 0.625
- xanchor 0.5
- yanchor 1.0
- ypos 1.0
- ymaximum 10
- xmaximum 256
- bar value Battle["party"][2]["hp"] range Battle["party"][2]["max_hp"] xmaximum 256
+ showif (fx3):
+ frame:
+ xpos 0.625
+ xanchor 0.5
+ yanchor 1.0
+ ypos 1.0
+ ymaximum 10
+ xmaximum 256
+ bar value Battle["party"][2]["hp"] range Battle["party"][2]["max_hp"] xmaximum 256
- if (fx4):
- frame:
- xpos 0.875
- xanchor 0.5
- yanchor 1.0
- ypos 1.0
- ymaximum 10
- xmaximum 256
- bar value Battle["party"][3]["hp"] range Battle["party"][3]["max_hp"] xmaximum 256
+ showif (fx4):
+ frame:
+ xpos 0.875
+ xanchor 0.5
+ yanchor 1.0
+ ypos 1.0
+ ymaximum 10
+ xmaximum 256
+ bar value Battle["party"][3]["hp"] range Battle["party"][3]["max_hp"] xmaximum 256
screen battle_layout(lb="Select unit"):
vbox: