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
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)
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"
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."
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
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"
def setUp(self): """ Builds the Status object""" self.status = Status()
def setUp(self): """ Builds the status""" self.status = Status()
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"
def cureStatus(self, pkmn): """ Cures the status from the given pokemon """ status = pkmn.getStatus() messages = status.getDoneMessage(pkmn) pkmn.setStatus(Status()) return messages