Exemplo n.º 1
0
 def testLoseStatsWithIncreasingAge(self):
     char = Character(age = 79)
     self.assertEquals(char.mental_pool(), 7)
     self.assertEquals(char.physical_pool(), 10)
     char.buy_perception(4)
     char.buy_will(3)
     char.add_path(Lifepath(born=True, years=1))
     self.assertEquals(char.mental_pool(), 0)
     self.assertEquals(char.perception, 3)
     self.assertEquals(char.will, 3)
     char.remove_path()
     char.buy_will()
     char.add_path(Lifepath(born=True, years=1))
     self.assertEquals(char.perception, 3)
     self.assertEquals(char.will, 3)
     char.remove_path()
     char.buy_speed(4)
     char.buy_power(3)
     char.buy_forte(2)
     char.buy_agility(1)
     self.assertEquals(char.physical_pool(), 0)
     char.add_path(human.BornNobility())
     self.assertEquals(char.physical_pool(), 0)
     self.assertEquals(char.speed, 3)
     self.assertEquals(char.power, 3)
     self.assertEquals(char.forte, 2)
     self.assertEquals(char.agility, 1)
Exemplo n.º 2
0
 def testBuyStatsMultiple(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)
     self.assertEquals(char.perception, 2)
     self.assertEquals(char.will, 2)
     self.assertEquals(char.agility, 2)
     self.assertEquals(char.speed, 2)
     self.assertEquals(char.power, 2)
     self.assertEquals(char.forte, 2)
     self.assertEquals(char.mental_pool(), 1)
     self.assertEquals(char.physical_pool(), 2)
Exemplo n.º 3
0
 def testBuyStats(self):
     char = Character(age=1)
     char.buy_agility()
     char.buy_speed()
     char.buy_power()
     char.buy_forte()
     char.buy_perception()
     char.buy_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)
Exemplo n.º 4
0
 def testBuyStatsWithoutPoints(self):
     char = Character(age = 1)
     char.buy_will(5)
     self.assertEquals(char.will, 5)
     self.assertEquals(char.mental_pool(), 0)
     self.assertRaises(CantAfford, char.buy_will)
     self.assertRaises(CantAfford, char.buy_perception)
     char.buy_forte(3)
     char.buy_speed(3)
     char.buy_power(3)
     char.buy_agility(1)
     self.assertEquals(char.forte, 3)
     self.assertEquals(char.speed, 3)
     self.assertEquals(char.power, 3)
     self.assertEquals(char.agility,1)
     self.assertEquals(char.physical_pool(),0)
     self.assertRaises(CantAfford, char.buy_forte)
     self.assertRaises(CantAfford, char.buy_agility)
     self.assertRaises(CantAfford, char.buy_speed)
     self.assertRaises(CantAfford, char.buy_power)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 def testInjuredWoundTolerance(self):
     char = Character([Lifepath(born=True, years=1)])
     char.buy_forte()
     self.assertEquals(char.injured_wound(), 'H1')
     char.buy_forte()
     self.assertEquals(char.injured_wound(), 'H3')
     char.buy_forte()
     self.assertEquals(char.injured_wound(), 'H3')
Exemplo n.º 7
0
 def testSuperficialWoundTolerance(self):
     char = Character([Lifepath(born=True, years=1)])
     char.buy_forte()
     self.assertEquals(char.superficial_wound(), 'H1')
     char.buy_forte()
     self.assertEquals(char.superficial_wound(), 'H2')
     char.buy_forte()
     self.assertEquals(char.superficial_wound(), 'H2')
Exemplo n.º 8
0
    def testLoseStatsWithDecreasingAge(self):
        """Changes in Lifepaths can lead to altering point pools.  Stats should be altered to avoid negative point pools.

        Assumption: higher stats should lose points first
        """
        char = Character([Lifepath(years=14, born=True), Lifepath(years=3)])
        self.assertEquals(char.age(), 17)
        self.assertEquals(char.mental_pool(), 7)
        self.assertEquals(char.physical_pool(), 16)
        
        char.buy_perception(4)
        char.buy_will(3)
        char.remove_path()
        self.assertEquals(char.age(), 14)
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.perception, 3)
        self.assertEquals(char.will, 3)

        char.add_path(Lifepath(years=3))
        char.buy_will()
        char.remove_path()
        self.assertEquals(char.age(), 14)
        self.assertEquals(char.mental_pool(), 0)
        self.assertEquals(char.perception, 3)
        self.assertEquals(char.will, 3)

        char.add_path(Lifepath(years=3))
        self.assertEquals(char.physical_pool(), 16)
        char.buy_speed(6)
        char.buy_power(5)
        char.buy_forte(3)
        char.buy_agility(2)
        self.assertEquals(char.physical_pool(), 0)
        char.remove_path()
        self.assertEquals(char.speed, 4)
        self.assertEquals(char.power, 4)
        self.assertEquals(char.forte, 3)
        self.assertEquals(char.agility, 2)
Exemplo n.º 9
0
 def testMaimedWoundTolerance(self):
     char = Character([Lifepath(born=True, years=1)])
     char.buy_power()
     char.buy_forte()
     self.assertEquals(char.maimed_wound(), 'H5')
     char.buy_forte()
     self.assertEquals(char.maimed_wound(), 'H5')
     char.buy_forte()
     self.assertEquals(char.maimed_wound(), 'H6')
Exemplo n.º 10
0
 def testMortalWoundTolerance(self):
     char = Character([Lifepath(born=True, years=1)])
     char.buy_power()
     char.buy_forte()
     self.assertEquals(char.mortal_wound(), 'H7')
     char.buy_forte()
     self.assertEquals(char.mortal_wound(), 'H7')
     char.buy_forte()
     self.assertEquals(char.mortal_wound(), 'H8')
Exemplo n.º 11
0
class TraitTests(unittest.TestCase):
    def setUp(self):
        self.char =  Character([ Lifepath(born=True, years=1,trait_points=100)])
    def testDie(self):
        dietrait = DieTrait('Mark of Privilege', 3)
        self.assertEquals(dietrait.name, 'Mark of Privilege')
        self.assertEquals(dietrait.cost, 3)
        dietrait = DieTrait('Corvus and Crucis', 4)
        self.assertEquals(dietrait.name, 'Corvus and Crucis')
        self.assertEquals(dietrait.cost, 4)
    def testCallOn(self):
        cotrait = CallOnTrait('Follow the Money', 2)
        self.assertEquals(cotrait.name, 'Follow the Money')
        self.assertEquals(cotrait.cost, 2)
        cotrait = CallOnTrait('Forked Tongue',  3)
        self.assertEquals(cotrait.name, 'Forked Tongue')
        self.assertEquals(cotrait.cost, 3)
    def testChar(self):
        ctrait = CharacterTrait('Testing Fiend')
        ctrait2 = CharacterTrait('Testing Fiend')
        self.assertEquals(ctrait.name, 'Testing Fiend')
        self.assertEquals(ctrait.cost, 1)
        self.assertEquals(ctrait, ctrait2)
    def testISolzjah(self):
        # No Kerrn requirement?  Humans and Vaylen can take it?
        pass
    def testHumanOnlyTrait(self):
        human_only = [BrightMark(), Forged(), FuurBlood(), HammerLord(), Primarch()]
        pass
    def testRequiresBrightMarkTrait(self):
        """test if Gift of Ahmilahk and The Psychologists Code require the Bright Makr
        """
        req_bright_mark = [GiftOfAhmilahk(), ThePsychologistsCode()]
        for x in req_bright_mark:
            self.assertFalse(x.allowed(self.char))
            self.assertFalse(x in self.char.allowed_traits())
            self.char.buy_trait(BrightMark())
            self.assertTrue(x.allowed(self.char))
            self.assertTrue(x in self.char.allowed_traits())
            self.char.remove_trait(BrightMark())
    def testWarriorsCode(self):
        """test requirements for Warriors Code trait
        'Bright Mark required.  Alternately, the player may use the mule trait,but he must also take a Branded Character Trait.  The circle brands him as one of their own'
        Bright mark OR (Mule AND Branded?)  Is branded free?  I will guess no
        """
        self.assertFalse(WarriorsCode().allowed(self.char))
        self.assertFalse(WarriorsCode() in self.char.allowed_traits())
        self.char.buy_trait(BrightMark())
        self.assertTrue(WarriorsCode().allowed(self.char))
        self.assertTrue(WarriorsCode() in self.char.allowed_traits())
        self.char.remove_trait(BrightMark())
        self.assertFalse(WarriorsCode().allowed(self.char))
        self.assertFalse(WarriorsCode() in self.char.allowed_traits())
        self.char.buy_trait(Mule())
        self.assertFalse(WarriorsCode().allowed(self.char))
        self.assertFalse(WarriorsCode() in self.char.allowed_traits())
        self.char.buy_trait(Branded())
        self.assertTrue(WarriorsCode().allowed(self.char))
        self.assertTrue(WarriorsCode() in self.char.allowed_traits())
    def testAnvilLord(self):
        """test requirements for Anvil Lord Trait
        'if not gained as an lp trait, the character must be born to rule or have the magnate lifepath'
        ie: requires magnate, born to rule, or anvil lord
        """
        for test_name in ['Magnate', 'Born to Rule', 'Anvil Lord']:
            self.assertFalse(AnvilLord().allowed(self.char))
            self.assertFalse(AnvilLord() in self.char.allowed_traits())
            self.char.add_path( Lifepath(test_name))
            self.assertTrue(AnvilLord().allowed(self.char))
            self.assertTrue(AnvilLord() in self.char.allowed_traits())
            self.char.remove_path()
            
    def testAnvilTrained(self):
        """test requirements for Anvil Trained trait: may not be taken by mukhadish
        i.e., only human, kern or vaylen
        """
        pass
    
    def testArbiter(self):
        """test requirements for Arbiter Trait
        Archcotare or Cult Leader LP
        """
        for test_name in ['Archcotare', 'Cult Leader']:
            self.assertFalse(Arbiter().allowed(self.char))
            self.assertFalse(Arbiter() in self.char.allowed_traits())
            self.char.add_path(Lifepath(test_name))
            self.assertTrue(Arbiter().allowed(self.char))
            self.assertTrue(Arbiter() in self.char.allowed_traits())
            self.char.remove_path()
            
    def testRequiresBornToRule(self):
        """Test requirements for Bastard and Your Eminence/Grace/Lordship/Majesty: Born to Rule Lifepath
        """
        req_born_to_rule = [Bastard(), YourEminence(), YourGrace(), YourLordship(), YourMajesty()]
        for x in req_born_to_rule:
            self.assertFalse(x.allowed(self.char))
            self.assertFalse(x in self.char.allowed_traits())
            self.char.remove_path()
            self.char.add_path( Lifepath(name='Born to Rule', born=True, trait_points=100))
            self.assertTrue(x.allowed(self.char))
            self.assertTrue(x in self.char.allowed_traits())
            self.char.remove_path()
            self.char.add_path( Lifepath(born=True, trait_points=100))
    def testBornOnTheWheel(self):
        """test requirements for Born on the Wheel trait: Born on the Wheel LP only
        """
        self.assertFalse(BornOnTheWheel().allowed(self.char))
        self.assertFalse(BornOnTheWheel() in self.char.allowed_traits())
        self.char.add_path(Lifepath(name='Born on the Wheel'))
        self.assertTrue(BornOnTheWheel().allowed(self.char))
        self.assertTrue(BornOnTheWheel() in self.char.allowed_traits())
    def testCitizenOfTheCommune(self):
        """test requirements for Citizen of the Commune trait: Born Citizen LP only
        """
        self.assertFalse(CitizenOfTheCommune().allowed(self.char))
        self.assertFalse(CitizenOfTheCommune() in self.char.allowed_traits())
        self.char.remove_path()
        self.char.add_path( Lifepath(name='Born Citizen', born=True, trait_points=100))
        self.assertTrue(CitizenOfTheCommune().allowed(self.char))
        self.assertTrue(CitizenOfTheCommune() in self.char.allowed_traits())
    def testCodebreaker(self):
        """test requirements for Codebreaker trait: Psychologist-type characters only
        """
        
        pass
    def testContender(self):
        """test requirements for Contender trait: Mark of Privilege Trait
        """
        self.assertFalse(Contender().allowed(self.char))
        self.assertFalse(Contender() in self.char.allowed_traits())
        self.char.buy_trait(MarkOfPrivilege())
        self.assertTrue(Contender().allowed(self.char))
        self.assertTrue(Contender() in self.char.allowed_traits())
    def testCorvusAndCrucis(self):
        #Characters with a human body
        #ie: humans, and vaylen in the human or infiltrator settings
        pass
    def testCotarFomas(self):
        """test requirements for Cotar Fomas trait: cotar fomas lp only
        """
        self.assertFalse(CotarFomas().allowed(self.char))
        self.assertFalse(CotarFomas() in self.char.allowed_traits())
        self.char.add_path( Lifepath(name='Cotar Fomas'))
        self.assertTrue(CotarFomas().allowed(self.char))
        self.assertTrue(CotarFomas() in self.char.allowed_traits())
    def testDevotedToFire(self):
        """test requirements for Devoted to Fire trait: Devoted to Fire LP only
        What?!  But why is it listed in the Sodalis-Brother LP?
        """
        self.assertFalse(DevotedToFire().allowed(self.char))
        self.assertFalse(DevotedToFire() in self.char.allowed_traits())
        self.char.add_path( Lifepath(name='Devoted to Fire'))
        self.assertTrue(DevotedToFire().allowed(self.char))
        self.assertTrue(DevotedToFire() in self.char.allowed_traits())
    def testDregutai(self):
        """test requirements for Dregutai trait: Dregus LP only
        """
        self.assertFalse(Dregutai().allowed(self.char))
        self.assertFalse(Dregutai() in self.char.allowed_traits())
        self.char.add_path( Lifepath(name='Dregus'))
        self.assertTrue(Dregutai().allowed(self.char))
        self.assertTrue(Dregutai() in self.char.allowed_traits())
    def testEducated(self):
        """test requirements for Educated trait: Human and Vaylen only
        #any vaylen setting?  It seems like more of a human or makara caste thing
        """
        h = Human([Lifepath(born=True, trait_points=100)])
        self.assertTrue(Educated().allowed(h))
        self.assertTrue(Educated() in h.allowed_traits())
    def testEmperorsSteward(self):
        """test requirements of Emperor's Steward Trait:Lord Steward LP
        """
        self.assertFalse(EmperorsSteward().allowed(self.char))
        self.assertFalse(EmperorsSteward() in self.char.allowed_traits())
        self.char.add_path(Lifepath(name='Lord Steward'))
        self.assertTrue(EmperorsSteward().allowed(self.char))
        self.assertTrue(EmperorsSteward() in self.char.allowed_traits())
    def testFamily(self):
        #Kerrn Diazspherah, Human, Mukhadish Underworld setting and Vaylen setting characters only
        #any human?  the human stock?
        pass
    def testGarbo(self):
        #Human or Human-bodied Vaylen only
        #Ie, human stock, or lifepath in human caste or invader settings?  any or ends in?
        pass
    def testRequiresCorvusAndCrucis(self):
        """test requirements for Iron Trained and Wigged trait: Corvus and Crucis trait
        """
        for x in [IronTrained(), Wigged()]:
            self.assertFalse(x.allowed(self.char))
            self.assertFalse(x in self.char.allowed_traits())
            self.char.buy_trait(CorvusAndCrucis())
            self.assertTrue(x.allowed(self.char))
            self.assertTrue(x in self.char.allowed_traits())
            self.char.remove_trait(CorvusAndCrucis())
    def testKeeperOfTheFire(self):
        """test requirements for Keeper of the Fire Trait: Keeper of the Fire LP only
        No such lifepath.  I assume they mean Cotar
        """
        self.assertFalse(KeeperOfTheFire().allowed(self.char))
        self.assertFalse(KeeperOfTheFire() in self.char.allowed_traits())
        self.char.add_path(Lifepath(name='Cotar'))
        self.assertTrue(KeeperOfTheFire().allowed(self.char))
        self.assertTrue(KeeperOfTheFire() in self.char.allowed_traits())
    def testKravMagahTrained(self):
        #Human, Vaylen and Mukhadish characters may only take this if there are no Kerrn player characters in their group
        # So Kerrn can take it without restriction.  Maybe a notice otherwise?
        pass
    def testMarkOfPrivilege(self):
        """test requirements for Mark of Privilege trait: Born to Rule, Vaylen Captain and Vaylen Command LPs only
        """
        self.assertFalse(MarkOfPrivilege().allowed(self.char))
        self.assertFalse(MarkOfPrivilege() in self.char.allowed_traits())
        self.char.add_path(Lifepath(name='Born to Rule'))
        self.assertTrue(MarkOfPrivilege().allowed(self.char))
        self.assertTrue(MarkOfPrivilege() in self.char.allowed_traits())
    def testMetropolitan(self):
        """test requirements for Metropolitan and Word is Law traits: Cotar Antistes LP only
        """
        self.assertFalse(Metropolitan().allowed(self.char))
        self.assertFalse(Metropolitan() in self.char.allowed_traits())
        self.assertFalse(WordIsLaw().allowed(self.char))
        self.assertFalse(WordIsLaw() in self.char.allowed_traits())
        self.char.add_path( Lifepath(name='Cotar Antistes'))
        self.assertTrue(Metropolitan().allowed(self.char))
        self.assertTrue(Metropolitan() in self.char.allowed_traits())
        self.assertTrue(WordIsLaw().allowed(self.char))
        self.assertTrue(WordIsLaw() in self.char.allowed_traits())
        
    def testOfficer(self):
        """test requirements for Officer trait: Hammer Captain and Vaylen Captain LPs only
        """
        self.assertFalse(Officer().allowed(self.char))
        self.assertFalse(Officer() in self.char.allowed_traits())
        self.char.add_path( Lifepath(name='Hammer Captain'))
        self.assertTrue(Officer().allowed(self.char))
        self.assertTrue(Officer() in self.char.allowed_traits())
        
    def testOwnerAboard(self):
        #The character must purchase a ship as part of his starting resources and must begin with Resources 7 or higher
        pass
    def testPublicServant(self):
        """test requirements for public servant:Civilian Commune or Merchant League Only
        taken once, or "ends with"?
        """
        self.assertFalse(PublicServant().allowed(self.char))
        self.assertFalse(PublicServant() in self.char.allowed_traits())
        self.char.add_path(CommuneLifepath())
        self.assertTrue(PublicServant().allowed(self.char))
        self.assertTrue(PublicServant() in self.char.allowed_traits())
        self.char.remove_path()
        self.assertFalse(PublicServant().allowed(self.char))
        self.assertFalse(PublicServant() in self.char.allowed_traits())
        self.char.add_path(MerchantLeagueLifepath())
        self.assertTrue(PublicServant().allowed(self.char))
        self.assertTrue(PublicServant() in self.char.allowed_traits())
    def testSenator(self):
        """test requirements for Senator trait: Legislative [Official] LP only
        """
        self.assertFalse(Senator().allowed(self.char))
        self.assertFalse(Senator() in self.char.allowed_traits())
        self.char.add_path(Lifepath(name='Legislative Official'))
        self.assertTrue(Senator().allowed(self.char))
        self.assertTrue(Senator() in self.char.allowed_traits())
    def testSlaggah(self):
        """test requirements for Slaggah trait: only for characters with the Artillery or Strategy skills
        Not sure if that's a real requirement
        """
        pass
    def testTough(self):
        """round up calculations for mortal wound
        """
        self.char.buy_power()
        self.char.buy_forte()
        self.assertEquals(self.char.mortal_wound(), 'H7')
        self.assertEquals(self.char.maimed_wound(), 'H5')
        self.char.buy_forte()
        self.assertEquals(self.char.mortal_wound(), 'H7')
        self.assertEquals(self.char.maimed_wound(), 'H5')
        self.char.buy_trait(Tough())
        self.assertEquals(self.char.mortal_wound(), 'H8')
        self.assertEquals(self.char.maimed_wound(), 'H6')
        self.char.buy_forte()
    def testVig(self):
        """test requirements for Vig Trait: Outcast and Criminal LPs only
        """
        self.assertFalse(Vig().allowed(self.char))
        self.assertFalse(Vig() in self.char.allowed_traits())
        self.char.add_path(OutcastLifepath())
        self.assertTrue(Vig().allowed(self.char))
        self.assertTrue(Vig() in self.char.allowed_traits())
Exemplo n.º 12
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)
Exemplo n.º 13
0
class CharacterSkillTests(unittest.TestCase):
    def setUp(self):
        self.c = Character(starting_paths=[Lifepath(born=True, years=1, floater_points=100)])
        self.c.buy_agility(2)
        self.c.buy_speed(2)
        self.c.buy_power(2)
        self.c.buy_forte(2)
        self.c.buy_perception(2)
        self.c.buy_will(2)
    def testBlank(self):
        self.assertEquals(self.c.skill_points(), 0)
        self.assertEquals(self.c.get_skills(), [])
        
    def testCountSkillPoints(self):
        """The first and second times a path is taken, the first untaken skill must be opened
        The third time, this is not the case, but the path only gives half points
        After this, no points are awarded.
        """
        self.assertEquals(self.c.skill_points(), 0)
        self.c.add_path(Lifepath(name = "Path A", skill_points=1))
        self.assertEquals(self.c.skill_points(), 1)
        self.c.add_path(Lifepath(name = "Path B", skill_points=2))
        self.assertEquals(self.c.skill_points(), 3)
        self.c.add_path(Lifepath(name = "Path C", skill_points=1, skills=[skill.Skill(name='Required Skill'), skill.Skill(name='Optional Skill')]))
        self.assertEquals(self.c.skill_points(), 3)
        self.c.add_path(Lifepath(name = "Path B", skill_points=2))
        self.assertEquals(self.c.skill_points(), 5)
        self.c.add_path(Lifepath(name = "Path B", skill_points=2))
        self.assertEquals(self.c.skill_points(), 6)
        self.c.add_path(Lifepath(name = "Path B", skill_points=2))
        self.assertEquals(self.c.skill_points(), 6)
    def testLifepathSkillList(self):
        self.assertEquals(self.c.lifepath_skills(), [])
        self.c.add_path(Lifepath(name = "Path A", skills = [skill.Skill(name='Lifepath Skill')], skill_points=1))
        self.assertTrue(len(self.c.lifepath_skills()), 1)
        
        self.c.add_path(Lifepath(name = "Path B", skills = [skill.Skill(name='Lifepath Skill')], skill_points=1))
        self.assertEquals(len(self.c.lifepath_skills()), 1)
        self.c.add_path(Lifepath(name = "Path C", skills = [skill.Skill(name='New Skill'), skill.Skill(name='Other Skill')], skill_points=1))
        self.assertEquals(len(self.c.lifepath_skills()), 3)
    def testRequiredLPSkills(self):
        self.c.add_path(Lifepath(name = "Path A", skills=[skill.PerceptionRoot(name='Skill on list 1'), skill.AgilityRoot(name='Skill on list 2')], skill_points=1))
        self.assertEquals(len(self.c.lifepath_skills()), 2)
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception']}], self.c.required_skills())
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception'],'points':1}], self.c.get_skills())
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception'],'points':1}], self.c.get_skills())
        #self.assertEquals(len(self.c.get_skills()), 1)
        self.assertEquals(self.c.skill_points(), 0)
        self.c.add_path(Lifepath(name = "Path A", skills=[skill.PerceptionRoot(name='Skill on list 1'), skill.AgilityRoot(name='Skill on list 2')], skill_points=1))
        self.assertEquals(self.c.skill_points(), 0)
        self.assertEquals(len(self.c.lifepath_skills()), 2)
        self.assertTrue({'name':'Skill on list 1','roots':['Perception']} in self.c.required_skills())
        self.assertTrue({'name':'Skill on list 2','roots':['Agility']} in self.c.required_skills())
        self.assertTrue({'name':'Skill on list 1','roots':['Perception'],'points':1} in self.c.get_skills())
        self.assertTrue({'name':'Skill on list 2','roots':['Agility'],'points':1} in self.c.get_skills())
    def testBuySkillNotOnList(self):
        """General points are halved the third time a lifepath is taken, and removed the fourth time.
        """
        # like floater points, general points are always spent last and returned first
        path_g = Lifepath(name ='Path G', general_skill_points=2)
        self.assertRaises(CantAfford, self.c.buy_skill, skill.Skill(name='Skill not on lifepath list'))
        self.c.add_path(Lifepath(skill_points=1))
        self.assertRaises(CantAfford, self.c.buy_skill, skill.PerceptionRoot(name='Skill not on lifepath list'))
        self.c.add_path(path_g)
        self.assertEquals(self.c.general_skill_points(), 2)
        self.c.buy_skill(skill.PerceptionRoot(name='Skill not on lifepath list'))
        self.assertEquals(self.c.skill_points(), 1)
        self.assertEquals(self.c.general_skill_points(), 1)
        self.c.buy_skill(skill.PerceptionRoot(name='Skill not on lifepath list'))
        self.assertEquals(self.c.general_skill_points(), 0)
        self.assertEquals(self.c.skill_points(), 1)
        self.assertRaises(CantAfford, self.c.buy_skill, skill.PerceptionRoot(name='Skill not on lifepath list'))
        self.c.add_path(path_g)
        self.assertEquals(self.c.general_skill_points(), 2)
        self.c.add_path(path_g)
        self.assertEquals(self.c.general_skill_points(), 3)
        self.c.add_path(path_g)
        self.assertEquals(self.c.general_skill_points(), 3)
    def testBuySkillOnList(self):
        self.assertEquals(self.c.get_skills(), [])
        self.c.add_path(Lifepath(name = "Path A", skills=[skill.PerceptionRoot(name='Skill on list 1'), skill.AgilityRoot(name='Skill on list 2')], skill_points=1))
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception'],'points':1}], self.c.get_skills())
        self.assertEquals(self.c.skill_points(), 0)
        self.assertRaises(CantAfford, self.c.buy_skill, skill.PerceptionRoot(name='Skill on list 2'))
        self.c.add_path(Lifepath(name = "Path B", skill_points=2))
        self.assertEquals(self.c.skill_points(), 2)
        self.c.buy_skill(skill.PerceptionRoot(name='Skill on list 1'))
        self.assertEquals(self.c.skill_points(), 1)
        self.assertTrue({'name':'Skill on list 1','roots':['Perception'],'points':2} in self.c.get_skills())
        self.c.buy_skill(skill.PerceptionRoot(name='Skill on list 2'))
        self.assertTrue({'name':'Skill on list 2','roots':['Perception'],'points':1} in self.c.get_skills())
        self.assertEquals(self.c.skill_points(), 0)
    def testSkillExponent(self):
        self.assertEquals(self.c.skill_totals(), [])
        self.c.bought_skills = [{'name':'Skill on list 1','roots':['Perception'],'points':1}]
        self.assertEquals(self.c.skill_totals(), [{'name':'Skill on list 1', 'exponent':1}])
        self.c.bought_skills = [{'name':'Skill on list 1','roots':['Perception'],'points':3}]
        self.assertEquals(self.c.skill_totals(), [{'name':'Skill on list 1', 'exponent':3}])
        self.c.perception += 1
        self.assertEquals(self.c.skill_totals(), [{'name':'Skill on list 1', 'exponent':3}])
        self.c.perception += 1
        self.assertEquals(self.c.skill_totals(), [{'name':'Skill on list 1', 'exponent':4}])
        self.c.bought_skills = [{'name':'Skill on list 1','roots':['Perception', 'Will'],'points':3}]
        self.assertEquals(self.c.skill_totals(), [{'name':'Skill on list 1', 'exponent':3}])
    def testRemoveSkills(self):
        skill_one = skill.PerceptionRoot(name='Skill on list 1')
        skill_two = skill.AgilityRoot(name='Skill on list 2')
        self.c.add_path(Lifepath(name = "Path A", skills=[skill_one, skill_two], skill_points=2))
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception'],'points':1}], self.c.get_skills())
        
        self.assertRaises(Exception, self.c.remove_skill, skill_one)
        self.assertEquals(self.c.skill_points(), 1)
        self.c.buy_skill(skill_two)
        self.assertEquals(self.c.skill_points(), 0)
        self.assertTrue({'name':'Skill on list 2','roots':['Agility'],'points':1} in self.c.get_skills())
        self.c.remove_skill(skill_two)
        self.assertEquals([{'name':'Skill on list 1','roots':['Perception'],'points':1}], self.c.get_skills())
        self.assertEquals(self.c.skill_points(), 1)
        self.c.buy_skill(skill_two)
        self.c.add_path(Lifepath(name='Path G', general_skill_points = 1))
        self.assertEquals(self.c.general_skill_points(), 1)
        self.assertEquals(self.c.skill_points(), 0)
        self.c.buy_skill(skill_two)
        self.assertEquals(self.c.general_skill_points(), 0)
        self.assertEquals(self.c.skill_points(), 0)
        self.c.remove_skill(skill_two)
        self.assertEquals(self.c.general_skill_points(), 1)
        self.assertEquals(self.c.skill_points(), 0)
    def testRemovePath(self):
        pass