diff options
Diffstat (limited to 'battle/summons.py')
-rw-r--r-- | battle/summons.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/battle/summons.py b/battle/summons.py index 18ce106..ff128e1 100644 --- a/battle/summons.py +++ b/battle/summons.py @@ -1,6 +1,6 @@ ################################################################################# # This file is part of Spheres. -# Copyright (C) 2019 Jesusalva +# Copyright (C) 2019-2021 Jesusalva # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,10 +16,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. ################################################################################# # Battle Module - Summons -import json +import json, traceback from utils import (compress, allsummons, stdout, dl_search, Player, Battle) -from consts import (ERR_ERR, ERR_BAD, SRV_SUMMON) +from consts import (ERR_ERR, ERR_SUMMON, SRV_SUMMON) from battle.skills import skill_core from battle.common import conditions #from battle.main import advance_wave, battle_endturn, get_result @@ -28,16 +28,19 @@ def handle_summon(token, summon): global Battle, Player try: + # Log that summon was used + Battle[token]["log"].append(["", 0, SRV_SUMMON, summon["summon_id"], "", 0]) + # Summon strength is based on player rank force=summon["strength"]*Player[token]["level"] # Cast the skill, return error 500 on exception skill_core(token, summon["type"], force, summon["attribute"]) except: + traceback.print_exc() return ERR_ERR stdout("Summon: Victory/Defeat Check", 2) - Battle[token]["log"].append(["", 0, SRV_SUMMON, summon["summon_id"], "", 0]) # HOLD THAT! Handle victory/defeat conditions check = conditions(token, Battle[token]["spheres"]) @@ -74,13 +77,13 @@ def summon(args, token): stdout("All fine thus far") except: # Invalid data - return ERR_BAD + return ERR_SUMMON # Already summoned (reverse logic) try: Battle["s"]+=1 Battle["s"]-=1 - return ERR_BAD + return ERR_SUMMON except: pass |