示例#1
0
    def checkBase(self):
        """ Test that base affect the crit chance correctly """
        self.pkmn.statMods["CRT"] = 0

        for base in range(0, len(CritDelegate.critMods)):
            crit = CritDelegate(base)
            chance = crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[
                base], "The Crit Delegate's base should get the corresponding crit chance"
示例#2
0
    def checkMods(self):
        """ Test that mods affect the crit chance correctly """
        self.crit = CritDelegate(0)

        for mod in range(0, len(CritDelegate.critMods)):
            self.pkmn.statMods["CRT"] = mod
            chance = self.crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[
                mod], "The Pkmn's crit mod should get the corresponding crit chance"
示例#3
0
    def checkBaseAndMod(self):
        """ Test that base and mod compound correctly """
        base = 2
        mod = 2

        self.crit = CritDelegate(base)
        self.pkmn.statMods["CRT"] = mod
        chance = self.crit.getCritChance(self.pkmn)
        assert chance == CritDelegate.critMods[
            base +
            mod], "The base and mod should compound to get the crit chance"
示例#4
0
    def loadFromDB(cursor, parent):
        """ Loads an attack Crit Delegate from a Database """
        type, id = CritDelegateFactory.GetTypeAndID(cursor, parent.name)

        if type == "CORE":
            cursor.execute("SELECT base from CoreCritDelegate where id=?",
                           (id, ))
            base = cursor.fetchone()[0]
            return CritDelegate(base)

        cursor.close()
示例#5
0
 def setUp(self):
     """ Build the CritDelegate and Pkmn for the test """
     self.pkmn = BuildPokemonBattleWrapper()
     self.crit = CritDelegate(0)
示例#6
0
 def setUp(self):
     """ Build the CritDelegate and Pkmn for the test """
     self.crit = CritDelegate(0)
示例#7
0
 def buildCritDelegate(element):
     """ Builds a critDelegate for the damageDelegate """
     delegate = element.find(Tags.critDelegateTag)
     base = int(delegate.find(Tags.baseTag).text)
     return CritDelegate(base)
示例#8
0
 def buildNull():
     """ Returns a Null crit delegate """
     return CritDelegate(0)