def testRemoveStats(self): char = Character(age=1) char.buy_agility(2) char.buy_speed(2) char.buy_power(2) char.buy_forte(2) char.buy_perception(2) char.buy_will(2) char.remove_agility() char.remove_speed() char.remove_power() char.remove_forte() char.remove_perception() char.remove_will() self.assertEquals(char.perception, 1) self.assertEquals(char.will, 1) self.assertEquals(char.agility, 1) self.assertEquals(char.speed, 1) self.assertEquals(char.power, 1) self.assertEquals(char.forte, 1) self.assertEquals(char.mental_pool(), 3) self.assertEquals(char.physical_pool(), 6)
def testBuyStatsPastLimits(self): """for humans: will and perception 8, all others 6, with no stat can be above 6 in character creation """ char = Character(age = 11) char.buy_perception(6) self.assertRaises(ExceedsMaximum, char.buy_perception) char.remove_perception(6) char.buy_will(6) self.assertRaises(ExceedsMaximum, char.buy_will) char.remove_will(6) char.buy_agility(6) self.assertRaises(ExceedsMaximum, char.buy_agility) char.remove_agility(6) char.buy_speed(6) self.assertRaises(ExceedsMaximum, char.buy_speed) char.remove_speed(6) char.buy_power(6) self.assertRaises(ExceedsMaximum, char.buy_power) char.remove_power(6) char.buy_forte(6) self.assertRaises(ExceedsMaximum, char.buy_forte) char.remove_forte(6)
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)