Calculating the maximum stat gain from item reforges through iteration - Hypixel Skyblock (Minecraft)

Armour and Talismans can be reforged to give stat bonuses when they are equipped, and the value the reforges give changes depending on the rarity of the item. Talismans can be Common, Uncommon, Rare, or Epic rarities, whilst Armour can be Common, Uncommon, Rare, Epic, or Legendary rarities.

Common Godly Talismans give 1% crit chance and 1% crit damage, Uncommon Godly Talismans give 2% crit chance and 2% crit damage, Rare Godly Talismans give 2% crit chance and 3% crit damage, and Epic Godly Talismans give 3% crit chance and 6% crit damage. Common Itchy Talismans give 3% crit damage, Uncommon Itchy Talismans give 5% crit damage, Rare Itchy Talismans give 8% crit damage, and Epic Itchy Talismans give 12% crit damage. Unpleasant Talismans give the same stats as Godly Talismans except with the crit chance and crit damage swapped.

Godly Armour gives the same stats as Godly Talismans, but with the addition of Legendary rarity, Legendary Godly Armour gives 5% crit chance and 8% crit damage. Unpleasant Armour, like Unpleasant Talismans, is the same as Godly Armour except with the crit chance and crit damage swapped. Common Strong Armour gives 1% crit damage, Uncommon Strong Armour gives 2% crit damage, Rare Strong Armour gives 4% crit damage, Epic Strong Armour gives 7% crit damage, and Legendary Strong Armour gives you 10% crit damage.

The player also has a base crit chance of 20, and a variable chance depending on the level of certain skills they've leveled up, as well as a weapon. Within each rarity tier of talismans, it's just a combination rather than a permutation, so it doesn't matter which of the Common Talismans is Godly. Currently, there are 11 Common Talismans, 10 Uncommon Talismans, 11 Rare Talismans, and 2 Epic Talismans, but there are other known ones that will come in the future, and as such I need it to be easily editable.

The goal is to get 80% crit chance and then maximise crit damage. I would like to know how to iterate through the possible combinations to get all the results that meet this criteria, and then print them out to the console.

I made a version of this where it only took 2 reforges into consideration, and as such I could just use the % remainder function (as shown below) to give me a result, and it has worked well for me unless I have to put a 0 into one of the talismanCount variables, which I just avoid doing.

int iterationMax = (commonCount * uncommonCount * rareCount * epicCount * 2 * 4 * 8 * 16); int iteration = 0; while (iteration < iterationMaximum) { godlyCommons = ((iteration + 1) % commonCount); godlyUncommons = ((iteration + 1) % (commonCount * uncommonCount)) / commonCount; godlyRares = ((iteration + 1) % (commonCount * uncommonCount * rareCount)) / (commonCount * uncommonCount); godlyEpics = ((iteration + 1) % (commonCount * uncommonCount * rareCount * epicCount)) / (commonCount * uncommonCount * rareCount); godlyHelmet = ((iteration + 1) % (commonCount * uncommonCount * rareCount * epicCount * 2)) / (commonCount * uncommonCount * rareCount * epicCount); godlyChestplate = ((iteration + 1) % (commonCount * uncommonCount * rareCount * epicCount * 4)) / (commonCount * uncommonCount * rareCount * epicCount * 2); godlyLeggings = ((iteration + 1) % (commonCount * uncommonCount * rareCount * epicCount * 8)) / (commonCount * uncommonCount * rareCount * epicCount * 4); godlyBoots = ((iteration + 1) % (commonCount * uncommonCount * rareCount * epicCount * 16)) / (commonCount * uncommonCount * rareCount * epicCount * 8); switch (godlyHelmet) { case 0: switch (helmetRarity) { case "common": armourCritDamage += 1; break; case "uncommon": armourCritDamage += 2; break; case "rare": armourCritDamage += 4; break; case "epic": armourCritDamage += 7; break; case "legendary": armourCritDamage += 10; break; } break; //Case 1: more stats //switch (godlyChestplate/Leggings/Boots) critChance += (baseCritChance + combatLevel + swordCritChance + (godlyCommons) + (godlyUncommons * 2) + (godlyRares * 2) + (godlyEpics * 3) + armourCritChance); //Add crit chance for godly pieces (only godly and unpleasant give crit chance, but this code was only for godly critDamage += (baseCritDamage + swordCritDamage + (godlyCommons) + (godlyUncommons * 2) + (godlyRares * 3) + (godlyEpics * 6) + ((commonCount - godlyCommons) * 3) + ((uncommonCount - godlyUncommons) * 5) + ((rareCount - godlyRares) * 8) + ((epicCount - godlyEpics) * 12) + armourCritDamage); //Add crit damage for all reforges if (critChance == targetCritChance) Console.WriteLine(godlyCommons + " " + godlyUncommons + " " + godlyRares + " " + godlyEpics + " | " + godlyHelmet + " " + godlyChestplate + " " + godlyLeggings + " " + godlyBoots + " | " + critChance + " " + critDamage); iteration += 1; } 

Now that a 3rd reforge is viable, I need to change my code to be able to take that into consideration. Is there a simple way to do this, or will I have to restart from scratch? How would you go about calculating this.

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like