reactor.stop() world_zeo = World_zeo() world = world_zeo.root maxsecs = timedelta(0, world['resigntime']) world_coords = str(sys.argv[1]) #this copy is really important, copies the objects out of the zeo and into memory. f = copy.deepcopy(world['Fields'][world_coords]) ply_time = 600 #for testing ending conditions #ply_time = f.ply_time atkr_name, atksquad = f.battlequeue[0] defsquad = f.get_defenders() #TODO rewrite player and hex_battle dfndr = Player(f.owner, [defsquad]) atkr = Player(atkr_name, [atksquad]) game = Game(grid=f.grid, defender=dfndr, attacker=atkr) btl = game.battlefield #!!!obviously for testing only. #The locations should be pushed to world before battle is started. for s in xrange(2): l = len(btl.squads[s]) for x in xrange(l): btl.place_object(btl.squads[s][x], Loc(x, s)) game.log['init_locs'] = game.log.init_locs() start_time = datetime.strptime(game.log['start_time'], "%Y-%m-%d %H:%M:%S.%f") ART = start_time + maxsecs #attacker resign time static_path = "./web" app = cyclone.web.Application([
from stores.yaml_store import load from binary_tactics.hex_battlefield import Battlefield from binary_tactics.player import Player from binary_tactics.grid import Loc def hp(): for s in btl.squads: print s.name for u in s: print " %s\n %s" %(u.name, u.hp) print "" p1 = Player(name='p1', squads=[load('yaml/ice_maxes.yaml')]) p2 = Player(name='p2', squads=[load('yaml/fire_maxes.yaml')]) game = Game(defender=p1, attacker=p2) btl = game.battlefield for s in range(2): for x in range(4): btl.place_object(btl.squads[s][x], Loc(x, s)) game.log['init_locs'] = game.log.init_locs() def show_squad(squad): for u in squad: print u.name, u.location, u.hp def show_squads(): for s in btl.squads:
reactor.stop() world_zeo = World_zeo() world = world_zeo.root maxsecs = timedelta(0, world['resigntime']) world_coords = str(sys.argv[1]) #this copy is really important, copies the objects out of the zeo and into memory. f = copy.deepcopy(world['Fields'][world_coords]) ply_time = 600 #for testing ending conditions #ply_time = f.ply_time atkr_name, atksquad = f.battlequeue[0] defsquad = f.get_defenders() #TODO rewrite player and hex_battle dfndr = Player(f.owner, [defsquad]) atkr = Player(atkr_name, [atksquad]) game = Game(grid=f.grid, defender=dfndr, attacker=atkr) btl = game.battlefield #!!!obviously for testing only. #The locations should be pushed to world before battle is started. for s in xrange(2): l = len(btl.squads[s]) for x in xrange(l): btl.place_object(btl.squads[s][x], Loc(x, s)) game.log['init_locs'] = game.log.init_locs() start_time = datetime.strptime(game.log['start_time'], "%Y-%m-%d %H:%M:%S.%f") ART = start_time + maxsecs #attacker resign time static_path = "./web"
from binary_tactics.player import Player from binary_tactics.grid import Loc def hp(): for s in btl.squads: print s.name for u in s: print " %s\n %s" % (u.name, u.hp) print "" p1 = Player(name='p1', squads=[load('yaml/ice_maxes.yaml')]) p2 = Player(name='p2', squads=[load('yaml/fire_maxes.yaml')]) game = Game(defender=p1, attacker=p2) btl = game.battlefield for s in range(2): for x in range(4): btl.place_object(btl.squads[s][x], Loc(x, s)) game.log['init_locs'] = game.log.init_locs() def show_squad(squad): for u in squad: print u.name, u.location, u.hp