private static StatUpgradeStruct chooseSecondStatUpgrade(StatUpgradeStruct firstStatUpgrade) { long rand = PRNG.getNextValue(); StatUpgradeStruct secondStatUpgrade = StatUpgradeStruct.GetFromPool(rand); while (secondStatUpgrade.type == firstStatUpgrade.type) { rand = PRNG.getNextValue(); secondStatUpgrade = StatUpgradeStruct.GetFromPool(rand); } return(secondStatUpgrade); }
private StatUpgradeStruct chooseThirdStatUpgrade(StatUpgradeStruct firstStatUpgrade, StatUpgradeStruct secondStatUpgrade) { long rand = PRNG.getNextValue(); StatUpgradeStruct thirdStatUpgrade = StatUpgradeStruct.GetFromPool(rand); while (thirdStatUpgrade.type == firstStatUpgrade.type || thirdStatUpgrade.type == secondStatUpgrade.type) { rand = PRNG.getNextValue(); thirdStatUpgrade = StatUpgradeStruct.GetFromPool(rand); } return(thirdStatUpgrade); }
private void initMapWithSeed() { int compteur = 0; List <AMJ.GunUpgrade> amjGunAvailable = initMappingIndexGunUpgrade(); List <AMJ.SwordUpgrade> amjSwordAvailable = initMappingIndexSwordUpgrade(); List <AMJ.OtherUpgrade> amjOtherAvailable = initMappingIndexOtherUpgrade(); while (compteur < NB_LVL) { long rand = PRNG.getNextValue(); if (compteur != 0 && compteur % NB_LVL_BETWEEN_AMJ == 0) { int choice = (int)(rand % amjGunAvailable.Count); gunUpgradeList.Add(amjGunAvailable[choice]); amjGunAvailable.Remove(amjGunAvailable[choice]); rand = PRNG.getNextValue(); choice = (int)(rand % amjSwordAvailable.Count); swordUpgradeList.Add(amjSwordAvailable[choice]); amjSwordAvailable.Remove(amjSwordAvailable[choice]); rand = PRNG.getNextValue(); choice = (int)(rand % amjOtherAvailable.Count); otherUpgradeList.Add(amjOtherAvailable[choice]); amjOtherAvailable.Remove(amjOtherAvailable[choice]); } else { StatUpgradeStruct firstStatUpgrade = StatUpgradeStruct.GetFromPool(rand); stat1UpgradeList.Add(firstStatUpgrade); StatUpgradeStruct secondStatUpgrade = chooseSecondStatUpgrade(firstStatUpgrade); stat2UpgradeList.Add(secondStatUpgrade); StatUpgradeStruct thirdStatUpgrade = chooseThirdStatUpgrade(firstStatUpgrade, secondStatUpgrade); stat3UpgradeList.Add(thirdStatUpgrade); } compteur++; } }