Aura.Channel.Skills.Life.Blacksmithing.CalculateQuality C# (CSharp) Метод

CalculateQuality() приватный Метод

Calculates quality, based on the stitches made by the player.
Calculates the distances between the dots and the hits performed by the player and calculates the quality based on the total of all distances. Unofficial, but seems to work rather well. Except for 100 quality, which is practically impossible with this atm. Slightly different from Tailoring, due to the addition of timing and the ability to *not* hit. Official formula unknown, based on guesses and some minor testing. Won't match official, but it should feel good enough.
private CalculateQuality ( List hits, List dots ) : int
hits List
dots List
Результат int
		private int CalculateQuality(List<HammerHit> hits, List<BlacksmithDot> dots)
		{
			var total = 0.0;
			for (int i = 0; i < hits.Count; ++i)
			{
				var p1 = dots[i];
				var p2 = hits[i];

				// Static -30 when not hit at all or timing was wrong
				// Time should be between 4k and 5k with time
				// displacement 1.
				if (!p2.Performed || p2.Timing < 4000 || p2.Timing > 5000)
				{
					total += 30;
					continue;
				}

				// Calculate distance between dot and hit performed by the player
				total += Math.Sqrt(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2));
			}

			// Quality = 100 - (Total Distance * 2)
			// Min = -100
			// Max = 100 (increasing the max would increase the chance for 100 quality)
			return Math.Max(-100, 100 - (int)(total * 2));
		}