private static AbilityAttribute SquashAttributes(AbilityAttribute attr1, AbilityAttribute attr2) { var attr1Copy = attr1.Copy(); var attr2Copy = attr2.Copy(); attr1Copy.points = ((attr1Copy.points + attr2Copy.points) / 2) * Mathf.Pow(1.05f, 3); attr1Copy.priority = attr1Copy.points + attr2Copy.points; foreach (var param in attr1Copy.parameters) { var param2 = attr2Copy.FindParameter(param.name); if (param.value is float) { param.value = ((float)param.value + (float)param2.value) / 2f; } else if (param.value is int) { param.value = ((int)param.value + (int)param2.value) / 2; } } return(attr1Copy); }