def loadFromPokemonFile(file): """ Load an attack as saved within a Pokemon instance in a file """ attack = Attack() attackdex = AttackFactory.getAttackdexTree() attack.name = file.readline().strip() temp = "" while (temp.find(attack.name) == -1): """ Read the file until you find the species we need """ temp = attackdex.readline().strip() attack.type = attackdex.readline().strip() #Load delegates attack.hitDelegate = HitDelegateFactory.loadFromAttackDex(attackdex, attack) attack.damageDelegate = DamageDelegateFactory.loadFromAttackDex(attackdex, attack) attack.effectDelegate = EffectDelegateFactory.loadFromAttackDex(attackdex) # Get currPP and PP from file values = file.readline().strip().split(" ") attack.powerPoints = int(values[0]) attack.currPowerPoints = int(values[1]) attackdex.close() return attack