Decompiled source of EnemiesPlus v1.0.5

EnemiesPlus.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 EntityStates;
using EntityStates.BeetleGuardMonster;
using EntityStates.Bell.BellWeapon;
using EntityStates.ImpMonster;
using EntityStates.LemurianMonster;
using EntityStates.LunarWisp;
using EntityStates.MagmaWorm;
using EntityStates.Wisp1Monster;
using HG;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.EntityStates.LemurianMonster;
using On.EntityStates.LunarWisp;
using On.EntityStates.Wisp1Monster;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("EnemiesPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a6ca0a77f3c426debb87d97738f624a9da9fef75")]
[assembly: AssemblyProduct("EnemiesPlus")]
[assembly: AssemblyTitle("EnemiesPlus")]
[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 EnemiesPlus
{
	[BepInPlugin("com.Nuxlar.EnemiesPlus", "EnemiesPlus", "1.0.5")]
	public class EnemiesPlus : BaseUnityPlugin
	{
		private GameObject beetleMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleMaster.prefab").WaitForCompletion();

		private GameObject beetleBody = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleBody.prefab").WaitForCompletion();

		private GameObject lemMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion();

		private GameObject lemBody = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianBody.prefab").WaitForCompletion();

		private GameObject impMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpMaster.prefab").WaitForCompletion();

		private GameObject impBody = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpBody.prefab").WaitForCompletion();

		private GameObject beetleQueenSpit = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenSpit.prefab").WaitForCompletion();

		private GameObject beetleQueenAcid = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenAcid.prefab").WaitForCompletion();

		public static GameObject beetleSpit = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenSpit.prefab").WaitForCompletion(), "BeetleSpitProjectileNux");

		public static GameObject beetleSpitGhost = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenSpitGhost.prefab").WaitForCompletion(), "BeetleSpitProjectileGhostNux");

		public static GameObject beetleSpitExplosion = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleSpitExplosion.prefab").WaitForCompletion(), "BeetleSpitExplosionNux");

		public static GameObject voidSpike = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ImpBoss/ImpVoidspikeProjectile.prefab").WaitForCompletion(), "VoidSpikeNux");

		private SpawnCard greaterWispCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/GreaterWisp/cscGreaterWisp.asset").WaitForCompletion();

		private SpawnCard bellCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Bell/cscBell.asset").WaitForCompletion();

		private BuffDef beetleJuice = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Beetle/bdBeetleJuice.asset").WaitForCompletion();

		private GameObject beetleGuard = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleGuardBody.prefab").WaitForCompletion();

		private GameObject beetleGuardMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleGuardMaster.prefab").WaitForCompletion();

		private BuffDef teamWarcryBuff = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/TeamWarCry/bdTeamWarCry.asset").WaitForCompletion();

		private GameObject frenzyAura = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/TeamWarCry/TeamWarCryAura.prefab").WaitForCompletion(), "BGFrenzyAura");

		private static Material frenzyMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/WardOnLevel/matWarbannerBuffBillboard.mat").WaitForCompletion();

		private GameObject bellMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellMaster.prefab").WaitForCompletion();

		private GameObject bell = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellBody.prefab").WaitForCompletion();

		private Sprite fireBuffSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffOnFireIcon.tif").WaitForCompletion();

		private GameObject lunarGolemMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemMaster.prefab").WaitForCompletion();

		private GameObject lunarGolem = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemBody.prefab").WaitForCompletion();

		private GameObject lunarWisp = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispBody.prefab").WaitForCompletion();

		private GameObject lunarWispMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispMaster.prefab").WaitForCompletion();

		private GameObject lunarWispTrackingBomb = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispTrackingBomb.prefab").WaitForCompletion(), "LunarWispOrbNux");

		private GameObject magmaWorm = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormBody.prefab").WaitForCompletion();

		private GameObject electricWorm = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormBody.prefab").WaitForCompletion();

		private GameObject magmaWormMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormMaster.prefab").WaitForCompletion();

		private GameObject electricWormMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormMaster.prefab").WaitForCompletion();

		public static GameObject helfireIgniteEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BurnNearby/HelfireIgniteEffect.prefab").WaitForCompletion();

		public static BuffDef frenzyBuff;

		public static BuffDef helfireBuff;

		private ModdedDamageType beetleJuiceDT;

		private ModdedDamageType helfireDT;

		private DotIndex helfireDotIdx;

		public static ConfigEntry<bool> enableBeetleChanges;

		public static ConfigEntry<bool> enableBeetleFamilyChanges;

		public static ConfigEntry<bool> enableBeetleGuardChanges;

		public static ConfigEntry<bool> enableBeetleQueenChanges;

		public static ConfigEntry<bool> enableLemurianChanges;

		public static ConfigEntry<bool> enableWispChanges;

		public static ConfigEntry<bool> enableGreaterWispChanges;

		public static ConfigEntry<bool> enableBellChanges;

		public static ConfigEntry<bool> enableImpChanges;

		public static ConfigEntry<bool> enableWormChanges;

		public static ConfigEntry<bool> enableLunarGolemChanges;

		public static ConfigEntry<bool> enableLunarWispChanges;

		private static ConfigFile EPConfig { get; set; }

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_01a7: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4e: Expected O, but got Unknown
			//IL_0b55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5f: Expected O, but got Unknown
			//IL_0b66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b70: Expected O, but got Unknown
			//IL_0b77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b81: Expected O, but got Unknown
			//IL_0b88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b92: Expected O, but got Unknown
			//IL_0b99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Expected O, but got Unknown
			//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb4: Expected O, but got Unknown
			//IL_0bbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc5: Expected O, but got Unknown
			//IL_0bcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd6: Expected O, but got Unknown
			//IL_0bdd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be7: Expected O, but got Unknown
			//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf8: Expected O, but got Unknown
			//IL_0bff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c05: Expected O, but got Unknown
			//IL_0c18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c33: Expected O, but got Unknown
			//IL_0c3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c44: Expected O, but got Unknown
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0838: Unknown result type (might be due to invalid IL or missing references)
			//IL_083d: Unknown result type (might be due to invalid IL or missing references)
			//IL_071d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b38: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_089a: Unknown result type (might be due to invalid IL or missing references)
			//IL_092c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_0998: Unknown result type (might be due to invalid IL or missing references)
			//IL_098e: Unknown result type (might be due to invalid IL or missing references)
			EPConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.EnemiesPlus.cfg", true);
			enableBeetleFamilyChanges = EPConfig.Bind<bool>("General", "Enable Beetle Family Changes", true, "Makes BeetleJuice stackable");
			enableBeetleChanges = EPConfig.Bind<bool>("General", "Enable Beetle Changes", true, "Adds projectile attack to beetles");
			enableBeetleGuardChanges = EPConfig.Bind<bool>("General", "Enable Beetle Guard Changes", true, "Adds rally cry to beetle guards");
			enableBeetleQueenChanges = EPConfig.Bind<bool>("General", "Enable Beetle Queen Changes", true, "Adds BeetleJuice to Beetle Queen attacks and spit explodes mid air");
			enableLemurianChanges = EPConfig.Bind<bool>("General", "Enable Lemurian Changes", true, "Adds slight leap to Lemurian bite");
			enableWispChanges = EPConfig.Bind<bool>("General", "Enable Wisp Changes", true, "Increases Wisp bullet count");
			enableGreaterWispChanges = EPConfig.Bind<bool>("General", "Enable Greater Wisp Changes", true, "Decreases Greater Wisp credit cost");
			enableBellChanges = EPConfig.Bind<bool>("General", "Enable Brass Contraption Changes", true, "Adds a new ability, BuffBeam to Brass Contraptions");
			enableImpChanges = EPConfig.Bind<bool>("General", "Enable Imp Changes", true, "Changes Imp's primary attack to be ranged");
			enableWormChanges = EPConfig.Bind<bool>("General", "Enable Worm Changes", true, "Changes Worms to have better targeting and adds a leap attack");
			enableLunarGolemChanges = EPConfig.Bind<bool>("General", "Enable Lunar Golem Changes", true, "Adds a new ability, Lunar Shell to Lunar Golems");
			enableLunarWispChanges = EPConfig.Bind<bool>("General", "Enable Lunar Wisp Changes", true, "Increases Lunar Wisp movement speed and acceleration, orb applies helfire");
			if (enableBeetleFamilyChanges.Value)
			{
				beetleJuice.canStack = true;
			}
			beetleJuiceDT = DamageAPI.ReserveDamageType();
			ModdedDamageTypeHolderComponent val = beetleSpit.AddComponent<ModdedDamageTypeHolderComponent>();
			if (enableBeetleQueenChanges.Value)
			{
				beetleQueenSpit.GetComponent<ProjectileImpactExplosion>().destroyOnEnemy = true;
				val.Add(beetleJuiceDT);
				beetleQueenSpit.AddComponent<ModdedDamageTypeHolderComponent>().Add(beetleJuiceDT);
				beetleQueenAcid.AddComponent<ModdedDamageTypeHolderComponent>().Add(beetleJuiceDT);
			}
			helfireDT = DamageAPI.ReserveDamageType();
			lunarWispTrackingBomb.AddComponent<ModdedDamageTypeHolderComponent>().Add(helfireDT);
			if (enableGreaterWispChanges.Value)
			{
				greaterWispCard.directorCreditCost = 120;
			}
			bool flag = default(bool);
			ContentAddition.AddEntityState<BeetleSpit>(ref flag);
			ContentAddition.AddEntityState<SpikeSlash>(ref flag);
			ContentAddition.AddEntityState<RallyCry>(ref flag);
			ContentAddition.AddEntityState<BuffBeamPlus>(ref flag);
			Transform transform = beetleSpit.transform;
			transform.localScale /= 2f;
			beetleSpit.GetComponent<Rigidbody>().useGravity = false;
			beetleSpit.GetComponent<ProjectileController>().ghostPrefab = beetleSpitGhost;
			ProjectileImpactExplosion component = beetleSpit.GetComponent<ProjectileImpactExplosion>();
			component.impactEffect = beetleSpitExplosion;
			((ProjectileExplosion)component).childrenProjectilePrefab = null;
			component.destroyOnEnemy = true;
			((ProjectileExplosion)component).fireChildren = false;
			((ProjectileExplosion)component).blastRadius = 2f;
			Transform transform2 = beetleSpitGhost.transform;
			transform2.localScale /= 2f;
			Transform child = beetleSpitGhost.transform.GetChild(1);
			child.localScale /= 2f;
			Transform child2 = beetleSpitGhost.transform.GetChild(0).GetChild(0);
			child2.localScale /= 2f;
			Transform child3 = beetleSpitGhost.transform.GetChild(1).GetChild(0);
			child3.localScale /= 2f;
			Transform child4 = beetleSpitGhost.transform.GetChild(1).GetChild(1);
			child4.localScale /= 2f;
			Transform child5 = beetleSpitExplosion.transform.GetChild(0);
			child5.localScale /= 2f;
			foreach (Transform item in beetleSpitExplosion.transform.GetChild(0))
			{
				item.localScale /= 2f;
			}
			ContentAddition.AddEffect(beetleSpitExplosion);
			if (enableBeetleChanges.Value)
			{
				SkillLocator component2 = beetleBody.GetComponent<SkillLocator>();
				component2.primary.skillFamily.variants[0].skillDef.activationState = new SerializableEntityStateType(typeof(BeetleSpit));
				component2.primary.skillFamily.variants[0].skillDef.baseRechargeInterval = 3f;
				component2.secondary.skillFamily.variants[0].skillDef.baseMaxStock = 0;
				AISkillDriver[] components = beetleMaster.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val3 in components)
				{
					switch (val3.customName)
					{
					case "HeadbuttOffNodegraph":
						val3.minDistance = 5f;
						val3.maxDistance = 20f;
						break;
					case "ChaseOffNodegraph":
						val3.maxDistance = 5f;
						val3.movementType = (MovementType)3;
						break;
					case "FollowNodeGraphToTarget":
						val3.minDistance = 15f;
						break;
					}
				}
			}
			SetupBGBuff();
			frenzyAura.GetComponent<DestroyOnTimer>().duration = 8f;
			((Renderer)((Component)frenzyAura.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>()).sharedMaterial = frenzyMat;
			ContentAddition.AddEntityState<RallyCry>(ref flag);
			if (enableBeetleGuardChanges.Value)
			{
				AISkillDriver obj = beetleGuardMaster.AddComponent<AISkillDriver>();
				obj.customName = "RallyCry";
				obj.skillSlot = (SkillSlot)2;
				obj.requireSkillReady = true;
				obj.movementType = (MovementType)0;
				beetleGuard.GetComponent<SkillLocator>().utility.skillFamily.variants[0].skillDef.activationState = new SerializableEntityStateType(typeof(RallyCry));
			}
			SetupHelfireBuff();
			if (enableBellChanges.Value)
			{
				BuffBeamSetup();
			}
			if (enableImpChanges.Value)
			{
				SkillDef skillDef = impBody.GetComponent<SkillLocator>().primary.skillFamily.variants[0].skillDef;
				skillDef.activationState = new SerializableEntityStateType(typeof(SpikeSlash));
				skillDef.baseRechargeInterval = 5f;
				AISkillDriver[] components = impMaster.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val4 in components)
				{
					switch (val4.customName)
					{
					case "Slash":
						val4.minDistance = 15f;
						val4.maxDistance = 45f;
						break;
					case "LeaveNodegraph":
						val4.minDistance = 0f;
						val4.maxDistance = 15f;
						val4.shouldSprint = true;
						val4.movementType = (MovementType)3;
						break;
					case "StrafeBecausePrimaryIsntReady":
						val4.minDistance = 15f;
						break;
					case "BlinkBecauseClose":
						val4.minDistance = 25f;
						val4.maxDistance = 45f;
						break;
					case "PathToTarget":
						val4.minDistance = 15f;
						break;
					}
				}
			}
			if (enableLemurianChanges.Value)
			{
				lemBody.GetComponent<SkillLocator>().secondary.skillFamily.variants[0].skillDef.baseRechargeInterval = 1f;
			}
			voidSpike.GetComponent<ProjectileImpactExplosion>().destroyOnWorld = true;
			if (enableWormChanges.Value)
			{
				ParticleSystem[] componentsInChildren = ((Component)magmaWorm.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem obj2 in componentsInChildren)
				{
					obj2.startSize *= 2f;
				}
				SkillDef skillDef2 = magmaWorm.GetComponent<SkillLocator>().utility.skillFamily.variants[0].skillDef;
				skillDef2.activationState = new SerializableEntityStateType(typeof(Leap));
				skillDef2.baseRechargeInterval = 60f;
				skillDef2.activationStateMachineName = "Weapon";
				AISkillDriver[] components = magmaWormMaster.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val5 in components)
				{
					if (val5.customName == "Blink")
					{
						val5.shouldSprint = true;
						val5.minDistance = 0f;
						val5.aimType = (AimType)1;
					}
					else
					{
						val5.skillSlot = (SkillSlot)(-1);
					}
				}
				componentsInChildren = ((Component)electricWorm.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem obj3 in componentsInChildren)
				{
					obj3.startSize *= 2f;
				}
				SkillDef skillDef3 = electricWorm.GetComponent<SkillLocator>().utility.skillFamily.variants[0].skillDef;
				skillDef3.activationState = new SerializableEntityStateType(typeof(Leap));
				skillDef3.baseRechargeInterval = 60f;
				skillDef3.activationStateMachineName = "Weapon";
				components = electricWormMaster.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val6 in components)
				{
					if (val6.customName == "Blink")
					{
						val6.shouldSprint = true;
						val6.minDistance = 0f;
						val6.aimType = (AimType)1;
					}
					else
					{
						val6.skillSlot = (SkillSlot)(-1);
					}
				}
			}
			if (enableLunarWispChanges.Value)
			{
				CharacterBody component3 = lunarWisp.GetComponent<CharacterBody>();
				component3.baseMoveSpeed = 20f;
				component3.baseAcceleration = 20f;
				AISkillDriver[] components = lunarWispMaster.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val7 in components)
				{
					switch (val7.customName)
					{
					case "Back Up":
						val7.maxDistance = 15f;
						break;
					case "Minigun":
						val7.minDistance = 15f;
						val7.maxDistance = 75f;
						break;
					case "Chase":
						val7.minDistance = 30f;
						val7.shouldSprint = true;
						break;
					}
				}
			}
			if (enableLunarGolemChanges.Value)
			{
				lunarGolem.GetComponent<SetStateOnHurt>().canBeHitStunned = false;
				lunarGolem.GetComponent<SkillLocator>().secondary.skillFamily.variants[0].skillDef.interruptPriority = (InterruptPriority)6;
				(from driver in lunarGolemMaster.GetComponents<AISkillDriver>()
					where driver.customName == "StrafeAndShoot"
					select driver).First().requireSkillReady = true;
				AISkillDriver obj4 = lunarGolemMaster.AddComponent<AISkillDriver>();
				obj4.customName = "LunarShell";
				obj4.skillSlot = (SkillSlot)1;
				obj4.requireSkillReady = true;
				obj4.requireEquipmentReady = false;
				obj4.driverUpdateTimerOverride = 3f;
				obj4.moveTargetType = (TargetType)0;
				obj4.movementType = (MovementType)1;
			}
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(RearrangeSkillDrivers);
			CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(AddHelfireEffect);
			CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(RemoveHelfireEffect);
			Bite.OnEnter += new hook_OnEnter(BiteLeap);
			FireEmbers.OnEnter += new hook_OnEnter(IncreaseWispEmbers);
			SeekingBomb.OnEnter += new hook_OnEnter(ReplaceSeekingBombPrefab);
			WormBodyPositionsDriver.FixedUpdateServer += new hook_FixedUpdateServer(RemoveRandomTurns);
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(AddBeetleJuiceStack);
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(ApplyHelfire);
			HealthComponent.Heal += new hook_Heal(PreventHelfireHeal);
			CharacterBody.UpdateAllTemporaryVisualEffects += new hook_UpdateAllTemporaryVisualEffects(AddFrenzyVFX);
			CustomDotBehaviour val8 = new CustomDotBehaviour(AddPercentHelfireDamage);
			helfireDotIdx = DotAPI.RegisterDotDef(0.2f, 0f, (DamageColorIndex)7, helfireBuff, val8, (CustomDotVisual)null);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AddFrenzyBehavior);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AddLunarShellBehavior);
		}

		private void RemoveRandomTurns(orig_FixedUpdateServer orig, WormBodyPositionsDriver self)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: 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)
			if (!enableWormChanges.Value)
			{
				orig.Invoke(self);
				return;
			}
			CharacterBody component = ((Component)self).gameObject.GetComponent<CharacterBody>();
			Vector3 val = self.referenceTransform.position;
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master) && ((object)(from machine in ((Component)self).gameObject.GetComponents<EntityStateMachine>()
				where machine.customName == "Weapon"
				select machine).First().state).GetType() != typeof(Leap))
			{
				BaseAI component2 = component.masterObject.GetComponent<BaseAI>();
				if (Object.op_Implicit((Object)(object)component2) && component2.currentEnemy != null && (Object)(object)component2.currentEnemy.characterBody != (Object)null)
				{
					val = component2.currentEnemy.characterBody.corePosition;
				}
			}
			float speedMultiplier = self.wormBodyPositions.speedMultiplier;
			Vector3 val2 = val - self.chaserPosition;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = (float)((self.chaserIsUnderground ? ((double)self.maxTurnSpeed) : ((double)self.maxTurnSpeed * (double)self.turnRateCoefficientAboveGround)) * (Math.PI / 180.0));
			Vector3 val3 = Vector3.RotateTowards(new Vector3(self.chaserVelocity.x, 0f, self.chaserVelocity.z), new Vector3(normalized.x, 0f, normalized.z) * speedMultiplier, num * Time.fixedDeltaTime, float.PositiveInfinity);
			val3 = ((Vector3)(ref val3)).normalized * speedMultiplier;
			float num2 = val.y - self.chaserPosition.y;
			float num3 = (0f - self.chaserVelocity.y) * self.yDamperConstant;
			float num4 = num2 * self.ySpringConstant;
			if (self.allowShoving && (double)Mathf.Abs(self.chaserVelocity.y) < (double)self.yShoveVelocityThreshold && (double)num2 > (double)self.yShovePositionThreshold)
			{
				val2 = self.chaserVelocity;
				self.chaserVelocity = Vector3Utils.XAZ(ref val2, self.chaserVelocity.y + self.yShoveForce * Time.fixedDeltaTime);
			}
			if (!self.chaserIsUnderground)
			{
				num4 *= self.wormForceCoefficientAboveGround;
				num3 *= self.wormForceCoefficientAboveGround;
			}
			val2 = self.chaserVelocity;
			self.chaserVelocity = Vector3Utils.XAZ(ref val2, self.chaserVelocity.y + (num4 + num3) * Time.fixedDeltaTime);
			self.chaserVelocity += Physics.gravity * Time.fixedDeltaTime;
			self.chaserVelocity = new Vector3(val3.x, self.chaserVelocity.y, val3.z);
			self.chaserPosition += self.chaserVelocity * Time.fixedDeltaTime;
			self.chasePositionVisualizer.position = self.chaserPosition;
			self.chaserIsUnderground = 0.0 - (double)num2 < (double)self.wormBodyPositions.undergroundTestYOffset;
			self.keyFrameGenerationTimer -= Time.deltaTime;
			if (!((double)self.keyFrameGenerationTimer > 0.0))
			{
				self.keyFrameGenerationTimer = self.keyFrameGenerationInterval;
				self.wormBodyPositions.AttemptToGenerateKeyFrame(self.wormBodyPositions.GetSynchronizedTimeStamp() + self.wormBodyPositions.followDelay, self.chaserPosition, self.chaserVelocity);
			}
		}

		private void ReplaceSeekingBombPrefab(orig_OnEnter orig, SeekingBomb self)
		{
			if (enableLunarWispChanges.Value)
			{
				SeekingBomb.projectilePrefab = lunarWispTrackingBomb;
			}
			orig.Invoke(self);
		}

		private void AddHelfireEffect(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if ((Object)(object)buffDef == (Object)(object)helfireBuff)
			{
				((Component)self).gameObject.AddComponent<NuxHelfireEffectController>();
			}
		}

		private void RemoveHelfireEffect(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if ((Object)(object)buffDef == (Object)(object)helfireBuff)
			{
				Object.Destroy((Object)(object)((Component)self).gameObject.GetComponent<NuxHelfireEffectController>());
			}
		}

		private void AddPercentHelfireDamage(DotController self, DotStack dotStack)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (dotStack.dotIndex == helfireDotIdx && Object.op_Implicit((Object)(object)self.victimBody) && Object.op_Implicit((Object)(object)self.victimBody.healthComponent))
			{
				dotStack.damageType = (DamageType)(dotStack.damageType | 1);
				dotStack.damage = self.victimBody.healthComponent.fullHealth * 0.1f / 10f * 0.2f;
			}
		}

		private void AddLunarShellBehavior(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && sender.HasBuff(Buffs.LunarShell))
			{
				args.armorAdd += 200f;
			}
		}

		private void BuffBeamSetup()
		{
			//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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = "BuffBeam";
			((Object)val).name = "BuffBeam";
			val.skillNameToken = "BuffBeam";
			val.skillDescriptionToken = "Creates a beam to a nearby ally and makes them invincible";
			val.activationState = new SerializableEntityStateType(typeof(BuffBeamPlus));
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)6;
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 30f;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.dontAllowPastMaxStocks = true;
			val.beginSkillCooldownOnSkillEnd = true;
			val.canceledFromSprinting = false;
			val.forceSprintDuringState = false;
			val.fullRestockOnAssign = true;
			val.resetCooldownTimerOnUse = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			val.cancelSprintingOnActivation = false;
			ContentAddition.AddSkillDef(val);
			GenericSkill val2 = bell.AddComponent<GenericSkill>();
			val2.skillName = "BuffBeam";
			SkillFamily val3 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val3).name = "BellBuffBeamFamily";
			val3.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = val
				}
			};
			val2._skillFamily = val3;
			ContentAddition.AddSkillFamily(val3);
			bell.GetComponent<SkillLocator>().secondary = val2;
			AISkillDriver obj = bellMaster.AddComponent<AISkillDriver>();
			obj.customName = "BuffBeam";
			obj.skillSlot = (SkillSlot)1;
			obj.requireSkillReady = true;
			obj.requireEquipmentReady = false;
			obj.maxUserHealthFraction = 0.8f;
			obj.moveTargetType = (TargetType)0;
		}

		private void IncreaseWispEmbers(orig_OnEnter orig, FireEmbers self)
		{
			if (enableWispChanges.Value)
			{
				FireEmbers.damageCoefficient = 0.75f;
				FireEmbers.bulletCount = 6;
			}
			orig.Invoke(self);
		}

		private void SetupBGBuff()
		{
			//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)
			frenzyBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)frenzyBuff).name = "BGFrenzy";
			frenzyBuff.canStack = false;
			frenzyBuff.isCooldown = false;
			frenzyBuff.isDebuff = false;
			frenzyBuff.buffColor = Color.yellow;
			frenzyBuff.iconSprite = teamWarcryBuff.iconSprite;
			((Object)frenzyBuff).name = ((Object)frenzyBuff).name;
			ContentAddition.AddBuffDef(frenzyBuff);
		}

		private void SetupHelfireBuff()
		{
			//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)
			helfireBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)helfireBuff).name = "Helfire";
			helfireBuff.canStack = true;
			helfireBuff.isCooldown = false;
			helfireBuff.isDebuff = true;
			helfireBuff.buffColor = Color.cyan;
			helfireBuff.iconSprite = fireBuffSprite;
			((Object)helfireBuff).name = ((Object)helfireBuff).name;
			ContentAddition.AddBuffDef(helfireBuff);
		}

		private void RearrangeSkillDrivers(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			orig.Invoke(self, body);
			if (((Object)body).name == "BeetleGuardBody(Clone)" && enableBeetleGuardChanges.Value)
			{
				int num = 2;
				AISkillDriver[] skillDrivers = ((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers;
				if (num >= 0 && num < skillDrivers.Length)
				{
					AISkillDriver val = skillDrivers[num];
					skillDrivers[num] = skillDrivers[^1];
					skillDrivers[^1] = val;
				}
				((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers = skillDrivers;
			}
			if (((Object)body).name == "BellBody(Clone)" && enableBellChanges.Value)
			{
				int num2 = 2;
				AISkillDriver[] skillDrivers2 = ((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers;
				if (num2 >= 0 && num2 < skillDrivers2.Length)
				{
					AISkillDriver val2 = skillDrivers2[num2];
					skillDrivers2[num2] = skillDrivers2[^1];
					skillDrivers2[^1] = val2;
				}
				((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers = skillDrivers2;
			}
			if (((Object)body).name == "LunarGolemBody(Clone)" && enableLunarGolemChanges.Value)
			{
				int num3 = 0;
				AISkillDriver[] array = ((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers;
				if (num3 >= 0 && num3 < array.Length)
				{
					List<AISkillDriver> list = new List<AISkillDriver>();
					list.Add(array[^1]);
					for (int i = 0; i < array.Length - 1; i++)
					{
						if (i != array.Length - 1)
						{
							list.Add(array[i]);
						}
					}
					array = list.ToArray();
				}
				((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers = array;
			}
			if (!(((Object)body).name == "MagmaWormBody(Clone)"))
			{
				return;
			}
			int num4 = 0;
			AISkillDriver[] array2 = ((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers;
			if (num4 >= 0 && num4 < array2.Length)
			{
				List<AISkillDriver> list2 = new List<AISkillDriver>();
				list2.Add(array2[1]);
				for (int j = 0; j < array2.Length - 1; j++)
				{
					if (j != array2.Length - 1)
					{
						list2.Add(array2[j]);
					}
				}
				array2 = list2.ToArray();
			}
			((Component)self).gameObject.GetComponent<BaseAI>().skillDrivers = array2;
		}

		private void AddFrenzyVFX(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self)
		{
			orig.Invoke(self);
			self.UpdateSingleTemporaryVisualEffect(ref self.teamWarCryEffectInstance, frenzyAura, self.bestFitRadius, self.HasBuff(frenzyBuff), "HeadCenter");
		}

		private void AddFrenzyBehavior(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && sender.HasBuff(frenzyBuff))
			{
				args.attackSpeedMultAdd += 0.25f;
				args.moveSpeedMultAdd += 0.25f;
			}
		}

		private float PreventHelfireHeal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(helfireBuff))
			{
				return 0f;
			}
			return orig.Invoke(self, amount, procChainMask, nonRegen);
		}

		private void ApplyHelfire(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0070: 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)
			orig.Invoke(self, damageInfo, victim);
			if (Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)victim) && !damageInfo.rejected)
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				CharacterBody component2 = victim.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && (component.HasBuff(Buffs.LunarShell) || DamageAPI.HasModdedDamageType(damageInfo, helfireDT)))
				{
					DotController.InflictDot(victim, damageInfo.attacker, helfireDotIdx, 10f, 1f, (uint?)null);
				}
			}
		}

		private void AddBeetleJuiceStack(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_000c: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, victim);
			if (!DamageAPI.HasModdedDamageType(damageInfo, beetleJuiceDT) || !Object.op_Implicit((Object)(object)victim) || damageInfo.rejected)
			{
				return;
			}
			CharacterBody component = victim.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			component.AddTimedBuff(beetleJuice, 5f);
			foreach (TimedBuff timedBuff in component.timedBuffs)
			{
				if (timedBuff.buffIndex == Buffs.BeetleJuice.buffIndex)
				{
					timedBuff.timer = 5f;
				}
			}
		}

		private void BiteLeap(orig_OnEnter orig, Bite self)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0054: 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_006a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (enableLemurianChanges.Value)
			{
				Ray aimRay = ((BaseState)self).GetAimRay();
				Vector3 val = ((Ray)(ref aimRay)).direction;
				val.y = 0f;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if ((double)magnitude > 0.0)
				{
					val /= magnitude;
				}
				CharacterMotor characterMotor = ((EntityState)self).characterMotor;
				Vector3 velocity = val * ((EntityState)self).characterBody.moveSpeed * 2f;
				velocity.y = ((EntityState)self).characterBody.jumpPower * 0.25f;
				characterMotor.velocity = velocity;
				((BaseCharacterController)((EntityState)self).characterMotor).Motor.ForceUnground();
			}
		}
	}
	public class BeetleSpit : BaseState
	{
		public static float baseDuration = 1f;

		public static float damageCoefficient;

		public static string attackSoundString = "Play_beetle_worker_attack";

		private GameObject projectilePrefab = EnemiesPlus.beetleSpit;

		private bool hasFired;

		private float stopwatch;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			stopwatch = 0f;
			duration = baseDuration / base.attackSpeedStat;
			((EntityState)this).GetModelTransform();
			Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, 2f);
			((EntityState)this).PlayCrossfade("Body", "EmoteSurprise", "Headbutt.playbackRate", duration, 0.1f);
		}

		public override void FixedUpdate()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += Time.deltaTime;
			if (!hasFired && (double)stopwatch >= (double)duration)
			{
				hasFired = true;
				Ray aimRay = ((BaseState)this).GetAimRay();
				ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, base.damageStat * 1f, 0f, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
			if (!((double)((EntityState)this).fixedAge < (double)duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BuffBeamPlus : BaseState
	{
		public static float duration;

		public static GameObject buffBeamPrefab;

		public static AnimationCurve beamWidthCurve;

		public static string playBeamSoundString;

		public static string stopBeamSoundString;

		public HurtBox target;

		private float healTimer;

		private float healInterval;

		private float healChunk;

		private CharacterBody targetBody;

		private GameObject buffBeamInstance;

		private BezierCurveLine healBeamCurve;

		private Transform muzzleTransform;

		private Transform beamTipTransform;

		public override void OnEnter()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Invalid comparison between Unknown and I4
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Invalid comparison between Unknown and I4
			((BaseState)this).OnEnter();
			Util.PlaySound(BuffBeam.playBeamSoundString, ((EntityState)this).gameObject);
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val = new BullseyeSearch();
			val.teamMaskFilter = TeamMask.none;
			if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
			{
				((TeamMask)(ref val.teamMaskFilter)).AddTeam(((EntityState)this).teamComponent.teamIndex);
			}
			val.filterByLoS = false;
			val.maxDistanceFilter = 50f;
			val.maxAngleFilter = 360f;
			val.searchOrigin = ((Ray)(ref aimRay)).origin;
			val.searchDirection = ((Ray)(ref aimRay)).direction;
			val.sortMode = (SortMode)1;
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			List<HurtBox> list = val.GetResults().ToList();
			if (list.Count > 0)
			{
				foreach (HurtBox item in list)
				{
					if (Object.op_Implicit((Object)(object)item.healthComponent) && Object.op_Implicit((Object)(object)item.healthComponent.body) && item.healthComponent.alive)
					{
						CharacterBody body = item.healthComponent.body;
						if (Object.op_Implicit((Object)(object)body) && ((Object)body).name != "BellBody(Clone)" && ((int)body.hullClassification == 1 || (int)body.hullClassification == 2))
						{
							target = item;
							targetBody = body;
							body.AddBuff(Buffs.Immune.buffIndex);
							break;
						}
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)target) && !Object.op_Implicit((Object)(object)targetBody))
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			string text = "Muzzle";
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				muzzleTransform = component.FindChild(text);
				buffBeamInstance = Object.Instantiate<GameObject>(BuffBeam.buffBeamPrefab);
				ChildLocator component2 = buffBeamInstance.GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					beamTipTransform = component2.FindChild("BeamTip");
				}
				healBeamCurve = buffBeamInstance.GetComponentInChildren<BezierCurveLine>();
			}
		}

		private void UpdateHealBeamVisuals()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			healBeamCurve.lineRenderer.widthMultiplier = BuffBeam.beamWidthCurve.Evaluate(((EntityState)this).age / BuffBeam.duration);
			healBeamCurve.v0 = muzzleTransform.forward * 3f;
			((Component)healBeamCurve).transform.position = muzzleTransform.position;
			if (Object.op_Implicit((Object)(object)target))
			{
				beamTipTransform.position = ((Component)targetBody.mainHurtBox).transform.position;
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			UpdateHealBeamVisuals();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if ((!((double)((EntityState)this).fixedAge < (double)BuffBeam.duration) || (Object)(object)target == (Object)null) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(BuffBeam.stopBeamSoundString, ((EntityState)this).gameObject);
			EntityState.Destroy((Object)(object)buffBeamInstance);
			if (Object.op_Implicit((Object)(object)targetBody))
			{
				targetBody.RemoveBuff(Buffs.Immune.buffIndex);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)6;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//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)
			((EntityState)this).OnSerialize(writer);
			HurtBoxReference val = HurtBoxReference.FromHurtBox(target);
			((HurtBoxReference)(ref val)).Write(writer);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			HurtBoxReference val = default(HurtBoxReference);
			((HurtBoxReference)(ref val)).Read(reader);
			GameObject obj = ((HurtBoxReference)(ref val)).ResolveGameObject();
			target = ((obj != null) ? obj.GetComponent<HurtBox>() : null);
		}
	}
	public class RallyCry : BaseState
	{
		public float baseDuration = 3.5f;

		public float buffDuration = 8f;

		private Animator modelAnimator;

		private List<HurtBox> nearbyAllies;

		private float duration;

		private bool hasCastBuff;

		public override void OnEnter()
		{
			//IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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)
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val = new BullseyeSearch();
			val.teamMaskFilter = TeamMask.none;
			if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
			{
				((TeamMask)(ref val.teamMaskFilter)).AddTeam(((EntityState)this).teamComponent.teamIndex);
			}
			val.filterByLoS = false;
			val.maxDistanceFilter = 16f;
			val.maxAngleFilter = 360f;
			val.searchOrigin = ((Ray)(ref aimRay)).origin;
			val.searchDirection = ((Ray)(ref aimRay)).direction;
			val.sortMode = (SortMode)1;
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			nearbyAllies = val.GetResults().ToList();
			modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				Util.PlayAttackSpeedSound("Play_beetle_guard_death", ((EntityState)this).gameObject, 0.5f);
				((EntityState)this).PlayCrossfade("Body", "DefenseUp", "DefenseUp.playbackRate", duration, 0.2f);
			}
		}

		public override void FixedUpdate()
		{
			//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)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)modelAnimator) && (double)modelAnimator.GetFloat("DefenseUp.activate") > 0.5 && !hasCastBuff)
			{
				ScaleParticleSystemDuration component = Object.Instantiate<GameObject>(DefenseUp.defenseUpPrefab, ((EntityState)this).transform.position, Quaternion.identity, ((EntityState)this).transform).GetComponent<ScaleParticleSystemDuration>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.newDuration = buffDuration;
				}
				hasCastBuff = true;
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.AddTimedBuff(Buffs.SmallArmorBoost, buffDuration);
					foreach (HurtBox nearbyAlly in nearbyAllies)
					{
						if (Object.op_Implicit((Object)(object)nearbyAlly.healthComponent.body) && !nearbyAlly.healthComponent.body.HasBuff(EnemiesPlus.frenzyBuff))
						{
							nearbyAlly.healthComponent.body.AddTimedBuff(EnemiesPlus.frenzyBuff, buffDuration);
						}
					}
				}
			}
			if (!((double)((EntityState)this).fixedAge < (double)duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class SpikeSlash : BaseState
	{
		public static float baseDuration = 3.5f;

		public static float damageCoefficient = 4f;

		public static float procCoefficient;

		public static float selfForce;

		public static float forceMagnitude = 16f;

		public static GameObject hitEffectPrefab;

		public static GameObject swipeEffectPrefab;

		public static string enterSoundString;

		public static string slashSoundString;

		public static float walkSpeedPenaltyCoefficient;

		public static GameObject projectilePrefab = EnemiesPlus.voidSpike;

		private Animator modelAnimator;

		private float duration;

		private int slashCount;

		private Transform modelTransform;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = DoubleSlash.baseDuration / base.attackSpeedStat;
			modelAnimator = ((EntityState)this).GetModelAnimator();
			modelTransform = ((EntityState)this).GetModelTransform();
			((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = DoubleSlash.walkSpeedPenaltyCoefficient;
			Util.PlayAttackSpeedSound(DoubleSlash.enterSoundString, ((EntityState)this).gameObject, base.attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "DoubleSlash", "DoubleSlash.playbackRate", duration);
				((EntityState)this).PlayAnimation("Gesture, Override", "DoubleSlash", "DoubleSlash.playbackRate", duration);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(duration + 2f);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f;
			((EntityState)this).OnExit();
		}

		private void HandleSlash(string animatorParamName, string muzzleName, string hitBoxGroupName)
		{
			//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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!((double)modelAnimator.GetFloat(animatorParamName) <= 0.100000001490116))
			{
				Util.PlaySound(DoubleSlash.slashSoundString, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(DoubleSlash.swipeEffectPrefab, ((EntityState)this).gameObject, muzzleName, true);
				slashCount++;
				Ray aimRay = ((BaseState)this).GetAimRay();
				ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, base.damageStat * 1f, 0f, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)modelAnimator))
			{
				switch (slashCount)
				{
				case 0:
					HandleSlash("HandR.hitBoxActive", "SwipeRight", "HandR");
					break;
				case 1:
					HandleSlash("HandL.hitBoxActive", "SwipeLeft", "HandL");
					break;
				}
			}
			if (!((double)((EntityState)this).fixedAge < (double)duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class NuxHelfireEffectController : MonoBehaviour
	{
		private CharacterBody victimBody;

		private ModelLocator modelLocator;

		private BurnEffectController helfireEffectController;

		private GameObject helfireEffectPrefab = EnemiesPlus.helfireIgniteEffect;

		private void Start()
		{
			victimBody = ((Component)this).GetComponent<CharacterBody>();
			modelLocator = ((Component)this).GetComponent<ModelLocator>();
			AddHelfireEffect();
		}

		private void OnDestroy()
		{
			RemoveHelfireEffect();
		}

		private void AddHelfireEffect()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			victimBody = (Object.op_Implicit((Object)(object)victimBody) ? victimBody : ((Component)this).GetComponent<CharacterBody>());
			if (Object.op_Implicit((Object)(object)victimBody))
			{
				EffectManager.SpawnEffect(helfireEffectPrefab, new EffectData
				{
					origin = victimBody.corePosition
				}, true);
			}
			modelLocator = (Object.op_Implicit((Object)(object)modelLocator) ? modelLocator : ((Component)this).GetComponent<ModelLocator>());
			if (Object.op_Implicit((Object)(object)modelLocator) && Object.op_Implicit((Object)(object)modelLocator.modelTransform))
			{
				helfireEffectController = ((Component)this).gameObject.AddComponent<BurnEffectController>();
				helfireEffectController.effectType = BurnEffectController.helfireEffect;
				helfireEffectController.target = ((Component)modelLocator.modelTransform).gameObject;
			}
		}

		private void RemoveHelfireEffect()
		{
			if (Object.op_Implicit((Object)(object)helfireEffectController))
			{
				Object.Destroy((Object)(object)helfireEffectController);
			}
		}
	}
}