Decompiled source of CoopsCards v1.0.9

CoopsCards.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CoopsCards.Assets;
using CoopsCards.Cards;
using CoopsCards.Monos;
using CoopsCards.Patches;
using HarmonyLib;
using On;
using Photon.Pun;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CoopsCards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CoopsCards")]
[assembly: AssemblyTitle("CoopsCards")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CoopsCards
{
	public static class CoopsCards
	{
		public const string ModId = "com.Muffin.CoopsCards";

		public const string ModName = "CoopsCards";

		public const string Version = "1.0.0";

		public const string ModInitials = "CC";

		public static ManualLogSource Log { get; internal set; }
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Muffin.CoopsCards", "CoopsCards", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class CoopsCardsPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			CoopsCards.Log = ((BaseUnityPlugin)this).Logger;
			CoopsCards.Log.LogInfo((object)"CoopsCards loaded!");
			Harmony val = new Harmony("com.Muffin.CoopsCards");
			try
			{
				val.PatchAll();
				CoopsCards.Log.LogInfo((object)"Harmony PatchAll complete.");
			}
			catch (Exception ex)
			{
				CoopsCards.Log.LogError((object)("Harmony PatchAll FAILED: " + ex));
			}
			try
			{
				AirstrikeHitPatch.RegisterHooks();
			}
			catch (Exception ex2)
			{
				CoopsCards.Log.LogError((object)("[Airstrike] Hook registration FAILED: " + ex2));
			}
		}

		private void Start()
		{
			TryBuildCard<Fling>();
			TryBuildCard<BigMell>();
			TryBuildCard<BiggerMell>();
			TryBuildCard<BiggestMell>();
			TryBuildCard<WillMax>();
			TryBuildCard<Artillery>();
			TryBuildCard<ChanceBuild>();
			TryBuildCard<GrantBuild>();
			TryBuildCard<Smoothbore>();
			TryBuildCard<SmoothboreII>();
			TryBuildCard<Merca>();
			TryBuildCard<Gumple>();
			TryBuildCard<Cords>();
			TryBuildCard<TheBigOne>();
			TryBuildCard<Remote2>();
			TryBuildCard<WillBuild>();
			TryBuildCard<OldSpice>();
			TryBuildCard<Chud>();
			TryBuildCard<StopSign>();
			TryBuildCard<Smbs>();
			TryBuildCard<Slime>();
			TryBuildCard<RealBS>();
			TryBuildCard<Armor1>();
			TryBuildCard<Armor2>();
			TryBuildCard<Crack>();
			TryBuildCard<Spooky>();
			TryBuildCard<Toyota>();
			TryBuildCard<MLRS>();
			TryBuildCard<JetEngine>();
			TryBuildCard<Fent>();
			TryBuildCard<Composite>();
			TryBuildCard<SuperGun>();
			TryBuildCard<ChudSmall>();
			TryBuildCard<ILD>();
			TryBuildCard<IED>();
			TryBuildCard<Split>();
			TryBuildCard<Foid>();
			TryBuildCard<Choad>();
			TryBuildCard<Boar>();
			TryBuildCard<Nuke>();
			TryBuildCard<Annoyance>();
			TryBuildCard<IHD>();
			TryBuildCard<Overpressure>();
			TryBuildCard<Panic>();
			TryBuildCard<Kirk>();
			TryBuildCard<Airstrike>();
			TryBuildCard<Autoloader>();
			TryBuildCard<SunGravity>();
			TryBuildCard<ReactiveArmor>();
			TryBuildCard<AntiStall>();
			TryBuildCard<GumpleII>();
		}

		private static void TryBuildCard<T>() where T : CustomCard
		{
			try
			{
				CustomCard.BuildCard<T>();
			}
			catch (Exception ex)
			{
				CoopsCards.Log.LogError((object)("BuildCard<" + typeof(T).Name + "> FAILED: " + ex));
			}
		}
	}
}
namespace CoopsCards.Patches
{
	public static class AirstrikeHitPatch
	{
		[CompilerGenerated]
		private sealed class <BombWaveCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int ownerID;

			public int ownerTeam;

			public Vector2 hitPoint;

			public int bombCount;

			public float spawnHeight;

			public float scatterRadius;

			public float staggerDelay;

			public float bombRadius;

			public float bombDamage;

			public bool isOffline;

			private int <i>5__1;

			private Vector2 <offset>5__2;

			private Vector2 <targetPos>5__3;

			private Vector3 <spawnPos>5__4;

			private GameObject <bombGO>5__5;

			private AirstrikeBomb <bomb>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <BombWaveCoroutine>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<bombGO>5__5 = null;
				<bomb>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0031: 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_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: 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_0095: 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_00ba: Expected O, but got Unknown
				//IL_00c6: 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_01a3: Expected O, but got Unknown
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_01b4;
				}
				<>1__state = -1;
				<i>5__1 = 0;
				goto IL_01d3;
				IL_01b4:
				<bombGO>5__5 = null;
				<bomb>5__6 = null;
				<i>5__1++;
				goto IL_01d3;
				IL_01d3:
				if (<i>5__1 < bombCount)
				{
					<offset>5__2 = Random.insideUnitCircle * scatterRadius;
					<targetPos>5__3 = hitPoint + <offset>5__2;
					<spawnPos>5__4 = new Vector3(<targetPos>5__3.x, <targetPos>5__3.y + spawnHeight + Random.Range(0f, 4f), 0f);
					<bombGO>5__5 = new GameObject($"AirstrikeBomb_{<i>5__1}");
					<bombGO>5__5.transform.position = <spawnPos>5__4;
					<bomb>5__6 = <bombGO>5__5.AddComponent<AirstrikeBomb>();
					<bomb>5__6.TargetY = <targetPos>5__3.y;
					<bomb>5__6.FallSpeed = Random.Range(24f, 32f);
					<bomb>5__6.Radius = bombRadius;
					<bomb>5__6.Damage = bombDamage;
					<bomb>5__6.OwnerPlayerID = ownerID;
					<bomb>5__6.OwnerTeamID = ownerTeam;
					<bomb>5__6.IsLocalAuthority = isOffline || true;
					if (staggerDelay > 0f && <i>5__1 < bombCount - 1)
					{
						<>2__current = (object)new WaitForSeconds(staggerDelay);
						<>1__state = 1;
						return true;
					}
					goto IL_01b4;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static void RegisterHooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ProjectileHit.Hit += new hook_Hit(OnProjectileHit);
		}

		private static void OnProjectileHit(orig_Hit orig, ProjectileHit self, HitInfo hit, bool forceCall)
		{
			//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_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_010f: 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)
			try
			{
				Vector2 val = Vector2.zero;
				Player val2 = null;
				float projectileDamage = 0f;
				AirstrikeOwner airstrikeOwner = null;
				if ((Object)(object)self != (Object)null && hit != null)
				{
					val = hit.point;
					val2 = self.ownPlayer;
					try
					{
						FieldInfo fieldInfo = AccessTools.Field(((object)self).GetType(), "damage");
						if (fieldInfo != null)
						{
							object value = fieldInfo.GetValue(self);
							if (value is float)
							{
								float num = (float)value;
								if (true)
								{
									projectileDamage = num;
								}
							}
						}
					}
					catch
					{
					}
					if ((Object)(object)val2 != (Object)null)
					{
						airstrikeOwner = ((Component)val2).GetComponent<AirstrikeOwner>();
					}
				}
				orig.Invoke(self, hit, forceCall);
				if (!((Object)(object)airstrikeOwner == (Object)null) && airstrikeOwner.IsReady && !((Object)(object)val2 == (Object)null))
				{
					airstrikeOwner.StartCooldown();
					int bombCount = airstrikeOwner.GetBombCount(projectileDamage);
					if (!PhotonNetwork.InRoom)
					{
						SpawnBombWaveLocal(val2.playerID, val2.teamID, val, bombCount, airstrikeOwner.SpawnHeight, airstrikeOwner.ScatterRadius, airstrikeOwner.StaggerDelay, airstrikeOwner.BombRadius, airstrikeOwner.BombDamage, isOffline: true);
					}
					else if (!((Object)(object)val2.data.view == (Object)null) && val2.data.view.IsMine)
					{
						NetworkingManager.RPC(typeof(AirstrikeHitPatch), "RPC_SpawnBombWave", new object[9] { val2.playerID, val2.teamID, val, bombCount, airstrikeOwner.SpawnHeight, airstrikeOwner.ScatterRadius, airstrikeOwner.StaggerDelay, airstrikeOwner.BombRadius, airstrikeOwner.BombDamage });
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = CoopsCards.Log;
				if (log != null)
				{
					log.LogError((object)("[Airstrike] Hit hook error: " + ex));
				}
				try
				{
					orig.Invoke(self, hit, forceCall);
				}
				catch
				{
				}
			}
		}

		[UnboundRPC]
		private static void RPC_SpawnBombWave(int ownerID, int ownerTeam, Vector2 hitPoint, int bombCount, float spawnHeight, float scatterRadius, float staggerDelay, float bombRadius, float bombDamage)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			SpawnBombWaveLocal(ownerID, ownerTeam, hitPoint, bombCount, spawnHeight, scatterRadius, staggerDelay, bombRadius, bombDamage, isOffline: false);
		}

		private static void SpawnBombWaveLocal(int ownerID, int ownerTeam, Vector2 hitPoint, int bombCount, float spawnHeight, float scatterRadius, float staggerDelay, float bombRadius, float bombDamage, bool isOffline)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)Unbound.Instance).StartCoroutine(BombWaveCoroutine(ownerID, ownerTeam, hitPoint, bombCount, spawnHeight, scatterRadius, staggerDelay, bombRadius, bombDamage, isOffline));
		}

		[IteratorStateMachine(typeof(<BombWaveCoroutine>d__4))]
		private static IEnumerator BombWaveCoroutine(int ownerID, int ownerTeam, Vector2 hitPoint, int bombCount, float spawnHeight, float scatterRadius, float staggerDelay, float bombRadius, float bombDamage, bool isOffline)
		{
			//IL_0015: 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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <BombWaveCoroutine>d__4(0)
			{
				ownerID = ownerID,
				ownerTeam = ownerTeam,
				hitPoint = hitPoint,
				bombCount = bombCount,
				spawnHeight = spawnHeight,
				scatterRadius = scatterRadius,
				staggerDelay = staggerDelay,
				bombRadius = bombRadius,
				bombDamage = bombDamage,
				isOffline = isOffline
			};
		}
	}
	[HarmonyPatch]
	public static class AutoloaderDeathBlocker
	{
		[CompilerGenerated]
		private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private MethodBase <>2__current;

			private int <>l__initialThreadId;

			private Type <t>5__1;

			private string[] <methodNames>5__2;

			private string[] <>s__3;

			private int <>s__4;

			private string <name>5__5;

			private MethodInfo <method>5__6;

			MethodBase IEnumerator<MethodBase>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TargetMethods>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<t>5__1 = null;
				<methodNames>5__2 = null;
				<>s__3 = null;
				<name>5__5 = null;
				<method>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_00da;
				}
				<>1__state = -1;
				<t>5__1 = typeof(HealthHandler);
				if (<t>5__1 == null)
				{
					return false;
				}
				<methodNames>5__2 = new string[3] { "RPCA_Die", "Die", "RPCA_Die_Vec2" };
				<>s__3 = <methodNames>5__2;
				<>s__4 = 0;
				goto IL_00f7;
				IL_00da:
				<method>5__6 = null;
				<name>5__5 = null;
				<>s__4++;
				goto IL_00f7;
				IL_00f7:
				if (<>s__4 < <>s__3.Length)
				{
					<name>5__5 = <>s__3[<>s__4];
					<method>5__6 = AccessTools.Method(<t>5__1, <name>5__5, (Type[])null, (Type[])null);
					if (<method>5__6 != null)
					{
						<>2__current = <method>5__6;
						<>1__state = 1;
						return true;
					}
					goto IL_00da;
				}
				<>s__3 = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <TargetMethods>d__0(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<MethodBase>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<TargetMethods>d__0))]
		private static IEnumerable<MethodBase> TargetMethods()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TargetMethods>d__0(-2);
		}

		private static bool Prefix(HealthHandler __instance)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)__instance == (Object)null)
				{
					return true;
				}
				Player componentInParent = ((Component)__instance).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					return true;
				}
				AutoloaderEffect component = ((Component)componentInParent).GetComponent<AutoloaderEffect>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (component.State == AutoloaderEffect.CookoffState.Exploded)
				{
					return true;
				}
				if (component.State == AutoloaderEffect.CookoffState.Active)
				{
					componentInParent.data.health = component.SurvivalHP;
					return false;
				}
				if (((Component)componentInParent).transform.position.y < component.VoidThreshold)
				{
					return true;
				}
				component.State = AutoloaderEffect.CookoffState.Active;
				componentInParent.data.health = component.SurvivalHP;
				AutoloaderCookoffRunner.EnsureExists();
				AutoloaderCookoffRunner.StartCookoff(componentInParent, component);
				return false;
			}
			catch
			{
				return true;
			}
		}
	}
	[HarmonyPatch]
	internal static class BoarProjectilePatch
	{
		private class BoarProjectileMarker : MonoBehaviour
		{
		}

		private class BoarFollowProjectile : MonoBehaviour
		{
			public Transform projectile;

			public float zOffsetTowardCamera = -5f;

			private void LateUpdate()
			{
				//IL_0026: 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_0032: 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_003e: 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)
				if ((Object)(object)projectile == (Object)null)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				Vector3 position = projectile.position;
				((Component)this).transform.position = new Vector3(position.x, position.y, position.z + zOffsetTowardCamera);
			}
		}

		[CompilerGenerated]
		private sealed class <TargetMethods>d__1 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private MethodBase <>2__current;

			private int <>l__initialThreadId;

			private Type <t>5__1;

			private MethodInfo <awake>5__2;

			private MethodInfo <start>5__3;

			MethodBase IEnumerator<MethodBase>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TargetMethods>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<t>5__1 = null;
				<awake>5__2 = null;
				<start>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<t>5__1 = AccessTools.TypeByName("ProjectileHit");
					if (<t>5__1 == null)
					{
						return false;
					}
					<awake>5__2 = AccessTools.Method(<t>5__1, "Awake", (Type[])null, (Type[])null);
					if (<awake>5__2 != null)
					{
						<>2__current = <awake>5__2;
						<>1__state = 1;
						return true;
					}
					goto IL_0094;
				case 1:
					<>1__state = -1;
					goto IL_0094;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0094:
					<start>5__3 = AccessTools.Method(<t>5__1, "Start", (Type[])null, (Type[])null);
					if (<start>5__3 != null)
					{
						<>2__current = <start>5__3;
						<>1__state = 2;
						return true;
					}
					break;
				}
				ManualLogSource log = CoopsCards.Log;
				if (log != null)
				{
					log.LogInfo((object)"[BoarPatch] Patched ProjectileHit.");
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <TargetMethods>d__1(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<MethodBase>)this).GetEnumerator();
			}
		}

		private const float BoarWorldHeight = 2f;

		[IteratorStateMachine(typeof(<TargetMethods>d__1))]
		private static IEnumerable<MethodBase> TargetMethods()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TargetMethods>d__1(-2);
		}

		private static void Postfix(object __instance)
		{
			try
			{
				Component val = (Component)((__instance is Component) ? __instance : null);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				GameObject gameObject = val.gameObject;
				if (!((Object)(object)gameObject == (Object)null) && !((Object)(object)gameObject.GetComponent<BoarProjectileMarker>() != (Object)null))
				{
					Player val2 = TryFindOwnerPlayer(gameObject);
					if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).GetComponent<BoarOwner>() == (Object)null))
					{
						SpawnBoarFollower(gameObject.transform, val2);
						gameObject.AddComponent<BoarProjectileMarker>();
					}
				}
			}
			catch
			{
			}
		}

		private static void SpawnBoarFollower(Transform projectile, Player owner)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_009b: Expected O, but got Unknown
			GameObject val = new GameObject("BoarFollowerVisual");
			val.layer = 0;
			SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
			val2.sprite = BoarAssets.GetBoarSprite();
			SpriteRenderer componentInChildren = ((Component)owner).GetComponentInChildren<SpriteRenderer>(true);
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Renderer)val2).sortingLayerID = ((Renderer)componentInChildren).sortingLayerID;
				((Renderer)val2).sortingOrder = ((Renderer)componentInChildren).sortingOrder + 2000;
			}
			else
			{
				((Renderer)val2).sortingLayerID = 0;
				((Renderer)val2).sortingOrder = 20000;
			}
			Shader val3 = Shader.Find("Sprites/Default");
			if ((Object)(object)val3 != (Object)null)
			{
				((Renderer)val2).material = new Material(val3);
			}
			ApplyWorldScale(val2, val.transform, 2f);
			BoarFollowProjectile boarFollowProjectile = val.AddComponent<BoarFollowProjectile>();
			boarFollowProjectile.projectile = projectile;
			boarFollowProjectile.zOffsetTowardCamera = -5f;
			val.transform.position = projectile.position + new Vector3(0f, 0f, boarFollowProjectile.zOffsetTowardCamera);
		}

		private static void ApplyWorldScale(SpriteRenderer sr, Transform t, float targetWorldHeight)
		{
			//IL_0026: 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_002e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sr.sprite == (Object)null)
			{
				t.localScale = Vector3.one;
				return;
			}
			Bounds bounds = sr.sprite.bounds;
			float num = ((Bounds)(ref bounds)).size.y;
			if (num <= 0.0001f)
			{
				num = 1f;
			}
			float num2 = targetWorldHeight / num;
			t.localScale = new Vector3(num2, num2, 1f);
		}

		private static Player TryFindOwnerPlayer(GameObject projectile)
		{
			Component[] components = projectile.GetComponents<Component>();
			foreach (Component val in components)
			{
				if (!((Object)(object)val == (Object)null))
				{
					Player val2 = TryGetPlayerFromObject(val);
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
			}
			Transform parent = projectile.transform.parent;
			if ((Object)(object)parent != (Object)null)
			{
				Component[] components2 = ((Component)parent).GetComponents<Component>();
				foreach (Component val3 in components2)
				{
					if (!((Object)(object)val3 == (Object)null))
					{
						Player val4 = TryGetPlayerFromObject(val3);
						if ((Object)(object)val4 != (Object)null)
						{
							return val4;
						}
					}
				}
			}
			return null;
		}

		private static Player TryGetPlayerFromObject(object obj)
		{
			Type type = obj.GetType();
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo == null)
				{
					continue;
				}
				if (fieldInfo.FieldType == typeof(Player))
				{
					object? value = fieldInfo.GetValue(obj);
					return (Player)((value is Player) ? value : null);
				}
				if (fieldInfo.FieldType == typeof(CharacterData))
				{
					object? value2 = fieldInfo.GetValue(obj);
					CharacterData val = (CharacterData)((value2 is CharacterData) ? value2 : null);
					if ((Object)(object)val != (Object)null && (Object)(object)val.player != (Object)null)
					{
						return val.player;
					}
				}
			}
			PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo == null || propertyInfo.GetIndexParameters().Length != 0)
				{
					continue;
				}
				if (propertyInfo.PropertyType == typeof(Player))
				{
					try
					{
						object? value3 = propertyInfo.GetValue(obj, null);
						return (Player)((value3 is Player) ? value3 : null);
					}
					catch
					{
					}
				}
				if (!(propertyInfo.PropertyType == typeof(CharacterData)))
				{
					continue;
				}
				try
				{
					object? value4 = propertyInfo.GetValue(obj, null);
					CharacterData val2 = (CharacterData)((value4 is CharacterData) ? value4 : null);
					if ((Object)(object)val2 != (Object)null && (Object)(object)val2.player != (Object)null)
					{
						return val2.player;
					}
				}
				catch
				{
				}
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(Block), "blocked")]
	public static class OverpressurePenetrationPatch
	{
		private class OverpressureDidDamageTag : MonoBehaviour
		{
		}

		private static bool Prefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
		{
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_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_0200: 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)
			try
			{
				if ((Object)(object)projectile == (Object)null)
				{
					return true;
				}
				ProjectileHit component = projectile.GetComponent<ProjectileHit>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				Player ownPlayer = component.ownPlayer;
				if ((Object)(object)ownPlayer == (Object)null)
				{
					return true;
				}
				OverpressureMarker component2 = ((Component)ownPlayer).GetComponent<OverpressureMarker>();
				if ((Object)(object)component2 == (Object)null)
				{
					return true;
				}
				float num = Mathf.Clamp01(component2.ChanceToPenetrate);
				if (num <= 0f)
				{
					return true;
				}
				if (Random.value > num)
				{
					return true;
				}
				Player componentInParent = ((Component)__instance).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					return true;
				}
				Collider2D[] componentsInChildren = projectile.GetComponentsInChildren<Collider2D>(true);
				Collider2D[] componentsInChildren2 = ((Component)__instance).GetComponentsInChildren<Collider2D>(true);
				if (componentsInChildren != null && componentsInChildren2 != null)
				{
					Collider2D[] array = componentsInChildren;
					foreach (Collider2D val in array)
					{
						if ((Object)(object)val == (Object)null)
						{
							continue;
						}
						Collider2D[] array2 = componentsInChildren2;
						foreach (Collider2D val2 in array2)
						{
							if (!((Object)(object)val2 == (Object)null))
							{
								Physics2D.IgnoreCollision(val, val2, true);
							}
						}
					}
				}
				if ((Object)(object)projectile.GetComponent<OverpressureDidDamageTag>() == (Object)null)
				{
					projectile.AddComponent<OverpressureDidDamageTag>();
					Damagable val3 = (Damagable)(object)componentInParent.data?.healthHandler;
					if ((Object)(object)val3 != (Object)null)
					{
						Vector2 val4 = TryGetProjectileDamageVector(component);
						if (((Vector2)(ref val4)).sqrMagnitude > 0f)
						{
							Color val5 = default(Color);
							((Color)(ref val5))..ctor(1f, 0.65f, 0.15f, 1f);
							val3.TakeDamage(val4, Vector2.op_Implicit(hitPos), val5, projectile, ownPlayer, false, true);
							Rigidbody2D component3 = projectile.GetComponent<Rigidbody2D>();
							if ((Object)(object)component3 != (Object)null)
							{
								component3.velocity *= 0.65f;
							}
						}
					}
				}
				return false;
			}
			catch
			{
				return true;
			}
		}

		private static Vector2 TryGetProjectileDamageVector(ProjectileHit projHit)
		{
			//IL_00fd: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_004d: 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_00bf: 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_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_00da: 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_0075: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Type type = ((object)projHit).GetType();
				FieldInfo fieldInfo = AccessTools.Field(type, "damage");
				if (fieldInfo != null)
				{
					object value = fieldInfo.GetValue(projHit);
					if (value is float num)
					{
						return Vector2.up * num;
					}
					if (value is Vector2 result)
					{
						return result;
					}
				}
				PropertyInfo propertyInfo = AccessTools.Property(type, "damage");
				if (propertyInfo != null)
				{
					object value2 = propertyInfo.GetValue(projHit, null);
					if (value2 is float num2)
					{
						return Vector2.up * num2;
					}
					if (value2 is Vector2 result2)
					{
						return result2;
					}
				}
				return Vector2.zero;
			}
			catch
			{
				return Vector2.zero;
			}
		}
	}
	[HarmonyPatch]
	public static class ReactiveArmorPatch
	{
		[CompilerGenerated]
		private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private MethodBase <>2__current;

			private int <>l__initialThreadId;

			private Type <t>5__1;

			private HashSet<string> <seen>5__2;

			private string[] <methodNames>5__3;

			private List<MethodInfo> <allMethods>5__4;

			private List<MethodInfo>.Enumerator <>s__5;

			private MethodInfo <method>5__6;

			private string[] <>s__7;

			private int <>s__8;

			private string <name>5__9;

			private string <sig>5__10;

			MethodBase IEnumerator<MethodBase>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TargetMethods>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<t>5__1 = null;
				<seen>5__2 = null;
				<methodNames>5__3 = null;
				<allMethods>5__4 = null;
				<>s__5 = default(List<MethodInfo>.Enumerator);
				<method>5__6 = null;
				<>s__7 = null;
				<name>5__9 = null;
				<sig>5__10 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					int num = <>1__state;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -3;
						<sig>5__10 = null;
						<name>5__9 = null;
						goto IL_018a;
					}
					<>1__state = -1;
					<t>5__1 = typeof(HealthHandler);
					if (<t>5__1 == null)
					{
						return false;
					}
					<seen>5__2 = new HashSet<string>();
					<methodNames>5__3 = new string[3] { "DoDamage", "TakeDamage", "RPCA_SendTakeDamage" };
					<allMethods>5__4 = AccessTools.GetDeclaredMethods(<t>5__1);
					<>s__5 = <allMethods>5__4.GetEnumerator();
					<>1__state = -3;
					goto IL_01ba;
					IL_0198:
					if (<>s__8 < <>s__7.Length)
					{
						<name>5__9 = <>s__7[<>s__8];
						if (!(<method>5__6.Name != <name>5__9))
						{
							<sig>5__10 = <method>5__6.ToString();
							if (!<seen>5__2.Contains(<sig>5__10))
							{
								<seen>5__2.Add(<sig>5__10);
								<>2__current = <method>5__6;
								<>1__state = 1;
								return true;
							}
						}
						goto IL_018a;
					}
					<>s__7 = null;
					<method>5__6 = null;
					goto IL_01ba;
					IL_018a:
					<>s__8++;
					goto IL_0198;
					IL_01ba:
					do
					{
						if (<>s__5.MoveNext())
						{
							<method>5__6 = <>s__5.Current;
							continue;
						}
						<>m__Finally1();
						<>s__5 = default(List<MethodInfo>.Enumerator);
						return false;
					}
					while (<method>5__6 == null);
					<>s__7 = <methodNames>5__3;
					<>s__8 = 0;
					goto IL_0198;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__5).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <TargetMethods>d__0(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<MethodBase>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<TargetMethods>d__0))]
		private static IEnumerable<MethodBase> TargetMethods()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TargetMethods>d__0(-2);
		}

		private static bool Prefix(HealthHandler __instance)
		{
			try
			{
				if ((Object)(object)__instance == (Object)null)
				{
					return true;
				}
				Player componentInParent = ((Component)__instance).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					return true;
				}
				ReactiveArmorEffect component = ((Component)componentInParent).GetComponent<ReactiveArmorEffect>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (component.currentCharges <= 0)
				{
					return true;
				}
				if ((Object)(object)componentInParent.data == (Object)null || componentInParent.data.dead)
				{
					return true;
				}
				if (component.TryAbsorbHit())
				{
					return false;
				}
				return true;
			}
			catch
			{
				return true;
			}
		}
	}
}
namespace CoopsCards.Monos
{
	internal class AirstrikeBomb : MonoBehaviour
	{
		public float TargetY;

		public float FallSpeed = 28f;

		public float Radius = 4f;

		public float Damage = 80f;

		public int OwnerPlayerID;

		public int OwnerTeamID;

		public bool IsLocalAuthority;

		private const float VfxLifetime = 2f;

		private SpriteRenderer _sr;

		private static AudioClip _boomClip;

		private static bool _didSearchExplosion;

		private static GameObject _cachedExplosionPrefab;

		private static Sprite _bombSprite;

		private static bool _didSearchBombPrefab;

		private static GameObject _cachedBombPrefab;

		public float VisualScale = 1f;

		private bool _scaledVisual;

		private void Awake()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_002f: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			EnsureSharedAssets();
			if ((Object)(object)_cachedBombPrefab != (Object)null)
			{
				try
				{
					GameObject val = Object.Instantiate<GameObject>(_cachedBombPrefab, ((Component)this).transform);
					val.transform.localPosition = Vector3.zero;
					val.SetActive(true);
					return;
				}
				catch
				{
				}
			}
			_sr = ((Component)this).gameObject.AddComponent<SpriteRenderer>();
			_sr.sprite = GetOrCreateBombSprite();
			((Renderer)_sr).sortingOrder = 20000;
			Shader val2 = Shader.Find("Sprites/Default");
			if ((Object)(object)val2 != (Object)null)
			{
				((Renderer)_sr).material = new Material(val2);
			}
			if ((Object)(object)_sr.sprite != (Object)null)
			{
				Bounds bounds = _sr.sprite.bounds;
				float num = ((Bounds)(ref bounds)).size.y;
				if (num < 0.001f)
				{
					num = 1f;
				}
				float num2 = 0.5f / num;
				((Component)this).transform.localScale = new Vector3(num2, num2, 1f);
			}
		}

		private void Update()
		{
			//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_005f: 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_0065: 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_0070: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_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)
			if (!_scaledVisual && VisualScale != 1f)
			{
				Transform transform = ((Component)this).transform;
				transform.localScale *= VisualScale;
				_scaledVisual = true;
			}
			Vector3 position = ((Component)this).transform.position;
			float num = FallSpeed * Time.deltaTime;
			RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(position), Vector2.down, num);
			if ((Object)(object)((RaycastHit2D)(ref val)).collider != (Object)null)
			{
				((Component)this).transform.position = Vector2.op_Implicit(((RaycastHit2D)(ref val)).point);
				Detonate();
				return;
			}
			position.y -= num;
			((Component)this).transform.position = position;
			((Component)this).transform.Rotate(0f, 0f, -360f * Time.deltaTime);
			if (position.y <= TargetY)
			{
				Detonate();
			}
		}

		private void Detonate()
		{
			//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_0019: 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)
			Vector2 pos = Vector2.op_Implicit(((Component)this).transform.position);
			SpawnExplosionVFX(pos);
			PlayBoom(pos);
			if (IsLocalAuthority)
			{
				ApplyAoEDamage(pos);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void ApplyAoEDamage(Vector2 pos)
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == OwnerPlayerID));
			foreach (Player player in PlayerManager.instance.players)
			{
				if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || !player.data.isPlaying || player.data.dead || (PhotonNetwork.InRoom && ((Object)(object)player.data.view == (Object)null || !player.data.view.IsMine)))
				{
					continue;
				}
				float num = Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), pos);
				if (num > Radius)
				{
					continue;
				}
				float num2 = 1f - num / Radius;
				float num3 = Damage * num2;
				if (!(num3 <= 0f))
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)player).transform.position) - pos;
					if (((Vector2)(ref val2)).sqrMagnitude < 0.0001f)
					{
						val2 = Vector2.up;
					}
					else
					{
						((Vector2)(ref val2)).Normalize();
					}
					Vector2 val3 = val2 * num3;
					((Damagable)player.data.healthHandler).TakeDamage(val3, pos, new Color(1f, 0.5f, 0.1f, 1f), ((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null, val, true, true);
				}
			}
		}

		private static void SpawnExplosionVFX(Vector2 pos)
		{
			//IL_0081: 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_0035: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_cachedExplosionPrefab != (Object)null)
			{
				try
				{
					GameObject val = Object.Instantiate<GameObject>(_cachedExplosionPrefab);
					((Object)val).name = "Airstrike_ExplosionVFX";
					val.transform.position = new Vector3(pos.x, pos.y, 0f);
					float num = 1.2f;
					val.transform.localScale = new Vector3(num, num, num);
					val.SetActive(true);
					Object.Destroy((Object)(object)val, 2f);
					return;
				}
				catch
				{
				}
			}
			SpawnFallbackRing(pos);
		}

		private static void SpawnFallbackRing(Vector2 pos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00c6: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Airstrike_FallbackRing");
			val.transform.position = new Vector3(pos.x, pos.y, 0f);
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = true;
			val2.loop = true;
			val2.positionCount = 48;
			val2.startWidth = 0.25f;
			val2.endWidth = 0.25f;
			val2.startColor = new Color(1f, 0.5f, 0.1f, 1f);
			val2.endColor = new Color(1f, 0.3f, 0.05f, 1f);
			Shader val3 = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color");
			Material val4 = new Material(val3);
			val4.renderQueue = 4000;
			((Renderer)val2).material = val4;
			float num = 1.5f;
			float num2 = MathF.PI * 2f / (float)val2.positionCount;
			for (int i = 0; i < val2.positionCount; i++)
			{
				float num3 = (float)i * num2;
				val2.SetPosition(i, new Vector3(pos.x + Mathf.Cos(num3) * num, pos.y + Mathf.Sin(num3) * num, 0f));
			}
			Object.Destroy((Object)(object)val, 0.5f);
		}

		private static void PlayBoom(Vector2 pos)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0026: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_boomClip == (Object)null))
			{
				GameObject val = new GameObject("Airstrike_BoomSFX");
				val.transform.position = new Vector3(pos.x, pos.y, 0f);
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = _boomClip;
				val2.volume = 0.85f;
				val2.spatialBlend = 0f;
				val2.dopplerLevel = 0f;
				val2.priority = 0;
				val2.pitch = Random.Range(0.85f, 1.05f);
				val2.Play();
				Object.Destroy((Object)(object)val, _boomClip.length + 0.1f);
			}
		}

		private static void EnsureSharedAssets()
		{
			if ((Object)(object)_boomClip == (Object)null)
			{
				_boomClip = MakeBoomClip("Airstrike_Boom", 0.3f, 44100);
			}
			if (!_didSearchExplosion)
			{
				_didSearchExplosion = true;
				_cachedExplosionPrefab = FindPrefabByName("explosion", "explode", "blast");
			}
			if (!_didSearchBombPrefab)
			{
				_didSearchBombPrefab = true;
				_cachedBombPrefab = FindBombPrefab();
			}
		}

		private static GameObject FindBombPrefab()
		{
			//IL_0042: 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_004a: Invalid comparison between Unknown and I4
			try
			{
				GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
				if (array == null)
				{
					return null;
				}
				GameObject val = null;
				GameObject[] array2 = array;
				foreach (GameObject val2 in array2)
				{
					if ((Object)(object)val2 == (Object)null || (((Object)val2).hideFlags & 1) > 0)
					{
						continue;
					}
					string name = ((Object)val2).name;
					if (string.IsNullOrEmpty(name))
					{
						continue;
					}
					string text = name.ToLowerInvariant();
					if ((text.Contains("bomb") || text.Contains("missile") || text.Contains("mortar")) && ((Object)(object)val2.GetComponent<SpriteRenderer>() != (Object)null || (Object)(object)val2.GetComponentInChildren<SpriteRenderer>(true) != (Object)null))
					{
						if (text.Contains("bomb"))
						{
							return val2;
						}
						if ((Object)(object)val == (Object)null)
						{
							val = val2;
						}
					}
				}
				return val;
			}
			catch (Exception ex)
			{
				ManualLogSource log = CoopsCards.Log;
				if (log != null)
				{
					log.LogError((object)("[Airstrike] Bomb prefab search failed: " + ex));
				}
				return null;
			}
		}

		private static GameObject FindPrefabByName(params string[] keywords)
		{
			//IL_0042: 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_004a: Invalid comparison between Unknown and I4
			try
			{
				GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
				if (array == null)
				{
					return null;
				}
				GameObject val = null;
				GameObject[] array2 = array;
				foreach (GameObject val2 in array2)
				{
					if ((Object)(object)val2 == (Object)null || (((Object)val2).hideFlags & 1) > 0)
					{
						continue;
					}
					string text = (((Object)val2).name ?? "").ToLowerInvariant();
					if (string.IsNullOrEmpty(text))
					{
						continue;
					}
					bool flag = false;
					bool flag2 = false;
					foreach (string text2 in keywords)
					{
						if (text.Contains(text2))
						{
							flag = true;
							if (text2 == keywords[0])
							{
								flag2 = true;
							}
						}
					}
					if (flag && (!((Object)(object)val2.GetComponent<ParticleSystem>() == (Object)null) || !((Object)(object)val2.GetComponentInChildren<ParticleSystem>(true) == (Object)null)))
					{
						if (flag2)
						{
							return val2;
						}
						if ((Object)(object)val == (Object)null)
						{
							val = val2;
						}
					}
				}
				return val;
			}
			catch
			{
				return null;
			}
		}

		private static Sprite GetOrCreateBombSprite()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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)
			if ((Object)(object)_bombSprite != (Object)null)
			{
				return _bombSprite;
			}
			int num = 16;
			int num2 = 24;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)0;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.25f, 0.25f, 0.28f, 1f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(0.85f, 0.45f, 0.15f, 1f);
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(0.4f, 0.42f, 0.45f, 1f);
			Color val6 = default(Color);
			((Color)(ref val6))..ctor(0.35f, 0.36f, 0.4f, 1f);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			int num3 = num / 2;
			for (int k = 4; k < num2 - 2; k++)
			{
				float num4 = (float)(k - 4) / (float)(num2 - 6);
				float num5 = Mathf.Sin(num4 * MathF.PI);
				int num6 = Mathf.RoundToInt(num5 * 5f);
				for (int l = -num6; l <= num6; l++)
				{
					int num7 = num3 + l;
					if (num7 >= 0 && num7 < num)
					{
						Color val7 = ((Mathf.Abs(l) <= 1) ? val6 : val3);
						if (k >= num2 - 4)
						{
							val7 = val4;
						}
						val.SetPixel(num7, k, val7);
					}
				}
			}
			for (int m = 0; m < 3; m++)
			{
				int num8 = 4 + m;
				int num9 = 6 - m;
				for (int n = -num9; n <= num9; n++)
				{
					int num10 = num3 + n;
					if (num10 >= 0 && num10 < num && Mathf.Abs(n) > 2)
					{
						val.SetPixel(num10, num8, val5);
					}
				}
			}
			val.Apply();
			_bombSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f), 100f);
			return _bombSprite;
		}

		private static AudioClip MakeBoomClip(string name, float seconds, int sampleRate)
		{
			int num = Mathf.CeilToInt(seconds * (float)sampleRate);
			AudioClip val = AudioClip.Create(name, num, 1, sampleRate, false);
			float[] array = new float[num];
			Random random = new Random(42);
			float num2 = 55f;
			float num3 = 140f;
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i / (float)sampleRate;
				float num5 = Mathf.Exp((0f - num4) * 12f);
				float num6 = Mathf.Sin(MathF.PI * 2f * num2 * num4) * 0.7f;
				float num7 = Mathf.Sin(MathF.PI * 2f * num3 * num4) * 0.35f;
				float num8 = ((float)random.NextDouble() * 2f - 1f) * 0.6f;
				float num9 = ((num4 < 0.015f) ? (num8 * 1.2f) : 0f);
				float num10 = (num6 + num7 + num8 * 0.5f + num9) * num5 * 1.3f;
				array[i] = Mathf.Clamp(num10, -1f, 1f);
			}
			val.SetData(array, 0);
			return val;
		}
	}
	internal class AirstrikeOwner : MonoBehaviour
	{
		public float Cooldown = 8f;

		public int BombCountMin = 5;

		public int BombCountMax = 10;

		public float DamageScaleFactor = 55f;

		public float BombRadius = 4f;

		public float BombDamage = 80f;

		public float SpawnHeight = 18f;

		public float ScatterRadius = 3.5f;

		public float StaggerDelay = 0.12f;

		private float _nextAllowedTime;

		public bool IsReady => Time.time >= _nextAllowedTime;

		public void StartCooldown()
		{
			_nextAllowedTime = Time.time + Cooldown;
		}

		public int GetBombCount(float projectileDamage)
		{
			int num = Random.Range(BombCountMin, BombCountMax + 1);
			int num2 = 0;
			if (DamageScaleFactor > 0f && projectileDamage > DamageScaleFactor)
			{
				num2 = Mathf.FloorToInt((projectileDamage - DamageScaleFactor) / DamageScaleFactor);
			}
			return num + num2;
		}
	}
	internal class AntiStallWatcher : MonoBehaviour
	{
		private static AntiStallWatcher _instance;

		private static int _pickCount;

		private const float BaseThreshold = 10f;

		private const float ReductionPerPick = 2f;

		private const float MinThreshold = 5f;

		private const float BombDamage = 120f;

		private const float BombRadius = 4.5f;

		private const float BombFallSpeed = 26f;

		private const float StartInterval = 1.8f;

		private const float MinInterval = 0.12f;

		private const float EscalationTime = 25f;

		private float _timer;

		private float _bombTimer;

		private bool _bombing;

		private bool _roundActive;

		private bool _hooksControlling;

		private int _lastAliveCount;

		public static void EnsureExists()
		{
			if (!((Object)(object)_instance != (Object)null))
			{
				_instance = ((Component)Unbound.Instance).gameObject.GetComponent<AntiStallWatcher>();
				if (!((Object)(object)_instance != (Object)null))
				{
					_instance = ((Component)Unbound.Instance).gameObject.AddComponent<AntiStallWatcher>();
				}
			}
		}

		public static void RegisterPick()
		{
			_pickCount++;
		}

		public static void UnregisterPick()
		{
			_pickCount = Mathf.Max(0, _pickCount - 1);
		}

		public static void ResetTimer()
		{
			if (!((Object)(object)_instance == (Object)null))
			{
				_instance._timer = 0f;
				_instance._bombTimer = 0f;
				_instance._bombing = false;
			}
		}

		public static void SetRoundActive(bool active)
		{
			if (!((Object)(object)_instance == (Object)null))
			{
				_instance._hooksControlling = true;
				_instance._roundActive = active;
				if (active)
				{
					_instance._timer = 0f;
					_instance._bombTimer = 0f;
					_instance._bombing = false;
				}
			}
		}

		public static void CleanupActiveBombs()
		{
			AirstrikeBomb[] array = Object.FindObjectsOfType<AirstrikeBomb>();
			AirstrikeBomb[] array2 = array;
			foreach (AirstrikeBomb airstrikeBomb in array2)
			{
				if (!((Object)(object)airstrikeBomb == (Object)null) && ((Object)((Component)airstrikeBomb).gameObject).name.Contains("AntiStall"))
				{
					Object.Destroy((Object)(object)((Component)airstrikeBomb).gameObject);
				}
			}
		}

		private float GetThreshold()
		{
			return Mathf.Max(5f, 10f - (float)(_pickCount - 1) * 2f);
		}

		private void Update()
		{
			if (_pickCount <= 0)
			{
				return;
			}
			if (!((!_hooksControlling) ? SandboxShouldRun() : _roundActive))
			{
				if (_bombing)
				{
					_bombing = false;
				}
				return;
			}
			_timer += Time.deltaTime;
			float threshold = GetThreshold();
			if (!_bombing && _timer >= threshold)
			{
				_bombing = true;
				_bombTimer = 0f;
			}
			if (!_bombing)
			{
				return;
			}
			float num = _timer - threshold;
			float num2 = Mathf.Clamp01(num / 25f);
			float bombTimer = Mathf.Lerp(1.8f, 0.12f, num2);
			int num3 = 1;
			if (num2 > 0.5f)
			{
				num3 = 2;
			}
			if (num2 > 0.8f)
			{
				num3 = 3;
			}
			if (num2 > 0.95f)
			{
				num3 = 5;
			}
			_bombTimer -= Time.deltaTime;
			if (_bombTimer <= 0f)
			{
				_bombTimer = bombTimer;
				for (int i = 0; i < num3; i++)
				{
					SpawnRandomBomb();
				}
			}
		}

		private bool SandboxShouldRun()
		{
			int num = 0;
			if ((Object)(object)PlayerManager.instance != (Object)null && PlayerManager.instance.players != null)
			{
				foreach (Player player in PlayerManager.instance.players)
				{
					if ((Object)(object)player != (Object)null && (Object)(object)player.data != (Object)null && !player.data.dead)
					{
						num++;
					}
				}
			}
			if (num > 0 && _lastAliveCount <= 0)
			{
				_timer = 0f;
				_bombTimer = 0f;
				_bombing = false;
			}
			_lastAliveCount = num;
			return num > 0;
		}

		private void SpawnRandomBomb()
		{
			//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_006f: 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_0092: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			Camera val = Camera.main;
			if ((Object)(object)val == (Object)null)
			{
				val = Object.FindObjectOfType<Camera>();
			}
			if (!((Object)(object)val == (Object)null))
			{
				float num;
				float num2;
				if (val.orthographic)
				{
					num = val.orthographicSize * 2f;
					num2 = num * val.aspect;
				}
				else
				{
					num = 20f;
					num2 = num * val.aspect;
				}
				Vector3 position = ((Component)val).transform.position;
				float num3 = Random.Range(position.x - num2 * 0.45f, position.x + num2 * 0.45f);
				float targetY = position.y - num * 0.35f;
				float num4 = position.y + num * 0.5f + Random.Range(2f, 8f);
				float num5 = Random.Range(0.6f, 1.8f);
				GameObject val2 = new GameObject("AntiStallBomb");
				val2.transform.position = new Vector3(num3, num4, 0f);
				AirstrikeBomb airstrikeBomb = val2.AddComponent<AirstrikeBomb>();
				airstrikeBomb.TargetY = targetY;
				airstrikeBomb.FallSpeed = 26f + Random.Range(-4f, 4f);
				airstrikeBomb.Radius = 4.5f * num5;
				airstrikeBomb.Damage = 120f * num5;
				airstrikeBomb.VisualScale = num5;
				airstrikeBomb.OwnerPlayerID = -1;
				airstrikeBomb.OwnerTeamID = -1;
				airstrikeBomb.IsLocalAuthority = true;
			}
		}
	}
	internal class AutoloaderEffect : MonoBehaviour
	{
		public enum CookoffState
		{
			Idle,
			Active,
			Exploded
		}

		public float FuseTime = 3f;

		public float ExplosionDamage = 500f;

		public float ExplosionRadius = 6f;

		public float SurvivalHP = 10f;

		public float VoidThreshold = -15f;

		public CookoffState State = CookoffState.Idle;
	}
	internal class BoarOwner : MonoBehaviour
	{
	}
	internal class BoarProjectileVisual : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <InitAfterParenting>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BoarProjectileVisual <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitAfterParenting>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0122: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 3;
					return true;
				case 3:
				{
					<>1__state = -1;
					if ((Object)(object)((Component)<>4__this).transform.parent == (Object)null)
					{
						((Renderer)<>4__this._sr).enabled = false;
						ManualLogSource log = CoopsCards.Log;
						if (log != null)
						{
							log.LogInfo((object)"[BoarProjectileVisual] No parent after delay -> treating as prefab-holder; renderer disabled.");
						}
						return false;
					}
					<>4__this._projectile = ((Component)<>4__this).transform.parent;
					<>4__this._projectileRb = ((Component)<>4__this._projectile).GetComponentInParent<Rigidbody2D>();
					((Component)<>4__this).gameObject.layer = ((Component)<>4__this._projectile).gameObject.layer;
					((Component)<>4__this).transform.localPosition = Vector3.zero;
					((Component)<>4__this).transform.localRotation = Quaternion.identity;
					((Component)<>4__this).transform.SetParent((Transform)null, true);
					<>4__this.ApplyWorldScale(0.6f);
					ManualLogSource log2 = CoopsCards.Log;
					if (log2 != null)
					{
						log2.LogInfo((object)"[BoarProjectileVisual] Active boar visual initialized (following projectile).");
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private SpriteRenderer _sr;

		private Transform _projectile;

		private Rigidbody2D _projectileRb;

		private const float TargetWorldHeight = 0.6f;

		private void Awake()
		{
			_sr = ((Component)this).GetComponent<SpriteRenderer>();
			if ((Object)(object)_sr == (Object)null)
			{
				_sr = ((Component)this).gameObject.AddComponent<SpriteRenderer>();
			}
			_sr.sprite = BoarAssets.GetBoarSprite();
			if ((Object)(object)_sr.sprite == (Object)null)
			{
				ManualLogSource log = CoopsCards.Log;
				if (log != null)
				{
					log.LogError((object)"[BoarProjectileVisual] Sprite is NULL.");
				}
				((Renderer)_sr).enabled = false;
			}
			else
			{
				((Renderer)_sr).enabled = true;
				((Renderer)_sr).sortingOrder = 500;
				((MonoBehaviour)this).StartCoroutine(InitAfterParenting());
			}
		}

		[IteratorStateMachine(typeof(<InitAfterParenting>d__5))]
		private IEnumerator InitAfterParenting()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitAfterParenting>d__5(0)
			{
				<>4__this = this
			};
		}

		private void LateUpdate()
		{
			//IL_002c: 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_0053: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_projectile == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			((Component)this).transform.position = _projectile.position;
			if ((Object)(object)_projectileRb != (Object)null)
			{
				Vector2 velocity = _projectileRb.velocity;
				if (((Vector2)(ref velocity)).sqrMagnitude > 0.001f)
				{
					((Component)this).transform.right = Vector2.op_Implicit(((Vector2)(ref velocity)).normalized);
				}
			}
		}

		private void ApplyWorldScale(float targetWorldHeight)
		{
			//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_0014: 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)
			Bounds bounds = _sr.sprite.bounds;
			float num = ((Bounds)(ref bounds)).size.y;
			if (num <= 0.0001f)
			{
				num = 1f;
			}
			float num2 = targetWorldHeight / num;
			((Component)this).transform.localScale = new Vector3(num2, num2, 1f);
			ManualLogSource log = CoopsCards.Log;
			if (log != null)
			{
				log.LogInfo((object)$"[BoarProjectileVisual] WorldScale set. spriteHeight={num:F3}, scale={num2:F3}");
			}
		}
	}
	internal class OverpressureOwner : MonoBehaviour
	{
		public float chance = 0.2f;

		public float postPenetrationSpeedMultiplier = 0.55f;

		public float postPenetrationExtraDrag = 3.5f;

		public float postPenetrationLifetime = 0.25f;
	}
	internal class PanicEffect : MonoBehaviour
	{
		public float threshold = 0.25f;

		public int bonusBlocks = 3;

		public float checkInterval = 0.15f;

		private Player _player;

		private Block _block;

		private float _timer;

		private bool _baselineValid;

		private int _baselineAdditionalBlocks;

		private bool _active;

		private void Awake()
		{
			_player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)_player != (Object)null)
			{
				_block = ((Component)_player).GetComponent<Block>();
			}
		}

		private void OnEnable()
		{
			_timer = 0f;
			_baselineValid = false;
			_active = false;
		}

		private void Update()
		{
			if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null || (Object)(object)_block == (Object)null)
			{
				return;
			}
			_timer -= Time.deltaTime;
			if (_timer > 0f)
			{
				return;
			}
			_timer = checkInterval;
			float maxHealth = _player.data.maxHealth;
			if (maxHealth <= 0.0001f)
			{
				return;
			}
			float num = _player.data.health / maxHealth;
			if (!(num <= threshold))
			{
				if (_active)
				{
					RemoveBonusIfPresent();
					_active = false;
				}
				_baselineAdditionalBlocks = Mathf.Max(0, _block.additionalBlocks);
				_baselineValid = true;
				return;
			}
			if (!_active)
			{
				if (!_baselineValid)
				{
					_baselineAdditionalBlocks = Mathf.Max(0, _block.additionalBlocks);
					_baselineValid = true;
				}
				_active = true;
			}
			EnforceBonus();
		}

		private void EnforceBonus()
		{
			if (!_baselineValid)
			{
				_baselineAdditionalBlocks = Mathf.Max(0, _block.additionalBlocks);
			}
			int num = _baselineAdditionalBlocks + bonusBlocks;
			int additionalBlocks = _block.additionalBlocks;
			if (additionalBlocks == num)
			{
				return;
			}
			if (additionalBlocks == _baselineAdditionalBlocks)
			{
				_block.additionalBlocks = num;
				return;
			}
			int num2 = additionalBlocks - bonusBlocks;
			if (num2 < 0)
			{
				num2 = additionalBlocks;
			}
			_baselineAdditionalBlocks = num2;
			_baselineValid = true;
			_block.additionalBlocks = _baselineAdditionalBlocks + bonusBlocks;
		}

		private void RemoveBonusIfPresent()
		{
			int additionalBlocks = _block.additionalBlocks;
			if (_baselineValid)
			{
				int num = _baselineAdditionalBlocks + bonusBlocks;
				if (additionalBlocks >= num)
				{
					_block.additionalBlocks = Mathf.Max(0, additionalBlocks - bonusBlocks);
				}
				else
				{
					_block.additionalBlocks = Mathf.Max(0, _baselineAdditionalBlocks);
				}
			}
			else
			{
				_block.additionalBlocks = Mathf.Max(0, additionalBlocks - bonusBlocks);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_block != (Object)null && _active)
			{
				RemoveBonusIfPresent();
			}
		}
	}
	internal class ReactiveArmorEffect : MonoBehaviour
	{
		public int maxCharges = 1;

		public int currentCharges = 1;

		private readonly List<GameObject> _plateObjects = new List<GameObject>();

		private Player _player;

		private HealthHandler _health;

		private bool _initialized;

		private const float PlateWidth = 0.35f;

		private const float PlateHeight = 0.55f;

		private const float ZOffsetTowardCamera = -5f;

		private float _lastAbsorbTime = -1f;

		private const float AbsorbCooldown = 0.1f;

		private static Sprite _plateSprite;

		private static Sprite _shardSprite;

		private static AudioClip _clinkClip;

		private int _sortingLayerID;

		private int _baseSortingOrder;

		private void Start()
		{
			TryInit();
		}

		private void Update()
		{
			if (!_initialized)
			{
				TryInit();
			}
			if (_initialized)
			{
				SyncPlateVisuals();
			}
		}

		private void OnDestroy()
		{
			foreach (GameObject plateObject in _plateObjects)
			{
				if ((Object)(object)plateObject != (Object)null)
				{
					Object.Destroy((Object)(object)plateObject);
				}
			}
			_plateObjects.Clear();
			if ((Object)(object)_health != (Object)null)
			{
				HealthHandler health = _health;
				health.reviveAction = (Action)Delegate.Remove(health.reviveAction, new Action(OnRevive));
			}
		}

		private void TryInit()
		{
			if (_initialized)
			{
				return;
			}
			_player = ((Component)this).GetComponentInParent<Player>();
			if (!((Object)(object)_player == (Object)null))
			{
				_health = _player.data?.healthHandler;
				if ((Object)(object)_health != (Object)null)
				{
					HealthHandler health = _health;
					health.reviveAction = (Action)Delegate.Remove(health.reviveAction, new Action(OnRevive));
					HealthHandler health2 = _health;
					health2.reviveAction = (Action)Delegate.Combine(health2.reviveAction, new Action(OnRevive));
				}
				SpriteRenderer componentInChildren = ((Component)_player).GetComponentInChildren<SpriteRenderer>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					_sortingLayerID = ((Renderer)componentInChildren).sortingLayerID;
					_baseSortingOrder = ((Renderer)componentInChildren).sortingOrder + 2000;
				}
				else
				{
					_sortingLayerID = 0;
					_baseSortingOrder = 20000;
				}
				_initialized = true;
				RebuildAllPlates();
			}
		}

		private void OnRevive()
		{
			currentCharges = maxCharges;
			_lastAbsorbTime = -1f;
			RebuildAllPlates();
		}

		public bool TryAbsorbHit()
		{
			if (currentCharges <= 0)
			{
				return false;
			}
			if (Time.time - _lastAbsorbTime < 0.1f)
			{
				return true;
			}
			_lastAbsorbTime = Time.time;
			currentCharges--;
			if (_plateObjects.Count > 0)
			{
				int index = _plateObjects.Count - 1;
				GameObject val = _plateObjects[index];
				_plateObjects.RemoveAt(index);
				if ((Object)(object)val != (Object)null)
				{
					ShatterPlate(val);
				}
			}
			return true;
		}

		private void SyncPlateVisuals()
		{
			while (_plateObjects.Count > currentCharges)
			{
				int index = _plateObjects.Count - 1;
				GameObject val = _plateObjects[index];
				_plateObjects.RemoveAt(index);
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
			while (_plateObjects.Count < currentCharges)
			{
				GameObject item = CreatePlate(_plateObjects.Count);
				_plateObjects.Add(item);
			}
		}

		private void RebuildAllPlates()
		{
			foreach (GameObject plateObject in _plateObjects)
			{
				if ((Object)(object)plateObject != (Object)null)
				{
					Object.Destroy((Object)(object)plateObject);
				}
			}
			_plateObjects.Clear();
			for (int i = 0; i < currentCharges; i++)
			{
				GameObject item = CreatePlate(i);
				_plateObjects.Add(item);
			}
		}

		private GameObject CreatePlate(int index)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject($"ReactiveArmorPlate_{index}");
			val.layer = 0;
			SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
			val2.sprite = GetOrCreatePlateSprite();
			((Renderer)val2).sortingLayerID = _sortingLayerID;
			((Renderer)val2).sortingOrder = _baseSortingOrder + index;
			Shader val3 = Shader.Find("Sprites/Default");
			if ((Object)(object)val3 != (Object)null)
			{
				((Renderer)val2).material = new Material(val3);
			}
			if ((Object)(object)val2.sprite != (Object)null)
			{
				Bounds bounds = val2.sprite.bounds;
				float num = ((Bounds)(ref bounds)).size.y;
				if (num < 0.001f)
				{
					num = 1f;
				}
				float num2 = 0.55f / num;
				val.transform.localScale = new Vector3(num2, num2, 1f);
			}
			ArmorPlateFollow armorPlateFollow = val.AddComponent<ArmorPlateFollow>();
			armorPlateFollow.player = ((Component)_player).transform;
			armorPlateFollow.zOffset = -5f;
			float num3 = (float)(Mathf.Max(1, currentCharges) - 1) * 0.35f * 0.8f;
			armorPlateFollow.xOffset = (0f - num3) / 2f + (float)index * 0.35f * 0.8f;
			Vector3 position = ((Component)_player).transform.position;
			val.transform.position = new Vector3(position.x + armorPlateFollow.xOffset, position.y, position.z + -5f);
			return val;
		}

		private void ShatterPlate(GameObject plate)
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0042: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			Vector3 position = plate.transform.position;
			Object.Destroy((Object)(object)plate);
			int num = 5;
			for (int i = 0; i < num; i++)
			{
				GameObject val = new GameObject($"ArmorShard_{i}");
				val.layer = 0;
				val.transform.position = position;
				SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
				val2.sprite = GetOrCreateShardSprite();
				((Renderer)val2).sortingLayerID = _sortingLayerID;
				((Renderer)val2).sortingOrder = _baseSortingOrder + 50;
				val2.color = new Color(0.5f, 0.55f, 0.5f, 1f);
				Shader val3 = Shader.Find("Sprites/Default");
				if ((Object)(object)val3 != (Object)null)
				{
					((Renderer)val2).material = new Material(val3);
				}
				float num2 = Random.Range(0.08f, 0.15f);
				val.transform.localScale = new Vector3(num2, num2, 1f);
				ArmorShard armorShard = val.AddComponent<ArmorShard>();
				armorShard.sr = val2;
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
				armorShard.velocity = normalized * Random.Range(4f, 8f);
				armorShard.tumbleSpeed = Random.Range(-540f, 540f);
				armorShard.lifetime = Random.Range(0.3f, 0.6f);
			}
			PlayShatterSound(position);
		}

		private static void PlayShatterSound(Vector3 pos)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			AudioClip orCreateClinkClip = GetOrCreateClinkClip();
			if (!((Object)(object)orCreateClinkClip == (Object)null))
			{
				GameObject val = new GameObject("ArmorShatter_SFX");
				val.transform.position = pos;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = orCreateClinkClip;
				val2.volume = 0.7f;
				val2.spatialBlend = 0f;
				val2.pitch = Random.Range(0.9f, 1.2f);
				val2.Play();
				Object.Destroy((Object)(object)val, orCreateClinkClip.length + 0.1f);
			}
		}

		private static Sprite GetOrCreatePlateSprite()
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_00d4: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_0224: 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_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_plateSprite != (Object)null)
			{
				return _plateSprite;
			}
			int num = 20;
			int num2 = 28;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.42f, 0.46f, 0.4f, 1f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(0.32f, 0.35f, 0.3f, 1f);
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(0.55f, 0.58f, 0.52f, 1f);
			Color val6 = default(Color);
			((Color)(ref val6))..ctor(0.3f, 0.3f, 0.3f, 1f);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 2; k < num2 - 2; k++)
			{
				for (int l = 2; l < num - 2; l++)
				{
					Color val7 = val3;
					if (k >= num2 - 4 || l <= 3)
					{
						val7 = val5;
					}
					if (k <= 3 || l >= num - 4)
					{
						val7 = val4;
					}
					val.SetPixel(l, k, val7);
				}
			}
			int[][] array = new int[4][]
			{
				new int[2] { 4, 5 },
				new int[2]
				{
					num - 5,
					5
				},
				new int[2]
				{
					4,
					num2 - 6
				},
				new int[2]
				{
					num - 5,
					num2 - 6
				}
			};
			int[][] array2 = array;
			foreach (int[] array3 in array2)
			{
				val.SetPixel(array3[0], array3[1], val6);
				val.SetPixel(array3[0] + 1, array3[1], val6);
				val.SetPixel(array3[0], array3[1] + 1, val6);
				val.SetPixel(array3[0] + 1, array3[1] + 1, val6);
			}
			val.Apply();
			_plateSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f), 100f);
			return _plateSprite;
		}

		private static Sprite GetOrCreateShardSprite()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_shardSprite != (Object)null)
			{
				return _shardSprite;
			}
			int num = 8;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.45f, 0.48f, 0.42f, 1f);
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			for (int k = 0; k < num; k++)
			{
				int num2 = Mathf.RoundToInt((float)k / (float)num * (float)(num / 2));
				int num3 = num / 2;
				for (int l = -num2; l <= num2; l++)
				{
					int num4 = num3 + l;
					if (num4 >= 0 && num4 < num)
					{
						val.SetPixel(num4, k, val3);
					}
				}
			}
			val.Apply();
			_shardSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f);
			return _shardSprite;
		}

		private static AudioClip GetOrCreateClinkClip()
		{
			if ((Object)(object)_clinkClip != (Object)null)
			{
				return _clinkClip;
			}
			int num = 44100;
			float num2 = 0.15f;
			int num3 = Mathf.CeilToInt(num2 * (float)num);
			AudioClip val = AudioClip.Create("ArmorClink", num3, 1, num, false);
			float[] array = new float[num3];
			Random random = new Random(5555);
			for (int i = 0; i < num3; i++)
			{
				float num4 = (float)i / (float)num;
				float num5 = Mathf.Exp((0f - num4) * 35f);
				float num6 = Mathf.Sin(MathF.PI * 4400f * num4) * 0.5f;
				float num7 = Mathf.Sin(MathF.PI * 6800f * num4) * 0.3f;
				float num8 = ((float)random.NextDouble() * 2f - 1f) * 0.3f;
				float num9 = (num6 + num7 + num8) * num5;
				array[i] = Mathf.Clamp(num9, -1f, 1f);
			}
			val.SetData(array, 0);
			_clinkClip = val;
			return _clinkClip;
		}
	}
	internal class ArmorPlateFollow : MonoBehaviour
	{
		public Transform player;

		public float xOffset;

		public float zOffset = -5f;

		private void LateUpdate()
		{
			//IL_0026: 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_0032: 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_0045: 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)
			if ((Object)(object)player == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Vector3 position = player.position;
			((Component)this).transform.position = new Vector3(position.x + xOffset, position.y, position.z + zOffset);
		}
	}
	internal class ArmorShard : MonoBehaviour
	{
		public SpriteRenderer sr;

		public Vector2 velocity;

		public float tumbleSpeed;

		public float lifetime;

		private float _elapsed;

		private void Update()
		{
			//IL_003c: 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_0057: 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_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_0078: 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_00d5: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			_elapsed += Time.deltaTime;
			if (_elapsed >= lifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			velocity *= 1f - 5f * Time.deltaTime;
			Transform transform = ((Component)this).transform;
			transform.position += Vector2.op_Implicit(velocity) * Time.deltaTime;
			((Component)this).transform.Rotate(0f, 0f, tumbleSpeed * Time.deltaTime);
			if ((Object)(object)sr != (Object)null)
			{
				float num = 1f - _elapsed / lifetime;
				Color color = sr.color;
				color.a = Mathf.Max(0f, num);
				sr.color = color;
			}
		}
	}
	internal class AutoloaderCookoffRunner : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <CookoffCoroutine>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Player player;

			public AutoloaderEffect autoloader;

			public AutoloaderCookoffRunner <>4__this;

			private float <fuseTime>5__1;

			private float <damage>5__2;

			private float <radius>5__3;

			private int <ownerID>5__4;

			private GameObject <hissGO>5__5;

			private float <elapsed>5__6;

			private Vector2 <explodePos>5__7;

			private float <progress>5__8;

			private float <interval>5__9;

			private Vector2 <playerPos>5__10;

			private Damagable <damagable>5__11;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CookoffCoroutine>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<hissGO>5__5 = null;
				<damagable>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0087: 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_0100: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: 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_01f0: 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_0153: 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_0175: Expected O, but got Unknown
				//IL_0146: 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_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: 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_036c: Expected O, but got Unknown
				//IL_030c: 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_031c: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					EnsureSharedAssets();
					<fuseTime>5__1 = autoloader.FuseTime;
					<damage>5__2 = autoloader.ExplosionDamage;
					<radius>5__3 = autoloader.ExplosionRadius;
					<ownerID>5__4 = player.playerID;
					<hissGO>5__5 = StartHiss(Vector2.op_Implicit(((Component)player).transform.position));
					<elapsed>5__6 = 0f;
					goto IL_0199;
				case 1:
					<>1__state = -1;
					<elapsed>5__6 += <interval>5__9;
					goto IL_0199;
				case 2:
					{
						<>1__state = -1;
						if ((Object)(object)autoloader != (Object)null)
						{
							autoloader.State = AutoloaderEffect.CookoffState.Idle;
						}
						return false;
					}
					IL_0199:
					if (<elapsed>5__6 < <fuseTime>5__1)
					{
						<progress>5__8 = Mathf.Clamp01(<elapsed>5__6 / <fuseTime>5__1);
						<interval>5__9 = Mathf.Lerp(0.18f, 0.03f, <progress>5__8);
						<playerPos>5__10 = (((Object)(object)player != (Object)null) ? Vector2.op_Implicit(((Component)player).transform.position) : Vector2.zero);
						if ((Object)(object)<hissGO>5__5 != (Object)null)
						{
							<hissGO>5__5.transform.position = new Vector3(<playerPos>5__10.x, <playerPos>5__10.y, 0f);
						}
						SpawnSmokePuff(<playerPos>5__10, <progress>5__8);
						<>2__current = (object)new WaitForSeconds(<interval>5__9);
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)<hissGO>5__5 != (Object)null)
					{
						Object.Destroy((Object)(object)<hissGO>5__5);
					}
					<explodePos>5__7 = (((Object)(object)player != (Object)null) ? Vector2.op_Implicit(((Component)player).transform.position) : Vector2.zero);
					if (!PhotonNetwork.InRoom)
					{
						ExplodeLocal(<ownerID>5__4, <explodePos>5__7, <radius>5__3, <damage>5__2);
					}
					else
					{
						NetworkingManager.RPC(typeof(AutoloaderCookoffRunner), "RPC_Explode", new object[4] { <ownerID>5__4, <explodePos>5__7, <radius>5__3, <damage>5__2 });
					}
					autoloader.State = AutoloaderEffect.CookoffState.Exploded;
					_activeCookoffs.Remove(<ownerID>5__4);
					if ((Object)(object)player != (Object)null && (Object)(object)player.data != (Object)null)
					{
						player.data.health = 0f;
						<damagable>5__11 = (Damagable)(object)player.data.healthHandler;
						if ((Object)(object)<damagable>5__11 != (Object)null)
						{
							<damagable>5__11.TakeDamage(Vector2.up * 9999f, <explodePos>5__7, new Color(1f, 0.4f, 0f, 1f), ((Component)player).gameObject, player, true, true);
						}
						<damagable>5__11 = null;
					}
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static AutoloaderCookoffRunner _instance;

		private static readonly HashSet<int> _activeCookoffs = new HashSet<int>();

		private static AudioClip _boomClip;

		private static AudioClip _hissClip;

		private static bool _didSearchExplosion;

		private static GameObject _cachedExplosionPrefab;

		private static Sprite _smokeSprite;

		public static void EnsureExists()
		{
			if (!((Object)(object)_instance != (Object)null))
			{
				_instance = ((Component)Unbound.Instance).gameObject.GetComponent<AutoloaderCookoffRunner>();
				if (!((Object)(object)_instance != (Object)null))
				{
					_instance = ((Component)Unbound.Instance).gameObject.AddComponent<AutoloaderCookoffRunner>();
				}
			}
		}

		public static void StartCookoff(Player player, AutoloaderEffect autoloader)
		{
			if (!((Object)(object)_instance == (Object)null))
			{
				_activeCookoffs.Add(player.playerID);
				((MonoBehaviour)_instance).StartCoroutine(_instance.CookoffCoroutine(player, autoloader));
			}
		}

		private void Update()
		{
			if (_activeCookoffs.Count == 0 || (Object)(object)PlayerManager.instance == (Object)null || PlayerManager.instance.players == null)
			{
				return;
			}
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && _activeCookoffs.Contains(player.playerID))
				{
					AutoloaderEffect component = ((Component)player).GetComponent<AutoloaderEffect>();
					if (!((Object)(object)component == (Object)null) && component.State == AutoloaderEffect.CookoffState.Active && player.data.health <= 0f)
					{
						player.data.health = component.SurvivalHP;
					}
				}
			}
		}

		[IteratorStateMachine(typeof(<CookoffCoroutine>d__5))]
		private IEnumerator CookoffCoroutine(Player player, AutoloaderEffect autoloader)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CookoffCoroutine>d__5(0)
			{
				<>4__this = this,
				player = player,
				autoloader = autoloader
			};
		}

		[UnboundRPC]
		private static void RPC_Explode(int ownerID, Vector2 pos, float radius, float damage)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ExplodeLocal(ownerID, pos, radius, damage);
		}

		private static void ExplodeLocal(int ownerID, Vector2 pos, float radius, float damage)
		{
			//IL_0014: 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_0104: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a2: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			EnsureSharedAssets();
			SpawnExplosionVFX(pos, radius);
			PlayBoom(pos);
			Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
			foreach (Player player in PlayerManager.instance.players)
			{
				if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || !player.data.isPlaying || player.data.dead || (PhotonNetwork.InRoom && ((Object)(object)player.data.view == (Object)null || !player.data.view.IsMine)) || player.playerID == ownerID)
				{
					continue;
				}
				float num = Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), pos);
				if (num > radius)
				{
					continue;
				}
				float num2 = 1f - num / radius;
				float num3 = damage * num2;
				if (!(num3 <= 0f))
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)player).transform.position) - pos;
					if (((Vector2)(ref val2)).sqrMagnitude < 0.0001f)
					{
						val2 = Vector2.up;
					}
					else
					{
						((Vector2)(ref val2)).Normalize();
					}
					Vector2 val3 = val2 * num3;
					((Damagable)player.data.healthHandler).TakeDamage(val3, pos, new Color(1f, 0.6f, 0.1f, 1f), (val != null) ? ((Component)val).gameObject : null, val, true, true);
				}
			}
		}

		private static void SpawnSmokePuff(Vector2 center, float progress)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_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_0042: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0114: Unknown result type (mi