private void alignBattleStarPowerToFaceOff(int[] battleStarPower, int[] faceOff)
{
//remove empty sp
List<int> sp = new List<int>();
for (int i = 0; i < battleStarPower.Length; i += 3)
{
for (int j = 0; j < faceOff.Length; j += 2)
{
//if the section ends within a face off section but starts before it.
if (battleStarPower[i] + battleStarPower[i + 1] >= faceOff[j] && battleStarPower[i] + battleStarPower[i + 1] < faceOff[j] + faceOff[j + 1] &&
battleStarPower[i] < faceOff[j])
{
if (battleStarPower[i + 1] > faceOff[j + 1])
battleStarPower[i + 1] = faceOff[j + 1]; //set lengths the same
battleStarPower[i] = faceOff[j]; //align the star power to the start of the face off section
}
//if the section starts within a face off section but ends after it.
if (battleStarPower[i] >= faceOff[j] && battleStarPower[i] < faceOff[j] + faceOff[j + 1] &&
battleStarPower[i] + battleStarPower[i + 1] > faceOff[j] + faceOff[j + 1])
{
if (battleStarPower[i + 1] > faceOff[j + 1])
battleStarPower[i + 1] = faceOff[j + 1]; //set lengths the same
battleStarPower[i] = (faceOff[j] + faceOff[j + 1]) - battleStarPower[i + 1]; //move section to the end of the face off section
}
}
}
}