public static ForceDamageResult CalculateForceDamage( NWCreature caster, NWCreature target, ForceAbilityType abilityType, int basePotency, float tier1Modifier, float tier2Modifier, float tier3Modifier, float tier4Modifier) { ForceResistanceResult resistance = CalculateResistanceRating(caster, target, abilityType); int itemBonus = CalculateItemPotencyBonus(caster, abilityType); int casterPrimary = 0; int casterSecondary = 0; int targetPrimary = 0; int targetSecondary = 0; switch (abilityType) { case ForceAbilityType.Electrical: casterPrimary = caster.Intelligence; casterSecondary = caster.Wisdom; targetPrimary = target.Intelligence; targetSecondary = target.Wisdom; break; case ForceAbilityType.Mind: casterPrimary = caster.Wisdom; casterSecondary = caster.Intelligence; targetPrimary = target.Wisdom; targetSecondary = target.Intelligence; break; case ForceAbilityType.Light: casterPrimary = caster.Wisdom; casterSecondary = caster.Intelligence; targetPrimary = target.Intelligence; targetSecondary = target.Wisdom; break; case ForceAbilityType.Dark: casterPrimary = caster.Intelligence; casterSecondary = caster.Wisdom; targetPrimary = target.Wisdom; targetSecondary = target.Intelligence; break; } // Calculate delta between caster's primary/secondary stats and target's primary and secondary stats int delta = (int)((casterPrimary + casterSecondary * 0.5f) - (targetPrimary + targetSecondary * 0.5f)); float multiplier; // Not every ability will have tiers 2-4. Default to the next lowest one if it's missing. if (delta <= 49 || tier2Modifier <= 0.0f) { multiplier = tier1Modifier; } else if (delta <= 99 || tier3Modifier <= 0.0f) { multiplier = tier2Modifier; } else if (delta <= 199 || tier4Modifier <= 0.0f) { multiplier = tier3Modifier; } else { multiplier = tier4Modifier; } //caster.SendMessage("casterPrimary = " + casterPrimary + ", casterSecondary = " + casterSecondary + ", targetPrimary = " + targetPrimary + ", targetSecondary = " + targetSecondary); //caster.SendMessage("itemBonus = " + itemBonus + ", basePotency = " + basePotency + ", delta = " + delta + ", multiplier = " + multiplier + ", resistanceMultiplier = " + resistanceMultiplier); // Combine everything together to get the damage result. int damage = (int)((itemBonus + basePotency + (delta * multiplier)) * resistance.Amount); if (damage > 0) { damage += RandomService.D8(1); } if (damage <= 1) { damage = 1; } ForceDamageResult result = new ForceDamageResult { Damage = damage, Resistance = resistance, ItemBonus = itemBonus }; // If this ability was resisted in any way, notify the caster. if (resistance.Type != ResistanceType.Zero) { string name = GetForceResistanceName(resistance.Type); caster.SendMessage("Your force ability was resisted. " + name); } return(result); }