예제 #1
0
    def immobilized(self, pkmn):
        """ Returns whether the status prevents an action """
        messages = [pkmn.getHeader() + Freeze.intermittent]

        if self.thawed(self.getRandom()):
            messages = messages + self.getDoneMessage(pkmn)
            pkmn.currPokemon.setStatus(Status())

        return True, messages
예제 #2
0
    def notImmune(self):
        """ Test an effect that is not immune returns correctly  """
        status = Status()
        self.pkmn.setStatus(status)

        effect = ApplyStatusDelegate(self.parent, "PAR", 1)
        self.buildDelegate(effect)
        assert not self.delegate.immune(self.pkmn,
                                        None), "Should not be immune"
    def setUp(self):
        """ Builds the ability and Pkmn for use in the tests """
        self.battlePkmn = BuildPokemonBattleWrapper()
        self.status = Paralysis()
        self.status2 = Status()
        self.stat = "ATK"
        self.mod = 1.5

        self.ability = StatModOnStatusAbility("", self.stat, self.mod)
예제 #4
0
class getStatMod(unittest.TestCase):
    """ Test that statMod returns the correct values for all stats """
    def setUp(self):
        """ Builds the Status object"""
        self.status = Status()

    def checkStatMods(self):
        """ Test that stat modifiers are correct for generic status """
        for key in self.status.statMods:
            assert self.status.getStatMod(key) == 1, "All stats should be 1"
예제 #5
0
class immune(unittest.TestCase):
    """ Test that immune returns correctly """
    def setUp(self):
        """ Builds the status"""
        self.status = Status()
            
    def notImmune(self):
        """ Test if it can correctly identify when the target is not immune """
        types = ["ELECTRIC"]
        other = "FIRE"
        assert not self.status.immune(types, other), "Should never be immune."
예제 #6
0
class immune(unittest.TestCase):
    """ Test that immune returns correctly """
    def setUp(self):
        """ Builds the status"""
        self.status = Status()

    def notImmune(self):
        """ Test if it can correctly identify when the target is not immune """
        types = ["ELECTRIC"]
        other = "FIRE"
        assert not self.status.immune(types, other), "Should never be immune."
예제 #7
0
class getStatMod(unittest.TestCase):
    """ Test that statMod returns the correct values for all stats """
    
    def setUp(self):
        """ Builds the Status object"""
        self.status = Status()
    
    def checkStatMods(self):
        """ Test that stat modifiers are correct for generic status """
        for key in self.status.statMods:
            assert self.status.getStatMod(key) == 1, "All stats should be 1"
예제 #8
0
    def immobilized(self, pkmn):
        """ Returns whether the status prevents an action """
        messages = [pkmn.getHeader() + Sleep.intermittent]

        if self.turns == 0:
            messages = messages + self.getDoneMessage(pkmn)
            pkmn.pkmn.setStatus(Status())
            return False, messages

        self.turns = self.turns - 1

        return True, messages
    def loadFromXML(parent, tree):
        """  Build a Pokemon's Battle Information """
        delegate = PokemonBattleDelegate()
        
        # Set parent
        delegate.parent = parent
    
        # Get current HP
        delegate.parent.stats.currentHP = int(tree.find(Tags.currHPTag).text)
    
        # Read attacks
        delegate.attacks = []
        attacksTree = tree.find(Tags.attacksTag)
        for attack in attacksTree.getiterator(Tags.attackTag):
             delegate.attacks.append(AttackFactory.loadFromPkmnXML(attack))
        
        # Status
        delegate.status = Status()

        return delegate
 def buildStarter(parent):
     """ Builds a BattleDelegate for a Starter Pokemon """
     delegate = PokemonBattleDelegate()
     
     # Set parent
     delegate.parent = parent
 
     # Get common info from Pokedex 
     # PokemonBattleDelegateFactory.loadPokedexBattleInfo(delegate, parent.species)
 
     # Set currHP to full
     delegate.currHP = delegate.stats["HP"]
 
     # Load attacks
     delegate.attacks = []
     
     # Status
     delegate.status = Status()
 
     return delegate
예제 #11
0
    def noStatus(self):
        """ Test that damage is core when the target has no status """
        self.target.setStatus(Status())
        damage = self.delegate.coreDamage(self.user, self.target)

        assert damage == self.core, "Damage should be the core when target has no status"
예제 #12
0
 def setUp(self):
     """ Builds the Status object"""
     self.status = Status()
예제 #13
0
 def setUp(self):
     """ Builds the status"""
     self.status = Status()
예제 #14
0
 def setUp(self):
     """ Builds the status"""
     self.status = Status()
예제 #15
0
 def hasNoStatusAlready(self):
     """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
     self.pkmn.setStatus(Status())
     assert not self.delegate.checkStatusAlready(
         self.pkmn), "Should not have a status already"
예제 #16
0
 def cureStatus(self, pkmn):
     """ Cures the status from the given pokemon """
     status = pkmn.getStatus()
     messages = status.getDoneMessage(pkmn)
     pkmn.setStatus(Status())
     return messages
예제 #17
0
 def setUp(self):
     """ Builds the Status object"""
     self.status = Status()