public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target) : base(attackPayload.Context, target) { this.IsCriticalHit = criticalHit; this.TotalDamage = RandomHelper.Next(20, 35); // TODO: select these values based on element type? /*float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0]; * float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];*/ // calculate and add up damage amount for each element type //this.ElementDamages = new Dictionary<DamageType, float>(); /*foreach (var entry in attackPayload.DamageEntries) * { * if (!this.ElementDamages.ContainsKey(entry.DamageType)) * this.ElementDamages[entry.DamageType] = 0f; * * if (entry.IsWeaponBasedDamage) * this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier * * (weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta); * else * this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta; * * this.ElementDamages[entry.DamageType] *= 1.0f + this.Target.Attributes[GameAttribute.Amplify_Damage_Percent]; * }*/ // apply critical damage boost /*if (criticalHit) * { * // TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set * var damTypes = this.ElementDamages.Keys.ToArray(); * foreach (var type in damTypes) * this.ElementDamages[type] *= 1.5f + this.Target.Attributes[GameAttribute.Crit_Percent_Bonus_Capped]; * }*/ // TODO: reduce element damage amounts according to target's resistances // TODO: reduce total damage by target's armor // ~weltmeyer Using WOW Calculation till we find the correct formula :) /*this.TotalDamage = Context.User.Attributes[GameAttribute.Damage_Delta_Total];; * var targetArmor = target.Attributes[GameAttribute.Armor_Total]; * var attackerLevel = attackPayload.Context.User.Attributes[GameAttribute.Level]; * var reduction = TotalDamage * (0.1f * targetArmor) / * ((8.5f * attackerLevel) + 40); * * reduction /= 1+reduction; * reduction = Math.Min(0.75f, reduction); * this.TotalDamage = TotalDamage*(1 - reduction);*/ //this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key; //if (this.DominantDamageType == null) //this.DominantDamageType = DamageType.Physical; // default to physical if no other damage type calced }
public void WeaponDamage(Actor target, DamageType damageType) { AttackPayload AttackPayload = new AttackPayload(this); AttackPayload.SetSingleTarget(target); //payload.AddWeaponDamage(damageMultiplier, damageType); AttackPayload.Apply(); }