示例#1
0
    def testFloaterPoints(self):
        """Some lifepaths give a bonus point for physical or mental stats.  These points should be spent last and refunded first.
        """
        char = Character([Lifepath(born=True, years=1), Lifepath(years=1, floater_points=1)])
        self.assertEquals(char.mental_pool(), 5)
        self.assertEquals(char.physical_pool(), 10)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_perception(3)
        char.buy_will(2)
        char.buy_forte(4)
        char.buy_power(2)
        char.buy_agility(2)
        char.buy_speed(2)
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_perception()
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.perception, 4)
        self.assertRaises(CantAfford, char.buy_will)
        self.assertRaises(CantAfford, char.buy_forte)
        self.assertRaises(CantAfford, char.buy_speed)
        self.assertRaises(CantAfford, char.buy_agility)
        self.assertRaises(CantAfford, char.buy_power)
        char.remove_perception()
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_will()
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.will, 3)
        self.assertRaises(CantAfford, char.buy_perception)
        self.assertRaises(CantAfford, char.buy_forte)
        self.assertRaises(CantAfford, char.buy_speed)
        self.assertRaises(CantAfford, char.buy_agility)
        self.assertRaises(CantAfford, char.buy_power)
        char.remove_will()
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_forte()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.forte, 5)
        self.assertRaises(CantAfford, char.buy_will)
        self.assertRaises(CantAfford, char.buy_perception)
        self.assertRaises(CantAfford, char.buy_speed)
        self.assertRaises(CantAfford, char.buy_agility)
        self.assertRaises(CantAfford, char.buy_power)
        char.remove_forte()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_power()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.power, 3)
        self.assertRaises(CantAfford, char.buy_will)
        self.assertRaises(CantAfford, char.buy_perception)
        self.assertRaises(CantAfford, char.buy_forte)
        self.assertRaises(CantAfford, char.buy_speed)
        self.assertRaises(CantAfford, char.buy_agility)
        char.remove_power()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_agility()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.agility, 3)
        self.assertRaises(CantAfford, char.buy_will)
        self.assertRaises(CantAfford, char.buy_perception)
        self.assertRaises(CantAfford, char.buy_forte)
        self.assertRaises(CantAfford, char.buy_speed)
        self.assertRaises(CantAfford, char.buy_power)
        char.remove_agility()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)

        char.buy_speed()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 0)
        self.assertEquals(char.speed, 3)
        self.assertRaises(CantAfford, char.buy_will)
        self.assertRaises(CantAfford, char.buy_perception)
        self.assertRaises(CantAfford, char.buy_forte)
        self.assertRaises(CantAfford, char.buy_power)
        self.assertRaises(CantAfford, char.buy_agility)
        char.remove_speed()
        self.assertEquals(char.physical_pool(), 0)
        self.assertEquals(char.floater_pool(), 1)