예제 #1
0
def getPetCostFromSeed(seed, safezoneId):
    name, dna, traitSeed = getPetInfoFromSeed(seed, safezoneId)
    traits = PetTraits.PetTraits(traitSeed, safezoneId)
    traitValue = traits.getOverallValue()

    #hack val so we have more '200' jelly bean pets
    traitValue -= 0.3
    traitValue = max(0, traitValue)  #clamp to 0
    """ TRAITFIX -- replace traitValue calculation with:
    traitValue = (traitValue - .3) / .7
    traitValue = PythonUtil.clampScalar(traitValue, 0., 1.)
    """

    # DNA rarity is in the range 0(rare) to 1(common)
    rarity = PetDNA.getRarity(dna)

    # traitValue is in the range 0(worthless) to 1(valuable)
    rarity *= (1.0 - traitValue)

    #this will give us a nice curve between .999(rare) and 0(common)
    rarity = pow(0.001, rarity) - 0.001

    minCost, maxCost = PetConstants.ZoneToCostRange[safezoneId]

    # scale this between min and max cost
    cost = (rarity * (maxCost - minCost)) + minCost

    cost = int(cost)

    return (cost)
예제 #2
0
def getPetCostFromSeed(seed, safezoneId):
    name, dna, traitSeed = getPetInfoFromSeed(seed, safezoneId)
    traits = PetTraits.PetTraits(traitSeed, safezoneId)
    traitValue = traits.getOverallValue()
    traitValue -= 0.3
    traitValue = max(0, traitValue)
    rarity = PetDNA.getRarity(dna)
    rarity *= 1.0 - traitValue
    rarity = pow(0.001, rarity) - 0.001
    minCost, maxCost = PetConstants.ZoneToCostRange[safezoneId]
    cost = rarity * (maxCost - minCost) + minCost
    cost = int(cost)
    return cost
예제 #3
0
def getPetCostFromSeed(seed, safezoneId):
    name, dna, traitSeed = getPetInfoFromSeed(seed, safezoneId)
    traits = PetTraits.PetTraits(traitSeed, safezoneId)
    traitValue = traits.getOverallValue()
    traitValue -= 0.3
    traitValue = max(0, traitValue)
    rarity = PetDNA.getRarity(dna)
    rarity *= 1.0 - traitValue
    rarity = pow(0.001, rarity) - 0.001
    minCost, maxCost = PetConstants.ZoneToCostRange[safezoneId]
    cost = rarity * (maxCost - minCost) + minCost
    cost = int(cost)
    return cost