From ab6ecd174125c398f892bf52e3a7c4ad96679f58 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Aug 2021 00:54:45 -0300 Subject: Add the summon button (no protocol-level action yet) --- game/01_init.rpy | 7 +++++++ game/ATTRIBUTION | 3 +++ game/battle.rpy | 14 ++++++++++++-- game/gfx/gui/summon_hover.png | Bin 0 -> 25678 bytes game/gfx/gui/summon_idle.png | Bin 0 -> 21258 bytes game/gfx/gui/summon_none.png | Bin 0 -> 14750 bytes game/gui/battle.rpy | 13 ++++++++++++- 7 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 game/gfx/gui/summon_hover.png create mode 100644 game/gfx/gui/summon_idle.png create mode 100644 game/gfx/gui/summon_none.png diff --git a/game/01_init.rpy b/game/01_init.rpy index 9b12e74..1a774bc 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -78,6 +78,11 @@ init -3 python: MUSIC_OPENING="sfx/bgm01.mp3" MUSIC_TOWN="sfx/bgm02.mp3" + # Battle actions + ACT_NONE =0 + ACT_TURN =1 + ACT_SUMMON =2 + # Spheres actions AP_NONE =False AP_SPHERE =1 @@ -122,6 +127,8 @@ init -3 python: SRV_SKILL =1000 SRV_WAVE =9901 SRV_SPHERE =9902 + SRV_SUMMON =9903 + SRV_NOCAST =9904 # Special error structs ERR_MOBSTRUCT ={ diff --git a/game/ATTRIBUTION b/game/ATTRIBUTION index fed9b6f..4c0e5ae 100644 --- a/game/ATTRIBUTION +++ b/game/ATTRIBUTION @@ -96,6 +96,9 @@ Where relevant, you must also include a link to https://tmw2.org in your credit. gfx/gui/ele_3.png (Chrisdesign) (CC0) (From OpenGameArt) gfx/gui/ele_4.png (Chrisdesign) (CC0) (From OpenGameArt) gfx/gui/ele_5.png (Chrisdesign) (CC0) (From OpenGameArt) + gfx/gui/summon_none.png (Jesusalva) (CC0) (Chrisdesign/sophokles/wayfarer) + gfx/gui/summon_idle.png (Jesusalva) (CC0) (Chrisdesign/sophokles/wayfarer) + gfx/gui/summon_hover.png (Jesusalva) (CC0) (Chrisdesign/sophokles/wayfarer) ## MOBS gfx/mobs/0.png (-) (-) (-) gfx/mobs/960000.png (Santiago Iborra) (CC BY SA) (Arcmage) diff --git a/game/battle.rpy b/game/battle.rpy index 6a0bea2..1d99471 100644 --- a/game/battle.rpy +++ b/game/battle.rpy @@ -84,9 +84,10 @@ label combat: # TODO: Display Spheres in the right place $ use_sphere=[AP_NONE, AP_NONE, AP_NONE, AP_NONE, AP_NONE] $ btl_ready = False + $ do_action = ACT_NONE python: try: - renpy.call_screen("battle", _with_none=True) + do_action = renpy.call_screen("battle", _with_none=True) except: traceback.print_exc() stdout("FAILED to render battle screen, trying again...") @@ -103,7 +104,13 @@ label combat: # TODO: Send to server new arrangement of units # Update Battle with server response - $ response=loadbattle(Battle["party"]) + if (do_action == ACT_TURN): + $ response=loadbattle(Battle["party"]) + elif (do_action == ACT_SUMMON): + $ response=Battle + else: + $ stdout("INVALID ACTION CODE: %d" % do_action) + jump combat # Maybe we error'ed out and should relog if (response in [FAILUREMSG, OFFLINEMSG, ERR_JSONDECODER, ERR_LOGIN_DEFAULT]): @@ -142,6 +149,9 @@ label combat: entry[3]) sdelay(0.1) print("Attacked Battle[%s][%d]" % (entry[4], entry[5])) + elif entry[2] == SRV_SUMMON: + # FIXME + print("Summoned %d to your aid! Show cutscene" % entry[3]) except: traceback.print_exc() diff --git a/game/gfx/gui/summon_hover.png b/game/gfx/gui/summon_hover.png new file mode 100644 index 0000000..6524855 Binary files /dev/null and b/game/gfx/gui/summon_hover.png differ diff --git a/game/gfx/gui/summon_idle.png b/game/gfx/gui/summon_idle.png new file mode 100644 index 0000000..d475906 Binary files /dev/null and b/game/gfx/gui/summon_idle.png differ diff --git a/game/gfx/gui/summon_none.png b/game/gfx/gui/summon_none.png new file mode 100644 index 0000000..34252cf Binary files /dev/null and b/game/gfx/gui/summon_none.png differ diff --git a/game/gui/battle.rpy b/game/gui/battle.rpy index f43ca65..d2f7f6d 100644 --- a/game/gui/battle.rpy +++ b/game/gui/battle.rpy @@ -390,7 +390,18 @@ screen battle(): button: text _("I'm ready"): outlines [(1,"#333",0,0)] - action Return() + action Return(ACT_TURN) + showif not btl_ready and Player["quest"] >= 5: + hbox: + xanchor 1.0 + yanchor 0.0 + xpos config.screen_width-32 + ypos 96 + imagebutton: + insensitive "gfx/gui/summon_none.png" + idle "gfx/gui/summon_idle.png" + hover "gfx/gui/summon_hover.png" + action ifte(Battle["bp"] > 10, Return(ACT_SUMMON), None) -- cgit v1.2.3-60-g2f50