private static bool InGuardDistance(Combat.HitDefinition hitdef, Combat.Entity attacker, Combat.Character target) { if (attacker == null) { throw new ArgumentNullException(nameof(attacker)); } if (target == null) { throw new ArgumentNullException(nameof(target)); } if (hitdef == null) { throw new ArgumentNullException(nameof(hitdef)); } var distance = Math.Abs(attacker.CurrentLocation.X - target.CurrentLocation.X); return(distance <= hitdef.GuardDistance); }
static Boolean InGuardDistance(Combat.HitDefinition hitdef, Combat.Entity attacker, Combat.Character target) { if (attacker == null) { throw new ArgumentNullException("attacker"); } if (target == null) { throw new ArgumentNullException("target"); } if (hitdef == null) { throw new ArgumentNullException("hitdef"); } Single distance = Math.Abs(attacker.CurrentLocation.X - target.CurrentLocation.X); return(distance <= hitdef.GuardDistance); }