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 BuildAttackAction(user=BuildPokemonBattleWrapper(), target=BuildPokemonBattleWrapper(), attack="TACKLE"): """ Builds an Attack Action """ attack = BuildAttack(attack=attack) environment = BattleEnvironment() return AttackAction(attack, user, target, environment)
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
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()
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"
def setAction(self, entry): """ Set the Chosen Action """ self.action = AttackAction(entry.getAttack(), self.pokemon, self.targets[0], self.battle.environment) self.stopRunning()
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)
def setAction(self, entry): """ Set the Attack Action """ self.action = AttackAction(entry.getAttack(), self.pkmn, self.targets[0], self.environment)
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)