def skillUpgrade(self,skill_id,to_level): heroLevel = 0 for skill in self.skills: if skill.skillID == 0: heroLevel = skill.skillLevel break for skill in self.skills: if skill.skillID == skill_id: if skill.skillLevel >= to_level: return None else: cost = 0 if skill_id == 0: for level in range(skill.skillLevel +1, to_level + 1): cost += heroUpgradeTable.getHeroUpgradeInfo(level).cost else: searchLevel = to_level # skillInfo = heroSkillTableManager.getHeroSkill(skill.skillID,searchLevel) # unlockLevel = skillInfo.unlock_level # if heroLevel < unlockLevel: # return ErrorCode.notunlocknow cost = 0 for level in range(skill.skillLevel +1, to_level + 1): if skill_id != 7: cost += heroSkillTableManager.getHeroSkill(skill_id,level).upcost if self.costResource(ResourceType.cash,cost): skill.skillLevel = to_level #ok pass break else: return (1111,"nowLevel:%s toLevel:%s own:%s need:%s"%(skill.skillLevel,to_level,self.cash,cost)) for skill in self.skills: if skill.skillID == skill_id: skill.skillLevel = to_level if skill_id == 7: self.relife() return None return None
def GetHeroDPS(self): level = self.getSkillInfo(0).skillLevel heroInfo = heroTable.GetHeroInfoByid(50000) heroDPS = heroUpgradeTable.getHeroUpgradeInfo(level).effValue heroDPS *= heroInfo.propmodify return heroDPS