# Set max_gilds to the number of gilds on your main damage dealer # Set hero_souls to your number of unassigned hero souls # Set each ancient value to 0 if you do not have the ancient, # otherwise set it to its current level. # Click the play button in the top right of # this side of the screen to get your result. max_gilds = 0 hero_souls = 1 argaiv = 0 atman = 0 dogcog = 0 dora = 0 fortuna = 0 libertas = 0 mammon = 0 mimzee = 0 morgulis = 0 siyalatas = 0 solomon = 0 # use name of ancient you want to try to buy and his price # or use None if you don't want to try buying any try_buy = "none" try_price = 667 # you can copy/paste selected result over the definition to update values # -------------------------------------------------------- def get_multiplier(hero_souls, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon): # Chests have been confirmed as being a 1% spawn rate by default, and give # about 10x normal gold. chest_rate = 0.01 chest_gold = 10.0 normal_chest_gold = (chest_gold * chest_rate) + (1.0 * (1.0 - chest_rate)) if morgulis > 0: # Assume for now that all hero souls will be spent on Morgulis if he is # available, since that will be the best outcome if no other ancients are # purchased. Morgulis gives 11% increased damage . mult = (1.0 + 0.11 * (morgulis + hero_souls)) else: # Hero souls give 10% increased damage per soul. mult = (1.0 + 0.1 * hero_souls) if argaiv > 0: mult *= (1 + (argaiv * 0.02 + 0.5) * max_gilds) else: mult *= (1 + 0.5 * max_gilds) if atman > 0: mult *= (1 + (atman * 0.04)) # Dogcog gives 2% reduction per level, which is equivalent to a (100% / 98%) # multiplier at rank one, and 100% / 50% multiplier at rank 25. if dogcog is not None: mult *= (1.0 / (1.0 - 0.02 * dogcog)) # Dora gives 20% increased chest spawn rate by 20% per level. if dora > 0: chest_rate *= (1.0 + 0.2 * dora) # Fortuna effectively gives 2.5% increased gold per level. if fortuna > 0: mult *= (1.0 + 0.0225 * fortuna) # Libertas gives 25% increased gold per level at level 1, scaling like # Siyalatas does for damage. if libertas > 0: libertas_bonus = sum((0.25 - 0.01 * (x // 10) for x in range(1, min(100, libertas + 1)))) + (0.15 * max(0, libertas - 99)) mult *= (1.0 + libertas_bonus) # Mammon gives 5% increased gold per level. if mammon > 0: mult *= (1.0 + 0.05 * mammon) # Mimzee increases gold from chests by 50% per level. if mimzee > 0: chest_gold *= (1.0 + 0.5 * mimzee) # Siyalatas gives 25% increased damage per level at level 1, scaling down to # 15% bonus at level 100, reduced by 1% per 10 levels. if siyalatas > 0: siyalatas_bonus = sum((0.25 - 0.01 * (x // 10) for x in range(1, min(100, siyalatas + 1)))) + (0.15 * max(0, siyalatas - 99)) mult *= (1.0 + siyalatas_bonus) if solomon > 0: if solomon < 21: mult *= 1 + .05 * solomon elif solomon < 41: mult *= 2 + .04 * (solomon-20) elif solomon < 61: #not sure if this is used until 61, assuming it drops every 20 levels mult *= 2.8 + .03 * (solomon-40) elif solomon < 81: #just a guess mult *= 3.4 + .02 * (solomon-60) else: #still guessing... mult *= 3.8 + .01 * (solomon-80) # Add chest contribution from Dora/Mimzee. new_chest_gold = (chest_gold * chest_rate) + (1.0 * (1.0 - chest_rate)) mult *= new_chest_gold / normal_chest_gold return mult def optimize(hero_souls, buy_ancient, buy_price, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, morgulis, siyalatas, solomon): hsd = hero_souls ard = argaiv atd = atman dod = dogcog drd = dora fod = fortuna lid = libertas mad = mammon mid = mimzee mod = morgulis sid = siyalatas sod = solomon start_mult = get_multiplier(hero_souls, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon) if buy_ancient == "argaiv": if argaiv == 0: hero_souls -= buy_price argaiv = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "atman": if atman == 0: hero_souls -= buy_price atman = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "dogcog": if dogcog == 0: hero_souls -= buy_price dogcog = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "dora": if dora == 0: hero_souls -= buy_price dora = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "fortuna": if fortuna == 0: hero_souls -= buy_price fortuna = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "libertas": if libertas == 0: hero_souls -= buy_price libertas = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "mammon": if mammon == 0: hero_souls -= buy_price mammon = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "mimzee": if mimzee == 0: hero_souls -= buy_price mimzee = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "morgulis": if morgulis == 0: hero_souls -= buy_price morgulis = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "siyalatas": if siyalatas == 0: hero_souls -= buy_price siyalatas = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient == "solomon": if solomon == 0: hero_souls -= buy_price solomon = 1 else: print("You already have " + str(buy_ancient)) return None elif buy_ancient != None: print("Invalid ancient name, can't buy: " + str(buy_ancient)) return None # The multiply calculation assumes that all hero souls will be spent on # Morgulis. This reverses that assumption, since at the start, it is not # the case. if morgulis > 0: # Divide out the Morgulis bonus given by get_multiplier. start_mult /= (1.0 + 0.11 * (morgulis + hero_souls)) # Multiply in the actual bonuses. start_mult *= (1.0 + (0.1 * hero_souls) + (0.11 * morgulis)) while True: # If morgulis is used, it is assumed that all remaining souls are spent on him, so he does not need his own mult value. base_mult = get_multiplier(hero_souls, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon) if (0 < atman < 25) and (hero_souls >= int((atman + 1) ** 1.5 + 0.5)): atman_mult = get_multiplier(hero_souls - int((atman + 1) ** 1.5 + 0.5), argaiv, atman + 1, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon) else: atman_mult = 0.0 if 0 < argaiv < hero_souls - 1: argaiv_mult = get_multiplier(hero_souls - argaiv - 1, argaiv + 1, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon) else: argaiv_mult = 0.0 if 0 < dogcog < min(25, hero_souls - 1): dogcog_mult = get_multiplier(hero_souls - dogcog - 1, argaiv, atman, dogcog + 1, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon) else: dogcog_mult = 0.0 if 0 < dora < min(50, hero_souls - 1): dora_mult = get_multiplier(hero_souls - dora - 1, argaiv, atman, dogcog, dora + 1, fortuna, libertas, mammon, mimzee, siyalatas, solomon) else: dora_mult = 0.0 if 0 < fortuna < min(40, hero_souls - 1): fortuna_mult = get_multiplier(hero_souls - fortuna - 1, argaiv, atman, dogcog, dora, fortuna + 1, libertas, mammon, mimzee, siyalatas, solomon) else: fortuna_mult = 0.0 if 0 < libertas < hero_souls - 1: libertas_mult = get_multiplier(hero_souls - libertas - 1, argaiv, atman, dogcog, dora, fortuna, libertas + 1, mammon, mimzee, siyalatas, solomon) else: libertas_mult = 0.0 if 0 < mammon < hero_souls - 1: mammon_mult = get_multiplier(hero_souls - mammon - 1, argaiv, atman, dogcog, dora, fortuna, libertas, mammon + 1, mimzee, siyalatas, solomon) else: mammon_mult = 0.0 if 0 < mimzee < hero_souls - 1: mimzee_mult = get_multiplier(hero_souls - mimzee - 1, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee + 1, siyalatas, solomon) else: mimzee_mult = 0.0 if 0 < siyalatas < hero_souls - 1: siyalatas_mult = get_multiplier(hero_souls - siyalatas - 1, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas + 1, solomon) else: siyalatas_mult = 0.0 if (0 < solomon) and (hero_souls >= int((solomon + 1) ** 1.5 + 0.5)): solomon_mult = get_multiplier(hero_souls - int((solomon + 1) ** 1.5 + 0.5), argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, siyalatas, solomon + 1) else: solomon_mult = 0.0 best_mult = max(base_mult, argaiv_mult, atman_mult, dogcog_mult, dora_mult, fortuna_mult, libertas_mult, mammon_mult, mimzee_mult, siyalatas_mult, solomon_mult) if best_mult == siyalatas_mult: # siyalatas is intentionally put first siyalatas += 1 hero_souls -= siyalatas elif best_mult == argaiv_mult: argaiv += 1 hero_souls -= argaiv elif best_mult == atman_mult: atman += 1 hero_souls -= int(atman ** 1.5 + 0.5) elif best_mult == dogcog_mult: dogcog += 1 hero_souls -= dogcog elif best_mult == dora_mult: dora += 1 hero_souls -= dora elif best_mult == fortuna_mult: fortuna += 1 hero_souls -= fortuna elif best_mult == libertas_mult: libertas += 1 hero_souls -= libertas elif best_mult == mammon_mult: mammon += 1 hero_souls -= mammon elif best_mult == mimzee_mult: mimzee += 1 hero_souls -= mimzee elif best_mult == solomon_mult: solomon += 1 hero_souls -= int(solomon ** 1.5 + 0.5) else: break # It is always optimal to spend all of your hero souls on Morgulis. if morgulis > 0: morgulis += hero_souls hero_souls = 0 hsd = hsd - hero_souls ard = argaiv - ard atd = atman - atd dod = dogcog - dod drd = dora - drd fod = fortuna - fod lid = libertas - lid mad = mammon - mad mid = mimzee - mid mod = morgulis - mod sid = siyalatas - sid sod = solomon - sod quot = ((best_mult / start_mult) - 1) * 100 if buy_ancient != None: print("Trying to buy " + buy_ancient) print("") print("hero_souls = " + str(hero_souls) + ((" # -" + str(hsd)) if hsd > 0 else "")) print("argaiv = " + str(argaiv) + ((" # +" + str(ard)) if ard > 0 else "")) print("atman = " + str(atman) + ((" # +" + str(atd)) if atd > 0 else "")) print("dogcog = " + str(dogcog) + ((" # +" + str(dod)) if dod > 0 else "")) print("dora = " + str(dora) + ((" # +" + str(drd)) if drd > 0 else "")) print("fortuna = " + str(fortuna) + ((" # +" + str(fod)) if fod > 0 else "")) print("libertas = " + str(libertas) + ((" # +" + str(lid)) if lid > 0 else "")) print("mammon = " + str(mammon) + ((" # +" + str(mad)) if mad > 0 else "")) print("mimzee = " + str(mimzee) + ((" # +" + str(mid)) if mid > 0 else "")) print("morgulis = " + str(morgulis) + ((" # +" + str(mod)) if mod > 0 else "")) print("siyalatas = " + str(siyalatas) + ((" # +" + str(sid)) if sid > 0 else "")) print("solomon = " + str(solomon) + ((" # +" + str(sod)) if sod > 0 else "")) print("Improvement: {0:.2f} %".format(quot)) return quot print("----------------------------------") print("") q1 = optimize(hero_souls, None, 0, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, morgulis, siyalatas, solomon) if (try_buy != None) and (str(try_buy).lower() != "none"): print("") print("") q2 = optimize(hero_souls, try_buy, try_price, argaiv, atman, dogcog, dora, fortuna, libertas, mammon, mimzee, morgulis, siyalatas, solomon) print("") print("") if q2 != None: print("Advice: " + ("BUY" if q2 > q1 else "don't buy")) print("")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question