def buildStarter(speciesName): """ Creates a Pokemon with Starter stats """ name = speciesName species = SpeciesFactory.getSpecies(speciesName) level = 5 pkmn = Pokemon(name, level, species) pkmn.id = "" pkmn.ability = Ability(None) pkmn.battleDelegate = PokemonBattleDelegateFactory.buildStarter(pkmn) pkmn.displayDelegate = PokemonDisplayDelegateFactory.buildStarter(species) # pkmn.experienceDelegate = ExperienceDelegateFactory.loadFromXML(pkmn, tree) return pkmn
def loadFromXML(tree): """ Loads a Pokemon object from a file """ name = tree.findtext(Tags.nameTag) speciesName = tree.findtext(Tags.speciesTag) species = SpeciesFactory.getSpecies(speciesName) level = int(tree.findtext(Tags.levelTag)) pkmn = Pokemon(name, level, species) pkmn.id = "" pkmn.ability = AbilityFactory.loadFromPkmnXML(tree.find(Tags.abilityTag).text) pkmn.battleDelegate = PokemonBattleDelegateFactory.loadFromXML(pkmn, tree) pkmn.displayDelegate = PokemonDisplayDelegateFactory.loadFromXML(tree.find(Tags.displayTag), pkmn) pkmn.experienceDelegate = ExperienceDelegateFactory.loadFromXML(pkmn, tree) return pkmn