DamageInfo ComputePhysicalDamage(MagnitudeRange damageRange, int armor, int critFactor, int reduction) { int mitigation = ArmorToMitigation(armor); int rawDamage = critFactor * damageRange.Interpolate(QualityRoll.GetRandom()); int afterArmor = ApplyMitigation(rawDamage, mitigation); DamageInfo damageResult = new DamageInfo(rawDamage, rawDamage - afterArmor, 0, reduction); return(damageResult); }
DamageInfo ComputeDamage(MagnitudeRange damageRange, int mitigation, int absorption, int reduction) { int rawDamage = damageRange.Interpolate(QualityRoll.GetRandom()); int afterResistance = ApplyMitigation(rawDamage, mitigation); int absorbed = rawDamage - ApplyMitigation(rawDamage, absorption); DamageInfo damageResult = new DamageInfo(rawDamage, rawDamage - afterResistance, absorbed, reduction); return(damageResult); }
Item BuildRare(ItemTemplate template) { template.StartBuilding(); int numPrefixes = UnityEngine.Random.Range(1, maxSuffixesOnRare); int numSuffixes = UnityEngine.Random.Range(1, maxPrefixesOnRare); foreach (var affix in GetAffixesForRareItem(template.Slot, numPrefixes, numSuffixes)) { template.AddAffix(affix, QualityRoll.GetRandom()); } // Will most likely replace with a random name generator, similar in design to how the rare enemy // name generator works. return(template.FinishBuilding($"Rare {template.Name}")); }
Item BuildMagic(ItemTemplate template) { template.StartBuilding(); var affixes = GetAffixesForRareItem(template.Slot, 1, 1); foreach (var affix in GetAffixesForRareItem(template.Slot, 1, 1)) { template.AddAffix(affix, QualityRoll.GetRandom()); } var prefix = affixes.First(aff => aff.IsPrefix); var suffix = affixes.First(aff => aff.IsSuffix); return(template.FinishBuilding($"{prefix.Name} {template.Name} of {suffix.Name}")); }