Decompiled source of The Captain Custom Character v2.0.2

plugins/Captain.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Alexandria.BreakableAPI;
using Alexandria.CharacterAPI;
using Alexandria.ItemAPI;
using Alexandria.Misc;
using Alexandria.PrefabAPI;
using BepInEx;
using Dungeonator;
using Gungeon;
using ItemAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("57445610-0892-47c3-be16-453172104123")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ItemAPI
{
	public class AdvancedGunBehaviourMultiActive : MonoBehaviour, IGunInheritable, ILevelLoadedListener
	{
		private bool pickedUpLast = false;

		private GameActor lastOwner = null;

		public bool everPickedUpByPlayer = false;

		public bool everPickedUp = false;

		public Gun gun;

		private bool hasReloaded = true;

		public bool preventNormalFireAudio;

		public bool preventNormalReloadAudio;

		public string overrideNormalFireAudio;

		public string overrideReloadSwitchGroup;

		public string overrideNormalReloadAudio;

		public bool usesOverrideHeroSwordCooldown;

		public float overrideHeroSwordCooldown;

		private static FieldInfo heroSwordCooldown = typeof(Gun).GetField("HeroSwordCooldown", BindingFlags.Instance | BindingFlags.NonPublic);

		public bool PickedUp => (Object)(object)gun.CurrentOwner != (Object)null;

		public PlayerController Player
		{
			get
			{
				if (gun.CurrentOwner is PlayerController)
				{
					GameActor currentOwner = gun.CurrentOwner;
					return (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
				}
				return null;
			}
		}

		public float HeroSwordCooldown
		{
			get
			{
				if ((Object)(object)gun != (Object)null)
				{
					return (float)heroSwordCooldown.GetValue(gun);
				}
				return -1f;
			}
			set
			{
				if ((Object)(object)gun != (Object)null)
				{
					heroSwordCooldown.SetValue(gun, value);
				}
			}
		}

		public GameActor Owner => gun.CurrentOwner;

		public bool PickedUpByPlayer => (Object)(object)Player != (Object)null;

		public virtual void Update()
		{
			if ((Object)(object)Player != (Object)null && !everPickedUpByPlayer)
			{
				everPickedUpByPlayer = true;
			}
			if ((Object)(object)Owner != (Object)null && !everPickedUp)
			{
				everPickedUp = true;
			}
			if ((Object)(object)lastOwner != (Object)(object)Owner)
			{
				lastOwner = Owner;
			}
			if ((Object)(object)Owner != (Object)null && !pickedUpLast)
			{
				OnPickup(Owner);
				pickedUpLast = true;
			}
			if ((Object)(object)Owner == (Object)null && pickedUpLast)
			{
				if ((Object)(object)lastOwner != (Object)null)
				{
					OnPostDrop(lastOwner);
					lastOwner = null;
				}
				pickedUpLast = false;
			}
			if ((Object)(object)gun != (Object)null && !gun.IsReloading && !hasReloaded)
			{
				hasReloaded = true;
				if ((Object)(object)Owner != (Object)null)
				{
					GameActor owner = Owner;
					OnReloadEnded((PlayerController)(object)((owner is PlayerController) ? owner : null), gun);
				}
			}
			gun.PreventNormalFireAudio = preventNormalFireAudio;
			gun.OverrideNormalFireAudioEvent = overrideNormalFireAudio;
		}

		public virtual void InheritData(Gun source)
		{
			AdvancedGunBehaviourMultiActive component = ((Component)source).GetComponent<AdvancedGunBehaviourMultiActive>();
			if ((Object)(object)component != (Object)null)
			{
				preventNormalFireAudio = component.preventNormalFireAudio;
				preventNormalReloadAudio = component.preventNormalReloadAudio;
				overrideNormalReloadAudio = component.overrideNormalReloadAudio;
				overrideNormalFireAudio = component.overrideNormalFireAudio;
				everPickedUpByPlayer = component.everPickedUpByPlayer;
				everPickedUp = component.everPickedUp;
				usesOverrideHeroSwordCooldown = component.usesOverrideHeroSwordCooldown;
				overrideHeroSwordCooldown = component.overrideHeroSwordCooldown;
				overrideReloadSwitchGroup = component.overrideReloadSwitchGroup;
			}
		}

		public virtual void MidGameSerialize(List<object> data, int dataIndex)
		{
			data.Add(preventNormalFireAudio);
			data.Add(preventNormalReloadAudio);
			data.Add(overrideNormalReloadAudio);
			data.Add(overrideNormalFireAudio);
			data.Add(everPickedUpByPlayer);
			data.Add(everPickedUp);
			data.Add(usesOverrideHeroSwordCooldown);
			data.Add(overrideHeroSwordCooldown);
			data.Add(overrideReloadSwitchGroup);
		}

		public virtual void MidGameDeserialize(List<object> data, ref int dataIndex)
		{
			preventNormalFireAudio = (bool)data[dataIndex];
			preventNormalReloadAudio = (bool)data[dataIndex + 1];
			overrideNormalReloadAudio = (string)data[dataIndex + 2];
			overrideNormalFireAudio = (string)data[dataIndex + 3];
			everPickedUpByPlayer = (bool)data[dataIndex + 4];
			everPickedUp = (bool)data[dataIndex + 5];
			usesOverrideHeroSwordCooldown = (bool)data[dataIndex + 6];
			overrideHeroSwordCooldown = (float)data[dataIndex + 7];
			overrideReloadSwitchGroup = (string)data[dataIndex + 8];
			dataIndex += 9;
		}

		public virtual void Start()
		{
			gun = ((Component)this).GetComponent<Gun>();
			Gun obj = gun;
			obj.OnInitializedWithOwner = (Action<GameActor>)Delegate.Combine(obj.OnInitializedWithOwner, new Action<GameActor>(OnInitializedWithOwner));
			if ((Object)(object)gun.CurrentOwner != (Object)null)
			{
				OnInitializedWithOwner(gun.CurrentOwner);
			}
			Gun obj2 = gun;
			obj2.PostProcessProjectile = (Action<Projectile>)Delegate.Combine(obj2.PostProcessProjectile, new Action<Projectile>(PostProcessProjectile));
			Gun obj3 = gun;
			obj3.PostProcessVolley = (Action<ProjectileVolleyData>)Delegate.Combine(obj3.PostProcessVolley, new Action<ProjectileVolleyData>(PostProcessVolley));
			Gun obj4 = gun;
			obj4.OnDropped = (Action)Delegate.Combine(obj4.OnDropped, new Action(OnDropped));
			Gun obj5 = gun;
			obj5.OnAutoReload = (Action<PlayerController, Gun>)Delegate.Combine(obj5.OnAutoReload, new Action<PlayerController, Gun>(OnAutoReload));
			Gun obj6 = gun;
			obj6.OnReloadPressed = (Action<PlayerController, Gun, bool>)Delegate.Combine(obj6.OnReloadPressed, new Action<PlayerController, Gun, bool>(OnReloadPressed));
			Gun obj7 = gun;
			obj7.OnFinishAttack = (Action<PlayerController, Gun>)Delegate.Combine(obj7.OnFinishAttack, new Action<PlayerController, Gun>(OnFinishAttack));
			Gun obj8 = gun;
			obj8.OnPostFired = (Action<PlayerController, Gun>)Delegate.Combine(obj8.OnPostFired, new Action<PlayerController, Gun>(OnPostFired));
			Gun obj9 = gun;
			obj9.OnAmmoChanged = (Action<PlayerController, Gun>)Delegate.Combine(obj9.OnAmmoChanged, new Action<PlayerController, Gun>(OnAmmoChanged));
			Gun obj10 = gun;
			obj10.OnBurstContinued = (Action<PlayerController, Gun>)Delegate.Combine(obj10.OnBurstContinued, new Action<PlayerController, Gun>(OnBurstContinued));
			Gun obj11 = gun;
			obj11.OnPreFireProjectileModifier = (Func<Gun, Projectile, ProjectileModule, Projectile>)Delegate.Combine(obj11.OnPreFireProjectileModifier, new Func<Gun, Projectile, ProjectileModule, Projectile>(OnPreFireProjectileModifier));
			((MonoBehaviour)this).StartCoroutine(UpdateCR());
		}

		public virtual void BraveOnLevelWasLoaded()
		{
		}

		private IEnumerator UpdateCR()
		{
			while (true)
			{
				NonCurrentGunUpdate();
				yield return null;
			}
		}

		public virtual void NonCurrentGunUpdate()
		{
		}

		public virtual void OnInitializedWithOwner(GameActor actor)
		{
		}

		public virtual void PostProcessProjectile(Projectile projectile)
		{
		}

		public virtual void PostProcessVolley(ProjectileVolleyData volley)
		{
		}

		public virtual void OnDropped()
		{
		}

		public virtual void OnAutoReload(PlayerController player, Gun gun)
		{
			if ((Object)(object)player != (Object)null)
			{
				OnAutoReloadSafe(player, gun);
			}
		}

		public virtual void OnAutoReloadSafe(PlayerController player, Gun gun)
		{
		}

		public virtual void OnReloadPressed(PlayerController player, Gun gun, bool manualReload)
		{
			if (hasReloaded && gun.IsReloading)
			{
				OnReload(player, gun);
				hasReloaded = false;
			}
			if ((Object)(object)player != (Object)null)
			{
				OnReloadPressedSafe(player, gun, manualReload);
			}
		}

		public virtual void OnGunsChanged(Gun previous, Gun current, bool newGun)
		{
			if ((Object)(object)previous != (Object)(object)gun && (Object)(object)current == (Object)(object)gun)
			{
				OnSwitchedToThisGun();
			}
			if ((Object)(object)previous == (Object)(object)gun && (Object)(object)current != (Object)(object)gun)
			{
				OnSwitchedAwayFromThisGun();
			}
		}

		public virtual void OnSwitchedToThisGun()
		{
		}

		public virtual void OnSwitchedAwayFromThisGun()
		{
		}

		public virtual void OnReloadPressedSafe(PlayerController player, Gun gun, bool manualReload)
		{
			if (hasReloaded && gun.IsReloading)
			{
				OnReloadSafe(player, gun);
				hasReloaded = false;
			}
		}

		public virtual void OnReload(PlayerController player, Gun gun)
		{
			if (preventNormalReloadAudio)
			{
				AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
				if (!string.IsNullOrEmpty(overrideNormalReloadAudio))
				{
					AkSoundEngine.PostEvent(overrideNormalReloadAudio, ((Component)this).gameObject);
				}
			}
		}

		public virtual void OnReloadEnded(PlayerController player, Gun gun)
		{
			if ((Object)(object)player != (Object)null)
			{
				OnReloadEndedSafe(player, gun);
			}
		}

		public virtual void OnReloadEndedSafe(PlayerController player, Gun gun)
		{
		}

		public virtual void OnReloadSafe(PlayerController player, Gun gun)
		{
		}

		public virtual void OnFinishAttack(PlayerController player, Gun gun)
		{
		}

		public virtual void OnPostFired(PlayerController player, Gun gun)
		{
			if (gun.IsHeroSword && HeroSwordCooldown == 0.5f)
			{
				OnHeroSwordCooldownStarted(player, gun);
			}
		}

		public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
		{
			if (usesOverrideHeroSwordCooldown)
			{
				HeroSwordCooldown = overrideHeroSwordCooldown;
			}
		}

		public virtual void OnAmmoChanged(PlayerController player, Gun gun)
		{
			if ((Object)(object)player != (Object)null)
			{
				OnAmmoChangedSafe(player, gun);
			}
		}

		public virtual void OnAmmoChangedSafe(PlayerController player, Gun gun)
		{
		}

		public virtual void OnBurstContinued(PlayerController player, Gun gun)
		{
			if ((Object)(object)player != (Object)null)
			{
				OnBurstContinuedSafe(player, gun);
			}
		}

		public virtual void OnBurstContinuedSafe(PlayerController player, Gun gun)
		{
		}

		public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
		{
			return projectile;
		}

		public virtual void OnPickup(GameActor owner)
		{
			if (owner is PlayerController)
			{
				OnPickedUpByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
			}
			if (owner is AIActor)
			{
				OnPickedUpByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
			}
		}

		public virtual void OnPostDrop(GameActor owner)
		{
			if (owner is PlayerController)
			{
				OnPostDroppedByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
			}
			if (owner is AIActor)
			{
				OnPostDroppedByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
			}
		}

		public virtual void OnPickedUpByPlayer(PlayerController player)
		{
			player.GunChanged += OnGunsChanged;
		}

		public virtual void OnPostDroppedByPlayer(PlayerController player)
		{
		}

		public virtual void OnPickedUpByEnemy(AIActor enemy)
		{
		}

		public virtual void OnPostDroppedByEnemy(AIActor enemy)
		{
		}
	}
	public class AdvancedGunBehavior : MonoBehaviour
	{
		private bool pickedUpLast = false;

		private PlayerController lastPlayer = null;

		public bool everPickedUpByPlayer = false;

		public Gun gun;

		private bool hasReloaded = true;

		public bool preventNormalFireAudio;

		public bool preventNormalReloadAudio;

		public string overrrideNormalFireAudio;

		public string overrideNormalReloadAudio;

		private static FieldInfo heroSwordCooldown = typeof(Gun).GetField("HeroSwordCooldown", BindingFlags.Instance | BindingFlags.NonPublic);

		public bool PickedUp => (Object)(object)gun.CurrentOwner != (Object)null;

		public PlayerController Player
		{
			get
			{
				if (gun.CurrentOwner is PlayerController)
				{
					GameActor currentOwner = gun.CurrentOwner;
					return (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
				}
				return null;
			}
		}

		public float HeroSwordCooldown
		{
			get
			{
				if ((Object)(object)gun != (Object)null)
				{
					return (float)heroSwordCooldown.GetValue(gun);
				}
				return -1f;
			}
			set
			{
				if ((Object)(object)gun != (Object)null)
				{
					heroSwordCooldown.SetValue(gun, value);
				}
			}
		}

		public GameActor Owner => gun.CurrentOwner;

		public bool OwnerIsPlayer => (Object)(object)Player != (Object)null;

		public virtual void Update()
		{
			if ((Object)(object)Player != (Object)null)
			{
				lastPlayer = Player;
				if (!everPickedUpByPlayer)
				{
					everPickedUpByPlayer = true;
				}
			}
			if ((Object)(object)Player != (Object)null && !pickedUpLast)
			{
				OnPickup(Player);
				pickedUpLast = true;
			}
			if ((Object)(object)Player == (Object)null && pickedUpLast)
			{
				if ((Object)(object)lastPlayer != (Object)null)
				{
					OnPostDrop(lastPlayer);
					lastPlayer = null;
				}
				pickedUpLast = false;
			}
			if ((Object)(object)gun != (Object)null && !gun.IsReloading && !hasReloaded)
			{
				hasReloaded = true;
			}
			gun.PreventNormalFireAudio = preventNormalFireAudio;
			gun.OverrideNormalFireAudioEvent = overrrideNormalFireAudio;
		}

		public virtual void Start()
		{
			gun = ((Component)this).GetComponent<Gun>();
			Gun val = gun;
			val.OnInitializedWithOwner = (Action<GameActor>)Delegate.Combine(val.OnInitializedWithOwner, new Action<GameActor>(OnInitializedWithOwner));
			Gun val2 = gun;
			val2.PostProcessProjectile = (Action<Projectile>)Delegate.Combine(val2.PostProcessProjectile, new Action<Projectile>(PostProcessProjectile));
			Gun val3 = gun;
			val3.PostProcessVolley = (Action<ProjectileVolleyData>)Delegate.Combine(val3.PostProcessVolley, new Action<ProjectileVolleyData>(PostProcessVolley));
			Gun val4 = gun;
			val4.OnDropped = (Action)Delegate.Combine(val4.OnDropped, new Action(OnDropped));
			Gun val5 = gun;
			val5.OnAutoReload = (Action<PlayerController, Gun>)Delegate.Combine(val5.OnAutoReload, new Action<PlayerController, Gun>(OnAutoReload));
			Gun val6 = gun;
			val6.OnReloadPressed = (Action<PlayerController, Gun, bool>)Delegate.Combine(val6.OnReloadPressed, new Action<PlayerController, Gun, bool>(OnReloadPressed));
			Gun val7 = gun;
			val7.OnFinishAttack = (Action<PlayerController, Gun>)Delegate.Combine(val7.OnFinishAttack, new Action<PlayerController, Gun>(OnFinishAttack));
			Gun val8 = gun;
			val8.OnPostFired = (Action<PlayerController, Gun>)Delegate.Combine(val8.OnPostFired, new Action<PlayerController, Gun>(OnPostFired));
			Gun val9 = gun;
			val9.OnAmmoChanged = (Action<PlayerController, Gun>)Delegate.Combine(val9.OnAmmoChanged, new Action<PlayerController, Gun>(OnAmmoChanged));
			Gun val10 = gun;
			val10.OnBurstContinued = (Action<PlayerController, Gun>)Delegate.Combine(val10.OnBurstContinued, new Action<PlayerController, Gun>(OnBurstContinued));
			Gun val11 = gun;
			val11.OnPreFireProjectileModifier = (Func<Gun, Projectile, ProjectileModule, Projectile>)Delegate.Combine(val11.OnPreFireProjectileModifier, new Func<Gun, Projectile, ProjectileModule, Projectile>(OnPreFireProjectileModifier));
			Gun val12 = gun;
		}

		public virtual void OnInitializedWithOwner(GameActor actor)
		{
		}

		public virtual void PostProcessProjectile(Projectile projectile)
		{
		}

		public virtual void PostProcessVolley(ProjectileVolleyData volley)
		{
		}

		public virtual void OnDropped()
		{
		}

		public virtual void OnAutoReload(PlayerController player, Gun gun)
		{
		}

		public virtual void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING)
		{
			if (hasReloaded)
			{
				OnReload(player, gun);
				hasReloaded = false;
			}
		}

		public virtual void OnReload(PlayerController player, Gun gun)
		{
			if (preventNormalReloadAudio)
			{
				AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
				if (!string.IsNullOrEmpty(overrideNormalReloadAudio))
				{
					AkSoundEngine.PostEvent(overrideNormalReloadAudio, ((Component)this).gameObject);
				}
			}
		}

		public virtual void OnFinishAttack(PlayerController player, Gun gun)
		{
		}

		public virtual void OnPostFired(PlayerController player, Gun gun)
		{
			if (gun.IsHeroSword && (float)heroSwordCooldown.GetValue(gun) == 0.5f)
			{
				OnHeroSwordCooldownStarted(player, gun);
			}
		}

		public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
		{
		}

		public virtual void OnAmmoChanged(PlayerController player, Gun gun)
		{
		}

		public virtual void OnBurstContinued(PlayerController player, Gun gun)
		{
		}

		public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
		{
			return projectile;
		}

		public virtual void OnPickup(PlayerController player)
		{
		}

		public virtual void OnPostDrop(PlayerController player)
		{
		}
	}
}
namespace Captain
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Lynceus.etg.Captain", "The Captain Custom Character", "2.0.2")]
	public class Module : BaseUnityPlugin
	{
		public const string GUID = "Lynceus.etg.Captain";

		public const string NAME = "The Captain Custom Character";

		public const string VERSION = "2.0.2";

		public const string TEXT_COLOR = "#2B65EC";

		public void Start()
		{
			ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
		}

		public void GMStart(GameManager g)
		{
			WhiteWhaleStatus.Initialise();
			CaptainEye.Register();
			Harpoon.Add();
			Log("The Captain Custom Character v2.0.2 started successfully.", "#2B65EC");
		}

		public static void Log(string text, string color = "FFFFFF")
		{
			ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
		}
	}
	public static class Toolbox
	{
		public static Random RNG = new Random();

		public const int ResolutionIBuiltOffOf_X = 1600;

		public const int ResolutionIBuiltOffOf_Y = 1024;

		public const int Resolution_Ratio_X = 25;

		public const int Resolution_Ratio_Y = 16;

		private static string[] BundlePrereqs = new string[30]
		{
			"brave_resources_001", "dungeon_scene_001", "encounters_base_001", "enemies_base_001", "flows_base_001", "foyer_001", "foyer_002", "foyer_003", "shared_auto_001", "shared_auto_002",
			"shared_base_001", "dungeons/base_bullethell", "dungeons/base_castle", "dungeons/base_catacombs", "dungeons/base_cathedral", "dungeons/base_forge", "dungeons/base_foyer", "dungeons/base_gungeon", "dungeons/base_mines", "dungeons/base_nakatomi",
			"dungeons/base_resourcefulrat", "dungeons/base_sewer", "dungeons/base_tutorial", "dungeons/finalscenario_bullet", "dungeons/finalscenario_convict", "dungeons/finalscenario_coop", "dungeons/finalscenario_guide", "dungeons/finalscenario_pilot", "dungeons/finalscenario_robot", "dungeons/finalscenario_soldier"
		};

		public static void ModifyVolley(ProjectileVolleyData volleyToModify, PlayerController player, int DuplicatesOfEachModule = 1, float DuplicateAngleOffset = 3f, float DuplicateAngleBaseOffset = 0f, float EachModuleOffsetAngle = 3f, int DuplicatesOfBaseModule = 0, ProjectileModule moduleToAdd = null, int frameDelay = 0)
		{
			((MonoBehaviour)GameManager.Instance).StartCoroutine(WhateverThisIs(volleyToModify, player, DuplicatesOfEachModule, DuplicateAngleOffset, DuplicateAngleBaseOffset, EachModuleOffsetAngle, DuplicatesOfBaseModule, moduleToAdd, frameDelay));
		}

		public static IEnumerator WhateverThisIs(ProjectileVolleyData volleyToModify, PlayerController player, int DuplicatesOfEachModule = 1, float DuplicateAngleOffset = 3f, float DuplicateAngleBaseOffset = 0f, float EachModuleOffsetAngle = 3f, int DuplicatesOfBaseModule = 0, ProjectileModule moduleToAdd = null, int frameDelay = 0)
		{
			if (frameDelay > 0)
			{
				int de = 0;
				while (de < frameDelay)
				{
					de++;
					yield return null;
				}
			}
			if (moduleToAdd != null)
			{
				bool flag = true;
				if ((Object)(object)volleyToModify != (Object)null && volleyToModify.projectiles.Count > 0 && volleyToModify.projectiles[0].projectiles != null && volleyToModify.projectiles[0].projectiles.Count > 0)
				{
					Projectile projectile = volleyToModify.projectiles[0].projectiles[0];
					if (Object.op_Implicit((Object)(object)projectile) && Object.op_Implicit((Object)(object)((Component)projectile).GetComponent<ArtfulDodgerProjectileController>()))
					{
						flag = false;
					}
				}
				if (flag)
				{
					moduleToAdd.isExternalAddedModule = true;
					volleyToModify.projectiles.Add(moduleToAdd);
				}
			}
			if (DuplicatesOfEachModule > 0)
			{
				int num = 1;
				int count = volleyToModify.projectiles.Count;
				for (int i = 0; i < count; i++)
				{
					float num2 = (float)DuplicatesOfEachModule * DuplicateAngleOffset * -1f / 2f;
					ProjectileModule projectileModule = volleyToModify.projectiles[i];
					for (int j = 0; j < DuplicatesOfEachModule; j++)
					{
						projectileModule.angleFromAim = num2;
						int sourceIndex = num;
						if (projectileModule.CloneSourceIndex >= 0)
						{
							sourceIndex = projectileModule.CloneSourceIndex;
						}
						ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false, sourceIndex);
						float angleFromAim = num2 + DuplicateAngleOffset * (float)(j + 1);
						projectileModule2.angleFromAim = angleFromAim;
						projectileModule2.ignoredForReloadPurposes = true;
						projectileModule2.ammoCost = 0;
						volleyToModify.projectiles.Add(projectileModule2);
					}
					num++;
				}
				if (!volleyToModify.UsesShotgunStyleVelocityRandomizer)
				{
					volleyToModify.UsesShotgunStyleVelocityRandomizer = true;
					volleyToModify.DecreaseFinalSpeedPercentMin = -10f;
					volleyToModify.IncreaseFinalSpeedPercentMax = 10f;
				}
			}
			if (DuplicatesOfBaseModule > 0)
			{
				GunVolleyModificationItem.AddDuplicateOfBaseModule(volleyToModify, player, DuplicatesOfBaseModule, DuplicateAngleOffset, DuplicateAngleBaseOffset);
			}
		}

		public static T RandomEnum<T>()
		{
			Type typeFromHandle = typeof(T);
			Array values = Enum.GetValues(typeFromHandle);
			lock (RNG)
			{
				object value = values.GetValue(RNG.Next(values.Length));
				return (T)Convert.ChangeType(value, typeFromHandle);
			}
		}

		public static void ShowHitBox(this SpeculativeRigidbody body)
		{
			//IL_004e: 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_0076: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			PixelCollider hitboxPixelCollider = body.HitboxPixelCollider;
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val).name = "HitboxDisplay";
			val.transform.SetParent(((BraveBehaviour)body).transform);
			val.layer = 28;
			GameObjectExtensions.SetLayerRecursively(val, LayerMask.NameToLayer("Unoccluded"));
			val.transform.localScale = new Vector3((float)hitboxPixelCollider.Dimensions.x / 16f, (float)hitboxPixelCollider.Dimensions.y / 16f, 1f);
			Vector3 localPosition = new Vector3((float)hitboxPixelCollider.Offset.x + (float)hitboxPixelCollider.Dimensions.x * 0.5f, (float)hitboxPixelCollider.Offset.y + (float)hitboxPixelCollider.Dimensions.y * 0.5f, -16f) / 16f;
			val.transform.localPosition = localPosition;
		}

		public static Entry CopyBulletBankEntry(Entry entryToCopy, string Name, string AudioEvent = null, VFXPool muzzleflashVFX = null, bool ChangeMuzzleFlashToEmpty = true)
		{
			//IL_003a: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			Entry val = Toolbox.CopyFields<Entry>(entryToCopy);
			val.Name = Name;
			Projectile component = Object.Instantiate<GameObject>(val.BulletObject).GetComponent<Projectile>();
			GameObjectExtensions.SetLayerRecursively(((Component)component).gameObject, 18);
			((BraveBehaviour)component).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)component).transform.position, 210.5125f);
			((Component)component).gameObject.SetActive(false);
			FakePrefab.MarkAsFakePrefab(((Component)component).gameObject);
			Object.DontDestroyOnLoad((Object)(object)component);
			val.BulletObject = ((Component)component).gameObject;
			if (AudioEvent != "DNC")
			{
				val.AudioEvent = AudioEvent;
			}
			if (ChangeMuzzleFlashToEmpty)
			{
				VFXPool muzzleFlashEffects;
				if (muzzleflashVFX != null)
				{
					muzzleFlashEffects = muzzleflashVFX;
				}
				else
				{
					VFXPool val2 = new VFXPool();
					val2.type = (VFXPoolType)0;
					val2.effects = (VFXComplex[])(object)new VFXComplex[0];
					muzzleFlashEffects = val2;
				}
				val.MuzzleFlashEffects = muzzleFlashEffects;
			}
			return val;
		}

		public static Entry CopyFields<T>(Entry sample2) where T : Entry
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			Entry val = new Entry();
			val.AudioEvent = sample2.AudioEvent;
			val.AudioLimitOncePerAttack = sample2.AudioLimitOncePerAttack;
			val.AudioLimitOncePerFrame = sample2.AudioLimitOncePerFrame;
			val.AudioSwitch = sample2.AudioSwitch;
			val.PlayAudio = sample2.PlayAudio;
			val.BulletObject = sample2.BulletObject;
			val.conditionalMinDegFromNorth = sample2.conditionalMinDegFromNorth;
			val.DontRotateShell = sample2.DontRotateShell;
			val.forceCanHitEnemies = sample2.forceCanHitEnemies;
			val.MuzzleFlashEffects = sample2.MuzzleFlashEffects;
			val.MuzzleInheritsTransformDirection = sample2.MuzzleInheritsTransformDirection;
			val.MuzzleLimitOncePerFrame = sample2.MuzzleLimitOncePerFrame;
			val.Name = sample2.Name;
			val.OverrideProjectile = sample2.OverrideProjectile;
			val.preloadCount = sample2.preloadCount;
			val.ProjectileData = sample2.ProjectileData;
			val.rampBullets = sample2.rampBullets;
			val.rampStartHeight = sample2.rampStartHeight;
			val.rampTime = sample2.rampTime;
			val.ShellForce = sample2.ShellForce;
			val.ShellForceVariance = sample2.ShellForceVariance;
			val.ShellGroundOffset = sample2.ShellGroundOffset;
			val.ShellPrefab = sample2.ShellPrefab;
			val.ShellsLimitOncePerFrame = sample2.ShellsLimitOncePerFrame;
			val.ShellTransform = sample2.ShellTransform;
			val.SpawnShells = sample2.SpawnShells;
			val.suppressHitEffectsIfOffscreen = sample2.suppressHitEffectsIfOffscreen;
			return val;
		}

		public static RaycastResult ReturnRaycast(Vector2 startPosition, Vector2 angle, int rayCastMask, float overrideDistance = 1000f, SpeculativeRigidbody bodyToIgnore = null)
		{
			//IL_0026: 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)
			Func<SpeculativeRigidbody, bool> func = (SpeculativeRigidbody otherRigidbody) => Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).minorBreakable) && !((BraveBehaviour)otherRigidbody).minorBreakable.stopsBullets;
			RaycastResult result = default(RaycastResult);
			PhysicsEngine.Instance.Raycast(startPosition, angle, overrideDistance, ref result, true, true, rayCastMask, (CollisionLayer?)null, false, func, bodyToIgnore);
			return result;
		}

		public static void ProcessAnimations(this CustomCharacterData self, Dictionary<string, int> dict)
		{
			tk2dSpriteAnimation library = self.animator.Library;
			foreach (KeyValuePair<string, int> item in dict)
			{
				library.GetClipByName(item.Key).fps = item.Value;
			}
		}

		public static void AddGlowShaderToGun(this Gun self, Color32 glowColor, int glowstrength, int colorGlowStrength = 0)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			Material val = new Material(((BraveBehaviour)((BraveBehaviour)EnemyDatabase.GetOrLoadByName("GunNut")).sprite).renderer.material);
			val.SetColor("_EmissiveColor", Color32.op_Implicit(glowColor));
			val.SetFloat("_EmissiveColorPower", (float)colorGlowStrength);
			val.SetFloat("_EmissivePower", (float)glowstrength);
			val.SetFloat("_EmissiveThresholdSensitivity", 0.2f);
			MeshRenderer component = ((Component)self).GetComponent<MeshRenderer>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Material[] array = ((Renderer)component).sharedMaterials;
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i].shader == (Object)(object)val)
				{
					return;
				}
			}
			Array.Resize(ref array, array.Length + 1);
			Material val2 = new Material(val);
			val2.SetTexture("_MainTex", array[0].GetTexture("_MainTex"));
			array[^1] = val2;
			((Renderer)component).sharedMaterials = array;
		}

		public static VFXPool MakeObjectIntoVFX(GameObject obj)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			VFXPool val = new VFXPool();
			val.type = (VFXPoolType)1;
			VFXComplex val2 = new VFXComplex();
			VFXObject val3 = new VFXObject();
			val3.effect = obj;
			val2.effects = (VFXObject[])(object)new VFXObject[1] { val3 };
			val.effects = (VFXComplex[])(object)new VFXComplex[1] { val2 };
			return val;
		}

		public static GameObject GenerateTransformPoint(GameObject attacher, Vector2 attachpoint, string name = "shootPoint")
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.parent = attacher.transform;
			val.transform.position = Vector2.op_Implicit(attachpoint);
			return ((Component)attacher.transform.Find(name)).gameObject;
		}

		public static float SinLerpTValue(float t)
		{
			return Mathf.Sin(t * ((float)Math.PI / 2f));
		}

		public static float CosLerpTValue(float t)
		{
			return Mathf.Cos(t * (float)Math.PI);
		}

		public static float SinLerpTValueFull(float t)
		{
			return Mathf.Sin(t * (float)Math.PI);
		}

		public static float SubdivideArc(float startAngle, float sweepAngle, int numBullets, int i, bool offset = false)
		{
			return startAngle + Mathf.Lerp(0f, sweepAngle, ((float)i + ((!offset) ? 0f : 0.5f)) / (float)(numBullets - 1));
		}

		public static float SubdivideCircle(float startAngle, int numBullets, int i, float direction = 1f, bool offset = false)
		{
			return startAngle + direction * Mathf.Lerp(0f, 360f, ((float)i + ((!offset) ? 0f : 0.5f)) / (float)numBullets);
		}

		public static Vector2 GetUnitOnCircle(float angleDegrees, float radius)
		{
			//IL_003c: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			float num2 = 0f;
			float num3 = 0f;
			num3 = angleDegrees * (float)Math.PI / 180f;
			num = radius * Mathf.Cos(num3);
			num2 = radius * Mathf.Sin(num3);
			Vector2 result = default(Vector2);
			((Vector2)(ref result))..ctor(num, num2);
			return result;
		}

		public static Vector2 CalculateScale_X_Y_Based_On_Resolution()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			val.x = Screen.width;
			val.y = Screen.height;
			return new Vector2(val.x / 1600f, val.y / 1024f);
		}

		public static IEnumerator FuckYou(GameObject sadcat)
		{
			yield return null;
			Transform transform = sadcat.transform;
			transform.localScale *= (Smaller() ? 1f : ScaleMult_Inv().x);
		}

		public static bool Smaller()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = CalculateScale_X_Y_Based_On_Resolution();
			return val.x < 1f;
		}

		private static Vector2 ScaleMult()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = CalculateScale_X_Y_Based_On_Resolution();
			return new Vector2(val.x * val.x, val.x * val.x);
		}

		private static Vector2 ScaleMult_Inv()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = CalculateScale_X_Y_Based_On_Resolution();
			return new Vector2(val.x / 1f, val.x / 1f);
		}

		public static void NotifyCustom(string header, string text, int spriteID, tk2dSpriteCollectionData CollectionData, NotificationColor color = 0, bool forceSingleLine = false)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			GameUIRoot.Instance.notificationController.DoCustomNotification(header, text, CollectionData, spriteID, color, false, forceSingleLine);
		}

		public static Vector3 RandomPositionOnSprite(tk2dBaseSprite targetSprite, float zOffset = 0f)
		{
			//IL_001c: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0078: 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_007b: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)targetSprite == (Object)null)
			{
				return Vector3.one;
			}
			Vector3 val = Vector2Extensions.ToVector3ZisY(targetSprite.WorldBottomLeft, zOffset);
			Vector3 val2 = Vector2Extensions.ToVector3ZisY(targetSprite.WorldTopRight, zOffset);
			float num = (val2.y - val.y) * (val2.x - val.x);
			float num2 = 25f * num;
			int num3 = Mathf.CeilToInt(Mathf.Max(1f, num2 * BraveTime.DeltaTime));
			int num4 = num3;
			Vector3 val3 = val;
			Vector3 val4 = val2;
			return new Vector3(Random.Range(val3.x, val4.x), Random.Range(val3.y, val4.y));
		}

		public static float PercentageOfClipLeft(this Gun g)
		{
			float num = g.ClipShotsRemaining;
			float num2 = g.ClipCapacity;
			return num / num2;
		}

		public static DungeonPlaceable GenerateDungeonPlaceable(Dictionary<GameObject, float> gameObjects, int placeableWidth = 1, int placeableLength = 1, DungeonPrerequisite[] dungeonPrerequisites = null)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if (dungeonPrerequisites == null)
			{
				dungeonPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0];
			}
			DungeonPlaceable val = ScriptableObject.CreateInstance<DungeonPlaceable>();
			val.width = placeableWidth;
			val.height = placeableLength;
			val.respectsEncounterableDifferentiator = true;
			val.variantTiers = new List<DungeonPlaceableVariant>();
			foreach (KeyValuePair<GameObject, float> gameObject in gameObjects)
			{
				DungeonPlaceableVariant val2 = new DungeonPlaceableVariant();
				val2.percentChance = gameObject.Value;
				val2.prerequisites = dungeonPrerequisites;
				val2.nonDatabasePlaceable = gameObject.Key;
				val.variantTiers.Add(val2);
			}
			return val;
		}

		public static T LoadAssetFromAnywhere<T>(string path) where T : Object
		{
			T val = default(T);
			string[] bundlePrereqs = BundlePrereqs;
			foreach (string text in bundlePrereqs)
			{
				try
				{
					val = ResourceManager.LoadAssetBundle(text).LoadAsset<T>(path);
				}
				catch
				{
				}
				if ((Object)(object)val != (Object)null)
				{
					break;
				}
			}
			return val;
		}

		public static void CreateFastBody(this GameObject gameObject, IntVector2 colliderX_Y, IntVector2 OffsetX_Y)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0049: 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_005b: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0092: 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_00a0: 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)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0125: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0154: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: 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_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)
			//IL_01c5: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent<SpeculativeRigidbody>(gameObject);
			orAddComponent.CollideWithTileMap = false;
			if (orAddComponent.PixelColliders == null)
			{
				orAddComponent.PixelColliders = new List<PixelCollider>();
			}
			orAddComponent.PixelColliders.Add(new PixelCollider
			{
				ColliderGenerationMode = (PixelColliderGeneration)0,
				CollisionLayer = (CollisionLayer)6,
				IsTrigger = false,
				BagleUseFirstFrameOnly = false,
				SpecifyBagelFrame = string.Empty,
				BagelColliderNumber = 0,
				ManualOffsetX = OffsetX_Y.x,
				ManualOffsetY = OffsetX_Y.y,
				ManualWidth = colliderX_Y.x,
				ManualHeight = colliderX_Y.y,
				ManualDiameter = 0,
				ManualLeftX = 0,
				ManualLeftY = 0,
				ManualRightX = 0,
				ManualRightY = 0
			});
			orAddComponent.PixelColliders.Add(new PixelCollider
			{
				ColliderGenerationMode = (PixelColliderGeneration)0,
				CollisionLayer = (CollisionLayer)13,
				IsTrigger = false,
				BagleUseFirstFrameOnly = false,
				SpecifyBagelFrame = string.Empty,
				BagelColliderNumber = 0,
				ManualOffsetX = OffsetX_Y.x,
				ManualOffsetY = OffsetX_Y.y,
				ManualWidth = colliderX_Y.x,
				ManualHeight = colliderX_Y.y,
				ManualDiameter = 0,
				ManualLeftX = 0,
				ManualLeftY = 0,
				ManualRightX = 0,
				ManualRightY = 0
			});
			orAddComponent.PixelColliders.Add(new PixelCollider
			{
				ColliderGenerationMode = (PixelColliderGeneration)0,
				CollisionLayer = (CollisionLayer)8,
				IsTrigger = false,
				BagleUseFirstFrameOnly = false,
				SpecifyBagelFrame = string.Empty,
				BagelColliderNumber = 0,
				ManualOffsetX = OffsetX_Y.x,
				ManualOffsetY = OffsetX_Y.y,
				ManualWidth = colliderX_Y.x,
				ManualHeight = colliderX_Y.y,
				ManualDiameter = 0,
				ManualLeftX = 0,
				ManualLeftY = 0,
				ManualRightX = 0,
				ManualRightY = 0
			});
		}

		public static SpeculativeRigidbody CreateFastBody(this GameObject gameObject, CollisionLayer layer, IntVector2 colliderX_Y, IntVector2 OffsetX_Y)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0049: 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_005b: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0092: 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_00a0: 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)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent<SpeculativeRigidbody>(gameObject);
			orAddComponent.CollideWithTileMap = false;
			if (orAddComponent.PixelColliders == null)
			{
				orAddComponent.PixelColliders = new List<PixelCollider>();
			}
			orAddComponent.PixelColliders.Add(new PixelCollider
			{
				ColliderGenerationMode = (PixelColliderGeneration)0,
				CollisionLayer = layer,
				IsTrigger = false,
				BagleUseFirstFrameOnly = false,
				SpecifyBagelFrame = string.Empty,
				BagelColliderNumber = 0,
				ManualOffsetX = OffsetX_Y.x,
				ManualOffsetY = OffsetX_Y.y,
				ManualWidth = colliderX_Y.x,
				ManualHeight = colliderX_Y.y,
				ManualDiameter = 0,
				ManualLeftX = 0,
				ManualLeftY = 0,
				ManualRightX = 0,
				ManualRightY = 0
			});
			return orAddComponent;
		}

		public static void AddShadowToObject(this GameObject obj, tk2dSpriteCollectionData Data, string spriteName, Vector2 OffsetX_Y)
		{
			//IL_004c: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabBuilder.BuildObject(((Object)obj).name + "_Shadow");
			tk2dSprite val2 = val.AddComponent<tk2dSprite>();
			((tk2dBaseSprite)val2).Collection = Data;
			((tk2dBaseSprite)val2).SetSprite(Data.GetSpriteIdByName(spriteName));
			val.transform.parent = obj.transform;
			val.transform.localPosition = Vector2.op_Implicit(OffsetX_Y);
			Vector3 localPosition = val.transform.localPosition;
			localPosition.z -= 1f;
			((tk2dBaseSprite)val2).HeightOffGround = (((Object)(object)((Component)obj.transform).GetComponent<tk2dSprite>() != (Object)null) ? (((tk2dBaseSprite)((Component)obj.transform).GetComponent<tk2dSprite>()).HeightOffGround - 0.1f) : 1f);
		}

		public static Delegate GetEventDelegate(this object self, string eventName)
		{
			Delegate result = null;
			if (self != null)
			{
				FieldInfo field = self.GetType().GetField(eventName, BindingFlags.Instance | BindingFlags.Public);
				if ((object)field != null)
				{
					object value = field.GetValue(self);
					if (value != null && value is Delegate)
					{
						result = value as Delegate;
					}
				}
			}
			return result;
		}

		public static object InvokeNotOverride(this MethodInfo methodInfo, object targetObject, params object[] arguments)
		{
			ParameterInfo[] parameters = methodInfo.GetParameters();
			if (parameters.Length == 0)
			{
				if (arguments != null && arguments.Length != 0)
				{
					throw new Exception("Arguments cont doesn't match");
				}
			}
			else if (parameters.Length != arguments.Length)
			{
				throw new Exception("Arguments cont doesn't match");
			}
			Type returnType = null;
			if ((object)methodInfo.ReturnType != typeof(void))
			{
				returnType = methodInfo.ReturnType;
			}
			Type type = targetObject.GetType();
			DynamicMethod dynamicMethod = new DynamicMethod("", returnType, new Type[2]
			{
				type,
				typeof(object)
			}, type);
			ILGenerator iLGenerator = dynamicMethod.GetILGenerator();
			iLGenerator.Emit(OpCodes.Ldarg_0);
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				iLGenerator.Emit(OpCodes.Ldarg_1);
				iLGenerator.Emit(OpCodes.Ldc_I4_S, i);
				iLGenerator.Emit(OpCodes.Ldelem_Ref);
				Type parameterType = parameterInfo.ParameterType;
				if (parameterType.IsPrimitive)
				{
					iLGenerator.Emit(OpCodes.Unbox_Any, parameterType);
				}
				else if ((object)parameterType != typeof(object))
				{
					iLGenerator.Emit(OpCodes.Castclass, parameterType);
				}
			}
			iLGenerator.Emit(OpCodes.Call, methodInfo);
			iLGenerator.Emit(OpCodes.Ret);
			return dynamicMethod.Invoke(null, new object[2] { targetObject, arguments });
		}
	}
	public class StickyProjectileModifier : MonoBehaviour
	{
		public class StickyContext
		{
			public bool CanStickToTerrain = false;

			public bool CanStickEnemies = true;
		}

		public Action<GameObject, PlayerController> OnPreStick;

		public Action<GameObject, StickyProjectileModifier, tk2dBaseSprite, PlayerController> OnStick;

		public Action<GameObject, StickyProjectileModifier, tk2dBaseSprite, PlayerController, Tile> OnStickToWall;

		public Action<GameObject, StickyProjectileModifier, PlayerController> OnStickyDestroyed;

		public static Action<GameObject> OnStickyProjectileStuck;

		public Projectile currentObject;

		public GameObject objectToLookOutFor;

		public Material materialToCopy;

		public PlayerController player;

		public List<StickyContext> stickyContexts = new List<StickyContext>();

		private bool StickToEnemies = false;

		private bool StickToTerrain = false;

		public void Start()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			foreach (StickyContext stickyContext in stickyContexts)
			{
				if (stickyContext.CanStickEnemies)
				{
					StickToEnemies = true;
				}
				if (stickyContext.CanStickToTerrain)
				{
					StickToTerrain = true;
				}
			}
			currentObject = ((Component)this).GetComponent<Projectile>();
			if (!Object.op_Implicit((Object)(object)currentObject))
			{
				return;
			}
			if (StickToTerrain)
			{
				SpeculativeRigidbody specRigidbody = ((BraveBehaviour)currentObject).specRigidbody;
				specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)(OnPreTileCollisionDelegate)delegate(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, Tile Tile, PixelCollider TilePixelCollider)
				{
					HandleHit(currentObject, null, Tile);
				});
			}
			if (StickToEnemies)
			{
				SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)currentObject).specRigidbody;
				specRigidbody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnPreRigidbodyCollision, (Delegate?)(OnPreRigidbodyCollisionDelegate)delegate(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider)
				{
					HandleHit(currentObject, otherRigidbody);
				});
			}
		}

		private void HandleHit(Projectile projectile, SpeculativeRigidbody otherBody, Tile tile = null)
		{
			if ((Object)(object)otherBody == (Object)null)
			{
				if (Object.op_Implicit((Object)(object)projectile))
				{
					if ((Object)(object)((Component)projectile).GetComponent<BounceProjModifier>() == (Object)null)
					{
						TransformToSticky(projectile, null, tile);
					}
					else if (((Component)projectile).GetComponent<BounceProjModifier>().numberOfBounces == 0)
					{
						TransformToSticky(projectile, null, tile);
					}
				}
			}
			else
			{
				if (!Object.op_Implicit((Object)(object)projectile) || !((Object)(object)((BraveBehaviour)otherBody).aiActor != (Object)null) || ((BraveBehaviour)otherBody).healthHaver.IsDead || !Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)otherBody).aiActor).behaviorSpeculator) || ((BraveBehaviour)otherBody).aiActor.IsHarmlessEnemy)
				{
					return;
				}
				if ((Object)(object)((Component)this).GetComponent<PierceProjModifier>() != (Object)null)
				{
					if (((Component)this).GetComponent<PierceProjModifier>().penetration == 0)
					{
						TransformToSticky(projectile, otherBody);
					}
				}
				else
				{
					TransformToSticky(projectile, otherBody);
				}
			}
		}

		private void TransformToSticky(Projectile projectile, SpeculativeRigidbody otherBody, Tile tile = null)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!((Object)(object)projectile == (Object)null))
			{
				if (OnPreStick != null && (Object)(object)projectile != (Object)null)
				{
					OnPreStick(((Component)projectile).gameObject, player);
				}
				projectile.DestroyMode = (ProjectileDestroyMode)1;
				objectToLookOutFor = ((Component)projectile).gameObject;
				if ((Object)(object)otherBody != (Object)null)
				{
					objectToLookOutFor.transform.parent = ((BraveBehaviour)otherBody).transform;
					objectToLookOutFor.transform.position = Vector2.op_Implicit(((BraveBehaviour)otherBody).sprite.WorldCenter + Toolbox.GetUnitOnCircle(projectile.angularVelocity, Vector2.Distance(Vector2.op_Implicit(objectToLookOutFor.transform.position), ((BraveBehaviour)otherBody).sprite.WorldCenter) * 0.2f));
				}
				ref PlayerController reference = ref player;
				GameActor owner = projectile.Owner;
				reference = (PlayerController)(object)((owner is PlayerController) ? owner : null);
				if (OnStick != null)
				{
					OnStick(objectToLookOutFor, this, objectToLookOutFor.GetComponentInChildren<tk2dBaseSprite>(), player);
				}
				if (OnStickToWall != null && tile != null)
				{
					OnStickToWall.Invoke(objectToLookOutFor, this, objectToLookOutFor.GetComponentInChildren<tk2dBaseSprite>(), player, tile);
				}
			}
		}

		public void OnDestroy()
		{
			if ((Object)(object)objectToLookOutFor != (Object)null && (Object)(object)this != (Object)null && (Object)(object)player != (Object)null && OnStickyDestroyed != null)
			{
				OnStickyDestroyed(objectToLookOutFor, this, player);
			}
		}
	}
	public class GameActorDecorationEffect : GameActorEffect
	{
	}
	internal static class OMITBMathsAndLogicExtensions
	{
		public static Vector2 GetCenteredLookingPosForObj(this Vector2 originalValue, SpeculativeRigidbody rigidBody, bool centerX = true, bool centerY = false)
		{
			//IL_0002: 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_0026: 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_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_0054: Unknown result type (might be due to invalid IL or missing references)
			float x = rigidBody.UnitDimensions.x;
			float num = originalValue.x;
			if (centerX)
			{
				num -= x * 0.5f;
			}
			float y = rigidBody.UnitDimensions.y;
			float num2 = originalValue.y;
			if (centerY)
			{
				num2 -= y * 0.5f;
			}
			return new Vector2(num, num2);
		}

		public static bool isEven(this float number)
		{
			if (number % 2f == 0f)
			{
				return true;
			}
			return false;
		}

		public static bool isEven(this int number)
		{
			if (number % 2 == 0)
			{
				return true;
			}
			return false;
		}

		public static bool IsBetweenRange(this float numberToCheck, float bottom, float top)
		{
			return numberToCheck >= bottom && numberToCheck <= top;
		}

		public static T KeyByValue<T, W>(this Dictionary<T, W> dict, W val)
		{
			T result = default(T);
			foreach (KeyValuePair<T, W> item in dict)
			{
				if (EqualityComparer<W>.Default.Equals(item.Value, val))
				{
					result = item.Key;
					return result;
				}
			}
			return result;
		}

		public static Vector2 GetPositionOfNearestEnemy(this Vector2 startPosition, bool canTargetNonRoomClear, bool targetSprite = false, List<AIActor> excludedActors = null)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			List<AIActor> exclude = new List<AIActor>();
			if (excludedActors != null && excludedActors.Count > 0)
			{
				exclude.AddRange(excludedActors);
			}
			Func<AIActor, bool> func = (AIActor a) => Object.op_Implicit((Object)(object)a) && a.HasBeenEngaged && Object.op_Implicit((Object)(object)((BraveBehaviour)a).healthHaver) && ((BraveBehaviour)a).healthHaver.IsVulnerable && ((BraveBehaviour)a).healthHaver.IsAlive && !((GameActor)a).IsGone && !exclude.Contains(a) && (Object)(object)a.CompanionOwner == (Object)null && (Object)(object)((Component)a).gameObject.GetComponent<CompanionController>() == (Object)null;
			IntVector2 val = Vector2Extensions.ToIntVector2(startPosition, (VectorConversions)2);
			ActiveEnemyType val2 = (ActiveEnemyType)1;
			if (canTargetNonRoomClear)
			{
				val2 = (ActiveEnemyType)0;
			}
			AIActor closestToPosition = BraveUtility.GetClosestToPosition<AIActor>(GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(val).GetActiveEnemies(val2), startPosition, func, (AIActor[])(object)new AIActor[0]);
			if ((Object)(object)closestToPosition == (Object)null)
			{
				return Vector2.zero;
			}
			if (targetSprite && Object.op_Implicit((Object)(object)((BraveBehaviour)closestToPosition).sprite))
			{
				return ((BraveBehaviour)closestToPosition).sprite.WorldCenter;
			}
			return ((BraveBehaviour)closestToPosition).specRigidbody.UnitCenter;
		}

		public static Vector2 GetVectorToNearestEnemy(this Vector2 bulletPosition, float angleFromAim = 0f, float angleVariance = 0f, PlayerController playerToScaleAccuracyOff = null, List<AIActor> excludedActors = null)
		{
			//IL_0037: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			List<AIActor> exclude = new List<AIActor>();
			if (excludedActors != null && excludedActors.Count > 0)
			{
				exclude.AddRange(excludedActors);
			}
			Vector2 val = Random.insideUnitCircle;
			Func<AIActor, bool> func = (AIActor a) => Object.op_Implicit((Object)(object)a) && a.HasBeenEngaged && Object.op_Implicit((Object)(object)((BraveBehaviour)a).healthHaver) && ((BraveBehaviour)a).healthHaver.IsVulnerable && !exclude.Contains(a) && (Object)(object)a.CompanionOwner == (Object)null && (Object)(object)a.CompanionOwner == (Object)null && (Object)(object)((Component)a).gameObject.GetComponent<CompanionController>() == (Object)null;
			IntVector2 val2 = Vector2Extensions.ToIntVector2(bulletPosition, (VectorConversions)2);
			AIActor closestToPosition = BraveUtility.GetClosestToPosition<AIActor>(GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(val2).GetActiveEnemies((ActiveEnemyType)0), bulletPosition, func, (AIActor[])(object)new AIActor[0]);
			if (Object.op_Implicit((Object)(object)closestToPosition))
			{
				val = ((GameActor)closestToPosition).CenterPosition - bulletPosition;
			}
			if (angleFromAim != 0f)
			{
				val = Vector2Extensions.Rotate(val, angleFromAim);
			}
			if (angleVariance != 0f)
			{
				if ((Object)(object)playerToScaleAccuracyOff != (Object)null)
				{
					angleVariance *= playerToScaleAccuracyOff.stats.GetStatValue((StatType)2);
				}
				float num = angleVariance * 0.5f;
				float num2 = num * -1f;
				float num3 = Random.Range(num2, num);
				val = Vector2Extensions.Rotate(val, num3);
			}
			return val;
		}

		public static Vector2 CalculateVectorBetween(this Vector2 startVector, Vector2 endVector)
		{
			//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_0008: 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_000a: 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)
			return endVector - startVector;
		}

		public static Vector2 CalculateVectorBetween(this Vector3 startVector, Vector3 endVector)
		{
			//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_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_000e: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			return Vector2.op_Implicit(endVector - startVector);
		}

		public static Vector2 GetVectorToNearestEnemy(this Vector3 bulletPos, float angleFromAim = 0f, float angleVariance = 0f, PlayerController playerToScaleAccuracyOff = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00f0: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Random.insideUnitCircle;
			Vector2 val2 = Vector2.op_Implicit(bulletPos);
			Func<AIActor, bool> func = (AIActor a) => Object.op_Implicit((Object)(object)a) && a.HasBeenEngaged && Object.op_Implicit((Object)(object)((BraveBehaviour)a).healthHaver) && ((BraveBehaviour)a).healthHaver.IsVulnerable && (Object)(object)a.CompanionOwner == (Object)null && (Object)(object)((Component)a).gameObject.GetComponent<CompanionController>() == (Object)null;
			IntVector2 val3 = Vector2Extensions.ToIntVector2(val2, (VectorConversions)2);
			AIActor closestToPosition = BraveUtility.GetClosestToPosition<AIActor>(GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(val3).GetActiveEnemies((ActiveEnemyType)0), val2, func, (AIActor[])(object)new AIActor[0]);
			if (Object.op_Implicit((Object)(object)closestToPosition))
			{
				val = ((GameActor)closestToPosition).CenterPosition - val2;
			}
			if (angleFromAim != 0f)
			{
				val = Vector2Extensions.Rotate(val, angleFromAim);
			}
			if (angleVariance != 0f)
			{
				if ((Object)(object)playerToScaleAccuracyOff != (Object)null)
				{
					angleVariance *= playerToScaleAccuracyOff.stats.GetStatValue((StatType)2);
				}
				float num = angleVariance * 0.5f;
				float num2 = num * -1f;
				float num3 = Random.Range(num2, num);
				val = Vector2Extensions.Rotate(val, num3);
			}
			return val;
		}

		public static bool PositionBetweenRelativeValidAngles(this Vector2 positionToCheck, Vector2 startPosition, float centerAngle, float range, float validAngleVariation)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (Vector2.Distance(positionToCheck, startPosition) < range)
			{
				float numberToCheck = BraveMathCollege.Atan2Degrees(positionToCheck - startPosition);
				float num = Math.Min(validAngleVariation, 0f - validAngleVariation);
				float num2 = Math.Max(validAngleVariation, 0f - validAngleVariation);
				bool result = false;
				float num3 = centerAngle + num2;
				float num4 = centerAngle + num;
				if (numberToCheck.IsBetweenRange(num4, num3))
				{
					result = true;
				}
				if (num3 > 180f)
				{
					float num5 = num3 - 180f;
					if (numberToCheck.IsBetweenRange(-180f, -180f + num5))
					{
						result = true;
					}
				}
				if (num4 < -180f)
				{
					float num6 = num4 + 180f;
					if (numberToCheck.IsBetweenRange(180f + num6, 180f))
					{
						result = true;
					}
				}
				return result;
			}
			return false;
		}

		public static Vector2 RadianToVector2(this float radian)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(Mathf.Cos(radian), Mathf.Sin(radian));
		}

		public static Vector2 DegreeToVector2(this float degree)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			return (degree * ((float)Math.PI / 180f)).RadianToVector2();
		}

		public static Vector2 DegreeToVector2(this int degree)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return ((float)degree * ((float)Math.PI / 180f)).RadianToVector2();
		}

		public static List<int> RemoveInvalidIDListEntries(this List<int> starterList, bool checkPlayerInventories = true, bool checkUnlocked = true)
		{
			List<int> list = new List<int>();
			list.AddRange(starterList);
			for (int num = list.Count; num > 0; num--)
			{
				int num2 = list[num - 1];
				if (checkPlayerInventories)
				{
					if (Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer) && GameManager.Instance.PrimaryPlayer.HasPickupID(num2))
					{
						list.RemoveAt(num - 1);
					}
					else if (Object.op_Implicit((Object)(object)GameManager.Instance.SecondaryPlayer) && GameManager.Instance.SecondaryPlayer.HasPickupID(num2))
					{
						list.RemoveAt(num - 1);
					}
				}
				if (checkUnlocked)
				{
					PickupObject byId = PickupObjectDatabase.GetById(num2);
					if (!byId.PrerequisitesMet())
					{
						list.RemoveAt(num - 1);
					}
				}
			}
			return list;
		}

		public static ItemQuality GetRandomQuality(this PickupObjectDatabase dat, float dChance = 0.35f, float cChance = 0.32f, float bChance = 0.2f, float aChance = 0.09f, float sChance = 0.04f)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0038: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			float value = Random.value;
			if (value <= sChance)
			{
				return (ItemQuality)5;
			}
			if (value <= aChance)
			{
				return (ItemQuality)4;
			}
			if (value <= bChance)
			{
				return (ItemQuality)3;
			}
			if (value <= cChance)
			{
				return (ItemQuality)2;
			}
			return (ItemQuality)1;
		}

		public static void SetForSeconds(this bool boolToSet, bool targetVal, float time)
		{
			((MonoBehaviour)GameManager.Instance).StartCoroutine(HandleTimedBool(boolToSet, targetVal, time));
		}

		private static IEnumerator HandleTimedBool(bool boolToSet, bool targetVal, float time)
		{
			bool origVal = boolToSet;
			boolToSet = targetVal;
			yield return (object)new WaitForSeconds(time);
			boolToSet = origVal;
		}
	}
	public static class RandomEnum<T>
	{
		private static T[] m_Values;

		static RandomEnum()
		{
			Array values = Enum.GetValues(typeof(T));
			m_Values = new T[values.Length];
			for (int i = 0; i < m_Values.Length; i++)
			{
				m_Values[i] = (T)values.GetValue(i);
			}
		}

		public static T Get()
		{
			return m_Values[Random.Range(0, m_Values.Length)];
		}
	}
	public class ProjectileSlashingBehaviour : MonoBehaviour
	{
		public delegate void OnSlashHit(PlayerController player, AIActor hitEnemy, Vector2 forceDirection);

		public delegate void PostProcessSlashHandler(PlayerController player, ProjectileSlashingBehaviour slash);

		public delegate void OnSlashEnded(bool hitAnEnemy, PlayerController player);

		public delegate void OnHitFirstEnemy(PlayerController player, AIActor hitEnemy);

		public List<GameActorEffect> effects = new List<GameActorEffect>();

		private float timer;

		public string soundToPlay;

		public float delayBeforeSlash;

		public VFXPool SlashVFX;

		public float timeBetweenSlashes;

		public bool doSpinAttack;

		public float playerKnockback;

		public float slashKnockback;

		public bool DoSound;

		public float SlashJammedMult;

		public float SlashBossMult;

		public float SlashDamage;

		public float SlashRange;

		public float SlashDimensions;

		public bool SlashDamageUsesBaseProjectileDamage;

		public SlashDoer.ProjInteractMode InteractMode;

		public bool DestroyBaseAfterFirstSlash;

		public bool DoesMultipleSlashes;

		public float MinSlashAngleOffset;

		public float MaxSlashAngleOffset;

		public bool UsesAngleVariance;

		public int AmountOfMultiSlashes;

		public float DelayBetweenMultiSlashes;

		public bool AppliesStun;

		public float StunApplyChance;

		public float StunTime;

		public float DeflectionDegree = 180f;

		private Projectile m_projectile;

		private PlayerController owner;

		public event PostProcessSlashHandler PostProcessSlash;

		public event OnSlashHit OnSlashHitEnemy;

		public event OnSlashEnded OnSlashEnd;

		public event OnHitFirstEnemy OnFirstEnemyHit;

		public ProjectileSlashingBehaviour()
		{
			DestroyBaseAfterFirstSlash = true;
			timeBetweenSlashes = 1f;
			DoSound = true;
			slashKnockback = 5f;
			SlashDamage = 15f;
			SlashBossMult = 1f;
			SlashJammedMult = 1f;
			playerKnockback = 1f;
			SlashDamageUsesBaseProjectileDamage = true;
			InteractMode = SlashDoer.ProjInteractMode.IGNORE;
			SlashDimensions = 90f;
			SlashRange = 2.5f;
			ref VFXPool slashVFX = ref SlashVFX;
			PickupObject obj = Databases.Items["wonderboy"];
			slashVFX = ((Gun)((obj is Gun) ? obj : null)).muzzleFlashEffects;
			soundToPlay = "Play_WPN_blasphemy_shot_01";
			DoesMultipleSlashes = false;
			UsesAngleVariance = false;
			MinSlashAngleOffset = 1f;
			MaxSlashAngleOffset = 4f;
			delayBeforeSlash = 0f;
			AppliesStun = false;
			StunApplyChance = 0f;
			StunTime = 0f;
		}

		private void Start()
		{
			m_projectile = ((Component)this).GetComponent<Projectile>();
			if (Object.op_Implicit((Object)(object)m_projectile.Owner) && m_projectile.Owner is PlayerController)
			{
				ref PlayerController reference = ref owner;
				GameActor obj = m_projectile.Owner;
				reference = (PlayerController)(object)((obj is PlayerController) ? obj : null);
			}
			((BraveBehaviour)((BraveBehaviour)m_projectile).sprite).renderer.enabled = false;
			m_projectile.collidesWithEnemies = false;
			m_projectile.UpdateCollisionMask();
			Projectile projectile = m_projectile;
			effects.AddRange(projectile.statusEffectsToApply);
			if (projectile.AppliesFire && Random.value <= projectile.FireApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.fireEffect);
			}
			if (projectile.AppliesCharm && Random.value <= projectile.CharmApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.charmEffect);
			}
			if (projectile.AppliesCheese && Random.value <= projectile.CheeseApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.cheeseEffect);
			}
			if (projectile.AppliesBleed && Random.value <= projectile.BleedApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.bleedEffect);
			}
			if (projectile.AppliesFreeze && Random.value <= projectile.FreezeApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.freezeEffect);
			}
			if (projectile.AppliesPoison && Random.value <= projectile.PoisonApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.healthEffect);
			}
			if (projectile.AppliesSpeedModifier && Random.value <= projectile.SpeedApplyChance)
			{
				effects.Add((GameActorEffect)(object)projectile.speedEffect);
			}
			if (Object.op_Implicit((Object)(object)m_projectile))
			{
				if (doSpinAttack)
				{
					DestroyBaseAfterFirstSlash = false;
					((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(90f, 0.15f + delayBeforeSlash));
					((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(180f, 0.3f + delayBeforeSlash));
					((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(-90f, 0.45f + delayBeforeSlash));
					((MonoBehaviour)this).Invoke("Suicide", 0.01f);
				}
				else if (DoesMultipleSlashes)
				{
					((MonoBehaviour)m_projectile).StartCoroutine(DoMultiSlash(0f, delayBeforeSlash, AmountOfMultiSlashes, DelayBetweenMultiSlashes));
				}
				else
				{
					((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(0f, 0f + delayBeforeSlash));
				}
			}
		}

		private void Update()
		{
		}

		private IEnumerator DoSlash(float angle, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if (SlashDamageUsesBaseProjectileDamage)
			{
				SlashDamage = m_projectile.baseData.damage;
				SlashBossMult = m_projectile.BossDamageMultiplier;
				SlashJammedMult = m_projectile.BlackPhantomDamageMultiplier;
				slashKnockback = m_projectile.baseData.force;
			}
			if (UsesAngleVariance)
			{
				angle += Random.Range(MinSlashAngleOffset, MaxSlashAngleOffset);
			}
			ProjectileSlashingBehaviour slash = ((Component)this).GetComponent<ProjectileSlashingBehaviour>();
			if ((Object)(object)slash != (Object)null && this.PostProcessSlash != null)
			{
				this.PostProcessSlash(owner, slash);
			}
			SlashDoer.GrabBoolsAndValuesAndShitForTheFuckingSlashingApplyEffect(AppliesStun, StunApplyChance, StunTime, DeflectionDegree);
			SlashDoer.DoSwordSlash(((BraveBehaviour)m_projectile).specRigidbody.UnitCenter, Vector2Extensions.ToAngle(m_projectile.Direction) + angle, owner, playerKnockback, InteractMode, SlashDamage, slashKnockback, effects, null, SlashJammedMult, SlashBossMult, SlashRange, SlashDimensions, m_projectile);
			if (DoSound)
			{
				AkSoundEngine.PostEvent(soundToPlay, ((Component)m_projectile).gameObject);
			}
			SlashVFX.SpawnAtPosition(Vector2.op_Implicit(((BraveBehaviour)m_projectile).specRigidbody.UnitCenter), Vector2Extensions.ToAngle(m_projectile.Direction) + angle, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false);
			if (DestroyBaseAfterFirstSlash)
			{
				Suicide();
			}
		}

		public void DoOnHitEffects(AIActor enemy, Vector2 forceDir)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (this.OnSlashHitEnemy != null)
			{
				this.OnSlashHitEnemy(owner, enemy, forceDir);
			}
		}

		public void DoOnSlashEndEffects(bool hitEnemies)
		{
			if (this.OnSlashEnd != null)
			{
				this.OnSlashEnd(hitEnemies, owner);
			}
		}

		public void DoOnHitFirstEnemyEffects(AIActor enemy)
		{
			if (this.OnFirstEnemyHit != null)
			{
				this.OnFirstEnemyHit(owner, enemy);
			}
		}

		private IEnumerator DoMultiSlash(float angle, float delay, int AmountOfMultiSlashes, float DelayBetweenMultiSlashes)
		{
			yield return (object)new WaitForSeconds(delay);
			for (int i = 0; i < AmountOfMultiSlashes; i++)
			{
				if (SlashDamageUsesBaseProjectileDamage)
				{
					SlashDamage = m_projectile.baseData.damage;
					SlashBossMult = m_projectile.BossDamageMultiplier;
					SlashJammedMult = m_projectile.BlackPhantomDamageMultiplier;
					slashKnockback = m_projectile.baseData.force;
				}
				if (UsesAngleVariance)
				{
					angle += Random.Range(MinSlashAngleOffset, MaxSlashAngleOffset);
				}
				ProjectileSlashingBehaviour slash = ((Component)this).GetComponent<ProjectileSlashingBehaviour>();
				if ((Object)(object)slash != (Object)null && this.PostProcessSlash != null)
				{
					PostProcessSlashHandler postProcessSlash = this.PostProcessSlash;
					GameActor obj = m_projectile.Owner;
					postProcessSlash((PlayerController)(object)((obj is PlayerController) ? obj : null), slash);
				}
				SlashDoer.GrabBoolsAndValuesAndShitForTheFuckingSlashingApplyEffect(AppliesStun, StunApplyChance, StunTime, DeflectionDegree);
				SlashDoer.DoSwordSlash(((BraveBehaviour)m_projectile).specRigidbody.UnitCenter, Vector2Extensions.ToAngle(m_projectile.Direction) + angle, owner, playerKnockback, InteractMode, SlashDamage, slashKnockback, m_projectile.statusEffectsToApply, null, SlashJammedMult, SlashBossMult, SlashRange, SlashDimensions);
				if (DoSound)
				{
					AkSoundEngine.PostEvent(soundToPlay, ((Component)m_projectile).gameObject);
				}
				SlashVFX.SpawnAtPosition(Vector2.op_Implicit(((BraveBehaviour)m_projectile).specRigidbody.UnitCenter), Vector2Extensions.ToAngle(m_projectile.Direction) + angle, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false);
				yield return (object)new WaitForSeconds(DelayBetweenMultiSlashes);
			}
			Suicide();
		}

		private void ApplyOnHitEffects()
		{
			m_projectile = ((Component)this).GetComponent<Projectile>();
		}

		private void Suicide()
		{
			Object.Destroy((Object)(object)((Component)m_projectile).gameObject);
		}
	}
	public class SlashDoer
	{
		public enum ProjInteractMode
		{
			IGNORE,
			DESTROY,
			REFLECT,
			DEFLECT,
			STOP
		}

		public static float DeflectionDegree;

		private static bool appliesStun;

		private static float stunApplyChance;

		private static float stunTime;

		public static void DoSwordSlash(Vector2 position, float angle, PlayerController owner, float playerKnockbackForce, ProjInteractMode intmode, float damageToDeal, float enemyKnockbackForce, List<GameActorEffect> statusEffects = null, Transform parentTransform = null, float jammedDamageMult = 1f, float bossDamageMult = 1f, float SlashRange = 2.5f, float SlashDimensions = 90f, Projectile sourceProjectile = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)GameManager.Instance).StartCoroutine(HandleSlash(position, angle, owner, playerKnockbackForce, intmode, damageToDeal, enemyKnockbackForce, statusEffects, jammedDamageMult, bossDamageMult, SlashRange, SlashDimensions, sourceProjectile));
		}

		private static IEnumerator HandleSlash(Vector2 position, float angle, PlayerController owner, float knockbackForce, ProjInteractMode intmode, float damageToDeal, float enemyKnockback, List<GameActorEffect> statusEffects, float jammedDMGMult, float bossDMGMult, float SlashRange, float SlashDimensions, Projectile sourceProjectile = null)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			int slashId = Time.frameCount;
			List<SpeculativeRigidbody> alreadyHit = new List<SpeculativeRigidbody>();
			if (knockbackForce != 0f && (Object)(object)owner != (Object)null)
			{
				((BraveBehaviour)owner).knockbackDoer.ApplyKnockback(BraveMathCollege.DegreesToVector(angle, 1f), knockbackForce, 0.25f, false);
			}
			float ela = 0f;
			while (ela < 0.2f)
			{
				ela += BraveTime.DeltaTime;
				HandleHeroSwordSlash(alreadyHit, position, angle, slashId, owner, intmode, damageToDeal, enemyKnockback, statusEffects, jammedDMGMult, bossDMGMult, SlashRange, SlashDimensions, sourceProjectile);
				yield return null;
			}
		}

		private static bool ProjectileIsValid(Projectile proj)
		{
			return Object.op_Implicit((Object)(object)proj) && (!(proj.Owner is PlayerController) || proj.ForcePlayerBlankable);
		}

		private static bool ObjectWasHitBySlash(Vector2 ObjectPosition, Vector2 SlashPosition, float slashAngle, float SlashRange, float SlashDimensions)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (Vector2.Distance(ObjectPosition, SlashPosition) < SlashRange)
			{
				float numberToCheck = BraveMathCollege.Atan2Degrees(ObjectPosition - SlashPosition);
				float num = Math.Min(SlashDimensions, 0f - SlashDimensions);
				float num2 = Math.Max(SlashDimensions, 0f - SlashDimensions);
				bool result = false;
				float num3 = slashAngle + num2;
				float num4 = slashAngle + num;
				if (numberToCheck.IsBetweenRange(num4, num3))
				{
					result = true;
				}
				if (num3 > 180f)
				{
					float num5 = num3 - 180f;
					if (numberToCheck.IsBetweenRange(-180f, -180f + num5))
					{
						result = true;
					}
				}
				if (num4 < -180f)
				{
					float num6 = num4 + 180f;
					if (numberToCheck.IsBetweenRange(180f + num6, 180f))
					{
						result = true;
					}
				}
				return result;
			}
			return false;
		}

		private static void HandleHeroSwordSlash(List<SpeculativeRigidbody> alreadyHit, Vector2 arcOrigin, float slashAngle, int slashId, PlayerController owner, ProjInteractMode intmode, float damageToDeal, float enemyKnockback, List<GameActorEffect> statusEffects, float jammedDMGMult, float bossDMGMult, float slashRange, float slashDimensions, Projectile sourceProjectile = null)
		{
			//IL_016a: 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_0046: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			ReadOnlyCollection<Projectile> allProjectiles = StaticReferenceManager.AllProjectiles;
			for (int num = allProjectiles.Count - 1; num >= 0; num--)
			{
				Projectile val = allProjectiles[num];
				if (ProjectileIsValid(val))
				{
					Vector2 worldCenter = ((BraveBehaviour)val).sprite.WorldCenter;
					if (ObjectWasHitBySlash(worldCenter, arcOrigin, slashAngle, slashRange, slashDimensions) && (intmode != 0 || val.collidesWithProjectiles))
					{
						if (intmode == ProjInteractMode.DESTROY || intmode == ProjInteractMode.IGNORE)
						{
							val.DieInAir(false, true, true, true);
						}
						else
						{
							if (intmode == ProjInteractMode.REFLECT && val.LastReflectedSlashId != slashId)
							{
								PassiveReflectItem.ReflectBullet(val, true, (GameActor)(object)owner, 2f, 1f, 1f, 0f);
								val.LastReflectedSlashId = slashId;
							}
							if (intmode == ProjInteractMode.DEFLECT && val.LastReflectedSlashId != slashId)
							{
								PassiveReflectItem.ReflectBullet(val, true, (GameActor)(object)owner, 2f, 1f, 1f, DeflectionDegree);
								val.LastReflectedSlashId = slashId;
							}
						}
					}
				}
			}
			DealDamageToEnemiesInArc(owner, arcOrigin, slashAngle, slashRange, damageToDeal, enemyKnockback, statusEffects, jammedDMGMult, bossDMGMult, slashDimensions, out flag, alreadyHit, sourceProjectile);
			List<MinorBreakable> allMinorBreakables = StaticReferenceManager.AllMinorBreakables;
			for (int num2 = allMinorBreakables.Count - 1; num2 >= 0; num2--)
			{
				MinorBreakable val2 = allMinorBreakables[num2];
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((BraveBehaviour)val2).specRigidbody) && !val2.IsBroken && Object.op_Implicit((Object)(object)((BraveBehaviour)val2).sprite) && ObjectWasHitBySlash(((BraveBehaviour)val2).sprite.WorldCenter, arcOrigin, slashAngle, slashRange, slashDimensions))
				{
					val2.Break();
				}
			}
			List<MajorBreakable> allMajorBreakables = StaticReferenceManager.AllMajorBreakables;
			for (int num3 = allMajorBreakables.Count - 1; num3 >= 0; num3--)
			{
				MajorBreakable val3 = allMajorBreakables[num3];
				if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)((BraveBehaviour)val3).specRigidbody) && !alreadyHit.Contains(((BraveBehaviour)val3).specRigidbody) && !val3.IsSecretDoor && !val3.IsDestroyed && ObjectWasHitBySlash(((BraveBehaviour)val3).specRigidbody.UnitCenter, arcOrigin, slashAngle, slashRange, slashDimensions))
				{
					float num4 = damageToDeal;
					if (Object.op_Implicit((Object)(object)((BraveBehaviour)val3).healthHaver))
					{
						num4 *= 0.2f;
					}
					val3.ApplyDamage(num4, ((BraveBehaviour)val3).specRigidbody.UnitCenter - arcOrigin, false, false, false);
					alreadyHit.Add(((BraveBehaviour)val3).specRigidbody);
				}
			}
			if ((Object)(object)sourceProjectile != (Object)null && (Object)(object)((Component)sourceProjectile).gameObject.GetComponent<ProjectileSlashingBehaviour>() != (Object)null)
			{
				ProjectileSlashingBehaviour component = ((Component)sourceProjectile).gameObject.GetComponent<ProjectileSlashingBehaviour>();
				component.DoOnSlashEndEffects(flag);
			}
		}

		private static void DealDamageToEnemiesInArc(PlayerController owner, Vector2 arcOrigin, float arcAngle, float arcRadius, float overrideDamage, float overrideForce, List<GameActorEffect> statusEffects, float jammedDMGMult, float bossDMGMult, float slashDimensions, out bool flag2, List<SpeculativeRigidbody> alreadyHit = null, Projectile sourceProjectile = null)
		{
			//IL_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			flag2 = false;
			bool flag3 = true;
			RoomHandler currentRoom = owner.CurrentRoom;
			if (currentRoom == null)
			{
				return;
			}
			List<AIActor> activeEnemies = currentRoom.GetActiveEnemies((ActiveEnemyType)0);
			if (activeEnemies == null)
			{
				return;
			}
			RaycastResult val3 = default(RaycastResult);
			for (int i = 0; i < activeEnemies.Count; i++)
			{
				AIActor val = activeEnemies[i];
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody) || !val.IsNormalEnemy || ((GameActor)val).IsGone || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver) || (alreadyHit != null && alreadyHit.Contains(((BraveBehaviour)val).specRigidbody)))
				{
					continue;
				}
				for (int j = 0; j < ((BraveBehaviour)val).healthHaver.NumBodyRigidbodies; j++)
				{
					SpeculativeRigidbody bodyRigidbody = ((BraveBehaviour)val).healthHaver.GetBodyRigidbody(j);
					PixelCollider hitboxPixelCollider = bodyRigidbody.HitboxPixelCollider;
					if (hitboxPixelCollider == null)
					{
						continue;
					}
					Vector2 val2 = BraveMathCollege.ClosestPointOnRectangle(arcOrigin, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions);
					float num = Vector2.Distance(val2, arcOrigin);
					if (!ObjectWasHitBySlash(val2, arcOrigin, arcAngle, arcRadius, slashDimensions))
					{
						continue;
					}
					bool flag4 = true;
					int num2 = CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)8, (CollisionLayer)12);
					if (PhysicsEngine.Instance.Raycast(arcOrigin, val2 - arcOrigin, num, ref val3, true, true, num2, (CollisionLayer?)null, false, (Func<SpeculativeRigidbody, bool>)null, (SpeculativeRigidbody)null) && (Object)(object)val3.SpeculativeRigidbody != (Object)(object)bodyRigidbody)
					{
						flag4 = false;
					}
					RaycastResult.Pool.Free(ref val3);
					if (!flag4)
					{
						continue;
					}
					float num3 = DealSwordDamageToEnemy(owner, val, arcOrigin, val2, arcAngle, overrideDamage, overrideForce, statusEffects, bossDMGMult, jammedDMGMult, sourceProjectile);
					if (flag3)
					{
						flag3 = false;
						if ((Object)(object)sourceProjectile != (Object)null && (Object)(object)((Component)sourceProjectile).gameObject.GetComponent<ProjectileSlashingBehaviour>() != (Ob