Decompiled source of SuperchargedFollowers v1.0.5

plugins/SuperchargedFollowers/SuperchargedFollowers.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using COTL_API.CustomInventory;
using COTL_API.CustomStructures;
using COTL_API.Helpers;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
using Lamb.UI;
using Lamb.UI.BuildMenu;
using Lamb.UI.FollowerSelect;
using MMBiomeGeneration;
using Microsoft.CodeAnalysis;
using Spine.Unity;
using SuperchargedFollowers.Helpers;
using SuperchargedFollowers.Interactions;
using SuperchargedFollowers.ProxyItems;
using SuperchargedFollowers.Structures;
using TMPro;
using UnityEngine;
using src.Extensions;
using src.UI.Menus;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SuperchargedFollowers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+67b254773966b2e37d65b99aa7c1ddea20f5df58")]
[assembly: AssemblyProduct("SuperchargedFollowers")]
[assembly: AssemblyTitle("SuperchargedFollowers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SuperchargedFollowers
{
	[BepInPlugin("InfernoDragon0.cotl.SuperchargedFollowers", "SuperchargedFollowers", "1.0.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "InfernoDragon0.cotl.SuperchargedFollowers";

		public const string PluginName = "SuperchargedFollowers";

		public const string PluginVer = "1.0.5";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("InfernoDragon0.cotl.SuperchargedFollowers");

		internal static string PluginPath;

		internal static ConfigEntry<float> followerTransparency;

		internal static ConfigEntry<bool> shouldCommanderTransparent;

		internal static ConfigEntry<bool> shouldBypassHitStop;

		public static List<FollowerInfo> summonList = new List<FollowerInfo>();

		public static FollowerInfo commander;

		public static bool summoned = false;

		public static List<Follower> tempSummoned = new List<Follower>();

		public static ITEM_TYPE holiday;

		public static ITEM_TYPE prayer;

		public static ITEM_TYPE missionary;

		public static ITEM_TYPE warrior;

		public static ITEM_TYPE undertaker;

		public static ITEM_TYPE prestige;

		public static TYPES rally;

		public static TYPES rallymulti;

		public static TYPES barracks;

		public static List<int> allJobs;

		private void Awake()
		{
			//IL_008a: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected I4, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected I4, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected I4, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected I4, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected I4, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			followerTransparency = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedFollowers", "FollowerTransparency", 0.5f, "Transparency of the followers, from 0 to 1");
			shouldCommanderTransparent = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedFollowers", "CommanderTransparency", true, "Should the commander be transparent?");
			shouldBypassHitStop = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedFollowers", "BypassHitStop", true, "Should attacks bypass hitstop feature? (recommended to TRUE for improved combat experience)");
			holiday = CustomItemManager.Add((CustomInventoryItem)(object)new Holiday());
			prayer = CustomItemManager.Add((CustomInventoryItem)(object)new Prayer());
			missionary = CustomItemManager.Add((CustomInventoryItem)(object)new Missionary());
			warrior = CustomItemManager.Add((CustomInventoryItem)(object)new Warrior());
			undertaker = CustomItemManager.Add((CustomInventoryItem)(object)new Undertaker());
			prestige = CustomItemManager.Add((CustomInventoryItem)(object)new Prestige());
			allJobs = new List<int>
			{
				(int)holiday,
				(int)prayer,
				(int)missionary,
				(int)warrior,
				(int)undertaker
			};
			rally = CustomStructureManager.Add((CustomStructure)(object)new RallyStructure());
			rallymulti = CustomStructureManager.Add((CustomStructure)(object)new RallyMultiStructure());
			barracks = CustomStructureManager.Add((CustomStructure)(object)new BarracksStructure());
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded SuperchargedFollowers!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded SuperchargedFollowers!");
		}
	}
}
namespace SuperchargedFollowers.Structures
{
	public class BarracksStructure : CustomStructure
	{
		public override string InternalName => "BARRACKS_STRUCTURE";

		public override Type Interaction => typeof(Interaction_Barracks);

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/Barracks.png"));

		public override int BuildDurationMinutes => 30;

		public override Vector2Int Bounds => new Vector2Int(2, 2);

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)2;

		public override string GetLocalizedName()
		{
			return "Barracks";
		}

		public override string GetLocalizedDescription()
		{
			return "[Supercharged Series] Upgrade your followers for battle here.";
		}

		public override string GetLocalizedLore()
		{
			return "[Supercharged Series]";
		}
	}
	public class RallyMultiStructure : CustomStructure
	{
		public override string InternalName => "RALLY_MULTI_STRUCTURE";

		public override Type Interaction => typeof(Interaction_RallyMulti);

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/RallyMulti.png"));

		public override int BuildDurationMinutes => 30;

		public override Vector2Int Bounds => new Vector2Int(2, 2);

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)2;

		public override string GetLocalizedName()
		{
			return "Super Rally Flag";
		}

		public override string GetLocalizedDescription()
		{
			return "[Supercharged Series] Rally / Unrally all followers at once.";
		}

		public override string GetLocalizedLore()
		{
			return "[Supercharged Series]";
		}
	}
	public class RallyStructure : CustomStructure
	{
		public override string InternalName => "RALLY_STRUCTURE";

		public override Type Interaction => typeof(Interaction_Rally);

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/Rally.png"));

		public override int BuildDurationMinutes => 30;

		public override Vector2Int Bounds => new Vector2Int(2, 2);

		public override Category Category => (Category)0;

		public override Categories StructureCategories => (Categories)2;

		public override string GetLocalizedName()
		{
			return "Rally Flag";
		}

		public override string GetLocalizedDescription()
		{
			return "[Supercharged Series] Rally your followers to bring them to battle.";
		}

		public override string GetLocalizedLore()
		{
			return "[Supercharged Series]";
		}
	}
}
namespace SuperchargedFollowers.ProxyItems
{
	public class Holiday : CustomInventoryItem
	{
		public override string InternalName => "Holiday_Proxy";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));


		public override string LocalizedName()
		{
			return "Holiday";
		}

		public override string LocalizedDescription()
		{
			return "A Proxy Item for Supercharged Followers.";
		}
	}
	public class Missionary : CustomInventoryItem
	{
		public override string InternalName => "Missionary_Proxy";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));


		public override string LocalizedName()
		{
			return "Missionary";
		}

		public override string LocalizedDescription()
		{
			return "A Proxy Item for Supercharged Followers.";
		}
	}
	public class Prayer : CustomInventoryItem
	{
		public override string InternalName => "Prayer_Proxy";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));


		public override string LocalizedName()
		{
			return "Prayer";
		}

		public override string LocalizedDescription()
		{
			return "A Proxy Item for Supercharged Followers.";
		}
	}
	public class Undertaker : CustomInventoryItem
	{
		public override string InternalName => "Undertaker_Proxy";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));


		public override string LocalizedName()
		{
			return "Undertaker";
		}

		public override string LocalizedDescription()
		{
			return "A Proxy Item for Supercharged Followers.";
		}
	}
	public class Warrior : CustomInventoryItem
	{
		public override string InternalName => "Warrior_Proxy";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/proxy.png"));


		public override string LocalizedName()
		{
			return "Warrior";
		}

		public override string LocalizedDescription()
		{
			return "A Proxy Item for Supercharged Followers.";
		}
	}
	public class Prestige : CustomInventoryItem
	{
		public override string InternalName => "Prestige";

		public override Sprite Sprite => TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/prestige.png"));

		public override Sprite InventoryIcon { get; } = TextureHelper.CreateSpriteFromPath(Path.Combine(Plugin.PluginPath, "Assets/prestige.png"));


		public override string LocalizedName()
		{
			return "Prestige";
		}

		public override string LocalizedDescription()
		{
			return "Give this to your followers via the Barracks to upgrade their battle stats.";
		}
	}
}
namespace SuperchargedFollowers.Patches
{
	[HarmonyPatch]
	internal class FollowerJoinRoomPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static RoomEvent <0>__OnRoomCleared;
		}

		private static SpawnedFollower SpawnAllyFollower(FollowerInfo followerInfo, Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			SpawnedFollower val = FollowerManager.SpawnCopyFollower(FollowerManager.CombatFollowerPrefab, followerInfo, position, ((Component)PlayerFarming.Instance).transform.parent, BiomeGenerator.Instance.DungeonLocation);
			val.Follower.State.CURRENT_STATE = (State)49;
			val.Follower.Spine.AnimationState.SetAnimation(1, "spawn-in", false);
			val.Follower.Spine.AnimationState.AddAnimation(1, "Reactions/react-worried1", true, 0f);
			((Behaviour)((Component)val.Follower).GetComponent<EnemyFollower>()).enabled = true;
			((Component)((Component)val.Follower).GetComponent<EnemyFollower>()).gameObject.AddComponent<FollowerRoutines>();
			EnemyFollower component = ((Component)val.Follower).GetComponent<EnemyFollower>();
			BuffStats prestigeBonuses = Bonuses.GetPrestigeBonuses(val.FollowerBrain._directInfoAccess);
			BuffStats classBonuses = Bonuses.GetClassBonuses(val.FollowerBrain._directInfoAccess);
			BuffStats commanderBonuses = Bonuses.GetCommanderBonuses(val.FollowerBrain._directInfoAccess);
			BuffStats necklaceBonuses = Bonuses.GetNecklaceBonuses(val.FollowerBrain._directInfoAccess);
			if (followerInfo == Plugin.commander)
			{
				TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)val.Follower).transform, 1f + commanderBonuses.SizeBonus, 0.25f), (Ease)30);
				component.variant = 1;
				if (Plugin.shouldCommanderTransparent.Value)
				{
					((SkeletonRenderer)val.Follower.Spine).skeleton.A = Plugin.followerTransparency.Value;
				}
			}
			else
			{
				component.variant = 0;
				((SkeletonRenderer)val.Follower.Spine).skeleton.A = Plugin.followerTransparency.Value;
			}
			component.Damage = 0.5f + prestigeBonuses.AttackBonus + classBonuses.AttackBonus + commanderBonuses.AttackBonus + necklaceBonuses.AttackBonus;
			((UnitObject)component).speed = 0.08f + prestigeBonuses.MovementSpeedBonus + classBonuses.MovementSpeedBonus + commanderBonuses.MovementSpeedBonus + necklaceBonuses.MovementSpeedBonus;
			((UnitObject)component).maxSpeed = 0.08f + prestigeBonuses.MovementSpeedBonus + classBonuses.MovementSpeedBonus + commanderBonuses.MovementSpeedBonus + necklaceBonuses.MovementSpeedBonus;
			Health component2 = ((Component)val.Follower).GetComponent<Health>();
			component2.ImmuneToPlayer = true;
			component2.totalHP = 10f + prestigeBonuses.HealthBonus + classBonuses.HealthBonus + commanderBonuses.HealthBonus + necklaceBonuses.HealthBonus;
			component2.HP = component2.totalHP;
			Plugin.tempSummoned.Add(val.Follower);
			component2.team = (Team)1;
			component2.isPlayerAlly = true;
			return val;
		}

		[HarmonyPatch(typeof(Door), "ChangeRoom")]
		[HarmonyPrefix]
		public static bool Door_ChangeRoom()
		{
			//IL_00d5: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			if (Plugin.summoned)
			{
				Plugin.Log.LogInfo((object)"Already summoned, repositioning to player if outside of room");
				foreach (Follower item in Plugin.tempSummoned)
				{
					if (item.Health.HP > 0f)
					{
						try
						{
							((MonoBehaviour)item).StartCoroutine((IEnumerator)((Component)((Component)item).GetComponent<EnemyFollower>()).gameObject.GetComponent<FollowerRoutines>().RepositionSelfIfOutside());
						}
						catch (Exception)
						{
							Plugin.Log.LogInfo((object)"FollowerRoutines may not have initialized yet, skipping");
						}
					}
				}
				return true;
			}
			Plugin.summoned = true;
			Plugin.Log.LogInfo((object)"Summoning followers");
			for (int i = 0; i < Plugin.summonList.Count; i++)
			{
				SpawnAllyFollower(Plugin.summonList[i], ((Component)PlayerFarming.Instance).transform.position);
			}
			object obj = <>O.<0>__OnRoomCleared;
			if (obj == null)
			{
				RoomEvent val = OnRoomCleared;
				<>O.<0>__OnRoomCleared = val;
				obj = (object)val;
			}
			RoomLockController.OnRoomCleared += (RoomEvent)obj;
			return true;
		}

		[HarmonyPatch(typeof(Door), "OnTriggerEnter2D")]
		[HarmonyPrefix]
		public static bool Door_OnTriggerEnter2D(Door __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)__instance.ConnectionType);
			__instance.Used = false;
			return true;
		}

		[HarmonyPatch(typeof(Health), "DealDamage")]
		[HarmonyPrefix]
		public static bool Health_DealDamage(Health __instance, GameObject Attacker)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			Health component = Attacker.GetComponent<Health>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			if ((int)component.team == 1 && (int)__instance.team == 1)
			{
				Plugin.Log.LogInfo((object)"No attack self teams");
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(EnemyFollower), "WaitForTarget")]
		[HarmonyPrefix]
		public static bool EnemyFollower_WaitForTarget(EnemyFollower __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if ((int)((UnitObject)__instance).health.team == 1 && ((UnitObject)__instance).health.isPlayerAlly)
			{
				Plugin.Log.LogInfo((object)"waiting for target");
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(EnemyFollower), "ChasePlayer")]
		[HarmonyPrefix]
		public static bool EnemyFollower_ChasePlayer(EnemyFollower __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			Plugin.Log.LogInfo((object)"start chasing");
			if ((int)((UnitObject)__instance).health.team == 1 && ((UnitObject)__instance).health.isPlayerAlly)
			{
				Plugin.Log.LogInfo((object)"start chasing 2");
				((MonoBehaviour)__instance).StartCoroutine((IEnumerator)((Component)__instance).GetComponent<FollowerRoutines>().RunFollowerAI());
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(GameManager), "HitStop")]
		[HarmonyPrefix]
		public static bool GameManager_HitStop()
		{
			return !Plugin.shouldBypassHitStop.Value;
		}

		public static void OnRoomCleared()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)"Room wascleared");
			Plugin.Log.LogInfo((object)("is this the boss room: " + BiomeGenerator.Instance.CurrentRoom.IsBoss));
			List<Follower> list = new List<Follower>();
			foreach (Follower item in Plugin.tempSummoned)
			{
				Plugin.Log.LogInfo((object)(item.Health.HP + " over " + item.Health.totalHP));
				if (item.Health.HP <= 0f)
				{
					ManualLogSource log = Plugin.Log;
					ITEM_TYPE necklace = item.Brain.Info.Necklace;
					log.LogInfo((object)("currently wearing " + ((object)(ITEM_TYPE)(ref necklace)).ToString()));
					if ((int)item.Brain.Info.Necklace == 127)
					{
						Plugin.Log.LogInfo((object)"Golden Skull found, revive");
						CollectionExtensions.AddItem<Follower>((IEnumerable<Follower>)list, item);
					}
				}
				else
				{
					BuffStats necklaceBonuses = Bonuses.GetNecklaceBonuses(item.Brain._directInfoAccess);
					BuffStats commanderBonuses = Bonuses.GetCommanderBonuses(item.Brain._directInfoAccess);
					BuffStats classBonuses = Bonuses.GetClassBonuses(item.Brain._directInfoAccess);
					Health health = item.Health;
					health.HP += necklaceBonuses.RegenBonus + commanderBonuses.RegenBonus + classBonuses.RegenBonus;
					Plugin.Log.LogInfo((object)("Regenerated " + item.Brain._directInfoAccess.Name + " to " + item.Health.HP + " HP"));
				}
			}
			if (list != null && !BiomeGenerator.Instance.CurrentRoom.IsBoss)
			{
				Plugin.Log.LogInfo((object)"Resummon all necklace followers");
				Plugin.tempSummoned.RemoveAll(list.Contains);
				foreach (Follower item2 in list)
				{
					SpawnAllyFollower(item2.Brain._directInfoAccess, ((Component)PlayerFarming.Instance).transform.position);
				}
			}
			if (!BiomeGenerator.Instance.CurrentRoom.IsBoss)
			{
				return;
			}
			Plugin.Log.LogInfo((object)"Boss completed, give reward");
			int num = 0;
			foreach (Follower item3 in Plugin.tempSummoned)
			{
				if (item3.Health.HP > 0f)
				{
					num++;
				}
			}
			Plugin.Log.LogInfo((object)("Total alive: " + num));
			Inventory.AddItem(Plugin.prestige, Math.Min(num, 12), false);
		}
	}
}
namespace SuperchargedFollowers.Interactions
{
	public class Interaction_Barracks : Interaction
	{
		public Structure Structure;

		private bool Activating = false;

		private GameObject Player;

		private float Delay = 0.04f;

		public float DistanceToTriggerDeposits = 5f;

		public StructuresData StructureInfo => Structure.Structure_Info;

		public BarracksStructure BarracksStructure => Structure.Brain as BarracksStructure;

		public override void GetLabel()
		{
			base.label = "Change Follower Class";
		}

		public override void GetSecondaryLabel()
		{
			base.secondaryLabel = "Follower Prestige Levels";
		}

		private void Start()
		{
			base.HasSecondaryInteraction = true;
		}

		public override void OnEnable()
		{
			((Interaction)this).OnEnable();
			Plugin.Log.LogInfo((object)"Barracks OnEnable");
			Structure = ((Component)((Component)this).GetComponentInParent<Transform>()).GetComponent<Structure>();
		}

		public override void OnInteract(StateMachine state)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			if (Activating)
			{
				return;
			}
			((Interaction)this).OnInteract(state);
			Activating = true;
			GameManager.GetInstance().OnConversationNew(true, true, (PlayerFarming)null);
			HUD_Manager.Instance.Hide(false, 0, false);
			UIMissionaryMenuController followerSelectMenu = GameObjectExtensions.Instantiate<UIMissionaryMenuController>(MonoSingleton<UIManager>.Instance.MissionaryMenuTemplate);
			List<FollowerInfo> list = new List<FollowerInfo>();
			foreach (FollowerInfo follower in DataManager.Instance.Followers)
			{
				if ((int)follower.CursedState == 146)
				{
					list.Add(follower);
				}
			}
			((UIFollowerSelectMenuController)followerSelectMenu).Show(MissionaryManager.FollowersAvailableForMission(), false, (Type)117, true, true, true, false, true);
			Plugin.Log.LogInfo((object)"on chosen 6");
			MissionInfoCardController missionInfoCardController = followerSelectMenu._missionInfoCardController;
			((UIInfoCardController<MissionInfoCard, FollowerInfo>)(object)missionInfoCardController).OnInfoCardShown = (Action<MissionInfoCard>)Delegate.Combine(((UIInfoCardController<MissionInfoCard, FollowerInfo>)(object)missionInfoCardController).OnInfoCardShown, (Action<MissionInfoCard>)delegate(MissionInfoCard mic)
			{
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b7: 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)
				Plugin.Log.LogInfo((object)"SHOWN");
				MissionButton val = mic.MissionButtons[0];
				MissionButton val2 = Object.Instantiate<MissionButton>(val, ((Component)val).transform.parent);
				MissionButton val3 = Object.Instantiate<MissionButton>(val, ((Component)val).transform.parent);
				MissionButton val4 = Object.Instantiate<MissionButton>(val, ((Component)val).transform.parent);
				MissionButton val5 = Object.Instantiate<MissionButton>(val, ((Component)val).transform.parent);
				MissionButton val6 = Object.Instantiate<MissionButton>(val, ((Component)val).transform.parent);
				List<MissionButton> list2 = new List<MissionButton> { val2, val3, val4, val5, val6 };
				val2.Configure(mic._followerInfo);
				val3.Configure(mic._followerInfo);
				val4.Configure(mic._followerInfo);
				val5.Configure(mic._followerInfo);
				val6.Configure(mic._followerInfo);
				((TMP_Text)val2._titleText).text = "Warrior: <sprite name=\"icon_GoodTrait\"><sprite name=\"icon_GoodTrait\">  ATK, <sprite name=\"icon_GoodTrait\"> HP";
				((TMP_Text)val2._amountText).text = "1";
				val2._type = Plugin.warrior;
				val2.OnMissionSelected = (Action<ITEM_TYPE>)Delegate.Combine(val2.OnMissionSelected, (Action<ITEM_TYPE>)delegate(ITEM_TYPE a)
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					Plugin.Log.LogInfo((object)("selected " + ((object)(ITEM_TYPE)(ref a)).ToString()));
					OnClassChosen(mic._followerInfo, a, followerSelectMenu);
				});
				val2.Start();
				Plugin.Log.LogInfo((object)"on chosen 7");
				((TMP_Text)val3._titleText).text = "Prayer: +10% Lamb Curse Damage";
				((TMP_Text)val3._amountText).text = "1";
				val3._type = Plugin.prayer;
				val3.OnMissionSelected = (Action<ITEM_TYPE>)Delegate.Combine(val3.OnMissionSelected, (Action<ITEM_TYPE>)delegate(ITEM_TYPE a)
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					Plugin.Log.LogInfo((object)("selected " + ((object)(ITEM_TYPE)(ref a)).ToString()));
					OnClassChosen(mic._followerInfo, a, followerSelectMenu);
				});
				val3.Start();
				((TMP_Text)val4._titleText).text = "Holiday: <sprite name=\"icon_GoodTrait\">  ASPD, <sprite name=\"icon_BadTrait\"> ATK";
				((TMP_Text)val4._amountText).text = "1";
				val4._type = Plugin.holiday;
				val4.OnMissionSelected = (Action<ITEM_TYPE>)Delegate.Combine(val4.OnMissionSelected, (Action<ITEM_TYPE>)delegate(ITEM_TYPE a)
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					Plugin.Log.LogInfo((object)("selected " + ((object)(ITEM_TYPE)(ref a)).ToString()));
					OnClassChosen(mic._followerInfo, a, followerSelectMenu);
				});
				val4.Start();
				((TMP_Text)val5._titleText).text = "Missionary: <sprite name=\"icon_GoodTrait\">  SPD, <sprite name=\"icon_GoodTrait\"> ATK";
				((TMP_Text)val5._amountText).text = "1";
				val5._type = Plugin.missionary;
				val5.OnMissionSelected = (Action<ITEM_TYPE>)Delegate.Combine(val5.OnMissionSelected, (Action<ITEM_TYPE>)delegate(ITEM_TYPE a)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					OnClassChosen(mic._followerInfo, a, followerSelectMenu);
					Plugin.Log.LogInfo((object)("selected " + ((object)(ITEM_TYPE)(ref a)).ToString()));
				});
				val5.Start();
				((TMP_Text)val6._titleText).text = "Undertaker: <sprite name=\"icon_GoodTrait\"> HP Regen";
				((TMP_Text)val6._amountText).text = "1";
				val6._type = Plugin.undertaker;
				val6.OnMissionSelected = (Action<ITEM_TYPE>)Delegate.Combine(val6.OnMissionSelected, (Action<ITEM_TYPE>)delegate(ITEM_TYPE a)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					OnClassChosen(mic._followerInfo, a, followerSelectMenu);
					Plugin.Log.LogInfo((object)("selected " + ((object)(ITEM_TYPE)(ref a)).ToString()));
				});
				val6.Start();
				MissionButton[] missionButtons = mic._missionButtons;
				foreach (MissionButton val7 in missionButtons)
				{
					((Component)val7).gameObject.SetActive(false);
				}
				mic._missionButtons = list2.ToArray();
			});
			UIMissionaryMenuController obj = followerSelectMenu;
			((UIMenuBase)obj).OnShown = (Action)Delegate.Combine(((UIMenuBase)obj).OnShown, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectMenu)._followerInfoBoxes)
				{
					BuffStats prestigeBonuses = Bonuses.GetPrestigeBonuses(((FollowerSelectItem)followerInfoBox).FollowerInfo);
					BuffStats classBonuses = Bonuses.GetClassBonuses(((FollowerSelectItem)followerInfoBox).FollowerInfo);
					((TMP_Text)followerInfoBox.FollowerRole).text = classBonuses.ClassName + " | Prestige " + prestigeBonuses.Level + " |  Health: " + (0.5 + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel) + " | Attack: " + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel * 0.5;
				}
			});
			UIMissionaryMenuController obj2 = followerSelectMenu;
			((UIMenuBase)obj2).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj2).OnHidden, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
			UIMissionaryMenuController obj3 = followerSelectMenu;
			((UIMenuBase)obj3).OnCancel = (Action)Delegate.Combine(((UIMenuBase)obj3).OnCancel, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
		}

		public override void OnSecondaryInteract(StateMachine state)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			if (Activating)
			{
				return;
			}
			((Interaction)this).OnSecondaryInteract(state);
			Activating = true;
			GameManager.GetInstance().OnConversationNew(true, true, (PlayerFarming)null);
			HUD_Manager.Instance.Hide(false, 0, false);
			UIFollowerSelectMenuController followerSelectMenu = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			List<FollowerInfo> list = new List<FollowerInfo>();
			foreach (FollowerInfo follower in DataManager.Instance.Followers)
			{
				if ((int)follower.CursedState == 146)
				{
					list.Add(follower);
				}
			}
			followerSelectMenu.Show(MissionaryManager.FollowersAvailableForMission(), false, (Type)117, true, true, true, false, true);
			UIFollowerSelectMenuController obj = followerSelectMenu;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected, new Action<FollowerInfo>(OnPrestigeChosen));
			UIFollowerSelectMenuController obj2 = followerSelectMenu;
			((UIMenuBase)obj2).OnShown = (Action)Delegate.Combine(((UIMenuBase)obj2).OnShown, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectMenu)._followerInfoBoxes)
				{
					BuffStats prestigeBonuses = Bonuses.GetPrestigeBonuses(((FollowerSelectItem)followerInfoBox).FollowerInfo);
					int num = Bonuses.PrestigeToNextLevel(((FollowerSelectItem)followerInfoBox).FollowerInfo);
					((TMP_Text)followerInfoBox.FollowerRole).text = "Prestige " + prestigeBonuses.Level + "| " + num + " to next Prestige | Bonuses: " + prestigeBonuses.HealthBonus + "HP, " + prestigeBonuses.AttackBonus + "ATK, " + prestigeBonuses.MovementSpeedBonus + "MOV, " + prestigeBonuses.DelayBonus + "SPD";
				}
			});
			UIFollowerSelectMenuController obj3 = followerSelectMenu;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
			UIFollowerSelectMenuController obj4 = followerSelectMenu;
			((UIMenuBase)obj4).OnCancel = (Action)Delegate.Combine(((UIMenuBase)obj4).OnCancel, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
		}

		public void OnHidden()
		{
			Activating = false;
			HUD_Manager.Instance.Show(1, false);
			GameManager.GetInstance().OnConversationEnd(true, true);
		}

		public void OnPrestigeChosen(FollowerInfo followerInfo)
		{
			//IL_002b: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			int num = Bonuses.PrestigeToNextLevel(followerInfo);
			if (num <= 0)
			{
				NotificationCentreScreen.Play("Follower is already at max level!");
				OnHidden();
				return;
			}
			int itemQuantity = Inventory.GetItemQuantity(Plugin.prestige);
			if (itemQuantity >= num)
			{
				Inventory.ChangeItemQuantity(Plugin.prestige, -num, 0);
				for (int i = 0; i < num; i++)
				{
					followerInfo.Inventory.Add(new InventoryItem(Plugin.prestige, 1));
				}
				NotificationCentreScreen.Play("Prestige level increased for " + followerInfo.Name);
			}
			else
			{
				NotificationCentreScreen.Play("Not enough Prestige to level, need " + num + " Prestige");
			}
			OnHidden();
		}

		public void OnClassChosen(FollowerInfo followerInfo, ITEM_TYPE classType, UIMissionaryMenuController followerSelectMenu)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			Plugin.Log.LogInfo((object)("class chosen " + ((object)(ITEM_TYPE)(ref classType)).ToString()));
			followerInfo.Inventory.RemoveAll((InventoryItem item) => Plugin.allJobs.Contains(item.type));
			followerInfo.Inventory.Add(new InventoryItem(classType, 1));
			((UIMenuBase)followerSelectMenu).Hide(false);
			OnHidden();
		}
	}
	public class Interaction_Rally : Interaction
	{
		public Structure Structure;

		private bool Activating = false;

		private GameObject Player;

		private float Delay = 0.04f;

		public float DistanceToTriggerDeposits = 5f;

		public StructuresData StructureInfo => Structure.Structure_Info;

		public RallyStructure RallyStructure => Structure.Brain as RallyStructure;

		public override void GetLabel()
		{
			base.secondaryLabel = "Select Commander";
			base.label = "Rally Followers";
		}

		private void Start()
		{
			base.HasSecondaryInteraction = true;
		}

		public override void OnEnable()
		{
			((Interaction)this).OnEnable();
			Plugin.Log.LogInfo((object)"Rally OnEnable");
			Structure = ((Component)((Component)this).GetComponentInParent<Transform>()).GetComponent<Structure>();
		}

		public override void OnInteract(StateMachine state)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Invalid comparison between Unknown and I4
			Plugin.summoned = false;
			if (Activating)
			{
				return;
			}
			((Interaction)this).OnInteract(state);
			Activating = true;
			GameManager.GetInstance().OnConversationNew(true, true, (PlayerFarming)null);
			HUD_Manager.Instance.Hide(false, 0, false);
			UIFollowerSelectMenuController followerSelectMenu = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			List<FollowerInfo> list = new List<FollowerInfo>();
			foreach (FollowerInfo follower in DataManager.Instance.Followers)
			{
				if ((int)follower.CursedState == 146)
				{
					list.Add(follower);
				}
			}
			followerSelectMenu.Show(MissionaryManager.FollowersAvailableForMission(), false, (Type)117, true, true, true, false, true);
			UIFollowerSelectMenuController obj = followerSelectMenu;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected, new Action<FollowerInfo>(OnFollowerChosen));
			UIFollowerSelectMenuController obj2 = followerSelectMenu;
			((UIMenuBase)obj2).OnShown = (Action)Delegate.Combine(((UIMenuBase)obj2).OnShown, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectMenu)._followerInfoBoxes)
				{
					if (Plugin.summonList.Contains(((FollowerSelectItem)followerInfoBox)._followerInfo))
					{
						((TMP_Text)followerInfoBox.FollowerRole).text = "Currently Rallied! |  Health: " + (0.5 + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel) + " | Attack: " + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel * 0.5;
						followerInfoBox.FollowerSpine.AnimationState.SetAnimation(0, "attack-impact-multi", true);
					}
					else
					{
						((TMP_Text)followerInfoBox.FollowerRole).text = "Rally | Health: " + (0.5 + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel) + " | Attack: " + (double)((FollowerSelectItem)followerInfoBox)._followerInfo.DwellingLevel * 0.5;
					}
				}
			});
			UIFollowerSelectMenuController obj3 = followerSelectMenu;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
			UIFollowerSelectMenuController obj4 = followerSelectMenu;
			((UIMenuBase)obj4).OnCancel = (Action)Delegate.Combine(((UIMenuBase)obj4).OnCancel, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
		}

		public override void OnSecondaryInteract(StateMachine state)
		{
			if (Activating)
			{
				return;
			}
			((Interaction)this).OnSecondaryInteract(state);
			Activating = true;
			GameManager.GetInstance().OnConversationNew(true, true, (PlayerFarming)null);
			HUD_Manager.Instance.Hide(false, 0, false);
			UIFollowerSelectMenuController followerSelectMenu = GameObjectExtensions.Instantiate<UIFollowerSelectMenuController>(MonoSingleton<UIManager>.Instance.FollowerSelectMenuTemplate);
			List<FollowerInfo> list = new List<FollowerInfo>();
			foreach (FollowerInfo follower in DataManager.Instance.Followers)
			{
				if (!Plugin.summonList.Contains(follower))
				{
					list.Add(follower);
				}
			}
			followerSelectMenu.Show(MissionaryManager.FollowersAvailableForMission(), false, (Type)117, true, true, true, false, true);
			UIFollowerSelectMenuController obj = followerSelectMenu;
			((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected = (Action<FollowerInfo>)Delegate.Combine(((UIFollowerSelectBase<FollowerInformationBox>)(object)obj).OnFollowerSelected, new Action<FollowerInfo>(OnCommanderChosen));
			UIFollowerSelectMenuController obj2 = followerSelectMenu;
			((UIMenuBase)obj2).OnShown = (Action)Delegate.Combine(((UIMenuBase)obj2).OnShown, (Action)delegate
			{
				foreach (FollowerInformationBox followerInfoBox in ((UIFollowerSelectBase<FollowerInformationBox>)(object)followerSelectMenu)._followerInfoBoxes)
				{
					if (Plugin.commander == ((FollowerSelectItem)followerInfoBox)._followerInfo)
					{
						((TMP_Text)followerInfoBox.FollowerRole).text = "Current Commander | Base Health: " + 4 + " | Attack: " + 3;
					}
					else
					{
						((TMP_Text)followerInfoBox.FollowerRole).text = "Select As Commander | Base Health: " + 4 + " | Attack: " + 3;
					}
				}
			});
			UIFollowerSelectMenuController obj3 = followerSelectMenu;
			((UIMenuBase)obj3).OnHidden = (Action)Delegate.Combine(((UIMenuBase)obj3).OnHidden, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
			UIFollowerSelectMenuController obj4 = followerSelectMenu;
			((UIMenuBase)obj4).OnCancel = (Action)Delegate.Combine(((UIMenuBase)obj4).OnCancel, (Action)delegate
			{
				followerSelectMenu = null;
				OnHidden();
			});
			Activating = false;
		}

		public void OnHidden()
		{
			Activating = false;
			HUD_Manager.Instance.Show(1, false);
			GameManager.GetInstance().OnConversationEnd(true, true);
		}

		public void OnFollowerChosen(FollowerInfo followerInfo)
		{
			if (Plugin.summonList.Contains(followerInfo))
			{
				Plugin.summonList.Remove(followerInfo);
			}
			else
			{
				Plugin.summonList.Add(followerInfo);
			}
		}

		public void OnCommanderChosen(FollowerInfo followerInfo)
		{
			Plugin.commander = followerInfo;
		}
	}
	public class Interaction_RallyMulti : Interaction
	{
		public Structure Structure;

		private bool Activating = false;

		private GameObject Player;

		private float Delay = 0.04f;

		public float DistanceToTriggerDeposits = 5f;

		public StructuresData StructureInfo => Structure.Structure_Info;

		public RallyStructure RallyStructure => Structure.Brain as RallyStructure;

		public override void GetLabel()
		{
			base.secondaryLabel = "Unrally All followers";
			base.label = "Rally All Followers";
		}

		private void Start()
		{
			base.HasSecondaryInteraction = true;
		}

		public override void OnEnable()
		{
			((Interaction)this).OnEnable();
			Plugin.Log.LogInfo((object)"RallyMulti OnEnable");
			Structure = ((Component)((Component)this).GetComponentInParent<Transform>()).GetComponent<Structure>();
		}

		public override void OnInteract(StateMachine state)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			Plugin.summoned = false;
			if (Activating)
			{
				return;
			}
			((Interaction)this).OnInteract(state);
			Activating = true;
			List<FollowerInfo> list = new List<FollowerInfo>();
			foreach (FollowerInfo follower in DataManager.Instance.Followers)
			{
				if ((int)follower.CursedState != 146)
				{
					list.Add(follower);
				}
			}
			Plugin.summonList.Clear();
			Plugin.summonList.AddRange(list);
			NotificationCentreScreen.Play("Rallied " + list.Count + " followers!");
			Activating = false;
		}

		public override void OnSecondaryInteract(StateMachine state)
		{
			if (!Activating)
			{
				((Interaction)this).OnSecondaryInteract(state);
				Activating = true;
				Plugin.summonList.Clear();
				NotificationCentreScreen.Play("Unrallied all followers!");
				Activating = false;
			}
		}

		public void OnHidden()
		{
			Activating = false;
			HUD_Manager.Instance.Show(1, false);
			GameManager.GetInstance().OnConversationEnd(true, true);
		}

		public void OnFollowerChosen(FollowerInfo followerInfo)
		{
			if (Plugin.summonList.Contains(followerInfo))
			{
				Plugin.summonList.Remove(followerInfo);
			}
			else
			{
				Plugin.summonList.Add(followerInfo);
			}
		}
	}
}
namespace SuperchargedFollowers.Helpers
{
	public class Bonuses
	{
		public static BuffStats GetClassBonuses(FollowerInfo followerInfo)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between I4 and Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between I4 and Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Invalid comparison between I4 and Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between I4 and Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Invalid comparison between I4 and Unknown
			BuffStats buffStats = new BuffStats();
			foreach (InventoryItem item in followerInfo.Inventory)
			{
				if (item.type == (int)Plugin.holiday)
				{
					buffStats.HealthBonus = 4f;
					buffStats.ClassName = "Holiday";
					break;
				}
				if (item.type == (int)Plugin.warrior)
				{
					buffStats.AttackBonus = 2f;
					buffStats.HealthBonus = 2f;
					buffStats.ClassName = "Warrior";
					break;
				}
				if (item.type == (int)Plugin.missionary)
				{
					buffStats.HealthBonus = 1f;
					buffStats.MovementSpeedBonus = 0.02f;
					buffStats.ClassName = "Missionary";
					break;
				}
				if (item.type == (int)Plugin.undertaker)
				{
					buffStats.RegenBonus = 0.5f;
					buffStats.ClassName = "Undertaker";
					break;
				}
				if (item.type == (int)Plugin.prayer)
				{
					buffStats.AttackBonus = 4f;
					buffStats.ClassName = "Prayer";
					break;
				}
			}
			return buffStats;
		}

		public static BuffStats GetNecklaceBonuses(FollowerInfo followerInfo)
		{
			//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_0010: 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_002d: Expected I4, but got Unknown
			BuffStats buffStats = new BuffStats();
			ITEM_TYPE necklace = followerInfo.Necklace;
			ITEM_TYPE val = necklace;
			switch (val - 45)
			{
			case 0:
				buffStats.DelayBonus = 0.5f;
				break;
			case 1:
				buffStats.MovementSpeedBonus = 0.02f;
				break;
			case 2:
				buffStats.AttackBonus = 1f;
				break;
			case 3:
				buffStats.HealthBonus = 1f;
				break;
			case 4:
				buffStats.RegenBonus = 0.25f;
				break;
			}
			return buffStats;
		}

		public static BuffStats GetCommanderBonuses(FollowerInfo followerInfo)
		{
			BuffStats buffStats = new BuffStats();
			if (Plugin.commander == followerInfo)
			{
				buffStats.AttackBonus = 3f;
				buffStats.HealthBonus = 10f;
				buffStats.DelayBonus = 1f;
				buffStats.MovementSpeedBonus = 0.09f;
				buffStats.RegenBonus = 1.5f;
				buffStats.SizeBonus = 1f;
			}
			return buffStats;
		}

		public static BuffStats GetPrestigeBonuses(FollowerInfo followerInfo)
		{
			BuffStats buffStats = new BuffStats();
			int num = followerInfo.Inventory.Count((InventoryItem x) => x.type == (int)Plugin.prestige);
			if (num >= 100)
			{
				buffStats.CritChance = 0.1f;
				buffStats.Level = 10f;
			}
			if (num >= 80)
			{
				buffStats.DropPrestigeChance = 0.1f;
				buffStats.Level = 9f;
			}
			if (num >= 60)
			{
				buffStats.CurseRegenBonus = 1f;
				buffStats.Level = 8f;
			}
			if (num >= 40)
			{
				buffStats.BlueHealthChance = 0.2f;
				buffStats.Level = 7f;
			}
			if (num >= 20)
			{
				buffStats.RegenBonus = 0.5f;
				buffStats.Level = 6f;
			}
			if (num >= 15)
			{
				buffStats.HealthBonus = 0.5f;
				buffStats.DelayBonus = 0.5f;
				buffStats.Level = 5f;
			}
			if (num >= 12)
			{
				buffStats.HealthBonus += 0.5f;
				buffStats.AttackBonus += 0.5f;
				buffStats.Level = 4f;
			}
			if (num >= 9)
			{
				buffStats.HealthBonus += 1f;
				buffStats.MovementSpeedBonus += 0.03f;
				buffStats.Level = 3f;
			}
			if (num >= 6)
			{
				buffStats.HealthBonus += 0.5f;
				buffStats.AttackBonus += 0.25f;
				buffStats.Level = 2f;
			}
			if (num >= 3)
			{
				buffStats.HealthBonus += 0.5f;
				buffStats.AttackBonus += 0.5f;
				buffStats.Level = 1f;
			}
			return buffStats;
		}

		public static int PrestigeToNextLevel(FollowerInfo followerInfo)
		{
			int prestigeTotal = followerInfo.Inventory.Count((InventoryItem x) => x.type == (int)Plugin.prestige);
			List<int> source = new List<int> { 3, 6, 9, 12, 15, 20, 40, 60, 80, 100 };
			int num = source.FirstOrDefault((int x) => x > prestigeTotal);
			return num - prestigeTotal;
		}
	}
	public class BuffStats
	{
		public float AttackBonus { get; set; }

		public float HealthBonus { get; set; }

		public float DelayBonus { get; set; }

		public float MovementSpeedBonus { get; set; }

		public float RegenBonus { get; set; }

		public float BlueHealthChance { get; set; }

		public float CurseRegenBonus { get; set; }

		public float DropPrestigeChance { get; set; }

		public float CritChance { get; set; }

		public float Level { get; set; }

		public float SizeBonus { get; set; }

		public string ClassName { get; set; }
	}
	public class FollowerRoutines : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <RepositionSelfIfOutside>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FollowerRoutines <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (BiomeGenerator.Instance.CurrentRoom.Completed)
					{
						Plugin.Log.LogInfo((object)"Follower reposition to player");
						((Component)<>4__this.follower).transform.position = ((Component)PlayerFarming.Instance).transform.position;
					}
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public FollowerRoutines <>4__this;

			private Follower <followerData>5__1;

			private bool <Loop>5__2;

			private Health <nextTarget>5__3;

			private bool <chasing>5__4;

			private int <NumAttacks>5__5;

			private int <AttackCount>5__6;

			private float <attackDistance>5__7;

			private float <MaxAttackSpeed>5__8;

			private float <AttackSpeed>5__9;

			private bool <attacking>5__10;

			private float <SignPostDelay>5__11;

			private SuperchargedFollowersAIState <>s__12;

			private Health <health>5__13;

			private Exception <e>5__14;

			private State <>s__15;

			private string <animationName>5__16;

			private string <animationName>5__17;

			private string <animationName>5__18;

			private Exception <e>5__19;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<followerData>5__1 = null;
				<nextTarget>5__3 = null;
				<health>5__13 = null;
				<e>5__14 = null;
				<animationName>5__16 = null;
				<animationName>5__17 = null;
				<animationName>5__18 = null;
				<e>5__19 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_1811: Unknown result type (might be due to invalid IL or missing references)
				//IL_1816: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: Expected O, but got Unknown
				//IL_0680: Unknown result type (might be due to invalid IL or missing references)
				//IL_0686: Invalid comparison between Unknown and I4
				//IL_0325: Unknown result type (might be due to invalid IL or missing references)
				//IL_044b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0451: Invalid comparison between Unknown and I4
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_0296: Invalid comparison between Unknown and I4
				//IL_0dba: Unknown result type (might be due to invalid IL or missing references)
				//IL_0df0: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_070c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f4e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f54: Invalid comparison between Unknown and I4
				//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cf: Expected O, but got Unknown
				//IL_0f84: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f89: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f8b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f8d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f93: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f98: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f9a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0fb7: Expected I4, but got Unknown
				//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ec: Expected O, but got Unknown
				//IL_0794: Unknown result type (might be due to invalid IL or missing references)
				//IL_0589: Unknown result type (might be due to invalid IL or missing references)
				//IL_058f: Invalid comparison between Unknown and I4
				//IL_0fdc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ff6: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ab: Expected O, but got Unknown
				//IL_109e: Unknown result type (might be due to invalid IL or missing references)
				//IL_10b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_10e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_10e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_1100: Unknown result type (might be due to invalid IL or missing references)
				//IL_1105: Unknown result type (might be due to invalid IL or missing references)
				//IL_135e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1364: Invalid comparison between Unknown and I4
				//IL_11dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_081c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0836: Unknown result type (might be due to invalid IL or missing references)
				//IL_13a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_13c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b8a: Unknown result type (might be due to invalid IL or missing references)
				//IL_146b: Unknown result type (might be due to invalid IL or missing references)
				//IL_1485: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bfe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c13: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c59: Unknown result type (might be due to invalid IL or missing references)
				//IL_0caa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0caf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cb4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ccf: Unknown result type (might be due to invalid IL or missing references)
				//IL_160b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a7d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a92: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b29: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b2e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
				SuperchargedFollowersAIState myState;
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_00be;
				case 1:
					<>1__state = -1;
					goto IL_00be;
				case 2:
					<>1__state = -1;
					goto IL_01c3;
				case 3:
					<>1__state = -1;
					goto IL_0221;
				case 4:
					<>1__state = -1;
					goto IL_02fd;
				case 5:
					<>1__state = -1;
					goto IL_195b;
				case 6:
					<>1__state = -1;
					<>4__this.myState = SuperchargedFollowersAIState.Searching;
					<chasing>5__4 = false;
					goto IL_0d04;
				case 7:
					<>1__state = -1;
					if ((Object)(object)<>4__this.follower.TargetObject == (Object)null)
					{
						Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " was chasing, now null after waiting"));
						<>4__this.myState = SuperchargedFollowersAIState.Searching;
						<chasing>5__4 = false;
						goto IL_0d04;
					}
					if (<>4__this.follower.Spine.AnimationName != "roll-stop" && (int)((UnitObject)<>4__this.follower).state.CURRENT_STATE == 1 && <>4__this.follower.Spine.AnimationName != "run")
					{
						<>4__this.follower.Spine.AnimationState.SetAnimation(1, "run", true);
					}
					((UnitObject)<>4__this.follower).state.LookAngle = Utils.GetAngle(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position);
					((SkeletonRenderer)<>4__this.follower.Spine).skeleton.ScaleX = (((double)((UnitObject)<>4__this.follower).state.LookAngle <= 90.0 || (double)((UnitObject)<>4__this.follower).state.LookAngle >= 270.0) ? (-1f) : 1f);
					if ((int)((UnitObject)<>4__this.follower).state.CURRENT_STATE == 0)
					{
						EnemyFollower follower = <>4__this.follower;
						if ((double)(follower.RepathTimer -= Time.deltaTime) < 0.0)
						{
							if (<>4__this.follower.CustomAttackLogic())
							{
								goto IL_0d04;
							}
							if ((double)<>4__this.follower.MaxAttackDelay < 0.0 || (double)Vector3.Distance(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position) < (double)<>4__this.follower.AttackWithinRange)
							{
								if (<>4__this.follower.ChargeAndAttack && ((double)<>4__this.follower.MaxAttackDelay < 0.0 || (double)<>4__this.follower.AttackDelay < 0.0))
								{
									try
									{
										<health>5__13 = <>4__this.follower.TargetObject.GetComponent<Health>();
										if (<health>5__13.HP <= 0f)
										{
											Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " attacked at 0 hp, so find new target"));
											<>4__this.myState = SuperchargedFollowersAIState.Searching;
											<chasing>5__4 = false;
										}
										else
										{
											((UnitObject)<>4__this.follower).health.invincible = false;
											<>4__this.myState = SuperchargedFollowersAIState.Attacking;
											<chasing>5__4 = false;
										}
									}
									catch (Exception ex)
									{
										<e>5__14 = ex;
										Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " attacked a null enemy, reset to Searching"));
										Plugin.Log.LogInfo((object)("Attacking an null enemy " + <e>5__14.Message));
										<>4__this.myState = SuperchargedFollowersAIState.Searching;
										<chasing>5__4 = false;
									}
									goto IL_0d04;
								}
								if (!((UnitObject)<>4__this.follower).health.HasShield)
								{
									<>4__this.follower.Angle = (float)(((double)Utils.GetAngle(<>4__this.follower.TargetObject.transform.position, ((Component)<>4__this.follower).transform.position) + (double)Random.Range(-20, 20)) * (Math.PI / 180.0));
									<>4__this.follower.TargetPosition = <>4__this.follower.TargetObject.transform.position + new Vector3(<>4__this.follower.MaintainTargetDistance * Mathf.Cos(<>4__this.follower.Angle), <>4__this.follower.MaintainTargetDistance * Mathf.Sin(<>4__this.follower.Angle));
									<>4__this.follower.FindPath(<>4__this.follower.TargetPosition);
								}
							}
							else if ((double)Vector3.Distance(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position) > (double)<>4__this.follower.MoveCloserDistance + (((UnitObject)<>4__this.follower).health.HasShield ? 0.0 : 1.0))
							{
								<>4__this.follower.Angle = (float)(((double)Utils.GetAngle(<>4__this.follower.TargetObject.transform.position, ((Component)<>4__this.follower).transform.position) + (double)Random.Range(-20, 20)) * (Math.PI / 180.0));
								<>4__this.follower.TargetPosition = <>4__this.follower.TargetObject.transform.position + new Vector3(<>4__this.follower.MaintainTargetDistance * Mathf.Cos(<>4__this.follower.Angle), <>4__this.follower.MaintainTargetDistance * Mathf.Sin(<>4__this.follower.Angle));
								<>4__this.follower.FindPath(<>4__this.follower.TargetPosition);
							}
						}
					}
					goto IL_0cdd;
				case 8:
					<>1__state = -1;
					goto IL_0cf5;
				case 9:
					<>1__state = -1;
					goto IL_195b;
				case 10:
					<>1__state = -1;
					goto IL_1875;
				case 11:
					<>1__state = -1;
					goto IL_195b;
				case 12:
					<>1__state = -1;
					goto IL_195b;
				case 13:
					<>1__state = -1;
					goto IL_195b;
				case 14:
					<>1__state = -1;
					goto IL_197b;
				case 15:
					{
						<>1__state = -1;
						return false;
					}
					IL_185c:
					<>2__current = null;
					<>1__state = 10;
					return true;
					IL_0d04:
					<>2__current = null;
					<>1__state = 9;
					return true;
					IL_195b:
					<nextTarget>5__3 = null;
					<>2__current = null;
					<>1__state = 14;
					return true;
					IL_00be:
					if (!GameManager.RoomActive)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					((SkeletonRenderer)<>4__this.follower.Spine).Initialize(false);
					((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)0;
					<>4__this.follower.Spine.AnimationState.SetAnimation(0, "Conversations/idle-nice", true);
					<followerData>5__1 = ((Component)<>4__this.follower).GetComponentInParent<Follower>();
					<>4__this.myState = SuperchargedFollowersAIState.Searching;
					Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " is ready for battle"));
					<Loop>5__2 = true;
					goto IL_197b;
					IL_1875:
					if (<attacking>5__10)
					{
						State cURRENT_STATE2;
						try
						{
							((UnitObject)<>4__this.follower).Seperate(0.5f, false);
							if (!((Object)(object)<>4__this.follower.TargetObject == (Object)null))
							{
								if ((int)((UnitObject)<>4__this.follower).state.CURRENT_STATE == 0)
								{
									((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)1;
								}
								State cURRENT_STATE = ((UnitObject)<>4__this.follower).state.CURRENT_STATE;
								<>s__15 = cURRENT_STATE;
								cURRENT_STATE2 = <>s__15;
								switch (cURRENT_STATE2 - 1)
								{
								case 0:
									((UnitObject)<>4__this.follower).state.LookAngle = Utils.GetAngle(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position);
									((SkeletonRenderer)<>4__this.follower.Spine).skeleton.ScaleX = (((double)((UnitObject)<>4__this.follower).state.LookAngle <= 90.0 || (double)((UnitObject)<>4__this.follower).state.LookAngle >= 270.0) ? (-1f) : 1f);
									((UnitObject)<>4__this.follower).state.LookAngle = (((UnitObject)<>4__this.follower).state.facingAngle = Utils.GetAngle(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position));
									if ((double)Vector2.Distance(Vector2.op_Implicit(((Component)<>4__this.follower).transform.position), Vector2.op_Implicit(<>4__this.follower.TargetObject.transform.position)) < (double)<attackDistance>5__7)
									{
										((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)4;
										<animationName>5__16 = "attack-charge";
										<>4__this.follower.Spine.AnimationState.SetAnimation(1, <animationName>5__16, false);
										<animationName>5__16 = null;
									}
									else
									{
										EnemyFollower follower2 = <>4__this.follower;
										if ((double)(follower2.RepathTimer += Time.deltaTime) > 0.20000000298023224)
										{
											<>4__this.follower.RepathTimer = 0f;
											((UnitObject)<>4__this.follower).givePath(<>4__this.follower.TargetObject.transform.position, (GameObject)null, false, false);
										}
										if ((Object)(object)<>4__this.follower.damageColliderEvents != (Object)null)
										{
											if ((double)((UnitObject)<>4__this.follower).state.Timer < 0.20000000298023224 && !((UnitObject)<>4__this.follower).health.WasJustParried)
											{
												<>4__this.follower.damageColliderEvents.SetActive(true);
											}
											else
											{
												<>4__this.follower.damageColliderEvents.SetActive(false);
											}
										}
									}
									if ((Object)(object)<>4__this.follower.damageColliderEvents != (Object)null)
									{
										<>4__this.follower.damageColliderEvents.SetActive(false);
									}
									break;
								case 3:
								{
									if ((Object)(object)<>4__this.follower.damageColliderEvents != (Object)null)
									{
										<>4__this.follower.damageColliderEvents.SetActive(false);
									}
									StateMachine state2 = ((UnitObject)<>4__this.follower).state;
									state2.Timer += Time.deltaTime;
									if ((double)((UnitObject)<>4__this.follower).state.Timer >= (double)<SignPostDelay>5__11 - (double)EnemyFollower.signPostParryWindow)
									{
										<>4__this.follower.canBeParried = true;
									}
									if ((int)((UnitObject)<>4__this.follower).health.team == 1 && (Object)(object)<>4__this.follower.TargetObject != (Object)null)
									{
										((UnitObject)<>4__this.follower).state.LookAngle = Utils.GetAngle(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position);
										((SkeletonRenderer)<>4__this.follower.Spine).skeleton.ScaleX = (((double)((UnitObject)<>4__this.follower).state.LookAngle <= 90.0 || (double)((UnitObject)<>4__this.follower).state.LookAngle >= 270.0) ? (-1f) : 1f);
										((UnitObject)<>4__this.follower).state.LookAngle = (((UnitObject)<>4__this.follower).state.facingAngle = Utils.GetAngle(((Component)<>4__this.follower).transform.position, <>4__this.follower.TargetObject.transform.position));
									}
									if ((double)((UnitObject)<>4__this.follower).state.Timer >= (double)<SignPostDelay>5__11)
									{
										((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)5;
										<animationName>5__17 = ((<>4__this.follower.variant == 0) ? "attack-impact" : "attack-impact-multi");
										<>4__this.follower.Spine.AnimationState.SetAnimation(1, <animationName>5__17, false);
										<>4__this.follower.canBeParried = true;
										((MonoBehaviour)<>4__this.follower).StartCoroutine(<>4__this.follower.EnableDamageCollider(0f));
										if (<>4__this.follower.variant == 1)
										{
											((MonoBehaviour)<>4__this.follower).StartCoroutine(<>4__this.follower.EnableDamageCollider(0.7f));
											((MonoBehaviour)<>4__this.follower).StartCoroutine(<>4__this.follower.EnableDamageCollider(1.4f));
										}
										if (!string.IsNullOrEmpty(<>4__this.follower.attackSoundPath))
										{
											AudioManager.Instance.PlayOneShot(<>4__this.follower.attackSoundPath, ((Component)<>4__this.follower).transform.position);
										}
									}
									break;
								}
								case 4:
								{
									if ((double)<AttackSpeed>5__9 > 0.0)
									{
										<AttackSpeed>5__9 -= 1f * GameManager.DeltaTime;
									}
									<>4__this.follower.Spine.AnimationState.SetAnimation(0, "Conversations/idle-nice", true);
									<>4__this.follower.canBeParried = ((UnitObject)<>4__this.follower).state.Timer <= EnemyFollower.attackParryWindow;
									StateMachine state = ((UnitObject)<>4__this.follower).state;
									if ((double)(state.Timer += Time.deltaTime) >= 0.6)
									{
										if (++<AttackCount>5__6 <= <NumAttacks>5__5)
										{
											<AttackSpeed>5__9 = <MaxAttackSpeed>5__8 + (float)((3 - <NumAttacks>5__5) * 2);
											((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)4;
											<>4__this.follower.variant = Random.Range(0, 2);
											<animationName>5__18 = "attack-charge";
											<>4__this.follower.Spine.AnimationState.SetAnimation(1, <animationName>5__18, false);
											<SignPostDelay>5__11 = 0.3f;
										}
										else
										{
											<attacking>5__10 = false;
										}
									}
									break;
								}
								}
								goto IL_185c;
							}
							Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " lost enemy, reset to search"));
							<>4__this.myState = SuperchargedFollowersAIState.Searching;
							<attacking>5__10 = false;
						}
						catch (Exception ex)
						{
							<e>5__19 = ex;
							ManualLogSource log = Plugin.Log;
							string[] obj = new string[8]
							{
								"[STATE: ",
								<>4__this.myState.ToString(),
								"]",
								<followerData>5__1.Brain.Info.Name,
								" hard reset to idle due to something went wrong when attacking at state [",
								null,
								null,
								null
							};
							cURRENT_STATE2 = ((UnitObject)<>4__this.follower).state.CURRENT_STATE;
							obj[5] = ((object)(State)(ref cURRENT_STATE2)).ToString();
							obj[6] = "]: ";
							obj[7] = <e>5__19.Message;
							log.LogInfo((object)string.Concat(obj));
							<>4__this.myState = SuperchargedFollowersAIState.Searching;
							<attacking>5__10 = false;
						}
					}
					<>4__this.myState = SuperchargedFollowersAIState.Chasing;
					<>2__current = null;
					<>1__state = 11;
					return true;
					IL_0cdd:
					<>2__current = null;
					<>1__state = 8;
					return true;
					IL_01c3:
					if (!GameManager.RoomActive)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_0221;
					IL_0319:
					<>4__this.follower.MyState = (State)0;
					((UnitObject)<>4__this.follower).state.CURRENT_STATE = (State)0;
					<>4__this.follower.Spine.AnimationState.SetAnimation(0, "Conversations/idle-nice", true);
					<>4__this.follower.AttackDelay = Random.Range(<>4__this.follower.AttackDelayRandomRange.x, <>4__this.follower.AttackDelayRandomRange.y);
					if (((UnitObject)<>4__this.follower).health.HasShield)
					{
						<>4__this.follower.AttackDelay = 2.5f;
					}
					<>4__this.follower.MaxAttackDelay = Random.Range(<>4__this.follower.MaxAttackDelayRandomRange.x, <>4__this.follower.MaxAttackDelayRandomRange.y);
					<chasing>5__4 = true;
					goto IL_0cf5;
					IL_0d21:
					if ((Object)(object)<>4__this.follower.TargetObject == (Object)null)
					{
						Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " precheck: lost enemy, reset to search"));
						<>4__this.myState = SuperchargedFollowersAIState.Searching;
						goto IL_195b;
					}
					<>4__this.follower.MyState = (State)2;
					((UnitObject)<>4__this.follower).UsePathing = true;
					((UnitObject)<>4__this.follower).givePath(<>4__this.follower.TargetObject.transform.position, (GameObject)null, false, false);
					<>4__this.follower.Spine.AnimationState.SetAnimation(1, "run", true);
					<>4__this.follower.RepathTimer = 0f;
					<NumAttacks>5__5 = ((!<>4__this.follower.DoubleAttack) ? 1 : 2);
					<AttackCount>5__6 = 1;
					<attackDistance>5__7 = 1.5f;
					<MaxAttackSpeed>5__8 = 15f;
					<AttackSpeed>5__9 = <MaxAttackSpeed>5__8;
					<attacking>5__10 = true;
					<SignPostDelay>5__11 = 0.5f;
					goto IL_1875;
					IL_0221:
					if (Health.team2.Count == 0)
					{
						<>4__this.follower.Spine.AnimationState.SetAnimation(1, "Conversations/idle-nice", true);
						<>4__this.myState = SuperchargedFollowersAIState.Idle;
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 3;
						return true;
					}
					myState = <>4__this.myState;
					<>s__12 = myState;
					switch (<>s__12)
					{
					case SuperchargedFollowersAIState.Searching:
						break;
					case SuperchargedFollowersAIState.Chasing:
						goto IL_0319;
					case SuperchargedFollowersAIState.Attacking:
						goto IL_0d21;
					case SuperchargedFollowersAIState.Idle:
						<>4__this.myState = SuperchargedFollowersAIState.Searching;
						<>2__current = null;
						<>1__state = 12;
						return true;
					default:
						Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " is fallback to default state, will search again"));
						<>4__this.myState = SuperchargedFollowersAIState.Searching;
						<>2__current = null;
						<>1__state = 13;
						return true;
					}
					<nextTarget>5__3 = <>4__this.GetRandomEnemy();
					if ((Object)(object)<nextTarget>5__3 != (Object)null && (int)<nextTarget>5__3.team != 1)
					{
						<>4__this.follower.TargetObject = ((Component)<nextTarget>5__3).gameObject;
						<>4__this.myState = SuperchargedFollowersAIState.Chasing;
						goto IL_02fd;
					}
					<>4__this.myState = SuperchargedFollowersAIState.Idle;
					<>2__current = (object)new WaitForSeconds(0.05f);
					<>1__state = 4;
					return true;
					IL_0cf5:
					if (<chasing>5__4)
					{
						if ((Object)(object)<>4__this.follower.TargetObject == (Object)null || (int)<>4__this.follower.TargetObject.GetComponent<Health>().team == 1)
						{
							Plugin.Log.LogInfo((object)("[STATE: " + <>4__this.myState.ToString() + "]" + <followerData>5__1.Brain.Info.Name + " was chasing, now null"));
							<>2__current = (object)new WaitForSeconds(0.2f);
							<>1__state = 6;
							return true;
						}
						if ((Object)(object)<>4__this.follower.damageColliderEvents != (Object)null)
						{
							<>4__this.follower.damageColliderEvents.SetActive(false);
						}
						EnemyFollower follower3 = <>4__this.follower;
						follower3.TeleportDelay -= Time.deltaTime;
						EnemyFollower follower4 = <>4__this.follower;
						follower4.AttackDelay -= Time.deltaTime;
						EnemyFollower follower5 = <>4__this.follower;
						follower5.MaxAttackDelay -= Time.deltaTime;
						if ((int)<>4__this.follower.MyState == 0)
						{
							<>2__current = (object)new WaitForSeconds(0.02f);
							<>1__state = 7;
							return true;
						}
						goto IL_0cdd;
					}
					goto IL_0d04;
					IL_197b:
					if (<Loop>5__2)
					{
						goto IL_01c3;
					}
					<>2__current = null;
					<>1__state = 15;
					return true;
					IL_02fd:
					<>2__current = null;
					<>1__state = 5;
					return true;
				}
			}

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

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

		private EnemyFollower follower;

		private SuperchargedFollowersAIState myState = SuperchargedFollowersAIState.Idle;

		public void Start()
		{
			follower = ((Component)this).GetComponent<EnemyFollower>();
			Plugin.Log.LogInfo((object)("follower is " + (object)follower));
		}

		public Health GetRandomEnemy()
		{
			List<Health> team = Health.team2;
			int num = 10;
			int num2 = 0;
			if (team.Count > 0)
			{
				int index = Random.Range(0, team.Count);
				while (team[index].HP <= 0f && num2 < num)
				{
					Plugin.Log.LogInfo((object)"Attempting to find random enemy again as targeted a dead enemy");
					index = Random.Range(0, team.Count);
					num2++;
				}
				return team[index];
			}
			Plugin.Log.LogInfo((object)"Returning none");
			return null;
		}

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

		[IteratorStateMachine(typeof(<RepositionSelfIfOutside>d__5))]
		public IEnumerator<object> RepositionSelfIfOutside()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RepositionSelfIfOutside>d__5(0)
			{
				<>4__this = this
			};
		}
	}
	public enum SuperchargedFollowersAIState
	{
		Idle,
		Searching,
		Chasing,
		Attacking
	}
}