Ejemplo n.º 1
0
 def equipmentUpgradeCost(self,nowLevel,tolevel,game_level):
     totalCost = 0
     if game_level < 1:
         game_level = 1
     if game_level > 1000:
         game_level = 1000
     levelConstInfo = levelTable.getItem(game_level)
     levelAddCost = levelConstInfo.eqmUpgradeAddCost
     for nexLevel in range(nowLevel + 1,tolevel +1):
         equipmentLevelUpInfo = equipmentUpgradeTable.getEuipmentLevelUpInfo(nexLevel)
         baseCost = equipmentLevelUpInfo.baseCost
         nextLevelCost = baseCost * levelAddCost
         totalCost += nextLevelCost
     return totalCost
Ejemplo n.º 2
0
    def upGradeToLevel(self,quality,level,buffs):
        tolevel30  = (quality - 1) * 10 + level
        nowLevel30 = (self.equipment_quality -1) * 10 + self.equipment_level
        distanceLevel = tolevel30 - nowLevel30

        if distanceLevel < 0:
            return  True
        elif distanceLevel == 0:
            self.equipment_quality = quality
            self.equipment_level = level
            return  True

        equipmentUpgradeConstInfo = equipmentUpgradeTable.getEuipmentLevelUpInfo(tolevel30)
        buffAdd = equipmentUpgradeConstInfo.buffAdd
        times = (1 + buffAdd)

        times += 0.5# rong cuo

        for buff in buffs:
            buffType = buff.get('bufType')
            buffToValue = buff.get('bufValue')
            nowValue = self.getBuffBaseValue(buffType)
            if nowValue == 0:
                return False
            if buffToValue > nowValue * times:
                return False

        for equipmentBuf in self.bufList:
            buffType = equipmentBuf.bufType
            newValue = equipmentBuf.bufValue
            for buff in buffs:
                if buff.get('bufType') == buffType:
                    newValue = buff.get('bufValue')
            equipmentBuf.bufValue = newValue
        self.equipment_quality = quality
        self.equipment_level = level
        return  True