private static string calculateAffix4(PowerTypesEnum powerType, List <AffixMetadataEnum> md, Random rand, ref SkillAffixProcStat affixProcData) { var isHighCd = md.Contains(AffixMetadataEnum.HighCD); var procsOnDeath = md.Contains(AffixMetadataEnum.ProcsOnDeath); var selectedAffix = string.Empty; if (powerType == PowerTypesEnum.AngelicPower) { selectedAffix = EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(0, isHighCd ? 9 : 8)); } if (powerType == PowerTypesEnum.DemonicPower) { selectedAffix = EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, 6)); } if (powerType == PowerTypesEnum.AncestralPower) { var randEP = EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, 3)); var randLB = EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(3, isHighCd ? 9 : 8)); if (randLB == EnumHelper.GetName(LBsEnum.OtherRandomLPROnDeathForX)) { randLB = EnumHelper.GetName <LPRsEnum>((LPRsEnum)rand.Next(0, 10)); } var randCurse = EnumHelper.GetName <CursesEnum>((CursesEnum)rand.Next(4, 9)); var selected = rand.Next(1, 9); selectedAffix = (selected % 3 == 0) ? randEP : (selected % 3 == 1) ? randLB : randCurse; } return(selectedAffix); }
public static decimal GetProcChance(int affixLevel, PowerTypesEnum powerType, bool isHighTier, List <CastTypesEnum> castTypes, List <AffixMetadataEnum> skillMetadata) { var isStrong = skillMetadata.Contains(AffixMetadataEnum.IsStrong); var isWeak = skillMetadata.Contains(AffixMetadataEnum.IsWeak); var procChance = isStrong ? 10 : isWeak ? 22 : 15; var rand = powerType == PowerTypesEnum.AngelicPower ? randA : powerType == PowerTypesEnum.DemonicPower ? randB : randC; if (!isHighTier) { procChance -= 4; } if (castTypes.Contains(CastTypesEnum.MeleeHit) || castTypes.Contains(CastTypesEnum.Projectile)) { procChance += rand.Next(3, 8); } // Make sure percentages are somewhat diverse var randFactor = (rand.Next(0, 7) - 4); procChance += randFactor; // Not the first upgrade, but make sure no less than 8% upgrade if (affixLevel != 1) { procChance -= 4; procChance = Math.Max(procChance, 8); } return(procChance); }
private static string calculateAffix3(PowerTypesEnum powerType, List <AffixMetadataEnum> md, Random rand, ref SkillAffixProcStat affixProcData) { var isHighCd = md.Contains(AffixMetadataEnum.HighCD); var procsOnDeath = md.Contains(AffixMetadataEnum.ProcsOnDeath); var selectedAffix = string.Empty; if (powerType == PowerTypesEnum.AngelicPower) { selectedAffix = EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(0, isHighCd ? 9 : 8)); } if (powerType == PowerTypesEnum.DemonicPower) { selectedAffix = procsOnDeath ? EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, 4)) : EnumHelper.GetName <CCsEnum>((CCsEnum)rand.Next(0, 4)); } if (powerType == PowerTypesEnum.AncestralPower) { var randCC = EnumHelper.GetName <HighTierCCAncEnum>((HighTierCCAncEnum)rand.Next(0, 4)); var randLB = EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(3, isHighCd ? 9 : 8)); var randEP = EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(3, 6)); var selected = rand.Next(1, 9); selectedAffix = (selected % 3 == 0) ? randEP : (selected % 3 == 1) ? randLB : randCC; } return(selectedAffix); }
private static string calculateAffix1(PowerTypesEnum powerType, List <AffixMetadataEnum> md, Random rand, ref SkillAffixProcStat affixProcData) { var isHighCd = md.Contains(AffixMetadataEnum.HighCD); var procsOnDeath = md.Contains(AffixMetadataEnum.ProcsOnDeath); var isDoT = md.Contains(AffixMetadataEnum.HasDoT); var isProjectile = md.Contains(AffixMetadataEnum.Projectile); var apRand = isProjectile ? 12 : isDoT ? 10 : 9;// : isDoA ? 9 : 10; var selectedAffix = string.Empty; if (powerType == PowerTypesEnum.AngelicPower) { selectedAffix = procsOnDeath ? EnumHelper.GetName <LPRsEnum>((LPRsEnum)rand.Next(0, apRand)) : EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(0, 7)); } if (powerType == PowerTypesEnum.DemonicPower) { selectedAffix = EnumHelper.GetName <LDBsEnum>((LDBsEnum)rand.Next(0, 9)); // : EnumHelper.GetName<CCsEnum>((CCsEnum)rand.Next(3, 6)); } if (powerType == PowerTypesEnum.AncestralPower) { var randCurse = EnumHelper.GetName <CursesEnum>((CursesEnum)rand.Next(0, 3)); var randCC = procsOnDeath ? EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, 3)) : EnumHelper.GetName <CCsEnum>((CCsEnum)rand.Next(0, 3)); var randLB = EnumHelper.GetName <LBsEnum>((LBsEnum)rand.Next(0, 3)); var randEP = EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, 3)); var selected = rand.Next(1, 9); selectedAffix = (selected % 3 == 0) ? (procsOnDeath ? randEP : randCurse) : (selected % 3 == 1) ? randLB : randCC; } return(selectedAffix); }
internal static SkillPowerAffixData RecalculatePowerAffixesForSkill(PowerTypesEnum powerType, CastTypesEnum castType, ISkillAffixProcStat affixStat, DamageSkillStat skillData, List <AffixMetadataEnum> md) { var empoweredAffixData = new SkillPowerAffixData(); var level = powerType == PowerTypesEnum.AngelicPower ? skillData.AngelicPower : powerType == PowerTypesEnum.DemonicPower ? skillData.DemonicPower : skillData.AncestralPower; var rng = SkillStatHelper.GetRNG(powerType); var affix = new SkillAffixProcStat(); var isHighTier = skillData.Tier > 2; var procChance = affixStat.ProcChance; // var procBonus = SkillStatHelper.GetProcChance(level, powerType, isHighTier, castType, md); // procChance += procBonus; var selectedAffix = affixStat.SelectedAffix; empoweredAffixData.PowerData = new SkillAffixProcStat(procChance, powerType, selectedAffix, skillData, md); empoweredAffixData.PowerData.ProcAmount = affixStat.ProcAmount; var skillUp = skillData; if (powerType == PowerTypesEnum.AngelicPower) { skillUp.AngelicPower += 1; } else if (powerType == PowerTypesEnum.DemonicPower) { skillUp.DemonicPower += 1; } else if (powerType == PowerTypesEnum.AncestralPower) { skillUp.AncestralPower += 1; } empoweredAffixData.PowerUp = new SkillAffixProcStat(procChance, powerType, selectedAffix, skillUp, md); return(empoweredAffixData); }
public SkillAffixProcStat(decimal procChance, PowerTypesEnum powerType, string selectedAffix, DamageSkillStat skillData, List <AffixMetadataEnum> md) { var rand = SkillStatHelper.GetRNG(powerType); var level = powerType == PowerTypesEnum.AngelicPower ? skillData.AngelicPower : powerType == PowerTypesEnum.DemonicPower ? skillData.DemonicPower : skillData.AncestralPower; this.Level = level; this.PowerType = powerType; this.SelectedAffix = selectedAffix; this.Stackable = md.Contains(AffixMetadataEnum.Stackable); this.IsBuff = md.Contains(AffixMetadataEnum.BuffDebuff); var highTier = skillData.Tier >= 3; var HighCD = md.Contains(AffixMetadataEnum.HighCD); var spender = md.Contains(AffixMetadataEnum.HighCost); var procsOnDeath = md.Contains(AffixMetadataEnum.ProcsOnDeath); this.ProcsOnDeath = procsOnDeath; // if (procsOnDeath) { // // Probably is a buff if LPR on death as well ? // var isBuff = EnumHelper.Contains<LBsEnum>(selectedAffix); // } var minBuffOrTotemDur = procsOnDeath ? (!highTier? 75 : 200) : (!highTier? 250 : 400); var maxBuffOrTotemDur = procsOnDeath ? (!highTier? 175 : 350) : (!highTier? 350 : 600); var minBuffDurIncr = procsOnDeath ? (!highTier? 10 : 30) : (!highTier? 20 : 50); var maxBuffDurIncr = procsOnDeath ? (!highTier? 30 : 50) : (!highTier? 40 : 100); var randDurBonus = rand.Next(minBuffDurIncr, maxBuffDurIncr) * level; var average = DecimalHelper.RoundToDecimals((skillData.From + skillData.To) / 2, 2); var minDPSIncr = procsOnDeath ? (!highTier? 8 : 8) : (!highTier? 20 : 18); var maxDPSIncr = procsOnDeath ? (!highTier? 25 : 20) : (!highTier? 40 : 25); var randBonus = rand.Next(minDPSIncr, maxDPSIncr) * level; if (md.Contains(AffixMetadataEnum.BuffDebuff) || md.Contains(AffixMetadataEnum.BannerOrTotem)) { this.Duration = DecimalHelper.RoundToDecimals(randDurBonus / 100, 2); this.ProcAmount = DecimalHelper.RoundToDecimalsD(average * (randBonus / 250), 2); } else if (md.Contains(AffixMetadataEnum.HasDoT)) { this.Duration = DecimalHelper.RoundToDecimals(randDurBonus / 250, 2); this.ProcAmount = DecimalHelper.RoundToDecimalsD(average * (randBonus / 100), 2); } else if (md.Contains(AffixMetadataEnum.Summon)) { this.Duration = DecimalHelper.RoundToDecimals(randDurBonus / 50, 2); this.ProcAmount = DecimalHelper.RoundToDecimalsD(average * (randBonus / 75), 2); } // else if (md.Contains(AffixMetadataEnum.Curse)) // { // this.Duration = DecimalHelper.RoundToDecimals(randDurBonus/125, 2); // this.ProcAmount = DecimalHelper.RoundToDecimalsD(average * (randBonus/75), 2); // } else { var durIncr = highTier ? rand.Next(level * 25, level * 45) : rand.Next(level * 15, level * 25); this.Duration = ((skillData.Duration ?? 0) * (1 + durIncr / 100)); this.ProcAmount = DecimalHelper.RoundToDecimalsD(average * randBonus / 100, 2); } // TODO: Set procChance upgrades per level, i.e. level this.ProcChance = procChance; }
public static Random GetRNG(PowerTypesEnum powerType) { var rand = powerType == PowerTypesEnum.AngelicPower ? randA : powerType == PowerTypesEnum.DemonicPower ? randB : randC; return(rand); }
public static SkillPowerAffixData GetPowerAffixesForSkill(PowerTypesEnum powerType, List <CastTypesEnum> castTypes, List <DamageTypesEnum> damageTypes, DamageSkillStat skillData, List <AffixMetadataEnum> skillMetadata) { var skillPowerAffixData = new SkillPowerAffixData(); var level = (powerType == PowerTypesEnum.AngelicPower) ? skillData.AngelicPower : (powerType == PowerTypesEnum.DemonicPower) ? skillData.DemonicPower : skillData.AncestralPower; var selectedPowerData = new SkillAffixProcStat(); var selectedAffix = string.Empty; var isCC = skillData.IsCC; var rand = SkillStatHelper.GetRNG(powerType); var isHighTier = skillData.Tier > 2; var procsBuff = false; var procChance = SkillStatHelper.GetProcChance(level, powerType, isHighTier, castTypes, skillMetadata); if (!isHighTier) { if (isCC) { selectedAffix = calculateAffix2(powerType, skillMetadata, rand, ref selectedPowerData); } else { selectedAffix = calculateAffix1(powerType, skillMetadata, rand, ref selectedPowerData); } } else { if (isCC) { selectedAffix = calculateAffix4(powerType, skillMetadata, rand, ref selectedPowerData); } else { selectedAffix = calculateAffix3(powerType, skillMetadata, rand, ref selectedPowerData); } } if (selectedAffix == EnumHelper.GetName <LBsEnum>(LBsEnum.RandomShoutOrCry)) { procsBuff = true; } if (selectedAffix == EnumHelper.GetName <LBsEnum>(LBsEnum.OtherRandomLPROnDeathForX)) { var isProjectile = skillMetadata.Contains(AffixMetadataEnum.Projectile); var isDoT = skillMetadata.Contains(AffixMetadataEnum.HasDoT); var isUltimate = skillMetadata.Contains(AffixMetadataEnum.Ultimate); var apRand = isProjectile ? 12 : isDoT ? 10 : 9;// : isDoA ? 9 : 10; selectedAffix = EnumHelper.GetName <LPRsEnum>((LPRsEnum)rand.Next(0, apRand)); if (isUltimate) { procChance += 0.1m; selectedPowerData.Stackable = true; } procsBuff = true; } if (selectedAffix == EnumHelper.GetName <LDBsEnum>(LDBsEnum.LowPercCastRandomEP)) { selectedAffix = EnumHelper.GetName <EPs_HighDBsEnum>((EPs_HighDBsEnum)rand.Next(0, isHighTier ? 7 : 3)); if (!isHighTier) { procChance -= 0.05m; } } if (selectedAffix == EnumHelper.GetName <EPs_HighDBsEnum>(EPs_HighDBsEnum.RandomCC)) { selectedAffix = EnumHelper.GetName <CCsEnum>((CCsEnum)rand.Next(0, isHighTier ? 4 : 2)); } if (selectedAffix == EnumHelper.GetName <EPs_HighDBsEnum>(EPs_HighDBsEnum.RandomCurse)) { selectedAffix = EnumHelper.GetName <CursesEnum>((CursesEnum)rand.Next(0, isHighTier ? 9 : 3)); } if (selectedAffix == EnumHelper.GetName <EPs_HighDBsEnum>(EPs_HighDBsEnum.RandomTotemOrBanner)) { selectedAffix = EnumHelper.GetName <CursesEnum>((CursesEnum)rand.Next(0, isHighTier ? 9 : 3)); if (!isHighTier) { procChance -= 0.10m; } } if (procsBuff) { skillMetadata.Add(AffixMetadataEnum.ProcsBuff); } skillPowerAffixData.PowerData = new SkillAffixProcStat(procChance, powerType, selectedAffix, skillData, skillMetadata); var skillUp = skillData; if (powerType == PowerTypesEnum.AngelicPower) { skillUp.AngelicPower += 1; } else if (powerType == PowerTypesEnum.DemonicPower) { skillUp.DemonicPower += 1; } else if (powerType == PowerTypesEnum.AncestralPower) { skillUp.AncestralPower += 1; } skillPowerAffixData.PowerUp = new SkillAffixProcStat(procChance, powerType, selectedAffix, skillUp, skillMetadata); return(skillPowerAffixData); }