Beispiel #1
0
def GetQuestItem(seed, daysPlayed, recipesKnown=1, mineFloor=0):
    random = Cs(seed + daysPlayed)
    random.Sample()  # Selecting person
    season = (daysPlayed - 1) // 28 % 4
    if season != 3 and random.Sample() < 0.15:
        possibleCrops = GetPossibleCrops(season,
                                         ((daysPlayed - 1) % 28) + 1 <= 7)
        return possibleCrops[random.Next(len(possibleCrops))]
    return SeedUtility.randomItemFromSeason(seed, daysPlayed, 1000, False,
                                            True, recipesKnown, mineFloor)
Beispiel #2
0
def unusualDarkFloor(seed, daysPlayed, level):
    if level % 10 == 0:
        return False
    if level % 40 > 30:
        return False
    rand = CSRandomLite(daysPlayed * level + 4 * level + int(seed / 2))
    if rand.Sample() < 0.3 and level > 2:
        return True
    if rand.Sample() < 0.15 and level > 5 and not level == 120:
        return True
    return False
Beispiel #3
0
def isEvent(seed):
    rand = CSRandomLite(seed)
    if rand.Sample() < 0.01:
        return 0
    if rand.Sample() < 0.01:
        return 0
    if rand.Sample() < 0.01:
        return 0
    if rand.Sample() < 0.01:
        return 1
    if rand.Sample() < 0.01:
        return 2
    return 0
Beispiel #4
0
def totalHarvest(seed, chanceForExtra, level=0, fert=0):
    num1 = 1
    rand = CSRandomLite(seed)
    num3 = 0.2 * (level / 10.0) + 0.2 * fert * ((level + 2.0) / 12.0) + 0.01
    if rand.Sample() >= num3:
        rand.Sample()  #crop quality
    if False:
        rand.Sample()  #TODO: min/max harvest
    if chanceForExtra > 0:
        while rand.Sample() < chanceForExtra:
            num1 = num1 + 1
    if rand.Sample() < 9.99999974737875E-05:
        num1 = num1 * 2

    return num1
Beispiel #5
0
def nightEvent(seed, daysPlayed):
    #Night events are based on the new day
    if daysPlayed == 32:
        return None
    rand = CSRandomLite(int(seed / 2) + daysPlayed)
    if rand.Sample() < 0.01:
        if (daysPlayed - 1) // 28 % 4 != 3:
            return "Fairy"
    if rand.Sample() < 0.01:
        return "Witch"
    if rand.Sample() < 0.01:
        return "Meteor"
    if rand.Sample() < 0.01:
        if daysPlayed > 28 * 4:
            return "UFO"
    if rand.Sample() < 0.01:
        return "Owl"
Beispiel #6
0
def dishOfTheDay(seed, daysPlayed, steps, rand=None):
    #random is initialised before daysPlayed is incremented
    localDaysPlayed = daysPlayed - 1
    if rand == None:
        rand = CSRandomLite(int(seed / 100) + localDaysPlayed * 10 + 1 + steps)
    dayOfMonth = ((localDaysPlayed - 1) % 28) + 1
    #  for index in range(100):
    #      print( str( min(.10, rand.Next(-100, 101) / 1000) ) )
    for index in range(dayOfMonth):
        rand.Sample()
    dish = rand.Next(194, 240)
    while dish in {346, 196, 216, 224, 206, 395, 217}:
        dish = rand.Next(194, 240)
    #Dish additional number
    number = rand.Next(1, 4 + 10 if rand.Sample() < 0.08 else 0)
    #Dish number
    rand.Sample()
    #Object constructor
    return dish, number
Beispiel #7
0
def harvest_quality(gameID, dayNumber, fLevel, xTile, yTile, fertilizer=None):
    number = 1
    quality = 0
    num3 = 0
    if fertilizer != None:
        if fertilizer == 'Basic':
            num3 = 1
        elif fertilizer == 'Quality':
            num3 = 2

    rand = CSRandomLite(xTile * 7 + yTile * 11 + gameID + dayNumber)
    num4 = 0.2 * (fLevel / 10.0) + 0.2 * num3 * (fLevel + 2.0) / 12.0 + 0.01
    num5 = min(0.75, num4 * 2.0)
    if rand.Sample() < num4:
        quality = 2
    elif rand.Sample() < num5:
        quality = 1

    return quality
Beispiel #8
0
def dailyLuck(seed, daysPlayed, steps, rand=None):
    if rand == None:
        #random is initialised before daysPlayed is incremented
        rand = CSRandomLite(
            int(seed / 100) + (daysPlayed - 1) * 10 + 1 + steps)
        dishOfTheDay(seed, daysPlayed, steps, rand)

    #rand.Sample(); #Friendship
    #rand.Sample(); #Friendship mail
    rand.Sample()
    #Rarecrow society
    return min(.10, rand.Next(-100, 101) / 1000)
Beispiel #9
0
def monsterFloor(seed, daysPlayed, level):
    if level % 5 == 0:
        return False
    if level % 40 < 5:
        return False
    if level % 40 > 30:
        return False
    if level % 40 == 19:
        return False

    rand = CSRandomLite(int(seed / 2) + daysPlayed + level * 100)
    return rand.Sample() < 0.044
def checkTrash(gameID,day,index,x,y,furnace=False, luck=0.2):
	rand = CSRandomLite(gameID//2 + day + 777 + index)
	if rand.Sample() < luck:
		r = rand.Next(10)
		if r == 6:
			ps = randomItemFromSeason(gameID, day, x*653+y*777, furnace)
		elif r == 8:
			ps = 309 + rand.Next(3)
		else:	
			ps = { 0 : 168,
					 1 : 167,
					 2 : 170,
					 3 : 171,
					 4 : 172,
					 5 : 216,
					 7 : 403,
					 9 : 153
					}[r]
		if index == 3 and rand.Sample() < luck:
			ps = 535
			if rand.Sample() < 0.05:
				ps = 749
		if index == 4 and rand.Sample() < luck:
			ps = 378 + rand.Next(3)*2
		if index == 5 and rand.Sample() < luck:
			ps = 196 # meals are complicated
			return 'DishOfTheDay'
		if index == 6 and rand.Sample() < luck:
			ps = 223
		return ObjectInfo[ps].split('/')[0]
	return None
def getTravelingMerchantStock(item_data, gameID, dayNumber):
    rand = CSRandom(gameID+dayNumber)
    stock = {}
    for i in range(10):
        index = rand.Next(2, 790)
        while True:
            index = (index+1) % 790
            item = item_data.get(str(index))
            if item is None or not item_validity_check(item):
                continue
            break
        stock[item['name']] = max(rand.Next(1,11)*100, item['price']*rand.Next(3,6))
        count = 1 if (rand.Sample() > 0.1) else 5
    return stock
Beispiel #12
0
def checkMinesSpot(seed, ladder=False):
    objects = []
    r = CSRandomLite(seed)
    r.Sample()
    if not ladder:
        r.Sample()
    if r.Sample() < 0.022:
        objects.extend([535])
    if r.Sample() < 0.005:
        objects.extend([749])
    if r.Sample() < 0.05:
        r.Sample()
        r.Sample()
        if r.Sample() < 0.25:
            objects.extend([382])
        if r.Sample() < 0.1:
            objects.extend([380])
        else:
            objects.extend([378])

    return objects
Beispiel #13
0
def nextGeodeItem(seed,
                  geodesCracked,
                  geodeType,
                  deepestMineLevel=0,
                  version="1.4"):

    rand = CSRandomLite(geodesCracked + int(seed / 2))

    if version == "1.4" or version == "1.5":
        num1 = rand.Next(1, 10)
        for index in range(num1):
            rand.Sample()
        num2 = rand.Next(1, 10)
        for index in range(num2):
            rand.Sample()

    if version == "1.5":
        rand.Sample()  #QI beans

    if rand.Sample() < 0.5:
        initialStack = rand.Next(3) * 2 + 1
        if rand.Sample() < 0.1:
            initialStack = 10
        if rand.Sample() < 0.01:
            initialStack = 20
        if rand.Sample() < 0.5:
            case = rand.Next(4)
            if case == 0 or case == 1:
                return (390, initialStack)
            elif case == 2:
                return (330, 1)
            else:
                if geodeType == "Geode":
                    return (86, 1)
                if geodeType == "Frozen":
                    return (84, 1)
                if geodeType == "Magma":
                    return (82, 1)
                if geodeType == "Omni":
                    return (82 + rand.Next(3) * 2, 1)
def getNumTreasureFromGeode(uniqueIDForThisGame, geode_number, geode_type):
    random = CSRandomLite(geode_number + (uniqueIDForThisGame // 2))
    num = None
    sheet_index = {0:535, 1:536, 2:537, 3: 749}[geode_type]
    if random.Sample() < 0.5:
        num = int(random.Next(3)) * 2 + 1
        if random.Sample() < 0.1:
            num = 10
        if random.Sample() < 0.01:
            num = 20
        if random.Sample() < 0.5:
            r = random.Next(4)
            if r == 0 or r == 1:
                return ObjectInfo[390], num # stone
            if r == 2:
                return ObjectInfo[330], 1 # clay
            if r == 3:
                if sheet_index == 535:
                    return ObjectInfo[86], 1 # earth crystal
                elif sheet_index == 536:
                    return ObjectInfo[84], 1 # frozen tear
                elif sheet_index ==537:
                    return ObjectInfo[82], 1 # fire quartz
                return ObjectInfo[82+ random.Next(3)*2], 1
        elif sheet_index == 535:
            num2 = random.Next(3)
            if num2 == 0:
                return ObjectInfo[378], num # copper ore
            if num2 == 1: # assumes that the person is beyond floor 25 in the mines
                return ObjectInfo[380], num # iron ore
            if num2 == 2:
                return ObjectInfo[382], num # coal
        elif sheet_index == 536:
            r = random.Next(4)
            if r == 0:
                return ObjectInfo[378], num # copper ore
            elif r == 1:
                return ObjectInfo[380], num # iron ore
            elif r == 2:
                return ObjectInfo[382], num # coal
            else:
                return ObjectInfo[384], num # gold ore
        else:
            r = random.Next(5)
            if r == 0:
                return ObjectInfo[378], num # copper ore
            elif r == 1:
                return ObjectInfo[380], num # iron ore
            elif r == 2:
                return ObjectInfo[382], num # coal
            elif r == 3:
                return ObjectInfo[384], num # gold ore
            else:
                return ObjectInfo[386], int(num/2) + 1# iridium ore
    else:
        geode_items = [538,542,548,549,552,555,556,557,558,566,568,569,571,574,576,121]
        frozen_items = [541,544,545,546,550,551,559,560,561,564,567,572,573,577,123]
        magma_items = [539,540,543,547,553,554,562,563,565,570,575,578,122]
        omni_items = [538,542,548,549,552,555,556,557,558,566,568,569,571,574,576,541,544,545,546,550,551,559,560,561,564,567,572,573,577,539,540,543,547,553,554,562,563,565,570,575,578,121,122,123]
        if sheet_index == 535:
            return ObjectInfo[geode_items[random.Next(len(geode_items))]], 1
        if sheet_index == 536:
            return ObjectInfo[frozen_items[random.Next(len(frozen_items))]], 1
        if sheet_index == 537:
            return ObjectInfo[magma_items[random.Next(len(magma_items))]], 1
        if sheet_index == 749:
            r = random.Next(len(omni_items))
            if random.Sample() < 0.008 and geode_number > 15:
                return ObjectInfo[74], 1
            try:
                return ObjectInfo[omni_items[r]], 1
            except IndexError:
                print(r, len(omni_items))
                return ObjectInfo[74], 1
    return ObjectInfo[390], 1
Beispiel #15
0
def fairyCropNumbers(seed, days):
    rand = CSRandomLite(seed + days)
    for i in range(100):
        print(rand.Sample())