From ee57db8dbf77727846b9c9c203a78a0e79169cb4 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 13 Aug 2021 00:13:25 -0300 Subject: Optimize some battle code because we'll be needing this soon --- game/01_init.rpy | 6 ++++-- game/battle.rpy | 32 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/game/01_init.rpy b/game/01_init.rpy index d9e2168..84032c8 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -47,8 +47,6 @@ init -3 python: persistent.serverlist.append(["Localhost", "localhost", 61000]) if (persistent.allfiles is None): persistent.allfiles=[] - if (persistent.summon is None): - persistent.summon=ifte(config.developer, 15, 0) allfiles=[] HOST=str(persistent.host) PORT=str(persistent.port) @@ -335,6 +333,10 @@ init -3 python: renpy.audio.audio.load=SpheresLoadAudioFile + ## Post setup + if (persistent.summon is None): + persistent.summon=ifte(config.developer, 15, 0) + ############################################################################# # URL3 Function def GAME_UPDATER(): diff --git a/game/battle.rpy b/game/battle.rpy index 1539203..fbc2cae 100644 --- a/game/battle.rpy +++ b/game/battle.rpy @@ -27,6 +27,22 @@ init python: return ERR_JSONDECODER return bt + def bt_handlelog(entry): + if entry[2] in [SPH_NONE, SPH_PIERCE, SPH_ASSAULT, SPH_HEAL]: + hit_someone_verbose(Battle[entry[4]][entry[5]], + 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]) + show_img("summon_%d" % entry[3], False) + renpy.show("summon_%d" % entry[3], at_list=[truecenter, tzoomin], tag="summon", zorder=29150, layer="overlay") + renpy.pause(2.0) + renpy.hide("summon", layer="overlay") + #renpy.with_statement(Dissolve(1.0)) + return + label combat: # Implement combat view $stdout("================= prepare for combat") @@ -148,19 +164,9 @@ label combat: # TODO: Highlight caster # TODO: Unmark cards # TODO: SRV_WAVE (ends waves) SRV_SPHERE (updates spheres) - if entry[2] in [SPH_NONE, SPH_PIERCE, SPH_ASSAULT, SPH_HEAL]: - hit_someone_verbose(Battle[entry[4]][entry[5]], - 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]) - show_img("summon_%d" % entry[3], False) - renpy.show("summon_%d" % entry[3], at_list=[truecenter, tzoomin], tag="summon", zorder=29150, layer="overlay") - renpy.pause(2.0) - renpy.hide("summon", layer="overlay") - #renpy.with_statement(Dissolve(1.0)) + # TODO: SRV_NONE (saves action in tmp memory) + # (then at next non-none, bt_handlelog() tmp memory) + bt_handlelog(entry) except: traceback.print_exc() -- cgit v1.2.3-60-g2f50