diff --git a/AI.py b/AI.py index c6d084c..396cd9c 100644 --- a/AI.py +++ b/AI.py @@ -63,7 +63,7 @@ def turn(self, world): my_paths = myself.paths_from_player path = my_paths[random.randint(0, len(my_paths) - 1)] size = len(path.cells) - cell = path.cells[(size + 1) / 2] + cell = path.cells[int((size + 1) / 2)] world.cast_unit_spell(unit=unit, path=path, cell=cell, spell=received_spell) # this code tries to upgrade damage of first unit. in case there's no damage token, it tries to upgrade range diff --git a/controller.py b/controller.py index 378523f..a5f1d28 100644 --- a/controller.py +++ b/controller.py @@ -1,6 +1,7 @@ import os import sys import threading +import traceback from queue import Queue from threading import Thread @@ -49,7 +50,8 @@ def launch_on_thread(self, action, world): action(world) except Exception as e: print("Error in client:") - print(e) + traceback.print_exc() + #print(e) world.queue.put(Message(type=ServerConstants.MESSAGE_TYPE_END_TURN, turn=world.current_turn, info={})) def start(self): diff --git a/world.py b/world.py index c079e15..fb65653 100644 --- a/world.py +++ b/world.py @@ -413,10 +413,10 @@ def cast_unit_spell(self, unit=None, unit_id=None, path=None, path_id=None, cell if unit is not None: unit_id = unit.unit_id if path is not None: - path_id = path.path_id + path_id = path.id message = Message(type="castSpell", turn=self.get_current_turn(), info={ - "typeId": spell.type, + "typeId": spell.type_id, "cell": { "row": cell.row, "col": cell.col