public static DamageRange operator+(DamageRange lhs, float rhs) { DamageRange result = new DamageRange(lhs); result.range += rhs; return(result); }
public static DamageRange operator-(DamageRange obj) { DamageRange result = new DamageRange(obj); result.range = -result.range; return(result); }
/// <summary> /// Adds two damage ranges. Returns the left hand side value if the damage types don't match. /// </summary> public static DamageRange operator+(DamageRange lhs, DamageRange rhs) { DamageRange result = new DamageRange(lhs); if (lhs.Type == rhs.Type) { lhs.range += rhs.range; } return(result); }
public ActionResult Perform(Actor actor, bool defaultAction = false) { Locator.Audio.PlaySound("attack", actor.Name()); var damage = new DamageRange(target, actor, missile).GetDamage(); target.TakeDamage(damage); if (!target.IsAlive && actor is Player p) { p.SetExperience(p.GetExperience() + Monster.ExperienceReward(((Monster)target).MonsterType)); } return(ActionResult.Succeed($"{actor.Name()} attacked {target.Name()} for {damage} damage", false)); }
public Weapon( string name, ItemIdentifier identifier, PrimaryAttributes primaryAttributes, SecondaryAttributes secondaryAttributes, WeaponType type, DamageRange damageRange, double speed, WeaponProc proc) : base( name, identifier, primaryAttributes, secondaryAttributes) { Type = type; DamageRange = damageRange; Speed = speed; Proc = proc; }
public Damage(int min, int max) { DamageRange = new DamageRange(min, max); }
/// <summary> /// Creates a new DamageRange object by copying a different one /// </summary> /// <param name="src">The source to be copied from</param> public DamageRange(DamageRange src) { range = src.range; Type = src.Type; }
private static double GetActionDamage(Action action, Configuration configuration, DamageRange range, bool offHand = false, bool forcedOffhand = false) { var hand = offHand ? configuration.OffHand : configuration.MainHand; double damage = 0; if (action.Type == ActionType.WeaponDamage) { damage += (1 + action.AmountModifierPercent) * hand.Multiplier * (range == DamageRange.Minimum ? hand.DamageMin : (range == DamageRange.Maximum ? hand.DamageMax : hand.DamageAvg)); } if (!forcedOffhand) { damage += action.Coefficient * (action.Type == ActionType.WeaponDamage ? configuration.BonusDamage : configuration.SpellBonusDamage) + (range == DamageRange.Minimum ? action.StandardHealthPercentMin : (range == DamageRange.Maximum ? action.StandardHealthPercentMax : action.StandardHealthPercentAvg)) * configuration.StandardDamage; } return damage; }
private static List<TokenDamage> GetAbilityTokenDamageList(this Ability ability, Configuration configuration, DamageRange range, bool forceOffhand = false) { lock (Lock) { if (ability == null) return null; var damage = new List<TokenDamage>(); foreach (var token in ability.Tokens.Where(t => t.Type == TokenType.Damage && t.Coefficients.Count > 0)) { // Main hand var mainHandActions = token.Coefficients.Where(a => a.IgnoreDualWieldModifier).ToList(); if (mainHandActions.Count == 0) mainHandActions = token.Coefficients; var tokenDamage = new TokenDamage { Multiplier = token.Multiplier }; tokenDamage.AddRange(mainHandActions.Select(action => new ActionDamage(false, GetActionDamage(action, configuration, range), action.DamageType == DamageType.Weapon ? configuration.MainHand.DamageType : action.DamageType))); // Offhand (only for weapon damage type) if (configuration.DualWield) { var offHandActions = token.Coefficients.Where(a => !a.IgnoreDualWieldModifier && a.Type == ActionType.WeaponDamage).ToList(); if (offHandActions.Count > 0) tokenDamage.AddRange(offHandActions.Select(action => new ActionDamage(true, GetActionDamage(action, configuration, range, true), action.DamageType == DamageType.Weapon ? configuration.OffHand.DamageType : action.DamageType))); else if (forceOffhand) { tokenDamage.AddRange(mainHandActions.Where(a => a.Type == ActionType.WeaponDamage).Select(action => new ActionDamage(true, GetActionDamage(action, configuration, range, true, true), action.DamageType == DamageType.Weapon ? configuration.OffHand.DamageType : action.DamageType))); } } damage.Add(tokenDamage); } return damage; } }