Decompiled source of Frontline v1.76.0

Mods/Frontline.dll

Decompiled 5 hours ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Combat;
using Il2CppSLZ.Data;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Combat;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.VoidLogic;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.SFX;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using LabFusion.Entities;
using LabFusion.Marrow.Pool;
using LabFusion.Network;
using LabFusion.Network.Serialization;
using LabFusion.Player;
using LabFusion.RPC;
using LabFusion.SDK.Modules;
using LabFusion.Utilities;
using MelonLoader;
using MelonLoader.Preferences;
using RadioStrike;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.DualShock;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "Frontline", "1.76.0", "thezabiggarry", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: HarmonyDontPatchAll]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RadioStrike")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.76.0.0")]
[assembly: AssemblyInformationalVersion("1.76.0")]
[assembly: AssemblyProduct("RadioStrike")]
[assembly: AssemblyTitle("RadioStrike")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.76.0.0")]
[module: UnverifiableCode]
namespace RadioStrike;

internal static class AirBattle
{
	private sealed class Plane
	{
		public FighterModel.Parts Parts;

		public int Team;

		public Vector3 Pos;

		public Vector3 Vel;

		public float Speed;

		public Plane Target;

		public int Health = 3;

		public bool Dead;

		public bool MidAirBlast;

		public bool Low;

		public float MinH;

		public float MaxH;

		public float GroundY;

		public float NextGroundCheck;

		public float DeadSince;

		public float NextGun;

		public float NextMissile;

		public float NextJink;

		public float JinkSide;

		public float JinkUntil;

		public float Roll;

		public float RollSpin;

		public Quaternion Rot = Fast.Quaternion__get_identity();

		public Vector3 LastVel;

		public AirSound Air;

		public List<(float t, Vector3 p, Vector3 v)> Trail = new List<(float, Vector3, Vector3)>();

		public ParticleSystem Smoke;

		public ParticleSystem Fire;

		public float LastFlyby = -100f;

		public int Attack;

		public Vector3 AttackAt;

		public float NextAttack;

		public float NextDrop;

		public float NextStrafe;

		public int Ordnance;

		public bool UseRockets;

		public Vector3 PassDir;

		public Vector3 PassPoint;

		public float PassH;

		public bool PassRoll;

		public bool PassSound;

		public Vector3 AnchorOff;

		public int Prio = -1;

		public float FlaresAt = float.MaxValue;

		public float NextFlares;

		public float EjectAt = float.MaxValue;

		public bool Ejected;

		public bool Transit;

		public bool Supersonic;

		public bool Gone;

		public Plane Hunter;

		public bool Doomed;

		public bool HunterFired;

		public AudioSource DiveSrc;

		public float DiveStart;

		public float DiveLen;

		public bool Skidding;

		public float SkidStart;

		public float SkidYawRate;

		public float NextSkidFx;

		public float NextSkidDebris;

		public float SkidGround;

		public float SkidYaw;

		public Vector3 SkidVel;

		public ParticleSystem SkidDust;

		public GameObject CrashSnd;

		public float CircleDir = 1f;

		public float CircleAlt = 300f;

		public float NextReverse;

		public float Phase;

		public int BombsLeft;

		public float BombAlong;

		public float BoomAt;

		public ParticleSystem VaporL;

		public ParticleSystem VaporR;
	}

	private sealed class Tracer
	{
		public GameObject Go;

		public Vector3 Pos;

		public Vector3 Vel;

		public float Die;

		public float GroundY = float.MinValue;
	}

	private sealed class Rocket
	{
		public GameObject Go;

		public Vector3 Pos;

		public Vector3 Vel;

		public Plane Target;

		public float Die;

		public float BurnOut;

		public ParticleSystem Trail;

		public Transform Glow;

		public Light Light;

		public bool Ground;

		public Vector3 Aim;

		public bool Decoy;

		public Flare DecoyFlare;
	}

	private sealed class Flare
	{
		public GameObject Go;

		public Light L;

		public Vector3 Pos;

		public Vector3 Vel;

		public float Die;

		public ParticleSystem Trail;

		public Plane Owner;
	}

	private sealed class BombDrop
	{
		public GameObject Go;

		public Vector3 Pos;

		public Vector3 Vel;

		public float GroundY;
	}

	private sealed class Gun
	{
		public Func<Vector3> Muzzle;

		public Func<Vector3> Aim;

		public Func<Vector3> ShooterVel;

		public float Until;

		public float Next;

		public float Spread;

		public float GroundY = float.MinValue;

		public GameObject Flash;

		public Light FlashLight;

		public ParticleSystem Smoke;

		public bool Alive = true;
	}

	private const float Leash = 480f;

	private static readonly List<Flare> Flares = new List<Flare>();

	private static Material _flareMat;

	private static readonly List<Plane> Planes = new List<Plane>();

	private static readonly List<Tracer> Tracers = new List<Tracer>();

	private static readonly List<Rocket> Rockets = new List<Rocket>();

	private static readonly List<BombDrop> Bombs = new List<BombDrop>();

	private static readonly List<Gun> Guns = new List<Gun>();

	private static Material _wreckMat;

	private static Material _bombMat;

	private static float _nextSpawnCheck;

	private static float _nextHeli;

	private static float _nextOverhead;

	private static Mesh _tracerMesh;

	private static Mesh _rocketMesh;

	private static Mesh _sphereMesh;

	private static Material _tracerMat;

	private static Material _rocketMat;

	private static Material _flashMat;

	private static readonly List<Vector3> RecentSpots = new List<Vector3>();

	private const float JetSoundSpeed = 520f;

	private static readonly float[] FlybyPeaks = new float[8] { 5.5f, 5.5f, 5.5f, 3.9f, 5.5f, 2.7f, 5.5f, 3.2f };

	private static readonly List<(Plane p, int dmg, float at)> PendingHits = new List<(Plane, int, float)>();

	private static readonly List<(ParticleSystem ps, float until)> Burning = new List<(ParticleSystem, float)>();

	private static readonly List<(AudioSource src, float from, float len)> Fading = new List<(AudioSource, float, float)>();

	public static bool Running => Settings.AirBattle.Value;

	public static void Tick()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		Transform head = Player.Head;
		if ((Object)(object)head == (Object)null)
		{
			return;
		}
		float time = Time.time;
		float dt = Fast.Mathf__Min(Time.deltaTime, 0.05f);
		Vector3 position = head.position;
		if (!Running)
		{
			if (Planes.Count > 0)
			{
				foreach (Plane plane3 in Planes)
				{
					Remove(plane3, 0f);
				}
				Planes.Clear();
			}
			TickShared(position, time, dt);
			return;
		}
		if (!Settings.Dogfights.Value || !Settings.JetsOverYou.Value)
		{
			for (int num = Planes.Count - 1; num >= 0; num--)
			{
				Plane plane = Planes[num];
				if (plane.Team >= 0 && ((plane.Transit && !Settings.JetsOverYou.Value) || (!plane.Transit && !Settings.Dogfights.Value)))
				{
					Remove(plane, 0f);
					Planes.RemoveAt(num);
				}
			}
		}
		if (!Settings.HeliFlyovers.Value)
		{
			Heli.Clear();
		}
		if (Settings.Dogfights.Value && time >= _nextSpawnCheck)
		{
			_nextSpawnCheck = time + 1.5f;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			foreach (Plane plane4 in Planes)
			{
				if (!plane4.Dead && plane4.Team >= 0 && !plane4.Transit)
				{
					num2++;
					if (plane4.Team == 0)
					{
						num4++;
					}
					else
					{
						num3++;
					}
				}
			}
			int dogfighters = Perf.Dogfighters;
			if (num2 <= dogfighters - 2)
			{
				SpawnPair(position);
			}
			else if (num2 < dogfighters)
			{
				SpawnSingle(position, (num4 > num3) ? 1 : 0);
			}
		}
		if (Settings.JetsOverYou.Value && time >= _nextOverhead)
		{
			_nextOverhead = time + Random.Range(8f, 18f) * Perf.OverheadGap;
			int num5 = 0;
			foreach (Plane plane5 in Planes)
			{
				if (plane5.Transit && !plane5.Dead)
				{
					num5++;
				}
			}
			if (num5 < Perf.MaxOverhead)
			{
				SpawnOverhead(position);
			}
		}
		if (Settings.HeliFlyovers.Value && time >= _nextHeli)
		{
			_nextHeli = time + Random.Range(45f, 110f) * Perf.HeliGap;
			Heli.Flyover(position);
		}
		for (int num6 = Planes.Count - 1; num6 >= 0; num6--)
		{
			Plane plane2 = Planes[num6];
			try
			{
				if (plane2.Dead)
				{
					if (Fall(plane2, position, time, dt))
					{
						Remove(plane2, 6f);
						Planes.RemoveAt(num6);
					}
				}
				else
				{
					Fly(plane2, position, time, dt);
					if (plane2.Gone)
					{
						Remove(plane2, 4f);
						Planes.RemoveAt(num6);
					}
					else
					{
						Weapons(plane2, position, time);
						Pose(plane2, time, dt);
						Record(plane2, time);
						Loudness(plane2, position);
						plane2.Air?.Update(time);
						Flyby(plane2, position, time);
					}
				}
			}
			catch (Exception ex)
			{
				if (Settings.DebugLogging.Value)
				{
					Main.Log.Warning("Air battle: " + ex.Message);
				}
				Remove(plane2, 0f);
				Planes.RemoveAt(num6);
			}
		}
		TickShared(position, time, dt);
	}

	private static void TickShared(Vector3 you, float now, float dt)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		TickGuns(now);
		TickTracers(now, dt);
		TickBombs(you, dt);
		TickRockets(you, now, dt);
		Boom.Tick();
		Heli.Tick();
		BattleAudio.Tick();
		TickFlares(now, dt);
		TickBurning(now);
		TickFading(now);
		Chute.Tick(you);
	}

	private static Vector3 NewAnchor()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		Vector3 result = Fast.Vector3__op_Multiply(Fast.Vector3__get_forward(), 800f);
		float num = -1f;
		for (int i = 0; i < 12; i++)
		{
			Vector3 val = Fast.Vector3__op_Multiply(Fast.Quaternion__op_Multiply(Fast.Quaternion__Euler(0f, Random.Range(0f, 360f), 0f), Fast.Vector3__get_forward()), Random.Range(320f, 780f));
			float num2 = 5000f;
			foreach (Plane plane in Planes)
			{
				if (!plane.Dead && plane.Team >= 0)
				{
					float a = num2;
					Vector3 v = Fast.Vector3__op_Subtraction(plane.AnchorOff, val);
					num2 = Fast.Mathf__Min(a, Fast.Vector3__get_magnitude(ref v));
				}
			}
			if (num2 > num)
			{
				num = num2;
				result = val;
			}
		}
		return result;
	}

	private static void SpawnPair(Vector3 you)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		Vector3 v = NewAnchor();
		bool flag = Random.value < 0.3f;
		Vector3 a = Fast.Quaternion__op_Multiply(Fast.Quaternion__Euler(0f, Random.Range(-70f, 70f), 0f), Fast.Vector3__get_normalized(ref v));
		Vector3 val = Fast.Vector3__op_UnaryNegation(a);
		Vector3 val2 = Fast.Vector3__op_Addition(Fast.Vector3__op_Addition(you, v), Fast.Vector3__op_Multiply(a, Random.Range(1100f, 1500f)));
		val2.y = you.y + (flag ? Random.Range(70f, 140f) : Random.Range(230f, 460f));
		int num = ((!(Random.value < 0.5f)) ? 1 : 0);
		Plane plane = Spawn(you, num, v, flag, val2, val);
		Vector3 a2 = Fast.Vector3__Cross(Fast.Vector3__get_up(), val);
		Plane plane2 = Spawn(you, 1 - num, v, flag, Fast.Vector3__op_Addition(Fast.Vector3__op_Addition(Fast.Vector3__op_Subtraction(val2, Fast.Vector3__op_Multiply(val, Random.Range(450f, 750f))), Fast.Vector3__op_Multiply(a2, Random.Range(-120f, 120f))), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Random.Range(-30f, 60f))), val);
		if (plane != null && plane2 != null)
		{
			plane2.Target = plane;
			plane.Target = plane2;
		}
	}

	private static void SpawnSingle(Vector3 you, int team)
	{
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		Plane plane = null;
		int num = int.MaxValue;
		foreach (Plane plane3 in Planes)
		{
			if (plane3.Dead || plane3.Team < 0 || plane3.Team == team)
			{
				continue;
			}
			int num2 = 0;
			foreach (Plane plane4 in Planes)
			{
				if (!plane4.Dead && plane4.Target == plane3)
				{
					num2++;
				}
			}
			if (num2 < num)
			{
				num = num2;
				plane = plane3;
			}
		}
		if (plane == null)
		{
			SpawnPair(you);
			return;
		}
		Vector3 val = ((Fast.Vector3__get_sqrMagnitude(ref plane.Vel) > 1f) ? Fast.Vector3__get_normalized(ref plane.Vel) : Fast.Vector3__get_forward());
		Vector3 at = Fast.Vector3__op_Addition(Fast.Vector3__op_Subtraction(plane.Pos, Fast.Vector3__op_Multiply(val, Random.Range(900f, 1400f))), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Random.Range(40f, 160f)));
		Vector3 anchorOff = plane.AnchorOff;
		bool low = plane.Low;
		Vector3 v = val.WithY(0f);
		Plane plane2 = Spawn(you, team, anchorOff, low, at, Fast.Vector3__get_normalized(ref v));
		if (plane2 != null)
		{
			plane2.Target = plane;
		}
	}

	private static Plane Spawn(Vector3 you, int team, Vector3 anchor, bool low, Vector3 at, Vector3 heading)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		FighterModel.Parts parts = FighterModel.Build((team == 1) ? FighterModel.Kind.Flanker : ((!(Random.value < 0.4f)) ? ((Random.value < 0.6f) ? FighterModel.Kind.Lightning : FighterModel.Kind.NextGen) : FighterModel.Kind.Raptor));
		if (parts == null)
		{
			return null;
		}
		float num = Fast.Mathf__Max(GroundBelow(Fast.Vector3__op_Addition(at, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 2000f)), you), you.y - 1.7f);
		Plane p = new Plane
		{
			Parts = parts,
			Team = team,
			Low = low,
			AnchorOff = anchor,
			MinH = (low ? 40f : 160f),
			MaxH = (low ? 160f : 520f),
			Speed = Random.Range(200f, 220f),
			RollSpin = ((Random.value < 0.5f) ? 1f : (-1f)),
			NextGun = Time.time + Random.Range(1.5f, 4f),
			NextMissile = Time.time + Random.Range(4f, 9f),
			NextAttack = Time.time + Random.Range(30f, 60f),
			GroundY = num,
			CircleDir = ((Random.value < 0.5f) ? (-1f) : 1f),
			CircleAlt = (low ? Random.Range(80f, 140f) : Random.Range(200f, 400f)),
			Phase = Random.value * 10f,
			NextReverse = Time.time + Random.Range(8f, 16f)
		};
		if (Fast.Vector3__get_sqrMagnitude(ref heading) < 0.01f)
		{
			heading = Fast.Vector3__get_forward();
		}
		p.Pos = Fast.Vector3__new(at.x, Fast.Mathf__Max(at.y, num + Random.Range(p.MinH + 30f, p.MaxH)), at.z);
		if (at.y < num + p.MinH)
		{
			p.Pos.y = num + Random.Range(p.MinH + 30f, p.MaxH);
		}
		p.Vel = Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref heading), p.Speed);
		p.LastVel = p.Vel;
		p.Rot = Fast.Quaternion__LookRotation(heading, Fast.Vector3__get_up());
		parts.Root.transform.SetPositionAndRotation(p.Pos, p.Rot);
		Record(p, Time.time);
		AirSound.PathFn path = delegate(float t, out Vector3 v)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return Sample(p, t, out v);
		};
		p.Air = new AirSound(path, Time.time, 0f, Sfx.JetRoarClip(), 0.35f, 520f, background: true)
		{
			MaxLookback = 9f
		};
		Planes.Add(p);
		return p;
	}

	public static Vector3 PickGroundSpot(Vector3 you, float min, float max)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Fast.Vector3__op_Multiply(Fast.Vector3__get_forward(), max);
		float num = -1f;
		Vector3 self = default(Vector3);
		for (int i = 0; i < 10; i++)
		{
			Vector2 v = Random.insideUnitCircle;
			Vector2 val2 = Fast.Vector2__op_Multiply(Fast.Vector2__get_normalized(ref v), Random.Range(min, max));
			Fast.Vector3__ctor(ref self, val2.x, 0f, val2.y);
			float num2 = 5000f;
			foreach (Vector3 recentSpot in RecentSpots)
			{
				float a = num2;
				Vector3 v2 = Fast.Vector3__op_Subtraction(recentSpot, self);
				num2 = Fast.Mathf__Min(a, Fast.Vector3__get_magnitude(ref v2));
			}
			if (num2 > num)
			{
				num = num2;
				val = self;
			}
		}
		RecentSpots.Add(val);
		if (RecentSpots.Count > 6)
		{
			RecentSpots.RemoveAt(0);
		}
		Vector3 val3 = Fast.Vector3__op_Addition(you, val);
		val3.y = GroundBelow(Fast.Vector3__op_Addition(val3, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 400f)), you);
		return val3;
	}

	private static void Fly(Plane p, Vector3 you, float now, float dt)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0471: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_047f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_042f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0490: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0508: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0517: Unknown result type (might be due to invalid IL or missing references)
		//IL_051c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0556: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0572: Unknown result type (might be due to invalid IL or missing references)
		//IL_0578: Unknown result type (might be due to invalid IL or missing references)
		//IL_0580: Unknown result type (might be due to invalid IL or missing references)
		//IL_0585: Unknown result type (might be due to invalid IL or missing references)
		//IL_058c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_0598: Unknown result type (might be due to invalid IL or missing references)
		//IL_059d: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
		if (p.Transit)
		{
			Overhead(p, you, now, dt);
			return;
		}
		if (p.Target == null || p.Target.Dead || !Planes.Contains(p.Target))
		{
			p.Target = PickTarget(p);
		}
		if (now >= p.NextGroundCheck)
		{
			p.NextGroundCheck = now + 0.2f;
			float num = you.y - 1.7f;
			Vector3 a = p.Vel.WithY(0f);
			p.GroundY = Fast.Mathf__Max(new float[4]
			{
				MapScan.Height(p.Pos, num),
				MapScan.Height(Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(a, 1.5f)), num),
				MapScan.Height(Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(a, 3f)), num),
				num
			});
		}
		if (now >= p.FlaresAt)
		{
			p.FlaresAt = float.MaxValue;
			PopFlares(p.Pos, p.Vel, p.Rot, p, Random.Range(6, 11));
		}
		if (p.Attack == 0 && now >= p.NextAttack && !BeingChased(p))
		{
			int num2 = 0;
			foreach (Plane plane in Planes)
			{
				if (!plane.Dead && plane.Attack > 0)
				{
					num2++;
				}
			}
			if (num2 < 1)
			{
				StartAttack(p, you, now);
			}
			else
			{
				p.NextAttack = now + Random.Range(6f, 12f);
			}
		}
		if (p.Attack > 0)
		{
			AttackFly(p, you, now, dt);
			return;
		}
		bool flag = false;
		if (p.Target != null)
		{
			Vector3 v = Fast.Vector3__op_Subtraction(p.Target.Pos, p.Pos);
			float num3 = Fast.Vector3__get_magnitude(ref v);
			flag = num3 < 1500f && Fast.Vector3__Dot(Fast.Vector3__get_normalized(ref p.Vel), Fast.Vector3__op_Division(v, Fast.Mathf__Max(1f, num3))) > 0.3f;
		}
		Vector3 v3;
		if (flag)
		{
			float a2 = Fast.Vector3__Distance(p.Pos, p.Target.Pos) / Fast.Mathf__Max(100f, p.Speed + 150f);
			Vector3 v2 = Fast.Vector3__op_Subtraction(Fast.Vector3__op_Addition(p.Target.Pos, Fast.Vector3__op_Multiply(p.Target.Vel, Fast.Mathf__Min(a2, 2.5f))), p.Pos);
			v3 = Fast.Vector3__get_normalized(ref v2);
			v3.y = Fast.Mathf__Clamp(v3.y, -0.45f, 0.45f);
			Fast.Vector3__Normalize(ref v3);
		}
		else
		{
			v3 = Circle(p, you, now);
		}
		bool flag2 = BeingChased(p);
		if (flag2)
		{
			if (now >= p.NextJink)
			{
				p.NextJink = now + Random.Range(1.2f, 2.6f);
				p.JinkSide = ((Random.value < 0.5f) ? (-1f) : 1f);
				p.JinkUntil = now + Random.Range(0.6f, 1.4f);
			}
			if (now < p.JinkUntil)
			{
				Vector3 v2 = Fast.Vector3__Cross(Fast.Vector3__get_up(), Fast.Vector3__get_normalized(ref p.Vel));
				Vector3 b = Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref v2), p.JinkSide);
				v2 = Fast.Vector3__op_Addition(Fast.Vector3__op_Addition(Fast.Vector3__op_Multiply(v3, 0.3f), b), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Random.Range(-0.4f, 0.6f)));
				v3 = Fast.Vector3__get_normalized(ref v2);
			}
		}
		Vector3 v4 = Fast.Vector3__op_Subtraction(p.Pos, Fast.Vector3__op_Addition(you, p.AnchorOff)).WithY(0f);
		if (Fast.Vector3__get_magnitude(ref v4) > 480f)
		{
			Vector3 a3 = v3;
			Vector3 v2 = Fast.Vector3__op_UnaryNegation(v4);
			v2 = Fast.Vector3__Lerp(a3, Fast.Vector3__get_normalized(ref v2), Fast.Mathf__Clamp01((Fast.Vector3__get_magnitude(ref v4) - 480f) / 220f));
			v3 = Fast.Vector3__get_normalized(ref v2);
		}
		float num4 = p.Pos.y - p.GroundY;
		if (p.Low && num4 > p.MaxH * 0.6f)
		{
			Vector3 v2 = Fast.Vector3__op_Subtraction(v3, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 0.35f));
			v3 = Fast.Vector3__get_normalized(ref v2);
		}
		if (num4 < p.MinH)
		{
			Vector3 v2 = Fast.Vector3__op_Addition(v3, Fast.Vector3__op_Multiply(Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Fast.Mathf__Clamp01((p.MinH - num4) / 60f)), 2.5f));
			v3 = Fast.Vector3__get_normalized(ref v2);
		}
		if (num4 > p.MaxH)
		{
			Vector3 v2 = Fast.Vector3__op_Subtraction(v3, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Fast.Mathf__Clamp((num4 - p.MaxH) / 60f, 0f, 1.5f)));
			v3 = Fast.Vector3__get_normalized(ref v2);
		}
		float rateDeg = (flag2 ? 34f : 30f);
		Avoid(p, you, ref v3, ref rateDeg, p.Low ? 18f : 30f);
		float num5 = rateDeg * ((float)Math.PI / 180f);
		Vector3 val = Vector3.RotateTowards(Fast.Vector3__get_normalized(ref p.Vel), v3, num5 * dt, 0f);
		p.Speed = Fast.Mathf__MoveTowards(p.Speed, flag2 ? 225f : (p.Low ? 185f : 195f), 7f * dt);
		p.Speed = Energy(p, val, num5 * 57.29578f, dt);
		p.LastVel = p.Vel;
		p.Vel = Fast.Vector3__op_Multiply(val, p.Speed);
		p.Pos = Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(p.Vel, dt));
		KeepAboveGround(p, you);
	}

	private static Vector3 Circle(Plane p, Vector3 you, float now)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		Vector3 b = Fast.Vector3__op_Addition(you, p.AnchorOff);
		Vector3 v = Fast.Vector3__op_Subtraction(p.Pos, b).WithY(0f);
		float num = Fast.Vector3__get_magnitude(ref v);
		Vector3 val = ((num > 1f) ? Fast.Vector3__op_Division(v, num) : Fast.Vector3__get_forward());
		if (now >= p.NextReverse)
		{
			p.NextReverse = now + Random.Range(8f, 16f);
			if (Random.value < 0.45f)
			{
				p.CircleDir = 0f - p.CircleDir;
			}
		}
		Vector3 v2 = Fast.Vector3__op_Addition(Fast.Vector3__op_Multiply(Fast.Vector3__Cross(Fast.Vector3__get_up(), val), p.CircleDir), Fast.Vector3__op_Multiply(val, Fast.Mathf__Clamp((400f - num) / 400f * 2.5f, -1.2f, 1.2f)));
		float num2 = you.y - 1.7f + p.CircleAlt + Fast.Mathf__Sin(now * 0.3f + p.Phase) * (p.Low ? 25f : 70f);
		v2.y = Fast.Mathf__Clamp((num2 - p.Pos.y) / 150f, -0.5f, 0.5f);
		return Fast.Vector3__get_normalized(ref v2);
	}

	private static bool BeingChased(Plane p)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		foreach (Plane plane in Planes)
		{
			if (!plane.Dead && plane.Team != p.Team && plane.Team >= 0)
			{
				Vector3 v = Fast.Vector3__op_Subtraction(p.Pos, plane.Pos);
				if (Fast.Vector3__get_sqrMagnitude(ref v) < 490000f && Fast.Vector3__Dot(Fast.Vector3__get_normalized(ref plane.Vel), Fast.Vector3__get_normalized(ref v)) > 0.85f)
				{
					return true;
				}
			}
		}
		return false;
	}

	private static Plane PickTarget(Plane p)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		Plane result = null;
		float num = float.MaxValue;
		foreach (Plane plane in Planes)
		{
			if (!plane.Dead && plane.Team != p.Team && plane.Team >= 0 && !plane.Transit)
			{
				Vector3 v = Fast.Vector3__op_Subtraction(plane.Pos, p.Pos);
				float num2 = Fast.Vector3__get_sqrMagnitude(ref v) * Random.Range(0.8f, 1.2f);
				v = Fast.Vector3__op_Subtraction(plane.AnchorOff, p.AnchorOff);
				if (Fast.Vector3__get_sqrMagnitude(ref v) > 1f)
				{
					num2 *= 8f;
				}
				if (num2 < num)
				{
					num = num2;
					result = plane;
				}
			}
		}
		return result;
	}

	private static void Pose(Plane p, float now, float dt)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		Vector3 a = Fast.Vector3__op_Addition(Fast.Vector3__op_Division(Fast.Vector3__op_Subtraction(p.Vel, p.LastVel), Fast.Mathf__Max(0.001f, dt)), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 9.81f));
		Vector3 val = Fast.Vector3__get_normalized(ref p.Vel);
		Vector3 v = Fast.Vector3__op_Subtraction(a, Fast.Vector3__op_Multiply(val, Fast.Vector3__Dot(a, val)));
		if (Fast.Vector3__get_sqrMagnitude(ref v) < 0.01f)
		{
			v = Fast.Vector3__get_up();
		}
		Quaternion b = Fast.Quaternion__LookRotation(val, Fast.Vector3__get_normalized(ref v));
		p.Rot = Fast.Quaternion__Slerp(p.Rot, b, 1f - Fast.Mathf__Exp((0f - dt) * 6f));
		if (now < p.JinkUntil)
		{
			p.Roll += 260f * dt * p.JinkSide;
		}
		else
		{
			p.Roll = Fast.Mathf__MoveTowards(Fast.Mathf__DeltaAngle(0f, p.Roll), 0f, 300f * dt);
		}
		p.Parts.Root.transform.SetPositionAndRotation(p.Pos, Fast.Quaternion__op_Multiply(p.Rot, Fast.Quaternion__Euler(0f, 0f, p.Roll)));
		float num = 1f + Fast.Mathf__Sin(now * 51f + p.Pos.x) * 0.1f;
		float num2 = Fast.Vector3__get_magnitude(ref v) / 9.81f;
		float t = Fast.Mathf__Clamp01(0.25f + val.y * 1.5f + ((now < p.JinkUntil) ? 0.5f : 0f) + (num2 - 1f) / 8f);
		float z = Fast.Mathf__Lerp(1.1f, 3.2f, t) * num;
		foreach (Transform flame in p.Parts.Flames)
		{
			if ((Object)(object)flame != (Object)null)
			{
				flame.localScale = Fast.Vector3__new(flame.localScale.x, flame.localScale.y, z);
			}
		}
		Vapour(p, num2);
	}

	private static void Vapour(Plane p, float g)
	{
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)p.Parts?.Root == (Object)null || !Perf.Vapour)
		{
			return;
		}
		ParticleSystem[] array;
		if ((Object)(object)p.VaporL == (Object)null)
		{
			float num = Fast.Mathf__Max(3f, p.Parts.Span * 0.5f);
			Transform transform = p.Parts.Root.transform;
			p.VaporL = Boom.Trail(transform, Fast.Vector3__new(0f - num, 0f, (0f - p.Parts.Length) * 0.15f), dark: false, 0.4f);
			p.VaporR = Boom.Trail(transform, Fast.Vector3__new(num, 0f, (0f - p.Parts.Length) * 0.15f), dark: false, 0.4f);
			array = (ParticleSystem[])(object)new ParticleSystem[2] { p.VaporL, p.VaporR };
			foreach (ParticleSystem val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					SmokeCloud.SetLifetime(val.main, 0.5f, 0.9f);
					val.emission.rateOverTimeMultiplier = 0f;
				}
			}
		}
		float rateOverTimeMultiplier = ((g > 3.2f) ? Fast.Mathf__Lerp(0f, 420f, Fast.Mathf__Clamp01((g - 3.2f) / 3f)) : 0f);
		array = (ParticleSystem[])(object)new ParticleSystem[2] { p.VaporL, p.VaporR };
		foreach (ParticleSystem val2 in array)
		{
			if ((Object)(object)val2 != (Object)null)
			{
				val2.emission.rateOverTimeMultiplier = rateOverTimeMultiplier;
			}
		}
	}

	private static float Energy(Plane p, Vector3 fwd, float turnDegPerSec, float dt)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return Fast.Mathf__Clamp(p.Speed - 9.81f * fwd.y * dt * 1.1f - Fast.Mathf__Max(0f, turnDegPerSec - 20f) * 0.06f * dt, 140f, 400f);
	}

	private static void StartAttack(Plane p, Vector3 you, float now)
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		foreach (Plane plane in Planes)
		{
			if (!plane.Dead && (plane.Attack == 4 || plane.Attack == 5))
			{
				num++;
			}
		}
		if (num < 2 && Random.value < (p.Low ? 0.7f : 0.45f))
		{
			StartLowPass(p, you);
			return;
		}
		p.AttackAt = PickGroundSpot(you, 160f, 600f);
		p.Attack = 1;
		p.UseRockets = Random.value < 0.45f;
		p.Ordnance = (p.UseRockets ? 8 : 4);
		p.NextStrafe = 0f;
	}

	private static void StartLowPass(Plane p, Vector3 you)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		Vector3 v = Fast.Vector3__op_Subtraction(p.Pos, you).WithY(0f);
		if (Fast.Vector3__get_sqrMagnitude(ref v) < 1f)
		{
			v = Fast.Vector3__get_forward();
		}
		Vector3 val = Fast.Quaternion__op_Multiply(Fast.Quaternion__Euler(0f, Random.Range(-35f, 35f), 0f), Fast.Vector3__op_UnaryNegation(Fast.Vector3__get_normalized(ref v)));
		Vector3 a = Fast.Vector3__Cross(Fast.Vector3__get_up(), val);
		float d = ((Random.value < 0.5f) ? (-1f) : 1f) * Random.Range(12f, 60f);
		Vector3 val2 = Fast.Vector3__op_Addition(you, Fast.Vector3__op_Multiply(a, d));
		val2.y = GroundBelow(Fast.Vector3__op_Addition(val2, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 400f)), you);
		p.PassDir = val;
		p.PassPoint = val2;
		p.PassH = Random.Range(18f, 45f);
		p.PassRoll = Random.value < 0.35f;
		p.PassSound = false;
		p.AttackAt = val2;
		p.Attack = 4;
		p.NextStrafe = Time.time + 50f;
	}

	private static void PassSound(Plane p, Vector3 you, float now, float along)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		float num = (0f - along) / Fast.Mathf__Max(150f, p.Speed);
		Vector3 b = Fast.Vector3__op_Addition(p.PassPoint, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), p.PassH));
		ScheduleFlyby(p, now + num, Fast.Vector3__Distance(you, b));
	}

	private static Vector3 OnPassLine(Plane p, float along)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return Fast.Vector3__op_Addition(p.PassPoint, Fast.Vector3__op_Multiply(p.PassDir, along));
	}

	private static void AttackFly(Plane p, Vector3 you, float now, float dt)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0635: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_053a: Unknown result type (might be due to invalid IL or missing references)
		//IL_053f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_066b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0670: Unknown result type (might be due to invalid IL or missing references)
		//IL_0680: Unknown result type (might be due to invalid IL or missing references)
		//IL_0685: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0702: Unknown result type (might be due to invalid IL or missing references)
		//IL_0707: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0712: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04db: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0456: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_047a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_049f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		Vector3 v = Fast.Vector3__op_Subtraction(p.AttackAt, p.Pos);
		Vector3 v2 = v.WithY(0f);
		float num = p.Pos.y - p.AttackAt.y;
		float rateDeg = 30f;
		Vector3 want;
		switch (p.Attack)
		{
		case 4:
		{
			float num6 = Fast.Vector3__Dot(Fast.Vector3__op_Subtraction(p.Pos, p.PassPoint), p.PassDir);
			Vector3 a2 = OnPassLine(p, -2200f);
			a2.y = p.PassPoint.y + 160f;
			Vector3 v3 = Fast.Vector3__op_Subtraction(a2, p.Pos);
			want = Fast.Vector3__get_normalized(ref v3);
			rateDeg = 30f;
			v3 = Fast.Vector3__op_Subtraction(p.Pos, OnPassLine(p, num6)).WithY(0f);
			float num7 = Fast.Vector3__get_magnitude(ref v3);
			if (num6 < -1300f && num7 < 450f && Fast.Vector3__Angle(p.Vel.WithY(0f), p.PassDir) < 60f)
			{
				p.Attack = 5;
			}
			else
			{
				v3 = Fast.Vector3__op_Subtraction(a2, p.Pos).WithY(0f);
				if (Fast.Vector3__get_magnitude(ref v3) < 500f)
				{
					p.Attack = 5;
				}
			}
			if (now > p.NextStrafe)
			{
				p.Attack = 3;
				p.AttackAt = p.PassPoint;
			}
			break;
		}
		case 5:
		{
			float num2 = Fast.Vector3__Dot(Fast.Vector3__op_Subtraction(p.Pos, p.PassPoint), p.PassDir);
			Vector3 a = OnPassLine(p, num2 + Fast.Mathf__Max(450f, p.Speed * 2f));
			float num3 = Fast.Mathf__Max(p.GroundY, GroundBelow(Fast.Vector3__op_Addition(a, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 300f)), you));
			float num4 = Fast.Mathf__Lerp(p.PassH, 120f, Fast.Mathf__Clamp01((0f - num2 - 300f) / 1200f));
			a.y = num3 + num4;
			Vector3 v3 = Fast.Vector3__op_Subtraction(a, p.Pos);
			want = Fast.Vector3__get_normalized(ref v3);
			rateDeg = 26f;
			if (p.Pos.y - p.GroundY < 14f)
			{
				v3 = Fast.Vector3__op_Addition(want, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 0.6f));
				want = Fast.Vector3__get_normalized(ref v3);
			}
			if (!p.PassSound && num2 > -1300f)
			{
				p.PassSound = true;
				PassSound(p, you, now, num2);
			}
			if (num2 > 350f)
			{
				p.Attack = 3;
				p.AttackAt = p.PassPoint;
				if (p.PassRoll)
				{
					p.JinkSide = ((Random.value < 0.5f) ? (-1f) : 1f);
					p.JinkUntil = now + 1.38f;
				}
			}
			break;
		}
		case 1:
		{
			Vector3 v3 = Fast.Vector3__op_Subtraction(Fast.Vector3__op_Subtraction(Fast.Vector3__op_Addition(p.AttackAt, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), p.Low ? 260f : 480f)), Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref v2), 300f)), p.Pos);
			want = Fast.Vector3__get_normalized(ref v3);
			if (Fast.Vector3__get_magnitude(ref v2) < 1600f && Fast.Vector3__get_magnitude(ref v2) > 700f && num > (p.Low ? 150f : 300f) && Fast.Vector3__Angle(p.Vel.WithY(0f), v2) < 35f)
			{
				p.Attack = 2;
			}
			if (Fast.Vector3__get_magnitude(ref v2) < 700f)
			{
				v3 = Fast.Vector3__op_Subtraction(want, Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref v2), 1.5f));
				want = Fast.Vector3__get_normalized(ref v3);
			}
			break;
		}
		case 2:
		{
			want = Fast.Vector3__get_normalized(ref v);
			rateDeg = 22f;
			float num5 = Fast.Vector3__get_magnitude(ref v);
			if (p.Ordnance > 0 && now >= p.NextDrop && num5 < (p.UseRockets ? 950f : 650f))
			{
				p.NextDrop = now + (p.UseRockets ? 0.12f : 0.2f);
				p.Ordnance--;
				if (p.UseRockets)
				{
					GroundRocket(Fast.Vector3__op_Subtraction(Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref p.Vel), 6f)), Fast.Vector3__op_Multiply(p.Parts.Root.transform.up, 0.8f)), p.Vel, Fast.Vector3__op_Addition(p.AttackAt, RandomFlat(30f)));
				}
				else
				{
					DropBomb(Fast.Vector3__op_Subtraction(p.Pos, Fast.Vector3__op_Multiply(p.Parts.Root.transform.up, 1.5f)), Fast.Vector3__op_Multiply(p.Vel, 0.95f), you);
				}
			}
			if (now >= p.NextStrafe && num5 < 1100f && num5 > 300f)
			{
				p.NextStrafe = now + 1.6f;
				Plane pl = p;
				Vector3 spot = Fast.Vector3__op_Addition(p.AttackAt, RandomFlat(20f));
				FireGun(() => GunMuzzle(pl), () => Fast.Vector3__op_Addition(spot, RandomFlat(6f)), () => pl.Vel, 0.9f, 0.006f, spot.y);
			}
			if (num < 45f + p.Speed * 0.12f || Fast.Vector3__get_magnitude(ref v2) < 110f)
			{
				p.Attack = 3;
			}
			break;
		}
		default:
		{
			Vector3 v3 = p.Vel.WithY(0f);
			v3 = Fast.Vector3__op_Addition(Fast.Vector3__get_normalized(ref v3), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 1.3f));
			want = Fast.Vector3__get_normalized(ref v3);
			rateDeg = 42f;
			if (num > (p.Low ? 130f : 300f))
			{
				p.Attack = 0;
				p.PassSound = false;
				p.NextAttack = now + Random.Range(40f, 80f);
			}
			break;
		}
		}
		Avoid(p, you, ref want, ref rateDeg, (p.Attack == 5) ? 9f : ((p.Attack == 2) ? 14f : 20f));
		Vector3 val = Vector3.RotateTowards(Fast.Vector3__get_normalized(ref p.Vel), want, rateDeg * ((float)Math.PI / 180f) * dt, 0f);
		p.Speed = Fast.Mathf__MoveTowards(p.Speed, (p.Attack == 2) ? 280f : ((p.Attack == 5) ? 275f : 250f), 9f * dt);
		p.Speed = Energy(p, val, rateDeg, dt);
		p.LastVel = p.Vel;
		p.Vel = Fast.Vector3__op_Multiply(val, p.Speed);
		p.Pos = Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(p.Vel, dt));
		KeepAboveGround(p, you);
	}

	private static bool Avoid(Plane p, Vector3 you, ref Vector3 want, ref float rateDeg, float clearance)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		float num = Fast.Vector3__get_magnitude(ref p.Vel);
		if (num < 1f)
		{
			return false;
		}
		Vector3 val = Fast.Vector3__op_Division(p.Vel, num);
		Vector3 v = val.WithY(0f);
		if (Fast.Vector3__get_sqrMagnitude(ref v) < 0.0025f)
		{
			v = Fast.Quaternion__op_Multiply(p.Rot, Fast.Vector3__get_forward());
		}
		v.y = 0f;
		if (Fast.Vector3__get_sqrMagnitude(ref v) < 0.0001f)
		{
			v = Fast.Vector3__get_forward();
		}
		Fast.Vector3__Normalize(ref v);
		float num2 = Fast.Mathf__Asin(Fast.Mathf__Clamp(val.y, -1f, 1f));
		float num3 = num / 0.6981317f;
		Vector3 val2 = Fast.Vector3__op_Addition(p.Pos, Fast.Vector3__op_Multiply(p.Vel, 0.35f));
		float fallback = you.y - 1.7f;
		float num4 = Fast.Mathf__Sin(num2);
		float num5 = Fast.Mathf__Cos(num2);
		float num6 = ((num2 < 0.87266463f) ? (num3 * (Fast.Mathf__Sin(0.87266463f) - num4)) : 0f);
		float num7 = ((num2 < 0.87266463f) ? (num3 * (num5 - Fast.Mathf__Cos(0.87266463f))) : 0f);
		float num8 = Fast.Mathf__Tan(Fast.Mathf__Max(num2, 0.87266463f));
		float num9 = Fast.Mathf__Max(700f, num * 5f);
		bool flag = val2.y < MapScan.Height(val2, fallback) + clearance * 0.5f;
		float num10 = 0f;
		while (!flag && num10 <= num9)
		{
			float num12;
			if (num10 <= num6)
			{
				float num11 = Fast.Mathf__Clamp(num4 + num10 / num3, -1f, 1f);
				num12 = val2.y + num3 * (num5 - Fast.Mathf__Sqrt(1f - num11 * num11));
			}
			else
			{
				num12 = val2.y + num7 + (num10 - num6) * num8;
			}
			if (MapScan.Height(Fast.Vector3__op_Addition(val2, Fast.Vector3__op_Multiply(v, num10)), fallback) + clearance > num12)
			{
				flag = true;
			}
			num10 += 20f;
		}
		if (!flag)
		{
			return false;
		}
		Vector3 v2 = Fast.Vector3__op_Addition(Fast.Vector3__op_Multiply(v, Fast.Mathf__Cos(0.87266463f)), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), Fast.Mathf__Sin(0.87266463f)));
		want = Fast.Vector3__get_normalized(ref v2);
		rateDeg = Fast.Mathf__Max(rateDeg, 58f);
		return true;
	}

	private static void KeepAboveGround(Plane p, Vector3 you)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		float num = MapScan.Height(p.Pos, you.y - 1.7f) + 4f;
		if (!(p.Pos.y >= num))
		{
			p.Pos.y = num;
			if (p.Vel.y < 0f)
			{
				Vector3 v = p.Vel;
				v.y = 0f;
				p.Vel = ((Fast.Vector3__get_sqrMagnitude(ref v) > 1f) ? Fast.Vector3__op_Multiply(Fast.Vector3__get_normalized(ref v), p.Speed) : Fast.Vector3__op_Multiply(Fast.Quaternion__op_Multiply(p.Rot, Fast.Vector3__get_forward()), p.Speed));
			}
		}
	}

	private static Vector3 RandomFlat(float r)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Fast.Vector2__op_Multiply(Random.insideUnitCircle, r);
		return Fast.Vector3__new(val.x, 0f, val.y);
	}

	private static Vector3 GunMuzzle(Plane p)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)p.Parts?.Root == (Object)null)
		{
			return p.Pos;
		}
		Transform transform = p.Parts.Root.transform;
		return Fast.Vector3__op_Addition(Fast.Vector3__op_Addition(Fast.Vector3__op_Addition(transform.position, Fast.Vector3__op_Multiply(transform.forward, p.Parts.Length * 0.38f)), Fast.Vector3__op_Multiply(transform.right, 0.9f)), Fast.Vector3__op_Multiply(transform.up, 0.3f));
	}

	private static void Record(Plane p, float now)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (p.Trail.Count <= 0 || !(now - p.Trail[p.Trail.Count - 1].t < 0.05f))
		{
			p.Trail.Add((now, p.Pos, p.Vel));
			while (p.Trail.Count > 2 && now - p.Trail[0].t > 10f)
			{
				p.Trail.RemoveAt(0);
			}
		}
	}

	private static Vector3 Sample(Plane p, float t, out Vector3 vel)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		List<(float, Vector3, Vector3)> trail = p.Trail;
		if (trail.Count == 0)
		{
			vel = p.Vel;
			return p.Pos;
		}
		if (t <= trail[0].Item1)
		{
			vel = trail[0].Item3;
			return Fast.Vector3__op_Addition(trail[0].Item2, Fast.Vector3__op_Multiply(trail[0].Item3, t - trail[0].Item1));
		}
		(float, Vector3, Vector3) tuple = trail[trail.Count - 1];
		if (t >= tuple.Item1)
		{
			vel = tuple.Item3;
			return Fast.Vector3__op_Addition(tuple.Item2, Fast.Vector3__op_Multiply(tuple.Item3, t - tuple.Item1));
		}
		int num = 0;
		int num2 = trail.Count - 1;
		while (num2 - num > 1)
		{
			int num3 = (num + num2) / 2;
			if (trail[num3].Item1 <= t)
			{
				num = num3;
			}
			else
			{
				num2 = num3;
			}
		}
		float t2 = Fast.Mathf__InverseLerp(trail[num].Item1, trail[num2].Item1, t);
		vel = Fast.Vector3__Lerp(trail[num].Item3, trail[num2].Item3, t2);
		return Fast.Vector3__Lerp(trail[num].Item2, trail[num2].Item2, t2);
	}

	private static void Loudness(Plane p, Vector3 you)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		if (p.Air != null)
		{
			float num = Fast.Vector3__Distance(p.Pos, you);
			int num2 = ((num < 1000f) ? 70 : 210);
			if (num2 != p.Prio)
			{
				p.Prio = num2;
				p.Air.Priority = num2;
			}
			bool flag = p.Transit || p.Attack == 4 || p.Attack == 5 || (p.Attack == 3 && p.PassSound);
			p.Air.VolumeScale = (flag ? Fast.Mathf__Lerp(3f, 1.5f, Fast.Mathf__Clamp01(num / 900f)) : 1f);
		}
	}

	private static void Flyby(Plane p, Vector3 you, float now)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		if (now - p.LastFlyby < 10f || p.Air == null)
		{
			return;
		}
		Vector3 a = Fast.Vector3__op_Subtraction(p.Pos, you);
		float num = Fast.Vector3__get_sqrMagnitude(ref p.Vel);
		if (num < 1f)
		{
			return;
		}
		float num2 = (0f - Fast.Vector3__Dot(a, p.Vel)) / num;
		if (!(num2 < 2.9f) && !(num2 > 6.5f))
		{
			Vector3 v = Fast.Vector3__op_Addition(a, Fast.Vector3__op_Multiply(p.Vel, num2));
			float num3 = Fast.Vector3__get_magnitude(ref v);
			if (!(num3 > 500f))
			{
				ScheduleFlyby(p, now + num2, num3);
			}
		}
	}

	private static void ScheduleFlyby(Plane p, float passTime, float closest)
	{
		if (p.Air != null)
		{
			p.LastFlyby = Time.time + 12f;
			int num = Random.Range(0, FlybyPeaks.Length);
			AudioClip val = CustomSounds.Get("jetfly" + (num + 1));
			float num2 = passTime + closest / 520f;
			if ((Object)(object)val != (Object)null)
			{
				float num3 = Fast.Mathf__Min(2.8f, FlybyPeaks[num]);
				float volume = Fast.Mathf__Clamp(1.4f - closest / 900f, 0.4f, 1.2f);
				p.Air.ScheduleClip(val, num2 - num3, FlybyPeaks[num] - num3, volume, 0.9f);
			}
			if (p.Supersonic)
			{
				p.BoomAt = num2;
			}
		}
	}

	private static void SpawnOverhead(Vector3 you)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		Vector2 v = Random.insideUnitCircle;
		Vector2 val = Fast.Vector2__get_normalized(ref v);
		Vector3 self = default(Vector3);
		Fast.Vector3__ctor(ref self, val.x, 0f, val.y);
		Vector3 val2 = Fast.Vector3__Cross(Fast.Vector3__get_up(), self);
		Vector3 val3 = Fast.Vector3__op_Addition(you, Fast.Vector3__op_Multiply(val2, Random.Range(-30f, 30f)));
		val3.y = GroundBelow(Fast.Vector3__op_Addition(val3, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 400f)), you);
		float num = Random.Range(30f, 90f);
		bool flag = Random.value < 0.22f;
		bool flag2 = Random.value < 0.55f;
		float num2 = (flag ? 390f : Random.Range(250f, 290f));
		int team = ((!(Random.value < 0.5f)) ? 1 : 0);
		float value = Random.value;
		int num3 = ((value < 0.75f) ? 1 : ((value < 0.93f) ? 2 : 3));
		float num4 = ((Random.value < 0.5f) ? (-1f) : 1f);
		float num5 = ((Random.value < 0.5f) ? Random.Range(-320f, -160f) : Random.Range(170f, 380f));
		if (num3 == 1 && Random.value < 0.4f)
		{
			SpawnChase(you, self, val2, num);
			return;
		}
		for (int i = 0; i < num3; i++)
		{
			float d = ((i == 1) ? num4 : (0f - num4));
			Vector3 val4 = ((i == 0) ? Fast.Vector3__get_zero() : Fast.Vector3__op_Addition(Fast.Vector3__op_Subtraction(Fast.Vector3__op_Multiply(Fast.Vector3__op_Multiply(val2, d), 45f), Fast.Vector3__op_Multiply(self, 40f + (float)(i - 1) * 8f)), Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 8f + (float)(i - 1) * 4f)));
			Vector3 val5 = Fast.Vector3__op_Addition(Fast.Vector3__op_Subtraction(val3, Fast.Vector3__op_Multiply(self, 2700f)), val4);
			val5.y = Fast.Mathf__Max(MapScan.Height(val5, val3.y), val3.y) + num + 90f;
			Plane plane = Spawn(you, team, Fast.Vector3__get_zero(), low: true, val5, self);
			if (plane == null)
			{
				break;
			}
			plane.Transit = true;
			plane.Supersonic = flag;
			plane.PassDir = self;
			plane.PassPoint = Fast.Vector3__op_Addition(val3, val4.WithY(0f));
			plane.PassH = num + val4.y;
			plane.Speed = num2;
			plane.Vel = Fast.Vector3__op_Multiply(self, num2);
			if (flag2)
			{
				plane.BombsLeft = Random.Range(4, 7);
				float num6 = Fast.Mathf__Sqrt(2f * Fast.Mathf__Max(20f, plane.PassH) / 9.81f) * 1.05f;
				plane.BombAlong = num5 + ((i == 1) ? 40f : 0f) - num2 * 0.97f * num6;
			}
		}
	}

	private static void SpawnChase(Vector3 you, Vector3 dir, Vector3 side, float h)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Fast.Vector3__op_Addition(you, Fast.Vector3__op_Multiply(side, ((Random.value < 0.5f) ? (-1f) : 1f) * Random.Range(70f, 140f)));
		val.y = GroundBelow(Fast.Vector3__op_Addition(val, Fast.Vector3__op_Multiply(Fast.Vector3__get_up(), 400f)), you);
		int num = ((!(Random.value < 0.5f)) ? 1 : 0);
		float num2 = Random.Range(255f, 280f);
		Plane hunter = null;
		for (int i = 0; i < 2; i++)
		{
			Vector3 val2 = Fast.Vector3__op_Subtraction(val, Fast.Vector3__op_Multiply(dir, 2700f + (float)i * 480f));
			val2.y = Fast.Mathf__Max(MapScan.Height(val2, val.y), val.y) + h + 90f + (float)i * 15f;
			Plane plane = Spawn(you, (i == 0) ? num : (1 - num), Fast.Vector3__get_zero(), low: true, val2, dir);
			if (plane == null)
			{
				break;
			}
			plane.Transit = true;
			plane.PassDir = dir;
			plane.PassPoint = val;
			plane.PassH = h + (float)i * 12f;
			plane.Speed = num2 + (float)i * 14f;
			plane.Vel = Fast.Vector3__op_Multiply(dir, plane.Speed);
			if (i == 0)
			{
				hunter = plane;
				plane.Doomed = true;
			}
			else
			{
				plane.Hunter = hunter;
			}
		}
	}

	private static void Overhead(Plane p, Vector3 you, float now, float dt)
	{
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL