protected override void ApplyToItem(AttributeAffix affix, QualityRoll quality) { Assert.IsTrue(IsApplicableToItem(affix)); MagnitudeRange magnitudeRange = affix.Range.Value; int magnitude = magnitudeRange.Interpolate(quality); tempEnhancement.ApplyWeaponAttribute(affix.Attribute, affix.Priority, magnitude); }
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); }
public TwoMagnitudeRange(MagnitudeRange first, MagnitudeRange second) { this.first = first; this.second = second; }
AttributeEnhancement BuildEnhancement(QualityRoll quality, MagnitudeRange range) { return(new AttributeEnhancement(attribute, priority, range.Interpolate(quality))); }
/* * This overload is provided to allow for a simple run-time change to the value. Originally this * was implemented to allow a compound attribute to substitute a different value for the range without * having to rebuild new attribute affixes for every sub-attribute. e.g. a compound affix that improves * all primary stats would have references to an affix for each primary stat, but we want to provide lesser * values for the range for balance reasons (otherwise, the compound attribute would be 4x as strong as the * individual affixes). */ /// <summary> /// Provide a different value for the magnitude range than the one attached to this affix. /// </summary> public void OnEquip(IEquipContext context, QualityRoll quality, MagnitudeRange rangeOverride) { context.ApplyAttributeBuff(BuildEnhancement(quality, rangeOverride)); }