Beispiel #1
0
    def test_move_creature_out_of_bounds(self):
        c = Creature(name='creature', player='red', position=Point(0, 0))
        self.world.insert_creature(c)

        self.assertFalse(self.world.move_creature(c, -1, 1))
        self.assertEqual(Point(0, 0), c.position)
        self.assertEqual(c, self.world.get_entity_at(0, 0))
Beispiel #2
0
    def test_move_creature(self):
        c = Creature(name='creature', player='red', position=Point(0, 0))
        self.world.insert_creature(c)

        self.assertTrue(self.world.move_creature(c, 1, 1))
        self.assertEqual(Point(1, 1), c.position)
        self.assertEqual(c, self.world.get_entity_at(1, 1))
Beispiel #3
0
    def test_insert_creature(self):
        c = Creature(name='creature', player='red', position=Point(0, 0))
        count = len(self.world.creatures)

        self.world.insert_creature(c)

        self.assertGreater(len(self.world.creatures), count)
        self.assertEqual(c, self.world.get_entity_at(c.position.x,
                                                     c.position.y))
        self.assertEqual(c, self.world.creatures[c.id])
Beispiel #4
0
 def setUp(self):
     self.creature = Creature(name="creature_1", player="player_1", level=1, position=Point(0, 0))
     self.resource = Resource(name="resource_1", gold_amount=100, gold_flux=10)
Beispiel #5
0
 def setUp(self):
     self.attacker = Creature(name="attacker", player="player_1", level=1, position=Point(0, 0))
     self.defender = Creature(name="defender", player="player_2", level=1, position=Point(1, 0))