void TopPost() { if (coords[0] > Field.SIDENET_P + Field.POSTRADIUS) { return; } if (coords[0] < Field.SIDENET_N - Field.POSTRADIUS) { return; } double pAng, a1, f, heSpeed, r; if (F.Distance(coords[1], height, Field.GOALLINE_N, Field.TOPPOST) < Field.POSTRADIUS * 2) { pAng = F.Angle(Field.GOALLINE_N, Field.TOPPOST, coords[1], height); if (pAng > 90) { pAng = 180 - pAng; } if (pAng < -90) { pAng = 0 - (180 + pAng); } a1 = HeAngleToSpeed(zSpeed) / 100; if (speed > a1) { a1 = speed; } f = 1.0 / 90.0 * pAng; if (f < 0) { f = 0 - f; } heSpeed = f * a1; speed = a1 - heSpeed; zSpeed = SpeedToHeAngle(a1, pAng); height = Field.TOPPOST; r = Math.Sin(F.ToRad * pAng) * (Field.POSTRADIUS * 2 + 0.001); height -= r; pAng = F.Angle(0, Field.GOALLINE_N, 0, coords[1]); r = Math.Sin(F.ToRad * pAng) * (Field.POSTRADIUS * 2 + 0.001); double _y = Field.GOALLINE_N + r;////////////// coords[1] = _y; if (coords[1] > Field.GOALLINE_N) { angle = 360 - angle; } speed *= 0.5; zSpeed *= 0.5; room.SoundBroadcast(9, room.timerEnabled); room.keeperDistanceShot = -1; if (room.IsOpponetsShot()) { room.AddShotStat(false); } } if (F.Distance(coords[1], height, Field.GOALLINE_P, Field.TOPPOST) < Field.POSTRADIUS * 2) { pAng = F.Angle(Field.GOALLINE_P, Field.TOPPOST, coords[1], height); if (pAng > 90) { pAng = 180 - pAng; } if (pAng < -90) { pAng = 0 - (180 + pAng); } a1 = HeAngleToSpeed(zSpeed) / 100; if (speed > a1) { a1 = speed; } f = 1.0 / 90.0 * pAng; if (f < 0) { f = 0 - f; } heSpeed = f * a1; speed = a1 - heSpeed; zSpeed = SpeedToHeAngle(a1, pAng); height = Field.TOPPOST; r = Math.Sin(F.ToRad * pAng) * (Field.POSTRADIUS * 2 + 0.001); height -= r; pAng = F.Angle(0, Field.GOALLINE_P, 0, coords[1]); r = Math.Sin(F.ToRad * pAng) * (Field.POSTRADIUS * 2 + 0.001); double _y = Field.GOALLINE_P + r;/////////////// coords[1] = _y; if (coords[1] < Field.GOALLINE_P) { angle = 360 - angle; } speed *= 0.5; zSpeed *= 0.5; room.SoundBroadcast(9, room.timerEnabled); room.keeperDistanceShot = -1; if (room.IsOpponetsShot()) { room.AddShotStat(false); } } }