Skip to content

Commit

Permalink
cast spell bug removed
Browse files Browse the repository at this point in the history
AI bug removed
  • Loading branch information
HamidrezaKmK committed Feb 14, 2020
1 parent 667ba73 commit b891a75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion controller.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import threading
import traceback
from queue import Queue
from threading import Thread

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b891a75

Please sign in to comment.