示例#1
0
 def setUp(self):
     """ Build the Attack Action """
     attack = AttackFactory.getAttackAsNew("TACKLE")
     self.priority = attack.speedDelegate.priority
     attack.use = self.use
     self.action = AttackAction(attack, None, None, None)
     self.usedAttack = False
示例#2
0
def BuildAttackAction(user=BuildPokemonBattleWrapper(),
                      target=BuildPokemonBattleWrapper(),
                      attack="TACKLE"):
    """ Builds an Attack Action """
    attack = BuildAttack(attack=attack)
    environment = BattleEnvironment()
    return AttackAction(attack, user, target, environment)
 def  setUp(self):
     """ Build the Attack Action """
     attack = AttackFactory.getAttackAsNew("TACKLE")
     self.priority = attack.speedDelegate.priority
     attack.use = self.use
     self.action = AttackAction(attack, None, None, None)
     self.usedAttack = False
示例#4
0
class doAction(unittest.TestCase):
    """ Test cases of doAction """
    def setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        attack.use = self.use
        self.action = AttackAction(attack, None, None, None)
        self.usedAttack = False

    def attackUsed(self):
        """ Test that the wrapped attack is used """
        self.action.doAction()
        assert self.usedAttack, "Should have used the Action's Attack"

    def use(self, user, target, environment):
        self.usedAttack = True
class doAction(unittest.TestCase):
    """ Test cases of doAction """
    
    def  setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        attack.use = self.use
        self.action = AttackAction(attack, None, None, None)
        self.usedAttack = False
        
    def attackUsed(self):
        """ Test that the wrapped attack is used """
        self.action.doAction()
        assert self.usedAttack, "Should have used the Action's Attack"
        
    def use(self, user, target, environment):
        self.usedAttack = True
示例#6
0
 def setAction(self, entry):
     """ Set the Chosen Action """
     if entry.getAttack().currPowerPoints == 0:
         self.runController(
             MessageBoxController(
                 BattleMessage("No PP left for this attack."), self.screen))
     else:
         self.action = AttackAction(entry.getAttack(), self.pokemon,
                                    self.targets[0], self.environment)
         self.stopRunning()
示例#7
0
class getPriority(unittest.TestCase):
    """ Test cases of getPriority """
    def setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        self.action = AttackAction(attack, None, None, None)

    def priorityIsCorrect(self):
        """ Test that the priority is returned correctly """
        assert self.action.getPriority(
        ) == self.priority, "Priority should be the priority of the attack provided"
class getPriority(unittest.TestCase):
    """ Test cases of getPriority """
    
    def  setUp(self):
        """ Build the Attack Action """
        attack = AttackFactory.getAttackAsNew("TACKLE")
        self.priority = attack.speedDelegate.priority
        self.action = AttackAction(attack, None, None, None)
        
    def priorityIsCorrect(self):
        """ Test that the priority is returned correctly """
        assert self.action.getPriority() == self.priority, "Priority should be the priority of the attack provided"
示例#9
0
 def setAction(self, entry):
     """ Set the Chosen Action """
     self.action = AttackAction(entry.getAttack(), self.pokemon,
                                self.targets[0], self.battle.environment)
     self.stopRunning()
示例#10
0
 def setUp(self):
     """ Build action for the test"""
     attack = AttackFactory.getAttackAsNew("TACKLE")
     self.action = AttackAction(attack, None, None, None)
     self.turns = 2
     self.actionLock = ActionLock(self, self.action, self.turns)
示例#11
0
 def setAction(self, entry):
     """ Set the Attack Action """
     self.action = AttackAction(entry.getAttack(), self.pkmn,
                                self.targets[0], self.environment)
示例#12
0
 def pickAction(self, user, targets, playerSide, oppSide, environment):
     """ Has the trainer pick its action via the screen
          Should be overwritten in subclasses """
     return AttackAction(None, None, None, None)