예제 #1
0
 def setUp(self):
     """ Builds the Pkmn and the Leech Effect """
     self.pkmn = BuildPokemonBattleWrapper()
     
     self.message = " hurt."
     self.pkmn2 = BuildPokemonBattleWrapper()
     self.leech = Leech(self.pkmn2, self.message)
예제 #2
0
 def applyEffect(self, user, target, environment):
     """ Apply the Leech to the target """
     leech = Leech(user, self.message)
     
     if not leech.immune(target.getTypes(), self.type):
         self.removePreviousLeech(target)
         
         target.secondaryEffects.append(leech)
         return [target.getHeader() + self.startMessage]
예제 #3
0
    def setUp(self):
        """ Builds the Pkmn and the Leech Effect """
        self.pkmn = BuildPokemonBattleWrapper()

        self.message = " hurt."
        self.pkmn2 = BuildPokemonBattleWrapper()
        self.leech = Leech(self.pkmn2, self.message)
예제 #4
0
class afterTurn(unittest.TestCase):
    """ Test that afterTurn returns correctly """
    
    def setUp(self):
        """ Builds the Pkmn and the Leech Effect """
        self.pkmn = BuildPokemonBattleWrapper()
        
        self.message = " hurt."
        self.pkmn2 = BuildPokemonBattleWrapper()
        self.leech = Leech(self.pkmn2, self.message)
        
    def message(self):
        """ Test the message is correct """
        message = self.leech.afterTurn(self.pkmn)
        assert message == [self.pkmn.getHeader() + self.message], "Message should be the pokemon's name and the message given to the Leech."
        
    def faint(self):
        """ Test that the messsages returned when the target faints """
        self.pkmn.setCurrHP(self.leech.getAmount(self.pkmn))
        messages = self.leech.afterTurn(self.pkmn)
        assert len(messages) == 2, "Should have 2 messages"
        assert messages[1] == self.pkmn.getHeader() + Faint.start, "Should have a faint message."
예제 #5
0
class afterTurn(unittest.TestCase):
    """ Test that afterTurn returns correctly """

    def setUp(self):
        """ Builds the Pkmn and the Leech Effect """
        self.pkmn = BuildPokemonBattleWrapper()

        self.message = " hurt."
        self.pkmn2 = BuildPokemonBattleWrapper()
        self.leech = Leech(self.pkmn2, self.message)

    def message(self):
        """ Test the message is correct """
        message = self.leech.afterTurn(self.pkmn)
        assert message == [
            self.pkmn.getHeader() + self.message
        ], "Message should be the pokemon's name and the message given to the Leech."

    def faint(self):
        """ Test that the messsages returned when the target faints """
        self.pkmn.setCurrHP(self.leech.getAmount(self.pkmn))
        messages = self.leech.afterTurn(self.pkmn)
        assert len(messages) == 2, "Should have 2 messages"
        assert messages[1] == self.pkmn.getHeader() + Faint.start, "Should have a faint message."
예제 #6
0
class getAmount(unittest.TestCase):
    """ Test that getAmount returns the right amount to heal """

    def setUp(self):
        """ Builds the Pkmn and Leech """
        self.pkmn = BuildPokemonBattleWrapper()
        self.pkmn2 = BuildPokemonBattleWrapper()
        self.leech = Leech(self.pkmn2, "")
        self.hp = 32

    def amount(self):
        """ Test the heal returns the proper ratio """
        self.pkmn.setStat("HP", self.hp)
        amount = self.leech.getAmount(self.pkmn)
        assert amount == self.hp / Leech.ratio, "Amount should be a sixteenth of the targets health"
예제 #7
0
class getAmount(unittest.TestCase):
    """ Test that getAmount returns the right amount to heal """
    
    def setUp(self):
        """ Builds the Pkmn and Leech """
        self.pkmn = BuildPokemonBattleWrapper()
        self.pkmn2 = BuildPokemonBattleWrapper()
        self.leech = Leech(self.pkmn2, "")
        self.hp = 32
    
    def amount(self):
        """ Test the heal returns the proper ratio """
        self.pkmn.setStat("HP", self.hp)
        amount = self.leech.getAmount(self.pkmn)
        assert amount == self.hp/Leech.ratio, "Amount should be a sixteenth of the targets health"
예제 #8
0
 def setUp(self):
     """ Builds the Pkmn and Leech """
     self.pkmn = BuildPokemonBattleWrapper()
     self.pkmn2 = BuildPokemonBattleWrapper()
     self.leech = Leech(self.pkmn2, "")
     self.hp = 32
예제 #9
0
 def setUp(self):
     """ Builds the delegate and pkmn for use in the tests """
     self.wrapper = BuildPokemonBattleWrapper()
     self.delegate = LeechDelegate("", "", "FIRE")
     self.leech = Leech(None, "")
     self.otherLeech = Leech(None, "other.")
예제 #10
0
 def setUp(self):
     """ Builds the Pkmn and Leech """
     self.pkmn = BuildPokemonBattleWrapper()
     self.pkmn2 = BuildPokemonBattleWrapper()
     self.leech = Leech(self.pkmn2, "")
     self.hp = 32