Пример #1
0
    def test_gather_wood_happy(self):
        theVillager = villager.Villager()
        theVillager.work(villager.Skill.CHOPPING)
        theVillager.tick()
        gatheredResources = theVillager.givesResources()

        self.assertEqual(len(gatheredResources), 1)
        self.assertTrue(gatheredResources[0].getQty() in range(1,4))
        self.assertEqual(gatheredResources[0].getType(), resource.ResourceType.WOOD)
Пример #2
0
 def __init__(self):
     rndmno = random.randint(16, 20)
     self.villagers = [villager.Villager() for _ in range(rndmno)]
     self.resources = []
     self.food = []
Пример #3
0
 def test_rebelling(self):
     theVillager = villager.Villager()
     self.tick(theVillager,4)
     self.checkEvolution(theVillager, villager.State.REBELLING)
Пример #4
0
 def test_dying_of_hunger_or_thirst(self):
     theVillager = villager.Villager()
     self.tick(theVillager,7)
     self.checkEvolution(theVillager, villager.State.DEAD)
Пример #5
0
 def test_ate_and_drank(self):
     theVillager = villager.Villager()
     theVillager.tick()
     theVillager.eat()
     theVillager.drink()
     self.checkEvolution(theVillager, villager.State.HAPPY)
Пример #6
0
 def test_ate_but_thirsty(self):
     theVillager = villager.Villager()
     theVillager.tick()
     theVillager.eat()
     self.checkEvolution(theVillager, villager.State.UNHAPPY)
Пример #7
0
 def test_becoming_unhappy(self):
     theVillager = villager.Villager()
     self.checkEvolution(theVillager, villager.State.HAPPY)
     self.checkEvolution(theVillager, villager.State.UNHAPPY)
Пример #8
0
 def test_initial_happy_mood(self):
     theVillager = villager.Villager()
     self.assertEqual(theVillager.mood(), villager.State.HAPPY)