Ejemplo n.º 1
0
 def test_move(self):
     testGame = game.PyFenseGame(1)
     testEnemy = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 1)
     testEnemy._move(0)
     actionAssigned = testEnemy.actions
     if not actionAssigned:
         self.fail('No actions assigned!')
Ejemplo n.º 2
0
 def initiate_projectile(self):
     self.testGame = game.PyFenseGame(1)
     self.testPath = self.testGame.movePath
     self.testTower = tower.PyFenseTower(0, (50, 70))
     self.testEnemy = enemy.PyFenseEnemy((50, 40), 0, 1, 1, self.testPath,
                                         2)
     self.testProjectile = projectileParticle.PyFenseProjectileSlow(
         self.testTower, self.testEnemy, 1, 45, 1000, 50, 'normal', 5, 1)
Ejemplo n.º 3
0
    def test_healthmultiplier(self):
        testGame = game.PyFenseGame(1)
        enemy1 = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 1)
        enemy2 = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 2.5)

        actualResult = enemy1.attributes["maxhealth"] * 2.5
        result = enemy2.healthPoints
        self.assertEqual(result, actualResult)
Ejemplo n.º 4
0
    def test_poison(self):
        testGame = game.PyFenseGame(1)
        testEnemy = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 1)
        actualResult = testEnemy.healthPoints - 5
        testEnemy.poison(5, 2)
        testEnemy._decrease_health(0)
        result = testEnemy.healthPoints

        self.assertEqual(result, actualResult)
Ejemplo n.º 5
0
    def test_freeze(self):
        testGame = game.PyFenseGame(1)
        testEnemy = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 1)

        testEnemy.freeze(5, 2)

        actualResult = testEnemy.attributes['speed']/5
        result = testEnemy.currentSpeed
        self.assertEqual(result, actualResult)
Ejemplo n.º 6
0
 def initiate_tower(self):
     self.testTower = tower.PyFenseTower(1, (0, 0))
     self.testGame = game.PyFenseGame(1)
     self.testEnemy = enemy.PyFenseEnemy((300, 200), 1, 1, 1,
                                         self.testGame.movePath, 1)
     self.testEntities = entities.PyFenseEntities(
         self.testGame.movePath, self.testGame.startTile,
         self.testGame.endTile)
     self.testEntities.add(self.testTower)
     self.testEntities.enemies.append(self.testEnemy)
Ejemplo n.º 7
0
 def initiate_projectile(self):
     self.testGame = game.PyFenseGame(1)
     self.testPath = self.testGame.movePath
     self.image = resources.load_image('projectile01.png')
     self.testTower = tower.PyFenseTower(0, (50, 70))
     self.testEnemy = enemy.PyFenseEnemy((50, 40), 0, 1, 1, self.testPath,
                                         2)
     self.testProjectile = projectile.PyFenseProjectile(
         self.testTower, self.testEnemy, self.image, 0, 0, 1000, 50,
         'normal', 5, 1)
Ejemplo n.º 8
0
 def on_start(self, lvl):
     """
     Starts the game with the selected level "lvl"
     """
     self.parent.switch_to(3)
     director.push(game.PyFenseGame(lvl))
Ejemplo n.º 9
0
 def test_is_move_function_scheduled(self):
     testGame = game.PyFenseGame(1)
     testEnemy = enemy.PyFenseEnemy((0, 0), 0, 1, 1, testGame.movePath, 1)
     isScheduled = testEnemy.scheduled_interval_calls
     if not isScheduled:
         self.fail('No scheduled calls!')