Decompiled source of AdvancedMovementPack v1.3.1

AdvancedMovementPack/AdvancedMovementPack/AdvancedMovementPack.dll

Decompiled 2 weeks 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.InteropServices;
using System.Runtime.Versioning;
using AdvancedMovementPack.Cards;
using BepInEx;
using HarmonyLib;
using UnboundLib.Cards;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AdvancedMovementPack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdvancedMovementPack")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1926c2cb-c879-4017-a6a3-1c0717de1dd9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AdvancedMovementPack
{
	[BepInPlugin("com.joel.rounds.advancedmovementpack", "Advanced Movement Pack", "1.3.1")]
	[BepInProcess("Rounds.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AdvancedMovementPack : BaseUnityPlugin
	{
		private const string ModId = "com.joel.rounds.advancedmovementpack";

		private const string ModName = "Advanced Movement Pack";

		private const string ModVersion = "1.3.1";

		private void Awake()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			CustomCard.BuildCard<SwiftShrink>();
			CustomCard.BuildCard<Geppo>();
			CustomCard.BuildCard<Grapple>();
			CustomCard.BuildCard<Momentum>();
			CustomCard.BuildCard<Hoverboots>();
			CustomCard.BuildCard<BlockStep>();
			CustomCard.BuildCard<Forcefield>();
			CustomCard.BuildCard<Hypno>();
			CustomCard.BuildCard<MortalDread>();
			CustomCard.BuildCard<Gloop>();
			CustomCard.BuildCard<Bonk>();
			CustomCard.BuildCard<GravityWell>();
			CustomCard.BuildCard<Hardened>();
			CustomCard.BuildCard<Capacitor>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Advanced Movement Pack 1.3.1 loaded");
			string[] manifestResourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				Debug.Log((object)("[AdvancedMovementPack] Resource: " + text));
			}
			new Harmony("com.joel.rounds.advancedmovementpack.forcefield").PatchAll();
		}
	}
}
namespace AdvancedMovementPack.Cards
{
	public class Capacitor : CustomCard
	{
		protected override string GetTitle()
		{
			return "Capacitor";
		}

		protected override string GetDescription()
		{
			return "Standing still builds up electrical energy that power up your bullets. Moving discharges the power.";
		}

		public override string GetModName()
		{
			return "AMP";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		protected override GameObject GetCardArt()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ae: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AdvancedMovementPack.Resources.Capacitor.png");
			if (stream == null)
			{
				Debug.LogError("[Capacitor] Resource not found!");
				return new GameObject("CapacitorArt_Missing");
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 1f);
			GameObject val2 = new GameObject("CapacitorArt");
			Image obj = val2.AddComponent<Image>();
			obj.sprite = sprite;
			obj.preserveAspect = true;
			val2.GetComponent<RectTransform>().sizeDelta = new Vector2((float)((Texture)val).width * 1.2f, (float)((Texture)val).height * 1.2f);
			((Object)val2).hideFlags = (HideFlags)61;
			return val2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_005e: Expected O, but got Unknown
			//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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Charge dmg",
					amount = "+200%",
					simepleAmount = (SimpleAmount)3
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Charge velocity",
					amount = "+150%",
					simepleAmount = (SimpleAmount)3
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Move speed",
					amount = "-15%",
					simepleAmount = (SimpleAmount)1
				}
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			CapacitorEffect orAddComponent = ((Component)player).gameObject.GetOrAddComponent<CapacitorEffect>();
			orAddComponent.gun = gun;
			orAddComponent.player = player;
			orAddComponent.data = data;
			orAddComponent.cardCount++;
			stats.movementSpeed *= 0.85f;
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun.ShootPojectileAction, new Action<GameObject>(orAddComponent.OnBulletFired));
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			CapacitorEffect component = ((Component)player).gameObject.GetComponent<CapacitorEffect>();
			if ((Object)(object)component != (Object)null)
			{
				gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, new Action<GameObject>(component.OnBulletFired));
				component.cardCount--;
				if (component.cardCount <= 0)
				{
					component.Cleanup();
					Object.Destroy((Object)(object)component);
				}
				else if (component.isEnergizing)
				{
					component.UpdateEnergy();
				}
				else if (component.baselineValuesSaved)
				{
					gun.damage = component.baselineDamage;
					gun.projectileSpeed = component.baselineProjectileSpeed;
					gun.projectileColor = component.originalProjectileColor;
				}
			}
			CleanupLightningTrails(player);
		}

		private static void CleanupLightningTrails(Player player)
		{
			LightningBulletTrail[] array = Object.FindObjectsOfType<LightningBulletTrail>();
			foreach (LightningBulletTrail lightningBulletTrail in array)
			{
				if ((Object)(object)lightningBulletTrail.ownerPlayer == (Object)(object)player)
				{
					lightningBulletTrail.Cleanup();
					Object.Destroy((Object)(object)lightningBulletTrail);
				}
			}
		}
	}
	public class CapacitorEffect : MonoBehaviour
	{
		public Gun gun;

		public Player player;

		public CharacterData data;

		public int cardCount;

		[HideInInspector]
		public float baselineDamage;

		[HideInInspector]
		public float baselineProjectileSpeed;

		[HideInInspector]
		public Color originalProjectileColor;

		[HideInInspector]
		public bool baselineValuesSaved;

		private float energyStartTime;

		public bool isEnergizing;

		private Vector3 lastPosition;

		private bool wasMovingLastFrame;

		private Traverse velocityTraverse;

		private const float MAX_ENERGY_TIME = 1.5f;

		private const float MOVEMENT_THRESHOLD = 0.08f;

		private const float VELOCITY_THRESHOLD = 0.5f;

		private GameObject energyParticles;

		private ParticleSystem ps;

		private GameObject lightningRing;

		private SpriteRenderer ringRenderer;

		private GameObject electricField;

		private ParticleSystem electricPs;

		public void OnBulletFired(GameObject projectile)
		{
			if ((Object)(object)projectile != (Object)null)
			{
				projectile.AddComponent<LightningBulletTrail>().Initialize(this);
			}
		}

		public float GetEnergyProgress()
		{
			if (!isEnergizing)
			{
				return 0f;
			}
			return Mathf.Clamp01((Time.time - energyStartTime) / 1.5f);
		}

		private void Start()
		{
			//IL_0041: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)data?.playerVel != (Object)null)
			{
				velocityTraverse = Traverse.Create((object)data.playerVel).Field("velocity");
			}
			lastPosition = ((Component)this).transform.position;
			CreateElectricVisuals();
			if ((Object)(object)ps != (Object)null)
			{
				ps.Stop();
			}
			if ((Object)(object)electricPs != (Object)null)
			{
				electricPs.Stop();
			}
			if ((Object)(object)ringRenderer != (Object)null)
			{
				((Renderer)ringRenderer).enabled = true;
				ringRenderer.color = new Color(0.2f, 0.8f, 1f, 0.3f);
			}
		}

		private void Update()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)gun == (Object)null || (Object)(object)player == (Object)null || (Object)(object)data == (Object)null || data.dead)
			{
				return;
			}
			bool flag = DetectMovement();
			if (!flag && wasMovingLastFrame)
			{
				StartEnergizing();
			}
			else if (flag && !wasMovingLastFrame)
			{
				DischargeEnergy();
			}
			if (isEnergizing && !flag)
			{
				UpdateEnergy();
			}
			else if (!isEnergizing)
			{
				if ((Object)(object)ps != (Object)null && ps.isPlaying)
				{
					ps.Stop();
				}
				if ((Object)(object)electricPs != (Object)null && electricPs.isPlaying)
				{
					electricPs.Stop();
				}
			}
			UpdateVisualPositions();
			lastPosition = ((Component)this).transform.position;
			wasMovingLastFrame = flag;
		}

		private bool DetectMovement()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			bool num = Mathf.Abs(data.input.direction.x) > 0.01f || Mathf.Abs(data.input.direction.y) > 0.01f || data.input.jumpIsPressed;
			bool flag = Vector3.Distance(((Component)this).transform.position, lastPosition) > 0.08f;
			bool flag2 = false;
			if (velocityTraverse != null)
			{
				Vector2 value = velocityTraverse.GetValue<Vector2>();
				flag2 = ((Vector2)(ref value)).magnitude > 0.5f;
			}
			bool flag3 = !data.isGrounded;
			return num || flag || flag2 || flag3;
		}

		private void StartEnergizing()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			isEnergizing = true;
			energyStartTime = Time.time;
			if ((Object)(object)gun != (Object)null)
			{
				baselineDamage = gun.damage;
				baselineProjectileSpeed = gun.projectileSpeed;
				originalProjectileColor = gun.projectileColor;
				baselineValuesSaved = true;
			}
			if ((Object)(object)ps != (Object)null)
			{
				if (ps.isPlaying)
				{
					ps.Stop();
				}
				ps.Play();
			}
			if ((Object)(object)electricPs != (Object)null)
			{
				if (electricPs.isPlaying)
				{
					electricPs.Stop();
				}
				electricPs.Play();
			}
			if ((Object)(object)ringRenderer != (Object)null)
			{
				((Renderer)ringRenderer).enabled = true;
				ringRenderer.color = new Color(0.2f, 0.8f, 1f, 0.3f);
			}
		}

		private void DischargeEnergy()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			isEnergizing = false;
			if ((Object)(object)gun != (Object)null && baselineValuesSaved)
			{
				gun.damage = baselineDamage;
				gun.projectileSpeed = baselineProjectileSpeed;
				gun.projectileColor = originalProjectileColor;
				baselineValuesSaved = false;
			}
			if ((Object)(object)ps != (Object)null && ps.isPlaying)
			{
				ps.Stop(true, (ParticleSystemStopBehavior)0);
			}
			if ((Object)(object)electricPs != (Object)null && electricPs.isPlaying)
			{
				electricPs.Stop(true, (ParticleSystemStopBehavior)0);
			}
			if ((Object)(object)ringRenderer != (Object)null)
			{
				((Renderer)ringRenderer).enabled = true;
				ringRenderer.color = new Color(0.2f, 0.8f, 1f, 0.3f);
				lightningRing.transform.localScale = Vector3.one;
			}
		}

		public void UpdateEnergy()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			if (baselineValuesSaved && !((Object)(object)gun == (Object)null))
			{
				float energyProgress = GetEnergyProgress();
				float num = 1f + 2f * (float)cardCount;
				float num2 = Mathf.Lerp(1f, num, energyProgress);
				gun.damage = baselineDamage * num2;
				float num3 = 1f + 1.5f * (float)cardCount;
				float num4 = Mathf.Lerp(1f, num3, energyProgress);
				gun.projectileSpeed = baselineProjectileSpeed * num4;
				Color projectileColor = Color.Lerp(originalProjectileColor, new Color(0.2f, 0.8f, 1f), energyProgress);
				gun.projectileColor = projectileColor;
				UpdateVisualIntensity(energyProgress);
			}
		}

		private void UpdateVisualIntensity(float intensity)
		{
			//IL_0017: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_0103: 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)
			//IL_015c: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ps != (Object)null)
			{
				EmissionModule emission = ps.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Lerp(15f, 100f, intensity));
				MainModule main = ps.main;
				Color val = Color.Lerp(new Color(0.2f, 0.8f, 1f), Color.white, intensity);
				((MainModule)(ref main)).startColor = new MinMaxGradient(val);
				((MainModule)(ref main)).startSize = new MinMaxCurve(Mathf.Lerp(0.1f, 0.3f, intensity), Mathf.Lerp(0.25f, 0.5f, intensity));
			}
			if ((Object)(object)electricPs != (Object)null)
			{
				EmissionModule emission2 = electricPs.emission;
				((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Lerp(5f, 40f, intensity));
				MainModule main2 = electricPs.main;
				((MainModule)(ref main2)).startSpeed = new MinMaxCurve(Mathf.Lerp(0.5f, 2f, intensity), Mathf.Lerp(2f, 4f, intensity));
			}
			if ((Object)(object)ringRenderer != (Object)null && (Object)(object)lightningRing != (Object)null)
			{
				Color color = Color.Lerp(new Color(0.2f, 0.8f, 1f, 0.3f), new Color(1f, 1f, 1f, 0.9f), intensity);
				ringRenderer.color = color;
				float num = 1f + intensity * 0.4f;
				float num2 = 1f + Mathf.Sin(Time.time * 8f) * (0.1f * intensity);
				lightningRing.transform.localScale = Vector3.one * num * num2;
			}
		}

		private void UpdateVisualPositions()
		{
			//IL_001f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)energyParticles != (Object)null)
			{
				energyParticles.transform.position = ((Component)this).transform.position;
			}
			if ((Object)(object)lightningRing != (Object)null)
			{
				lightningRing.transform.position = ((Component)this).transform.position;
			}
			if ((Object)(object)electricField != (Object)null)
			{
				electricField.transform.position = ((Component)this).transform.position;
			}
		}

		private void CreateElectricVisuals()
		{
			CreateEnergyParticles();
			CreateLightningRing();
			CreateElectricField();
		}

		private void CreateEnergyParticles()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0032: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Expected O, but got Unknown
			energyParticles = new GameObject("EnergyParticles");
			energyParticles.transform.SetParent(((Component)this).transform, false);
			energyParticles.transform.localPosition = Vector3.zero;
			ps = energyParticles.AddComponent<ParticleSystem>();
			MainModule main = ps.main;
			((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.2f, 0.8f, 1f), new Color(0.7f, 0.9f, 1f));
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.1f, 0.25f);
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.6f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(2f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 80;
			EmissionModule emission = ps.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			ShapeModule shape = ps.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = 1.5f;
			VelocityOverLifetimeModule velocityOverLifetime = ps.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).radial = new MinMaxCurve(-3f, -6f);
			SizeOverLifetimeModule sizeOverLifetime = ps.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			AnimationCurve val = new AnimationCurve();
			val.AddKey(0f, 0.3f);
			val.AddKey(0.4f, 1f);
			val.AddKey(1f, 0f);
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val);
			ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(new Color(0.2f, 0.8f, 1f), 0f),
				new GradientColorKey(new Color(0.8f, 0.9f, 1f), 0.5f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0.9f, 0f),
				new GradientAlphaKey(0.8f, 0.5f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2);
			ParticleSystemRenderer component = ((Component)ps).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).material = new Material(Shader.Find("Sprites/Default"));
			((Renderer)component).sortingOrder = 15;
			ps.Stop();
		}

		private void CreateLightningRing()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			lightningRing = new GameObject("LightningRing");
			lightningRing.transform.position = ((Component)this).transform.position;
			ringRenderer = lightningRing.AddComponent<SpriteRenderer>();
			ringRenderer.sprite = CreateLightningRingSprite();
			((Renderer)ringRenderer).material = new Material(Shader.Find("Sprites/Default"));
			((Renderer)ringRenderer).sortingOrder = 10;
			ringRenderer.color = new Color(0.2f, 0.8f, 1f, 0.3f);
		}

		private void CreateElectricField()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0032: 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_005b: 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)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_0162: 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_0173: Expected O, but got Unknown
			//IL_017d: 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_018c: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			electricField = new GameObject("ElectricField");
			electricField.transform.SetParent(((Component)this).transform, false);
			electricField.transform.localPosition = Vector3.zero;
			electricPs = electricField.AddComponent<ParticleSystem>();
			MainModule main = electricPs.main;
			((MainModule)(ref main)).startColor = new MinMaxGradient(Color.white, new Color(0.8f, 0.9f, 1f));
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.15f);
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.1f, 0.3f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.5f, 2f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 40;
			EmissionModule emission = electricPs.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			ShapeModule shape = electricPs.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = 1.8f;
			VelocityOverLifetimeModule velocityOverLifetime = electricPs.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(-5f, 5f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(-5f, 5f);
			ColorOverLifetimeModule colorOverLifetime = electricPs.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(new Color(0.8f, 0.9f, 1f), 0.7f),
				new GradientColorKey(new Color(0.2f, 0.8f, 1f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.8f, 0.5f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val);
			ParticleSystemRenderer component = ((Component)electricPs).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).material = new Material(Shader.Find("Sprites/Default"));
			((Renderer)component).sortingOrder = 20;
			electricPs.Stop();
		}

		private Sprite CreateLightningRingSprite()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0049: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			int num = 128;
			Texture2D val = new Texture2D(num, num, (TextureFormat)5, false);
			float num2 = (float)num * 0.5f;
			float num3 = (float)num * 0.45f;
			float num4 = (float)num * 0.35f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num5 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2));
					if (num5 <= num3 && num5 >= num4)
					{
						float num6 = 1f;
						float num7 = Mathf.PerlinNoise(Mathf.Atan2((float)i - num2, (float)j - num2) * 8f, num5 * 0.1f) * 0.3f;
						float num8 = num4 + num7 * 8f;
						float num9 = num3 + num7 * 6f;
						if (num5 > num9 || num5 < num8)
						{
							num6 = 0f;
						}
						else
						{
							if (num5 > num9 - 3f)
							{
								num6 = (num9 - num5) / 3f;
							}
							if (num5 < num8 + 3f)
							{
								num6 = Mathf.Min(num6, (num5 - num8) / 3f);
							}
						}
						val.SetPixel(j, i, new Color(1f, 1f, 1f, num6));
					}
					else
					{
						val.SetPixel(j, i, Color.clear);
					}
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f);
		}

		public void Cleanup()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)gun != (Object)null && baselineValuesSaved)
			{
				gun.damage = baselineDamage;
				gun.projectileSpeed = baselineProjectileSpeed;
				gun.projectileColor = originalProjectileColor;
			}
			if ((Object)(object)energyParticles != (Object)null)
			{
				Object.Destroy((Object)(object)energyParticles);
			}
			if ((Object)(object)lightningRing != (Object)null)
			{
				Object.Destroy((Object)(object)lightningRing);
			}
			if ((Object)(object)electricField != (Object)null)
			{
				Object.Destroy((Object)(object)electricField);
			}
		}

		private void OnDestroy()
		{
			Cleanup();
		}

		public void OnDeath()
		{
			DischargeEnergy();
			if ((Object)(object)ringRenderer != (Object)null)
			{
				((Renderer)ringRenderer).enabled = false;
			}
			if ((Object)(object)ps != (Object)null && ps.isPlaying)
			{
				ps.Stop(true, (ParticleSystemStopBehavior)0);
			}
			if ((Object)(object)electricPs != (Object)null && electricPs.isPlaying)
			{
				electricPs.Stop(true, (ParticleSystemStopBehavior)0);
			}
		}
	}
	public class LightningBulletTrail : MonoBehaviour
	{
		[HideInInspector]
		public Player ownerPlayer;

		private CapacitorEffect capacitorEffect;

		private ParticleSystem lightningPs;

		private float currentIntensity = 0.5f;

		private bool isInitialized;

		public void Initialize(CapacitorEffect effect)
		{
			capacitorEffect = effect;
			ownerPlayer = effect.player;
			CreateLightningTrail();
			isInitialized = true;
		}

		private void Start()
		{
			if (!isInitialized)
			{
				CreateLightningTrail();
				isInitialized = true;
			}
		}

		private void Update()
		{
			if ((Object)(object)capacitorEffect != (Object)null && capacitorEffect.isEnergizing)
			{
				float energyProgress = capacitorEffect.GetEnergyProgress();
				currentIntensity = Mathf.Lerp(0.3f, 1.5f, energyProgress);
				UpdateTrailIntensity();
			}
		}

		private void CreateLightningTrail()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: 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_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("LightningTrail");
			val.transform.SetParent(((Component)this).transform, false);
			val.transform.localPosition = Vector3.zero;
			lightningPs = val.AddComponent<ParticleSystem>();
			MainModule main = lightningPs.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.15f, 0.25f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.12f, 0.25f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.2f, 0.8f, 1f, 0.9f), new Color(1f, 1f, 1f, 0.7f));
			((MainModule)(ref main)).maxParticles = 300;
			EmissionModule emission = lightningPs.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(120f);
			ShapeModule shape = lightningPs.shape;
			((ShapeModule)(ref shape)).enabled = false;
			VelocityOverLifetimeModule velocityOverLifetime = lightningPs.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			AnimationCurve val2 = new AnimationCurve();
			val2.AddKey(0f, 0f);
			val2.AddKey(0.3f, 1f);
			val2.AddKey(0.7f, -0.5f);
			val2.AddKey(1f, 0f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(-2f, 2f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(-2f, 2f);
			SizeOverLifetimeModule sizeOverLifetime = lightningPs.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			AnimationCurve val3 = new AnimationCurve();
			val3.AddKey(0f, 1.2f);
			val3.AddKey(0.2f, 0.8f);
			val3.AddKey(0.5f, 1.5f);
			val3.AddKey(0.8f, 0.6f);
			val3.AddKey(1f, 0f);
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val3);
			ColorOverLifetimeModule colorOverLifetime = lightningPs.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val4 = new Gradient();
			val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[4]
			{
				new GradientColorKey(new Color(0.2f, 0.8f, 1f), 0f),
				new GradientColorKey(new Color(0.8f, 0.9f, 1f), 0.3f),
				new GradientColorKey(Color.white, 0.6f),
				new GradientColorKey(new Color(0.2f, 0.8f, 1f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0.9f, 0f),
				new GradientAlphaKey(0.8f, 0.2f),
				new GradientAlphaKey(0.6f, 0.8f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val4);
			ParticleSystemRenderer component = ((Component)lightningPs).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).material = CreateLightningMaterial();
			((Renderer)component).sortingOrder = 5;
			NoiseModule noise = lightningPs.noise;
			((NoiseModule)(ref noise)).enabled = true;
			((NoiseModule)(ref noise)).strength = new MinMaxCurve(0.5f, 1.2f);
			((NoiseModule)(ref noise)).frequency = 0.8f;
			((NoiseModule)(ref noise)).damping = false;
			((NoiseModule)(ref noise)).octaveCount = 2;
			((NoiseModule)(ref noise)).scrollSpeed = new MinMaxCurve(2f);
		}

		private Material CreateLightningMaterial()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_007c: Expected O, but got Unknown
			Material val = new Material(Shader.Find("Sprites/Default"))
			{
				mainTexture = (Texture)(object)CreateDetailedLightningTexture()
			};
			val.SetFloat("_Mode", 2f);
			val.SetInt("_SrcBlend", 5);
			val.SetInt("_DstBlend", 1);
			val.SetInt("_ZWrite", 0);
			val.DisableKeyword("_ALPHATEST_ON");
			val.EnableKeyword("_ALPHABLEND_ON");
			val.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val.renderQueue = 3000;
			return val;
		}

		private Texture2D CreateDetailedLightningTexture()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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)
			int num = 32;
			int num2 = 8;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)5, false);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = (float)num2 * 0.5f;
					Mathf.Abs((float)i - num3);
					float num4 = Mathf.Sin((float)j * 0.8f) * 1.2f + Mathf.Sin((float)j * 2.1f) * 0.6f;
					float num5 = num3 + num4;
					float num6 = Mathf.Abs((float)i - num5);
					if (num6 < 1.5f)
					{
						float num7 = 1f - num6 / 1.5f;
						val.SetPixel(j, i, new Color(1f, 1f, 1f, num7));
					}
					else if (num6 < 2.5f)
					{
						float num8 = (2.5f - num6) / 1f * 0.4f;
						val.SetPixel(j, i, new Color(0.6f, 0.9f, 1f, num8));
					}
					else
					{
						val.SetPixel(j, i, Color.clear);
					}
				}
			}
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			return val;
		}

		private void UpdateTrailIntensity()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)lightningPs == (Object)null))
			{
				EmissionModule emission = lightningPs.emission;
				((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(Mathf.Lerp(80f, 200f, currentIntensity));
				MainModule main = lightningPs.main;
				((MainModule)(ref main)).startSize = new MinMaxCurve(Mathf.Lerp(0.08f, 0.18f, currentIntensity), Mathf.Lerp(0.15f, 0.35f, currentIntensity));
				NoiseModule noise = lightningPs.noise;
				((NoiseModule)(ref noise)).strength = new MinMaxCurve(Mathf.Lerp(0.3f, 0.8f, currentIntensity), Mathf.Lerp(0.8f, 1.8f, currentIntensity));
			}
		}

		public void Cleanup()
		{
			if ((Object)(object)lightningPs != (Object)null)
			{
				lightningPs.Stop(true, (ParticleSystemStopBehavior)0);
			}
		}

		private void OnDestroy()
		{
			Cleanup();
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "RPCA_Die")]
	internal static class Capacitor_DeathPatch
	{
		private static void Prefix(HealthHandler __instance)
		{
			CapacitorEffect component = ((Component)__instance).GetComponent<CapacitorEffect>();
			if ((Object)(object)component != (Object)null)
			{
				component.OnDeath();
			}
		}
	}
	public class Gloop : CustomCard
	{
		internal static GameObject _rayPrefab;

		private static readonly Dictionary<Player, Action<GameObject>> gloopHandlers = new Dictionary<Player, Action<GameObject>>();

		protected override string GetTitle()
		{
			return "Gloop";
		}

		protected override string GetDescription()
		{
			return "Bullets spread sticky gloop on surfaces that slows enemies who step in it.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)6;
		}

		public override string GetModName()
		{
			return "AMP";
		}

		protected override GameObject GetCardArt()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ae: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AdvancedMovementPack.Resources.Gloop.png");
			if (stream == null)
			{
				Debug.LogError("[Gloop] Resource not found!");
				return new GameObject("GloopArt_Missing");
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 1f);
			GameObject val2 = new GameObject("GloopArt");
			Image obj = val2.AddComponent<Image>();
			obj.sprite = sprite;
			obj.preserveAspect = true;
			val2.GetComponent<RectTransform>().sizeDelta = new Vector2((float)((Texture)val).width * 1.2f, (float)((Texture)val).height * 1.2f);
			((Object)val2).hideFlags = (HideFlags)61;
			return val2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Attack speed",
					amount = "+30%",
					simepleAmount = (SimpleAmount)2
				}
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers stats, Block block)
		{
			gun.attackSpeed *= 0.7f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			EnsureRayPrefab();
			List<ObjectsToSpawn> list = gun.objectsToSpawn?.ToList() ?? new List<ObjectsToSpawn>();
			if (!list.Any((ObjectsToSpawn x) => (Object)(object)x.AddToProjectile == (Object)(object)_rayPrefab))
			{
				list.Add(new ObjectsToSpawn
				{
					AddToProjectile = _rayPrefab
				});
				gun.objectsToSpawn = list.ToArray();
			}
			Action<GameObject> action = delegate(GameObject projChild)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: 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)
				//IL_0104: 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_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Expected O, but got Unknown
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Expected O, but got Unknown
				if (!((Object)(object)projChild == (Object)null))
				{
					(projChild.GetComponent<GloopOwnerTag>() ?? projChild.AddComponent<GloopOwnerTag>()).owner = player;
					if ((Object)(object)projChild.transform.Find("AMP_Gloop_Trail") == (Object)null)
					{
						GameObject val = new GameObject("AMP_Gloop_Trail");
						val.transform.SetParent(projChild.transform, false);
						ParticleSystem obj = val.AddComponent<ParticleSystem>();
						MainModule main = obj.main;
						((MainModule)(ref main)).loop = true;
						((MainModule)(ref main)).playOnAwake = true;
						((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
						((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.28f);
						((MainModule)(ref main)).startSize = new MinMaxCurve(0.36f, 0.5f);
						((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.6509804f, 2f / 3f, 0f, 0.8f), new Color(0.6509804f, 2f / 3f, 0f, 0.8f));
						EmissionModule emission = obj.emission;
						((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
						((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(80f);
						ShapeModule shape = obj.shape;
						((ShapeModule)(ref shape)).enabled = false;
						SizeOverLifetimeModule sizeOverLifetime = obj.sizeOverLifetime;
						((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
						AnimationCurve val2 = new AnimationCurve();
						val2.AddKey(0f, 1f);
						val2.AddKey(1f, 0.2f);
						((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val2);
						ParticleSystemRenderer component = ((Component)obj).GetComponent<ParticleSystemRenderer>();
						((Renderer)component).material = new Material(Shader.Find("Sprites/Default"));
						component.renderMode = (ParticleSystemRenderMode)0;
					}
				}
			};
			gloopHandlers[player] = action;
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun.ShootPojectileAction, action);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			if (gun?.objectsToSpawn != null && (Object)(object)_rayPrefab != (Object)null)
			{
				List<ObjectsToSpawn> list = gun.objectsToSpawn.ToList();
				list.RemoveAll((ObjectsToSpawn o) => (Object)(object)o.AddToProjectile == (Object)(object)_rayPrefab);
				gun.objectsToSpawn = list.ToArray();
			}
			if (gloopHandlers.TryGetValue(player, out var value))
			{
				gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, value);
				gloopHandlers.Remove(player);
			}
			GloopTile[] array = Object.FindObjectsOfType<GloopTile>();
			foreach (GloopTile gloopTile in array)
			{
				if ((Object)(object)gloopTile != (Object)null && (Object)(object)gloopTile.sourcePlayer == (Object)(object)player)
				{
					Object.Destroy((Object)(object)((Component)gloopTile).gameObject);
				}
			}
			CleanGloopTrails(player);
		}

		internal static void CleanGloopTrails(Player player)
		{
			GloopOwnerTag[] array = Object.FindObjectsOfType<GloopOwnerTag>();
			foreach (GloopOwnerTag gloopOwnerTag in array)
			{
				if ((Object)(object)gloopOwnerTag.owner == (Object)(object)player)
				{
					ParticleSystem componentInChildren = ((Component)gloopOwnerTag).GetComponentInChildren<ParticleSystem>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.Stop(true, (ParticleSystemStopBehavior)0);
						Object.Destroy((Object)(object)((Component)componentInChildren).gameObject, 1f);
					}
					Object.Destroy((Object)(object)((Component)gloopOwnerTag).gameObject);
				}
			}
		}

		internal static void EnsureRayPrefab()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)_rayPrefab != (Object)null))
			{
				_rayPrefab = new GameObject("AMP_Gloop_Ray");
				((Object)_rayPrefab).hideFlags = (HideFlags)61;
				_rayPrefab.AddComponent<GloopRayEffect>();
				Object.DontDestroyOnLoad((Object)(object)_rayPrefab);
			}
		}
	}
	public class GloopOwnerTag : MonoBehaviour
	{
		public Player owner;
	}
	internal static class AMP_GloopProbe
	{
		private static GameObject _go;

		private static CircleCollider2D _col;

		public static void Ensure()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)_col != (Object)null))
			{
				_go = new GameObject("AMP_GloopProbe");
				((Object)_go).hideFlags = (HideFlags)61;
				_col = _go.AddComponent<CircleCollider2D>();
				((Collider2D)_col).isTrigger = true;
				_col.radius = 0.06f;
				Object.DontDestroyOnLoad((Object)(object)_go);
			}
		}

		public static bool Resolve(Collider2D surface, Vector2 approx, out Vector2 pointOnSurface, out Vector2 surfaceNormal, float radius = 0.06f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005f: 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)
			Ensure();
			pointOnSurface = approx;
			surfaceNormal = Vector2.up;
			if ((Object)(object)surface == (Object)null)
			{
				return false;
			}
			_col.radius = radius;
			_go.transform.position = Vector2.op_Implicit(approx);
			ColliderDistance2D val = Physics2D.Distance((Collider2D)(object)_col, surface);
			pointOnSurface = ((ColliderDistance2D)(ref val)).pointB;
			surfaceNormal = ((ColliderDistance2D)(ref val)).normal;
			return true;
		}
	}
	public class GloopRayEffect : RayHitEffect
	{
		public float tileSpacing = 0.35f;

		public int maxTilesPerImpact = 12;

		public float tileLifetime = 6f;

		private const float SURFACE_PUSH = 0.08f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			GloopOwnerTag componentInParent = ((Component)this).GetComponentInParent<GloopOwnerTag>();
			Player owner = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.owner : null);
			if ((Object)(object)hit.collider != (Object)null)
			{
				PlaceGloop(hit, owner);
			}
			return (HasToReturn)1;
		}

		private void PlaceGloop(HitInfo hit, Player owner)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_00f8: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			Collider2D collider = hit.collider;
			if (!((Object)(object)collider == (Object)null))
			{
				Collider2D val = (Object.op_Implicit((Object)(object)((Component)this).transform.root) ? ((Component)((Component)this).transform.root).GetComponentsInChildren<Collider2D>(true).OrderByDescending(delegate(Collider2D c)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					Bounds bounds = c.bounds;
					Vector3 extents = ((Bounds)(ref bounds)).extents;
					return ((Vector3)(ref extents)).magnitude;
				}).FirstOrDefault() : null);
				Vector2 surfaceNormal;
				Vector2 pointOnSurface;
				if ((Object)(object)val != (Object)null)
				{
					ColliderDistance2D val2 = Physics2D.Distance(val, collider);
					pointOnSurface = ((ColliderDistance2D)(ref val2)).pointB;
					Vector2 normal = ((ColliderDistance2D)(ref val2)).normal;
					surfaceNormal = ((Vector2)(ref normal)).normalized;
				}
				else
				{
					AMP_GloopProbe.Resolve(collider, Vector2.op_Implicit(((Component)this).transform.position), out pointOnSurface, out surfaceNormal, 0.08f);
					surfaceNormal = ((Vector2)(ref surfaceNormal)).normalized;
				}
				pointOnSurface += surfaceNormal * 0.08f;
				HashSet<Vector2Int> visited = new HashSet<Vector2Int>();
				int tiles = 0;
				PlaceTile(collider, pointOnSurface, surfaceNormal, owner, ref tiles, visited);
				Vector2 tangent = default(Vector2);
				((Vector2)(ref tangent))..ctor(0f - surfaceNormal.y, surfaceNormal.x);
				SpreadAlong(collider, pointOnSurface, surfaceNormal, tangent, 1f, owner, ref tiles, visited);
				SpreadAlong(collider, pointOnSurface, surfaceNormal, tangent, -1f, owner, ref tiles, visited);
			}
		}

		private void SpreadAlong(Collider2D surface, Vector2 start, Vector2 normal, Vector2 tangent, float dir, Player owner, ref int tiles, HashSet<Vector2Int> visited)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0071: 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)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = start;
			Vector2 val2 = normal;
			for (int i = 0; i < maxTilesPerImpact; i++)
			{
				if (tiles >= maxTilesPerImpact)
				{
					break;
				}
				Vector2 approx = val + tangent * dir * tileSpacing;
				if (AMP_GloopProbe.Resolve(surface, approx, out var pointOnSurface, out var surfaceNormal))
				{
					pointOnSurface += ((Vector2)(ref surfaceNormal)).normalized * 0.08f;
					if (TryMark(pointOnSurface, visited))
					{
						PlaceTile(surface, pointOnSurface, surfaceNormal, owner, ref tiles, visited);
					}
					val = pointOnSurface;
					val2 = ((Vector2)(ref surfaceNormal)).normalized;
					((Vector2)(ref tangent))..ctor(0f - val2.y, val2.x);
					continue;
				}
				break;
			}
		}

		private void PlaceTile(Collider2D surface, Vector2 worldPos, Vector2 normal, Player owner, ref int tiles, HashSet<Vector2Int> visited)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			if (tiles < maxTilesPerImpact)
			{
				tiles++;
				Vector2 val = ((((Vector2)(ref normal)).sqrMagnitude > 1E-06f) ? ((Vector2)(ref normal)).normalized : Vector2.up);
				Vector3 position = Vector2.op_Implicit(worldPos + val * 0.08f);
				GameObject val2 = new GameObject("AMP_GloopTile");
				val2.transform.position = position;
				val2.transform.rotation = Quaternion.FromToRotation(Vector3.up, new Vector3(val.x, val.y, 0f));
				GloopTile gloopTile = val2.AddComponent<GloopTile>();
				gloopTile.maxLifetime = tileLifetime;
				gloopTile.radius = 0.75f;
				gloopTile.slowAmount = 0.45f;
				gloopTile.sourcePlayer = owner;
				gloopTile.InitVisuals();
				GloopRegistry.Register(val2);
			}
		}

		private bool TryMark(Vector2 p, HashSet<Vector2Int> visited)
		{
			//IL_0002: 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_002a: 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)
			Vector2Int item = default(Vector2Int);
			((Vector2Int)(ref item))..ctor(Mathf.RoundToInt(p.x / 0.35f), Mathf.RoundToInt(p.y / 0.35f));
			if (visited.Contains(item))
			{
				return false;
			}
			visited.Add(item);
			return true;
		}
	}
	public class GloopTile : MonoBehaviour
	{
		private class GlobalOrig
		{
			public float originalSpeed;

			public float originalGrav;

			public float originalJump;

			public Rigidbody2D rb;

			public int count;

			public Action reviveHandler;
		}

		public float maxLifetime = 6f;

		public float radius = 0.75f;

		public float slowAmount = 0.45f;

		public Player sourcePlayer;

		private float life;

		private ParticleSystem ps;

		private HashSet<Player> localAffected = new HashSet<Player>();

		private static readonly Dictionary<Player, GlobalOrig> GlobalModified = new Dictionary<Player, GlobalOrig>();

		private static readonly Collider2D[] _buf = (Collider2D[])(object)new Collider2D[16];

		public void InitVisuals()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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)
			int num = LayerMask.NameToLayer("Ignore Raycast");
			((Component)this).gameObject.layer = ((num >= 0) ? num : 2);
			Collider2D[] components = ((Component)this).GetComponents<Collider2D>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.Destroy((Object)(object)components[i]);
			}
			ps = ((Component)this).gameObject.AddComponent<ParticleSystem>();
			ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).material = new Material(Shader.Find("Sprites/Default"));
			MainModule main = ps.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1.2f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.06f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.4f, 0.8f);
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(new Color(0.6509804f, 2f / 3f, 0f), 0f),
				new GradientColorKey(new Color(0.6509804f, 2f / 3f, 0f), 0.5f),
				new GradientColorKey(new Color(0.6509804f, 2f / 3f, 0f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0.95f, 0f),
				new GradientAlphaKey(0.75f, 0.5f),
				new GradientAlphaKey(0f, 1f)
			});
			ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val);
			EmissionModule emission = ps.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(30f);
			ShapeModule shape = ps.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = radius * 0.6f;
			CircleCollider2D obj = ((Component)this).gameObject.AddComponent<CircleCollider2D>();
			((Collider2D)obj).isTrigger = true;
			obj.radius = radius;
		}

		private void Update()
		{
			//IL_0032: 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)
			life += Time.deltaTime;
			if (life >= maxLifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			int num = Physics2D.OverlapCircleNonAlloc(Vector2.op_Implicit(((Component)this).transform.position), radius, _buf);
			HashSet<Player> hashSet = new HashSet<Player>();
			for (int i = 0; i < num; i++)
			{
				Collider2D val = _buf[i];
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				Player componentInParent = ((Component)val).GetComponentInParent<Player>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.data.dead)
				{
					hashSet.Add(componentInParent);
					if (!localAffected.Contains(componentInParent))
					{
						AddLocalEffect(componentInParent);
					}
				}
			}
			List<Player> list = new List<Player>();
			foreach (Player item in localAffected)
			{
				if (!hashSet.Contains(item))
				{
					list.Add(item);
				}
			}
			foreach (Player item2 in list)
			{
				RemoveLocalEffect(item2);
			}
		}

		private void AddLocalEffect(Player p)
		{
			CharacterStatModifiers val = p.data?.stats;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			if (!GlobalModified.TryGetValue(p, out var value))
			{
				value = new GlobalOrig();
				value.originalSpeed = val.movementSpeed;
				value.originalJump = val.jump;
				Rigidbody2D val2 = (value.rb = ((Component)p).GetComponent<Rigidbody2D>() ?? ((Component)p).GetComponentInChildren<Rigidbody2D>());
				if ((Object)(object)val2 != (Object)null)
				{
					value.originalGrav = val2.gravityScale;
					val2.gravityScale *= 2f;
				}
				value.count = 1;
				value.reviveHandler = delegate
				{
					RestoreAllForPlayer(p);
				};
				if ((Object)(object)p.data?.healthHandler != (Object)null)
				{
					try
					{
						HealthHandler healthHandler = p.data.healthHandler;
						healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, value.reviveHandler);
					}
					catch
					{
					}
				}
				GlobalModified[p] = value;
			}
			else
			{
				value.count++;
			}
			localAffected.Add(p);
			float num = Mathf.Pow(1f - slowAmount, (float)GlobalModified[p].count);
			val.movementSpeed = GlobalModified[p].originalSpeed * num;
			val.jump = GlobalModified[p].originalJump * 0.2f;
		}

		private void RemoveLocalEffect(Player p)
		{
			if (!localAffected.Remove(p) || !GlobalModified.TryGetValue(p, out var value))
			{
				return;
			}
			value.count--;
			if (value.count <= 0)
			{
				CharacterStatModifiers val = p.data?.stats;
				if ((Object)(object)val != (Object)null)
				{
					val.movementSpeed = value.originalSpeed;
					val.jump = value.originalJump;
				}
				if ((Object)(object)value.rb != (Object)null)
				{
					value.rb.gravityScale = value.originalGrav;
				}
				if (value.reviveHandler != null && (Object)(object)p.data?.healthHandler != (Object)null)
				{
					try
					{
						HealthHandler healthHandler = p.data.healthHandler;
						healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, value.reviveHandler);
					}
					catch
					{
					}
				}
				GlobalModified.Remove(p);
			}
			else
			{
				CharacterStatModifiers val2 = p.data?.stats;
				if ((Object)(object)val2 != (Object)null)
				{
					val2.movementSpeed = value.originalSpeed * Mathf.Pow(1f - slowAmount, (float)value.count);
					val2.jump = value.originalJump * 0.2f;
				}
			}
		}

		public void PublicRestorePlayer(Player p)
		{
			RestoreAllForPlayer(p);
		}

		public static void RestoreAllForPlayer(Player p)
		{
			if ((Object)(object)p == (Object)null || !GlobalModified.TryGetValue(p, out var value))
			{
				return;
			}
			CharacterStatModifiers val = p.data?.stats;
			if ((Object)(object)val != (Object)null)
			{
				val.movementSpeed = value.originalSpeed;
				val.jump = value.originalJump;
			}
			if ((Object)(object)value.rb != (Object)null)
			{
				value.rb.gravityScale = value.originalGrav;
			}
			if (value.reviveHandler != null && (Object)(object)p.data?.healthHandler != (Object)null)
			{
				try
				{
					HealthHandler healthHandler = p.data.healthHandler;
					healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, value.reviveHandler);
				}
				catch
				{
				}
			}
			GlobalModified.Remove(p);
			GloopTile[] array = Object.FindObjectsOfType<GloopTile>();
			foreach (GloopTile gloopTile in array)
			{
				try
				{
					gloopTile.ForceForgetPlayer(p);
				}
				catch
				{
				}
			}
		}

		public void ForceForgetPlayer(Player p)
		{
			localAffected.Remove(p);
		}

		private void OnDestroy()
		{
			Player[] array = localAffected.ToArray();
			foreach (Player p in array)
			{
				try
				{
					RemoveLocalEffect(p);
				}
				catch
				{
				}
			}
			localAffected.Clear();
			GloopRegistry.Unregister(((Component)this).gameObject);
		}
	}
	public class GloopRegistry : MonoBehaviour
	{
		private static readonly HashSet<GameObject> Active = new HashSet<GameObject>();

		private static GloopRegistry _instance;

		public static void Register(GameObject go)
		{
			Ensure();
			if (Object.op_Implicit((Object)(object)go))
			{
				Active.Add(go);
			}
		}

		public static void Unregister(GameObject go)
		{
			if (Object.op_Implicit((Object)(object)go))
			{
				Active.Remove(go);
			}
		}

		private static void Ensure()
		{
			//IL_0013: 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_0028: Expected O, but got Unknown
			if (!((Object)(object)_instance != (Object)null))
			{
				GameObject val = new GameObject("GloopRegistry");
				_instance = val.AddComponent<GloopRegistry>();
				Object.DontDestroyOnLoad((Object)val);
				SceneManager.activeSceneChanged += OnActiveSceneChanged;
				SceneManager.sceneLoaded += OnSceneLoaded;
				SceneManager.sceneUnloaded += OnSceneUnloaded;
			}
		}

		private static void OnActiveSceneChanged(Scene a, Scene b)
		{
			CleanupAllAndSweep();
		}

		private static void OnSceneLoaded(Scene s, LoadSceneMode m)
		{
			CleanupAllAndSweep();
		}

		private static void OnSceneUnloaded(Scene s)
		{
			CleanupAllAndSweep();
		}

		private static void CleanupAllAndSweep()
		{
			foreach (GameObject item in Active.ToList())
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					Object.Destroy((Object)(object)item);
				}
			}
			Active.Clear();
			GloopTile[] array = Object.FindObjectsOfType<GloopTile>();
			foreach (GloopTile gloopTile in array)
			{
				if (Object.op_Implicit((Object)(object)gloopTile) && Object.op_Implicit((Object)(object)((Component)gloopTile).gameObject))
				{
					Object.Destroy((Object)(object)((Component)gloopTile).gameObject);
				}
			}
		}

		private void OnDestroy()
		{
			SceneManager.activeSceneChanged -= OnActiveSceneChanged;
			SceneManager.sceneLoaded -= OnSceneLoaded;
			SceneManager.sceneUnloaded -= OnSceneUnloaded;
			CleanupAllAndSweep();
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "RPCA_Die")]
	internal static class Gloop_DeathPatch
	{
		private static void Prefix(HealthHandler __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			Player val = ((Component)__instance).GetComponentInParent<Player>() ?? ((Component)__instance).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GloopTile[] array = Object.FindObjectsOfType<GloopTile>();
			foreach (GloopTile gloopTile in array)
			{
				if (!((Object)(object)gloopTile == (Object)null))
				{
					gloopTile.PublicRestorePlayer(val);
				}
			}
		}
	}
	public class GravityWell : CustomCard
	{
		internal static GameObject _rayPrefab;

		protected override string GetTitle()
		{
			return "Gravity Well";
		}

		protected override string GetDescription()
		{
			return "Your last bullet creates a gravity well that pull in nearby objects and enemies.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		public override string GetModName()
		{
			return "AMP";
		}

		protected override GameObject GetCardArt()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ae: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AdvancedMovementPack.Resources.GravityWell.png");
			if (stream == null)
			{
				Debug.LogError("[GravityWell] Resource not found!");
				return new GameObject("GravityWellArt_Missing");
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 1f);
			GameObject val2 = new GameObject("GravityWellArt");
			Image obj = val2.AddComponent<Image>();
			obj.sprite = sprite;
			obj.preserveAspect = true;
			val2.GetComponent<RectTransform>().sizeDelta = new Vector2((float)((Texture)val).width * 1.2f, (float)((Texture)val).height * 1.2f);
			((Object)val2).hideFlags = (HideFlags)61;
			return val2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = false,
					stat = "Reload Speed",
					amount = "-75%",
					simepleAmount = (SimpleAmount)7
				}
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			EnsureRayPrefab();
			gun.reloadTime *= 4f;
			GravityWellTracker orAddComponent = ((Component)player).gameObject.GetOrAddComponent<GravityWellTracker>();
			orAddComponent.gun = gun;
			orAddComponent.gunAmmo = gunAmmo;
			orAddComponent.player = player;
			List<ObjectsToSpawn> list = gun.objectsToSpawn?.ToList() ?? new List<ObjectsToSpawn>();
			if (!list.Any((ObjectsToSpawn x) => (Object)(object)x.AddToProjectile == (Object)(object)_rayPrefab))
			{
				list.Add(new ObjectsToSpawn
				{
					AddToProjectile = _rayPrefab
				});
				gun.objectsToSpawn = list.ToArray();
			}
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers stats)
		{
			GravityWellTracker component = ((Component)player).gameObject.GetComponent<GravityWellTracker>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if (gun?.objectsToSpawn != null && (Object)(object)_rayPrefab != (Object)null)
			{
				List<ObjectsToSpawn> list = gun.objectsToSpawn.ToList();
				list.RemoveAll((ObjectsToSpawn o) => (Object)(object)o.AddToProjectile == (Object)(object)_rayPrefab);
				gun.objectsToSpawn = list.ToArray();
			}
		}

		internal static void EnsureRayPrefab()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)_rayPrefab != (Object)null))
			{
				_rayPrefab = new GameObject("AMP_GravityWell_Ray");
				((Object)_rayPrefab).hideFlags = (HideFlags)61;
				_rayPrefab.AddComponent<GravityWellRayEffect>();
				Object.DontDestroyOnLoad((Object)(object)_rayPrefab);
			}
		}
	}
	public class GravityWellTracker : MonoBehaviour
	{
		public Gun gun;

		public GunAmmo gunAmmo;

		public Player player;

		private bool nextShotIsLast;

		private void Start()
		{
			if ((Object)(object)gun != (Object)null)
			{
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnBulletFired));
			}
		}

		private void Update()
		{
			if (!((Object)(object)gun == (Object)null) && !((Object)(object)gunAmmo == (Object)null))
			{
				FieldInfo field = typeof(GunAmmo).GetField("currentAmmo", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					int num = (int)field.GetValue(gunAmmo);
					nextShotIsLast = num == 1;
				}
				else
				{
					nextShotIsLast = ((Weapon)gun).sinceAttack >= gun.attackSpeed - 0.01f && !gun.isReloading;
				}
			}
		}

		private void OnBulletFired(GameObject projectile)
		{
			if (nextShotIsLast)
			{
				GravityWellMarker orAddComponent = projectile.GetOrAddComponent<GravityWellMarker>();
				orAddComponent.owner = player;
				orAddComponent.isLastBullet = true;
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)gun != (Object)null)
			{
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnBulletFired));
			}
		}
	}
	public class GravityWellMarker : MonoBehaviour
	{
		public Player owner;

		public bool isLastBullet;

		public bool hasSpawnedWell;

		private void OnDestroy()
		{
			if (isLastBullet && !hasSpawnedWell)
			{
				SpawnGravityWell();
			}
		}

		private void SpawnGravityWell()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (hasSpawnedWell)
			{
				return;
			}
			hasSpawnedWell = true;
			if ((Object)(object)owner != (Object)null)
			{
				GravityWellEffect[] array = Object.FindObjectsOfType<GravityWellEffect>();
				foreach (GravityWellEffect gravityWellEffect in array)
				{
					if ((Object)(object)gravityWellEffect.owner == (Object)(object)owner && gravityWellEffect.isActive)
					{
						gravityWellEffect.CleanupEffect();
					}
				}
			}
			Vector3 position = ((Component)this).transform.position + Vector3.up * 2f;
			GameObject val = new GameObject("AMP_GravityWell");
			val.transform.position = position;
			val.AddComponent<GravityWellEffect>().Initialize(owner);
		}
	}
	public class GravityWellRayEffect : RayHitEffect
	{
		public bool isLastBullet;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			return (HasToReturn)1;
		}
	}
	public class GravityWellEffect : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <AnimateDamageEffect>d__16 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject effect;

			private SpriteRenderer <sr>5__2;

			private float <duration>5__3;

			private float <elapsed>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<sr>5__2 = effect.GetComponent<SpriteRenderer>();
					<duration>5__3 = 0.5f;
					<elapsed>5__4 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__4 < <duration>5__3)
				{
					float num = <elapsed>5__4 / <duration>5__3;
					float num2 = Mathf.Lerp(0.5f, 2f, num);
					float num3 = Mathf.Lerp(1f, 0f, num);
					effect.transform.localScale = Vector3.one * num2;
					<sr>5__2.color = new Color(1f, 0f, 0f, num3);
					<elapsed>5__4 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Object.Destroy((Object)(object)effect);
				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();
			}
		}

		[CompilerGenerated]
		private sealed class <GravityWellRoutine>d__12 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GravityWellEffect <>4__this;

			private float <elapsed>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				int num = <>1__state;
				GravityWellEffect gravityWellEffect = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__2 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__2 < gravityWellEffect.scaledDuration && gravityWellEffect.isActive)
				{
					gravityWellEffect.ApplyGravityPull();
					<elapsed>5__2 += Time.deltaTime;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				gravityWellEffect.CleanupEffect();
				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 float baseGravityStrength = 15f;

		private float baseGravityRange = 25f;

		private float baseDuration = 3f;

		public bool isActive;

		public Player owner;

		private float scaledGravityStrength;

		private float scaledGravityRange;

		private float scaledDuration;

		private float damageInterval = 0.5f;

		private float lastDamageTime;

		private float centerDamageRadius = 2f;

		public void Initialize(Player owner)
		{
			this.owner = owner;
			if ((Object)(object)owner != (Object)null)
			{
				Holding component = ((Component)owner).GetComponent<Holding>();
				object obj;
				if (component == null)
				{
					obj = null;
				}
				else
				{
					Holdable holdable = component.holdable;
					obj = ((holdable != null) ? ((Component)holdable).GetComponent<Gun>() : null);
				}
				Gun val = (Gun)obj;
				if ((Object)(object)val != (Object)null)
				{
					float damage = val.damage;
					float num = 1f + Mathf.Clamp((damage - 2f) * 0.25f, 0f, 0.5f);
					scaledGravityStrength = baseGravityStrength * num;
					scaledGravityRange = baseGravityRange * num;
					scaledDuration = baseDuration * num;
				}
				else
				{
					scaledGravityStrength = baseGravityStrength;
					scaledGravityRange = baseGravityRange;
					scaledDuration = baseDuration;
				}
			}
			else
			{
				scaledGravityStrength = baseGravityStrength;
				scaledGravityRange = baseGravityRange;
				scaledDuration = baseDuration;
			}
			isActive = true;
			CreateVisualEffect();
			((MonoBehavio