Example #1
0
    def __init__(self, engine):
        super(BattleTester, self).__init__(engine)

        sim_lib.set_speed(self, 10000)
        self.cycles = 0
        self.max_cycles = 0
        self.testing = True
Example #2
0
 def __init__(self, engine):
     super(BattleTester, self).__init__(engine)
     
     sim_lib.set_speed(self, 10000)
     self.cycles = 0
     self.max_cycles = 0
     self.testing = True
Example #3
0
 def __init__(self, engine):
     # How many cycles between collision checks
     self._collision_interval = 5
     self._collision_inverval_count = 0
     
     super(BattleSim, self).__init__(engine)
     
     self.next_cycle = time.time()
     
     sim_lib.set_speed(self, 100)
     
     self.running = True
     self.loaded = False
     
     self.actor_types = {}
     self.ability_types = {}
     
     self.ais = {}
     self.cycle_count = [0, 0]
Example #4
0
 def new_game(self, file_path=""):
     self.set_screen('Battle screen')
     
     self.current_screen.name = "Sequtus"
     self.current_screen.background_image = self.images['battlefield'].get().copy()
     self.current_screen.player_team = 1
     
     # self.current_screen.load_all("data/config.json", "data/game_data.json", "data/dummy.json")
     self.current_screen.load_all("data/config.json", "data/game_data.json", "data/scenario_1.json")
     
     # Wrap it in a try block so that the screen can quit it's AI processes
     try:
         pass
         
         # self.current_screen.select_actor(self.current_screen.actors[1])
         
         # self.current_screen.actors[0].build_queue = ['Red tank']
         
         self.current_screen.scroll_to_coords(2000, 2000)
         
         # S key to issue stop command
         # e = pygame.event.Event(3, scancode=2, key=100, mod=0)
         # self.current_screen.handle_keyup(e)
         
         # Fake mouseclick
         # ev = pygame.event.Event(3, button=1, pos=(960, 960))# Corner of view
         # ev = pygame.event.Event(3, button=1, pos=(74, 88))# Corner of map view
         # ev = pygame.event.Event(3, button=1, pos=(96, 96))# Corner of map view
         # ev = pygame.event.Event(3, button=1, pos=(1, 1))
         
         # self.current_screen.place_actor_mode("Red factory")
         # self.current_screen.handle_mouseup(ev)
         
         # self.current_screen.add_order(self.current_screen.actors[0], "aid", target=self.current_screen.actors[2])
         
     except Exception:
         self.current_screen.quit()
         raise
     
     sim_lib.set_speed(self.current_screen, 42)
Example #5
0
    def new_game(self, file_path=""):
        self.set_screen("Battle screen")

        self.current_screen.name = "Sequtus"
        self.current_screen.background_image = self.images["battlefield"].get().copy()
        self.current_screen.player_team = 1

        # self.current_screen.load_all("data/config.json", "data/game_data.json", "data/dummy.json")
        self.current_screen.load_all("data/config.json", "data/game_data.json", "data/scenario_1.json")

        # Wrap it in a try block so that the screen can quit it's AI processes
        try:
            pass

            # self.current_screen.select_actor(self.current_screen.actors[1])

            # self.current_screen.actors[0].build_queue = ['Red tank']

            self.current_screen.scroll_to_coords(2000, 2000)

            # S key to issue stop command
            # e = pygame.event.Event(3, scancode=2, key=100, mod=0)
            # self.current_screen.handle_keyup(e)

            # Fake mouseclick
            # ev = pygame.event.Event(3, button=1, pos=(960, 960))# Corner of view
            # ev = pygame.event.Event(3, button=1, pos=(74, 88))# Corner of map view
            # ev = pygame.event.Event(3, button=1, pos=(96, 96))# Corner of map view
            # ev = pygame.event.Event(3, button=1, pos=(1, 1))

            # self.current_screen.place_actor_mode("Red factory")
            # self.current_screen.handle_mouseup(ev)

            # self.current_screen.add_order(self.current_screen.actors[0], "aid", target=self.current_screen.actors[2])

        except Exception:
            self.current_screen.quit()
            raise

        sim_lib.set_speed(self.current_screen, 42)
Example #6
0
 def __init__(self, engine):
     # How many cycles between collision checks
     self._collision_interval = 5
     self._collision_inverval_count = 0
     
     super(BattleSim, self).__init__(engine)
     
     self.next_cycle = time.time()
     
     sim_lib.set_speed(self, 100)
     
     self.running = True
     self.loaded = False
     
     self.actor_types = {}
     self.ability_types = {}
     self.build_lists = {}
     self.tech_trees = {}
     self.resources = {}
     
     self.teams = {}
     
     self.autotargeters = {}
     self.out_queues = {}
     self.in_queues = {}
     self.cycle_count = [0, 0]
     
     # Used to signal that we may need to update a menu
     self.signal_menu_rebuild = False
     
     self.next_ai_update = 0
     
     # Allows looking up of actors based on their oid
     # rather than reference passing. Ref passing is preferred
     # but things such as the AIs cannot use refs so must
     # limit themselves to oids
     self.actor_lookup = {}
     
     self.ai_prefs = {}
Example #7
0
 def new_game(self, file_path=""):
     self.set_screen('Battle screen')
     
     self.current_screen.name = "Sequtus"
     self.current_screen.scroll_boundaries = (self.window_width-2000, self.window_height-2000, 0, 0)
     self.current_screen.background_image = self.images['battlefield'].copy()
     self.current_screen.player_team = 1
     
     self.current_screen.load_all("data/config.json", "data/game_data.json", "data/dummy.json")
     # self.current_screen.load_all("data/config.json", "data/game_data.json", "engine/test_lib/battle_test_setups/collisions.json")
     
     self.current_screen.add_order(0, "move", [100, 800])
     self.current_screen.add_order(1, "move", [200, 800])
     self.current_screen.add_order(2, "move", [300, 800])
     self.current_screen.add_order(3, "move", [100, 900])
     self.current_screen.add_order(4, "move", [200, 900])
     self.current_screen.add_order(5, "move", [300, 900])
     
     self.current_screen.add_order(6, "move", [200, 600])
     self.current_screen.add_order(7, "move", [200, 700])
     self.current_screen.add_order(8, "move", [200, 800])
     self.current_screen.add_order(9, "move", [300, 600])
     self.current_screen.add_order(10, "move", [300, 700])
     self.current_screen.add_order(11, "move", [300, 800])
     
     for i in range(0, 5):
         for j in range(0, 5):
             self.current_screen.place_actor({"type":"Red circle","pos":[i*50, j*50,0],"team":1,"completion":100,"hp":10})
             self.current_screen.add_order(len(self.current_screen.actors)-1, "move", [400, 1000])
     
     for i in range(0, 5):
         for j in range(0, 5):
             self.current_screen.place_actor({"type":"Blue circle","pos":[i*50+500, j*50+500,0],"team":2,"completion":100,"hp":10})
             self.current_screen.add_order(len(self.current_screen.actors)-1, "move", [100, 700])
     
     sim_lib.set_speed(self.current_screen, 30)