Exemple #1
0
 def test_wave_is_over(self):
     with patch('application.Application') as perm_mock:
         perm_mock.game_engine = None
     game_state = GameState(perm_mock)
     game_state.world.creeps[0].rect = (20, 20, 50, 100)
     game_state.world.finish = [20, 20]
     game_state.check_creeps(game_state.world, game_state.gamer)
     self.assertEqual(game_state.wave_is_over(game_state.world), True)
     creep = Creep(20, 50, game_state.world.ways[0], 2)
     tower = Tower(30, 50, 'laser')
     tower.level = 2
     creep.health = 0
     game_state.world.creeps.append(creep)
     game_state.world.towers.append(tower)
     game_state.blast_and_kill(game_state.world.creeps[0], game_state.world,
                               game_state.gamer)
     self.assertEqual(game_state.wave_is_over(game_state.world), True)
Exemple #2
0
 def test_help_creeps(self):
     with patch('application.Application') as perm_mock:
         perm_mock.game_engine = None
     game_state = GameState(perm_mock)
     creep_helper = CreepHelper(100, 150, game_state.world.ways[0], 1)
     creep = Creep(132, 150, game_state.world.ways[0], 1)
     creep.health = 80
     creep.need_help = 26
     game_state.world.creeps.append(creep)
     game_state.world.creeps.append(creep_helper)
     game_state.help_creeps(game_state.world.creeps[2])
     self.assertEqual(game_state.world.creeps[1].health, 90)
     self.assertEqual(game_state.world.creeps[1].doctored, True)
     game_state.world.creeps[1].health = 93
     game_state.world.creeps[1].need_help = 26
     game_state.help_creeps(game_state.world.creeps[2])
     self.assertEqual(game_state.world.creeps[1].health, 100)
Exemple #3
0
 def test_is_dead(self):
     creep = Creep(10, 20, [50, 50], 2)
     creep.health = 0
     self.assertEqual(creep.is_dead(), True)
     creep.health = 90
     self.assertEqual(creep.is_dead(), False)