Decompiled source of Carcass v1.0.9

plugins/Carcass/CarcassEnemy.dll

Decompiled 4 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using CarcassEnemy.Assets;
using CarcassEnemy.Components;
using CarcassEnemy.Components.FX;
using CarcassEnemy.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sandbox;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[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("Hydraxous")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Free to use in your Ultrakill levels, please credit both Rem_Safe_Space and Hydraxous if you use it.")]
[assembly: AssemblyDescription("A custom enemy for ULTRAKILL")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5+4398b2d70ecdc1bdabbedd5ee93573994131eb0a")]
[assembly: AssemblyProduct("CarcassEnemy")]
[assembly: AssemblyTitle("CarcassEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.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 CarcassEnemy
{
	[RequireComponent(typeof(CarcassComponents))]
	public class Carcass : MonoBehaviour, IEnemy, IEnrage, IAlter, IAlterOptions<bool>, IAlterOptions<float>
	{
		[SerializeField]
		private float maxHealth = 50f;

		[SerializeField]
		private CarcassComponents components;

		[SerializeField]
		private CarcassParametersAsset serializedParameters;

		[SerializeField]
		private bool disableDeathSequence;

		private CarcassParameters parameters;

		private bool m_isEnraged = false;

		private float health;

		private float randomStrafeDirection;

		private float currentDashBrakeForce;

		private bool isDead;

		private bool isHealing;

		private bool isHooked;

		private bool isStunned;

		private bool isDodging;

		private bool isBlind;

		private bool isActioning;

		private bool inModalAction;

		private float dodgeCooldown;

		private float dashTimeLeft;

		private float hookTimer;

		private float enrageTimer;

		private float actionTimer = 3f;

		private float timeUntilDirectionChange = 2f;

		private float healCooldownTimer;

		private float eyeRespawnTimer;

		private float targetCheckTimer = 1f;

		private Delegate lastAttack;

		private Action onInterupt;

		private Action onActionEnd;

		private List<Drone> spawnedEyes = new List<Drone>();

		private List<GameObject> activeSigils = new List<GameObject>();

		private GameObject spawnedEnrageEffect;

		public float Health => health;

		public bool isEnraged => m_isEnraged;

		public bool IsDashing => dashTimeLeft > 0f;

		public bool Dead => isDead;

		private EnemyTarget target => Components.EnemyIdentifier.target;

		public CarcassComponents Components
		{
			get
			{
				if ((Object)(object)components == (Object)null)
				{
					components = ((Component)this).GetComponent<CarcassComponents>();
				}
				return components;
			}
		}

		public CarcassParameters Parameters
		{
			get
			{
				if (parameters == null)
				{
					if ((Object)(object)serializedParameters != (Object)null)
					{
						parameters = serializedParameters.Parameters;
					}
					else
					{
						parameters = new CarcassParameters();
					}
				}
				return parameters;
			}
		}

		public string alterKey => "carcass";

		public string alterCategoryName => "Carcass";

		AlterOption<bool>[] IAlterOptions<bool>.options => new AlterOption<bool>[3]
		{
			new AlterOption<bool>
			{
				name = "Enraged",
				value = isEnraged,
				callback = delegate(bool value)
				{
					SetEnraged(value);
				},
				key = "enraged"
			},
			new AlterOption<bool>
			{
				name = "Disable Death Sequence",
				value = disableDeathSequence,
				callback = delegate(bool value)
				{
					disableDeathSequence = value;
				},
				key = "disableDeathSequence"
			},
			new AlterOption<bool>
			{
				name = "Enable Enraged Wild Attacks",
				value = Parameters.enableEnrageWildAttacks,
				callback = delegate(bool value)
				{
					Parameters.enableEnrageWildAttacks = value;
				},
				key = "enableEnrageWildAttacks"
			}
		};

		AlterOption<float>[] IAlterOptions<float>.options => new AlterOption<float>[21]
		{
			new AlterOption<float>
			{
				key = "maxHealth",
				name = "<size=5>Max Health</size>",
				value = maxHealth,
				callback = delegate(float value)
				{
					maxHealth = value;
				}
			},
			new AlterOption<float>
			{
				key = "eyeHealth",
				name = "<size=5>Eye Health</size>",
				value = Parameters.eyeHealth,
				callback = delegate(float value)
				{
					Parameters.eyeHealth = value;
				}
			},
			new AlterOption<float>
			{
				key = "eyeHealPerEye",
				name = "<size=5>Healing Per Eye</size>",
				value = Parameters.eyeHealPerEye,
				callback = delegate(float value)
				{
					Parameters.eyeHealPerEye = value;
				}
			},
			new AlterOption<float>
			{
				key = "eyeHealDelay",
				name = "<size=5>Eye Heal Interval</size>",
				value = Parameters.eyeHealDelay,
				callback = delegate(float value)
				{
					Parameters.eyeHealDelay = value;
				}
			},
			new AlterOption<float>
			{
				key = "eyeSpawnCooldown",
				name = "<size=5>Eye Spawn Cooldown</size>",
				value = Parameters.eyeSpawnCooldown,
				callback = delegate(float value)
				{
					Parameters.eyeSpawnCooldown = value;
				}
			},
			new AlterOption<float>
			{
				key = "attackDelay",
				name = "<size=5>Attack Delay</size>",
				value = Parameters.attackDelay,
				callback = delegate(float value)
				{
					Parameters.attackDelay = value;
				}
			},
			new AlterOption<float>
			{
				key = "stunDamageMultiplier",
				name = "<size=5>Stun Bonus Damage Multiplier</size>",
				value = Parameters.stunDamageMultiplier,
				callback = delegate(float value)
				{
					Parameters.stunDamageMultiplier = value;
				}
			},
			new AlterOption<float>
			{
				key = "dodgeCooldownTime",
				name = "<size=5>Dodge Cooldown Length</size>",
				value = Parameters.dodgeCooldownTime,
				callback = delegate(float value)
				{
					Parameters.dodgeCooldownTime = value;
				}
			},
			new AlterOption<float>
			{
				key = "hookBiteDelay",
				name = "<size=5>Hook Bite Delay</size>",
				value = Parameters.hookBiteDelay,
				callback = delegate(float value)
				{
					Parameters.hookCooldown = value;
				}
			},
			new AlterOption<float>
			{
				key = "hookPlayerCooldown",
				name = "<size=5>Hook Cooldown After Bite</size>",
				value = Parameters.hookPlayerCooldown,
				callback = delegate(float value)
				{
					Parameters.hookPlayerCooldown = value;
				}
			},
			new AlterOption<float>
			{
				key = "shakeProjectileBurstLength",
				name = "<size=5>Shake Attack Length</size>",
				value = Parameters.shakeProjectileBurstLengthInSeconds,
				callback = delegate(float value)
				{
					Parameters.shakeProjectileBurstLengthInSeconds = value;
				}
			},
			new AlterOption<float>
			{
				key = "enrageLength",
				name = "<size=5>Enrage Length</size>",
				value = Parameters.enrageLength,
				callback = delegate(float value)
				{
					Parameters.enrageLength = value;
				}
			},
			new AlterOption<float>
			{
				key = "enrageSpeedMultiplier",
				name = "<size=5>Enraged Speed Multiplier</size>",
				value = Parameters.enragedSpeedMultiplier,
				callback = delegate(float value)
				{
					Parameters.enragedSpeedMultiplier = value;
				}
			},
			new AlterOption<float>
			{
				key = "enrageAttackTimerMultiplier",
				name = "<size=5>Enrage Attack Speed Multiplier</size>",
				value = Parameters.enrageAttackTimerMultiplier,
				callback = delegate(float value)
				{
					Parameters.enrageAttackTimerMultiplier = value;
				}
			},
			new AlterOption<float>
			{
				key = "carpetBombLength",
				name = "<size=5>(WILD) Carpet Bomb Length</size>",
				value = Parameters.carpetBombLength,
				callback = delegate(float value)
				{
					Parameters.carpetBombLength = value;
				}
			},
			new AlterOption<float>
			{
				key = "carpetBombProjectileDelay",
				name = "<size=5>(WILD) Carpet Bomb Projectile Delay</size>",
				value = Parameters.carpetBombProjectileDelay,
				callback = delegate(float value)
				{
					Parameters.carpetBombProjectileDelay = value;
				}
			},
			new AlterOption<float>
			{
				key = "eyeSpawnCount",
				name = "<size=5>Eye Spawn Count</size>",
				value = Parameters.eyeSpawnCount,
				callback = delegate(float value)
				{
					Parameters.eyeSpawnCount = (int)value;
				}
			},
			new AlterOption<float>
			{
				key = "shakeProjectileCount",
				name = "<size=5>Shake Projectile Count</size>",
				value = Parameters.shakeProjectileCount,
				callback = delegate(float value)
				{
					Parameters.shakeProjectileCount = (int)value;
				}
			},
			new AlterOption<float>
			{
				key = "shakeProjectileGroup",
				name = "<size=5>Shake Projectile Group</size>",
				value = Parameters.shakeProjectileGroup,
				callback = delegate(float value)
				{
					Parameters.shakeProjectileGroup = (int)value;
				}
			},
			new AlterOption<float>
			{
				key = "enrageBlueProjectileCount",
				name = "<size=5>Enraged Projectile Count</size>",
				value = Parameters.enrageBlueProjectileCount,
				callback = delegate(float value)
				{
					Parameters.enrageBlueProjectileCount = (int)value;
				}
			},
			new AlterOption<float>
			{
				key = "barrageProjectileCount",
				name = "<size=5>(Wild) Barrage Projectile Count</size>",
				value = Parameters.barrageProjectileCount,
				callback = delegate(float value)
				{
					Parameters.barrageProjectileCount = (int)value;
				}
			}
		};

		public event Action<Carcass> OnDeath;

		public bool IsAlive()
		{
			return !isDead;
		}

		private void Awake()
		{
			Patcher.QueryInstance();
			health = maxHealth;
			Components.Machine.health = maxHealth;
			GameObject[] hitboxes = components.Hitboxes;
			foreach (GameObject val in hitboxes)
			{
				Rigidbody val2 = val.AddComponent<Rigidbody>();
				val2.isKinematic = true;
				val2.useGravity = false;
			}
			if ((Object)(object)Components.ProjectileDetector != (Object)null)
			{
				Components.ProjectileDetector.OnProjectileDetected += OnProjectileDetected;
			}
			if ((Object)(object)Components.SpinHitbox != (Object)null)
			{
				Components.SpinHitbox.OnTriggerEntered += OnHurtboxEnter;
			}
			if ((Object)(object)Components.HookDetector != (Object)null)
			{
				Components.HookDetector.OnHookstateChanged += OnHookStateChanged;
			}
			Components.EnemyIdentifier.overrideCenter = Components.CenterMass;
			if ((Object)(object)Components.EnemyIdentifier.spawnEffect == (Object)null)
			{
				Components.EnemyIdentifier.spawnEffect = UKPrefabs.SpawnEffect.Asset;
			}
			if (SceneHelper.CurrentScene == "Endless")
			{
				disableDeathSequence = true;
			}
		}

		private void Start()
		{
			ResolveTarget();
			((MonoBehaviour)this).StartCoroutine(ActionFailsafe());
			SummonEyes();
		}

		private void Update()
		{
			isBlind = BlindEnemies.Blind;
			TimerUpdate();
		}

		private void FixedUpdate()
		{
			MovementUpdate();
		}

		private void LateUpdate()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (target != null && !isDodging && !isDead && !isBlind)
			{
				TurnTowards(target.position, 20000f);
			}
		}

		private void TimerUpdate()
		{
			if (isDead)
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			eyeRespawnTimer -= deltaTime;
			timeUntilDirectionChange -= deltaTime;
			dashTimeLeft -= deltaTime;
			dodgeCooldown -= deltaTime;
			float num = Parameters.hookBiteDelay / (m_isEnraged ? Parameters.enrageHookBiteSpeedMultiplier : 1f);
			hookTimer = Mathf.Clamp(hookTimer + (isHooked ? deltaTime : (0f - deltaTime)), 0f, num);
			if (hookTimer >= num && !isBlind)
			{
				BiteHook();
				hookTimer = 0f;
			}
			if (timeUntilDirectionChange <= 0f)
			{
				ChangeStrafeDirection();
				timeUntilDirectionChange = Parameters.directionChangeDelay;
			}
			if (!isBlind)
			{
				actionTimer = Mathf.Max(0f, actionTimer - deltaTime * (m_isEnraged ? Parameters.enrageAttackTimerMultiplier : 1f));
			}
			if (actionTimer <= 0f && !isStunned && !isBlind)
			{
				PerformAction();
				actionTimer = Parameters.attackDelay;
			}
			if (enrageTimer > 0f)
			{
				enrageTimer -= deltaTime;
				if (enrageTimer <= 0f)
				{
					SetEnraged(enraged: false);
				}
			}
			if (targetCheckTimer > 0f)
			{
				targetCheckTimer -= deltaTime;
				if (targetCheckTimer <= 0f)
				{
					ResolveTarget();
					targetCheckTimer = Parameters.targetCheckDelay;
				}
			}
		}

		private void TurnTowards(Vector3 point, float speed)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			Vector3 vector = point - position;
			Quaternion val = Quaternion.LookRotation(vector.XZ());
			Quaternion rotation = ((Component)this).transform.rotation;
			Quaternion rotation2 = Quaternion.RotateTowards(rotation, val, Time.deltaTime * speed);
			((Component)this).transform.rotation = rotation2;
		}

		private float CalculateVerticalMoveDirection(Vector3 position, float desiredHeight)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0095: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(position, Vector3.down, ref val, float.PositiveInfinity, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1))
			{
				if (target == null)
				{
					return -1f;
				}
				return Mathf.Sign(target.position.y - position.y);
			}
			float num = ((RaycastHit)(ref val)).point.y + desiredHeight;
			if (target != null)
			{
				num = Mathf.Max(num, target.position.y);
			}
			float num2 = num - position.y;
			return Mathf.Sign(num2);
		}

		private void MovementUpdate()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			SolveMovementDash();
			Vector3 velocity = GetVelocity();
			velocity = ((isDead || isHealing || isStunned || isBlind || target == null) ? ApplyBrake(velocity) : ((!IsDashing) ? ApplyMovement(velocity) : ApplyDashMovement(velocity)));
			Components.Rigidbody.velocity = velocity;
		}

		private void SolveMovementDash()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0055: 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_0057: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (m_isEnraged && !isDead && !IsDashing && target != null && !isActioning && !isBlind)
			{
				Vector3 position = ((Component)this).transform.position;
				Vector3 position2 = target.position;
				Vector3 direction = position2 - position;
				float magnitude = ((Vector3)(ref direction)).magnitude;
				if (!(magnitude < Parameters.enrageDashMaxRange) && TargetLineOfSightCheck())
				{
					actionTimer += Parameters.enrageDashActionDelay;
					Components.Animation.Dash();
					Dash(direction, Parameters.enrageDashForce, Parameters.enrageDashBrakeForce, Parameters.enrageDashLength);
				}
			}
		}

		private Vector3 GetVelocity()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return Components.Rigidbody.velocity;
		}

		private Vector3 ApplyMovement(Vector3 velocity)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0094: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.right * randomStrafeDirection;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(Components.CenterMass.position, val, ref val2, Parameters.strafeObstacleCheckDistance, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))) && ((RaycastHit)(ref val2)).distance < Parameters.strafeObstacleCheckDistance * 0.5f)
			{
				randomStrafeDirection = 0f - randomStrafeDirection;
				val = -val;
			}
			Vector3 position = target.position;
			Vector3 position2 = ((Component)this).transform.position;
			Vector3 vector = position - position2;
			Vector3 val3 = vector.XZ();
			float magnitude = ((Vector3)(ref val3)).magnitude;
			float moveSpeedMultiplier = GetMoveSpeedMultiplier();
			float num = Parameters.strafeSpeed;
			if (magnitude < Parameters.minTargetDistance)
			{
				val = -((Vector3)(ref val3)).normalized;
				num = Parameters.lateralFlySpeed;
			}
			if (magnitude > Parameters.maxTargetDistance)
			{
				val = ((Vector3)(ref val3)).normalized;
				num = Parameters.lateralFlySpeed;
			}
			num *= moveSpeedMultiplier;
			Vector3 val4 = val * num;
			float num2 = CalculateVerticalMoveDirection(((Component)this).transform.position, Parameters.desiredFlyHeight);
			num2 *= ((num2 > 0f) ? Parameters.verticalFlySpeed : Parameters.fallSpeed);
			val4.y += num2 * moveSpeedMultiplier;
			velocity = Vector3.MoveTowards(velocity, val4, Time.fixedDeltaTime * Parameters.movementSmoothing);
			return velocity;
		}

		private Vector3 ApplyBrake(Vector3 velocity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.MoveTowards(velocity, Vector3.zero, Time.fixedDeltaTime * Parameters.movementSmoothing);
		}

		private Vector3 ApplyDashMovement(Vector3 velocity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			return velocity + CalcDrag(velocity, currentDashBrakeForce) * Time.fixedDeltaTime;
		}

		private Vector3 CalcDrag(Vector3 velocity, float drag)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			float magnitude = ((Vector3)(ref velocity)).magnitude;
			float num = magnitude * magnitude * drag;
			return num * -((Vector3)(ref velocity)).normalized;
		}

		private float GetMoveSpeedMultiplier()
		{
			if (isActioning)
			{
				return Parameters.speedWhileAttackingMultiplier;
			}
			if (m_isEnraged)
			{
				return Parameters.enragedSpeedMultiplier;
			}
			return 1f;
		}

		private void ChangeStrafeDirection()
		{
			randomStrafeDirection = Mathf.Sign((Random.value - 0.5f) * 2f);
		}

		private void Dash(Vector3 direction, float force, float brakeForce, float length)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			dashTimeLeft = length;
			currentDashBrakeForce = brakeForce;
			Components.Rigidbody.velocity = ((Vector3)(ref direction)).normalized * force;
		}

		private void PerformAction()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			if (spawnedEyes.Count < Parameters.eyeSpawnCount && eyeRespawnTimer <= 0f && !m_isEnraged)
			{
				SummonEyes();
			}
			else
			{
				if (target == null)
				{
					return;
				}
				Vector3 position = ((Component)this).transform.position;
				Vector3 position2 = target.position;
				Vector3 val = position2 - position;
				float y = val.y;
				Vector3 val2 = val.XZ();
				float magnitude = ((Vector3)(ref val2)).magnitude;
				List<Delegate> list = new List<Delegate>();
				bool flag = TargetLineOfSightCheck();
				if (healCooldownTimer <= 0f && spawnedEyes.Count > 0 && health < Parameters.lowHealthThreshold * maxHealth)
				{
					list.Add(new Action(StartHealing));
				}
				RaycastHit val3 = default(RaycastHit);
				if (!Physics.Raycast(Components.ProjectileLobPoint.position, Vector3.up, ref val3, 3f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))))
				{
					if (m_isEnraged && Parameters.enableEnrageWildAttacks)
					{
						list.Add(new Action(CarpetBomb));
					}
					else if (flag)
					{
						list.Add(new Action(SpinAttack));
					}
				}
				if ((y < 0f || !flag || m_isEnraged) && (activeSigils.Count == 0 || m_isEnraged))
				{
					list.Add(new Action(SummonSigil));
				}
				if (m_isEnraged && Parameters.enableEnrageWildAttacks)
				{
					list.Add(new Action(BarrageAttack));
				}
				else if (flag)
				{
					list.Add(new Action(ShakeAttack));
				}
				if ((object)lastAttack != null)
				{
					list.Remove(lastAttack);
				}
				if (list.Count == 0)
				{
					lastAttack = null;
					return;
				}
				int index = Random.Range(0, list.Count);
				lastAttack = list[index];
				lastAttack.DynamicInvoke();
			}
		}

		public void ShakeAttack()
		{
			Components.Animation.Shake();
			ActionStart();
			if ((Object)(object)Components.PsychosisFXPrefab != (Object)null)
			{
				GameObject psychosisFX = Object.Instantiate<GameObject>(Components.PsychosisFXPrefab, Components.CenterMass);
				onActionEnd = (onInterupt = delegate
				{
					if ((Object)(object)psychosisFX != (Object)null)
					{
						Object.Destroy((Object)(object)psychosisFX);
					}
				});
			}
			((MonoBehaviour)this).StartCoroutine(ShakeAttackCoroutine());
		}

		public void SpinAttack()
		{
			isActioning = true;
			inModalAction = true;
			Components.Animation.Spin();
			((Component)Components.SpinHitbox).gameObject.SetActive(true);
			((MonoBehaviour)this).StartCoroutine(InvokeAfterAnimation(delegate
			{
				ActionEnd();
				((Component)Components.SpinHitbox).gameObject.SetActive(false);
			}));
		}

		public void SummonSigil()
		{
			Components.Animation.Summon();
			ActionStart();
			((MonoBehaviour)this).StartCoroutine(InvokeAfterAnimation(ActionEnd));
		}

		public void SummonEyes()
		{
			eyeRespawnTimer = Parameters.eyeSpawnCooldown;
			isActioning = true;
			Components.Animation.SetVibrating(shaking: true);
			Components.Animation.Writhe();
			int num = Parameters.eyeSpawnCount - spawnedEyes.Count;
			for (int i = 0; i < num; i++)
			{
				float time = Parameters.eyeSpawnDelay * (float)(i + 1);
				InvokeDelayed(SpawnEye, time);
			}
			((MonoBehaviour)this).StartCoroutine(InvokeAfterAnimation(ActionEnd));
		}

		public void BarrageAttack()
		{
			Components.Animation.Writhe();
			ActionStart();
			((MonoBehaviour)this).StartCoroutine(EnragedBarrageCoroutine());
		}

		public void CarpetBomb()
		{
			Components.Animation.Spin();
			ActionStart();
			((MonoBehaviour)this).StartCoroutine(EnragedCarpetBomb());
		}

		public void StartHealing()
		{
			isActioning = true;
			isHealing = true;
			inModalAction = true;
			healCooldownTimer = Parameters.healCooldown;
			Components.Animation.KillEyes();
			Action action = null;
			if ((Object)(object)Components.HealAuraFX != (Object)null)
			{
				GameObject healAuraFX = Object.Instantiate<GameObject>(Components.HealAuraFX, Components.CenterMass);
				action = (onInterupt = delegate
				{
					if ((Object)(object)healAuraFX != (Object)null)
					{
						Object.Destroy((Object)(object)healAuraFX);
					}
					isHealing = false;
				});
			}
			int eyeCount = spawnedEyes.Count;
			float num = Parameters.eyeHealDelay * (float)eyeCount + Parameters.eyeInitialHealDelay;
			InvokeDelayed(delegate
			{
				for (int i = 0; i < eyeCount; i++)
				{
					InvokeDelayed(SacrificeEyeForHealth, Parameters.eyeHealDelay * (float)i);
				}
			}, Parameters.eyeInitialHealDelay);
			InvokeDelayed(action, num + 0.2f);
			((MonoBehaviour)this).StartCoroutine(InvokeAfterAnimation(delegate
			{
				ActionEnd();
			}));
		}

		public void InterruptAction()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(ActionFailsafe());
			onInterupt?.Invoke();
			onInterupt = null;
		}

		public void Stun()
		{
			if (!isDead)
			{
				isStunned = true;
				isActioning = false;
				inModalAction = false;
				isHealing = false;
				InterruptAction();
				ActionEndCallback();
				if ((Object)(object)Components.StunnedFX != (Object)null)
				{
					Object.Instantiate<GameObject>(Components.StunnedFX, Components.CenterMass);
				}
				Components.Animation.Stunned();
				Components.Animation.SetVibrating(shaking: false);
				if (m_isEnraged)
				{
					enrageTimer += Parameters.enrageAddEnrageTimeOnStun;
				}
				onActionEnd = delegate
				{
					isStunned = false;
				};
			}
		}

		public bool CanDodge()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (isDead)
			{
				return false;
			}
			if (isDodging || inModalAction || !(dodgeCooldown <= 0f) || isBlind)
			{
				return false;
			}
			if (target == null)
			{
				return true;
			}
			Vector3 position = target.position;
			Vector3 position2 = ((Component)this).transform.position;
			Vector3 val = position - position2;
			return ((Vector3)(ref val)).magnitude > Parameters.dodgeMinRange;
		}

		public void Dodge(Vector3 direction)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			dodgeCooldown = Parameters.dodgeCooldownTime;
			actionTimer += Parameters.dodgeActionTimerAddition;
			isActioning = true;
			isDodging = true;
			SetHitboxesActive(enabled: false);
			Components.Animation.Dodge();
			Dash(direction, Parameters.dodgeForce, Parameters.dodgeBrakeSpeed, Parameters.dodgeLength);
			InvokeDelayed(delegate
			{
				SetHitboxesActive(enabled: true);
			}, dashTimeLeft / 2f);
			InvokeDelayed(delegate
			{
				ActionEnd();
				isDodging = false;
			}, dashTimeLeft);
		}

		public void SetHitboxesActive(bool enabled)
		{
			GameObject[] hitboxes = Components.Hitboxes;
			foreach (GameObject val in hitboxes)
			{
				val.SetActive(enabled);
			}
		}

		public void ActionStart()
		{
			isActioning = true;
			Components.Animation.SetVibrating(shaking: true);
		}

		public void ActionEnd()
		{
			isActioning = false;
			inModalAction = false;
			Components.Animation.SetVibrating(shaking: false);
			ActionEndCallback();
		}

		private void ActionEndCallback()
		{
			if (onActionEnd != null)
			{
				onActionEnd();
				onActionEnd = null;
			}
		}

		public void Heal(float amount)
		{
			if (!isDead)
			{
				health = Mathf.Clamp(health + amount, 0f, maxHealth);
				if (health <= 0f)
				{
					Die();
				}
				else if (amount > 0f && (Object)(object)Components.HealFX != (Object)null)
				{
					Object.Instantiate<GameObject>(Components.HealFX, Components.CenterMass);
				}
			}
		}

		public void Enrage()
		{
			if (!isDead && !((Object)(object)((Component)this).gameObject == (Object)null))
			{
				SetEnraged(enraged: true);
			}
		}

		public void UnEnrage()
		{
			if (!isDead && !((Object)(object)((Component)this).gameObject == (Object)null))
			{
				SetEnraged(enraged: false);
			}
		}

		public void SacrificeEyeForHealth()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (isStunned || isDead || !isHealing)
			{
				return;
			}
			Drone val = null;
			for (int i = 0; i < spawnedEyes.Count; i++)
			{
				if (!((Object)(object)spawnedEyes[i] == (Object)null))
				{
					val = spawnedEyes[i];
					break;
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				spawnedEyes.Remove(val);
				Vector3 position = ((Component)val).transform.position;
				val.Explode();
				Heal(Parameters.eyeHealPerEye);
				if ((Object)(object)Components.GenericSpawnFX != (Object)null)
				{
					Object.Instantiate<GameObject>(Components.GenericSpawnFX, position, Quaternion.identity);
				}
			}
		}

		public void SetEnraged(bool enraged)
		{
			bool flag = m_isEnraged;
			m_isEnraged = enraged;
			if (!m_isEnraged)
			{
				Components?.MaterialChanger?.ResetMaterials();
				enrageTimer = 0f;
				if ((Object)(object)spawnedEnrageEffect != (Object)null)
				{
					Object.Destroy((Object)(object)spawnedEnrageEffect.gameObject);
				}
			}
			else if (!flag)
			{
				if (Components.EnragedMaterials != null)
				{
					Components?.MaterialChanger?.SetMaterialSet(Components.EnragedMaterials);
				}
				enrageTimer = Parameters.enrageLength;
				spawnedEnrageEffect = Object.Instantiate<GameObject>(UKPrefabs.RageEffect.Asset, Components.CenterMass);
			}
		}

		public void BiteHook()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			if (isHooked && activeSigils.Count <= 0)
			{
				Vector3 position = Components.CenterMass.position;
				Vector3 position2 = target.position;
				Vector3 val = position2 - position;
				if ((Object)(object)Components.HookSnapFX != (Object)null)
				{
					Object.Instantiate<GameObject>(Components.HookSnapFX, Components.CenterMass).transform.rotation = Quaternion.LookRotation(val, Vector3.up);
				}
				Components.HookDetector.ForceUnhook();
				FieldInfo field = typeof(HookArm).GetField("cooldown", BindingFlags.Instance | BindingFlags.NonPublic);
				if (Parameters.hookBiteYellowHP > 0)
				{
					MonoSingleton<NewMovement>.Instance.ForceAddAntiHP((float)Parameters.hookBiteYellowHP, false, false, true);
				}
				MonoSingleton<CameraController>.Instance.CameraShake(1.25f);
				if ((Object)(object)MonoSingleton<HookArm>.Instance != (Object)null)
				{
					field.SetValue(MonoSingleton<HookArm>.Instance, Parameters.hookPlayerCooldown);
				}
			}
		}

		public void Instakill()
		{
			Die();
		}

		public void ForceCountDeath()
		{
			if (!Components.EnemyIdentifier.dontCountAsKills)
			{
				GoreZone val = GoreZone.ResolveGoreZone(((Component)this).transform);
				if ((Object)(object)val != (Object)null && (Object)(object)val.checkpoint != (Object)null)
				{
					val.AddDeath();
					StatsManager sm = val.checkpoint.sm;
					sm.kills++;
				}
				else
				{
					StatsManager instance = MonoSingleton<StatsManager>.Instance;
					instance.kills++;
				}
				ActivateNextWave componentInParent = ((Component)this).GetComponentInParent<ActivateNextWave>();
				if (componentInParent != null)
				{
					componentInParent.AddDeadEnemy();
				}
			}
		}

		private void Die()
		{
			if (!isDead)
			{
				InterruptAction();
				ActionEndCallback();
				isDead = true;
				DestroyAllSigils();
				DestroyAllEyes();
				ForceCountDeath();
				this.OnDeath?.Invoke(this);
				if (disableDeathSequence)
				{
					DeathVFX();
					Remove();
				}
				else
				{
					DeathSequence();
				}
			}
		}

		public void DestroyAllSigils()
		{
			if (activeSigils.Count <= 0)
			{
				return;
			}
			SummonCircle summonCircle = default(SummonCircle);
			foreach (GameObject activeSigil in activeSigils)
			{
				if (activeSigil.TryGetComponent<SummonCircle>(ref summonCircle))
				{
					summonCircle.Die();
				}
				else
				{
					Object.Destroy((Object)(object)activeSigil);
				}
			}
		}

		public void DestroyAllEyes()
		{
			for (int i = 0; i < spawnedEyes.Count; i++)
			{
				if (!((Object)(object)spawnedEyes[i] == (Object)null))
				{
					spawnedEyes[i].Explode();
				}
			}
		}

		private void DeathSequence()
		{
			if (m_isEnraged)
			{
				SetEnraged(enraged: false);
			}
			GameObject bloodSpray = null;
			if ((Object)(object)Components.CarcassScreamPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(Components.CarcassScreamPrefab, Components.CenterMass);
			}
			if (MonoSingleton<PrefsManager>.Instance.GetBoolLocal("bloodEnabled", false) && (Object)(object)Components.BloodSprayFX != (Object)null)
			{
				bloodSpray = Object.Instantiate<GameObject>(Components.BloodSprayFX, Components.CenterMass);
			}
			Components.Animation.Death();
			Components.Animation.SetVibrating(shaking: true);
			Components.Animation.SetVibrationRange(0.25f);
			MonoSingleton<TimeController>.Instance.SlowDown(0.001f);
			InvokeDelayed(SpawnLightShaft, 0.25f);
			InvokeDelayed(SpawnLightShaft, 1f);
			InvokeDelayed(SpawnLightShaft, 1.75f);
			InvokeDelayed(SpawnLightShaft, 2.5f);
			InvokeDelayed(SpawnLightShaft, 3f);
			InvokeDelayed(SpawnLightShaft, 3.4f);
			InvokeDelayed(SpawnLightShaft, 3.6f);
			InvokeDelayed(SpawnLightShaft, 3.7f);
			if ((Object)(object)bloodSpray != (Object)null)
			{
				InvokeDelayed(delegate
				{
					ParticleSystem[] componentsInChildren = bloodSpray.GetComponentsInChildren<ParticleSystem>();
					foreach (ParticleSystem val in componentsInChildren)
					{
						val.Stop();
					}
				}, 3.7f);
			}
			InvokeDelayed(DeathVFX, 4.6f);
			InvokeDelayed(delegate
			{
				MonoSingleton<TimeController>.Instance.SlowDown(0.001f);
				Remove();
			}, 4.85f);
		}

		private void DeathVFX()
		{
			if ((Object)(object)Components.CarcassScreamPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(Components.CarcassScreamPrefab, ((Component)Components.CenterMass).transform).transform.parent = null;
			}
			if ((Object)(object)Components.CarcassDeathFX != (Object)null)
			{
				Object.Instantiate<GameObject>(Components.CarcassDeathFX, ((Component)Components.CenterMass).transform).transform.parent = null;
			}
			Components.Animation.SetVisible(visible: false);
		}

		public void Remove()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void SpawnEye()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			Vector3 ringSpawnPosition = GetRingSpawnPosition();
			GameObject eye = GetEye();
			if ((Object)(object)eye == (Object)null)
			{
				return;
			}
			GoreZone val = GoreZone.ResolveGoreZone(((Component)this).transform);
			GameObject val2 = Object.Instantiate<GameObject>(eye, ringSpawnPosition, Quaternion.identity);
			if ((Object)(object)val != (Object)null)
			{
				val2.transform.SetParent(((Component)val).transform, true);
			}
			Drone drone = default(Drone);
			if (val2.TryGetComponent<Drone>(ref drone))
			{
				spawnedEyes.Add(drone);
				drone.health = Parameters.eyeHealth;
				SetDroneTarget(drone, target);
			}
			EnemyIdentifier val3 = default(EnemyIdentifier);
			if (val2.TryGetComponent<EnemyIdentifier>(ref val3))
			{
				val3.dontCountAsKills = true;
				val3.health = Parameters.eyeHealth;
				val3.damageBuff = Components.EnemyIdentifier.damageBuff;
				val3.healthBuff = Components.EnemyIdentifier.healthBuff;
				val3.speedBuff = Components.EnemyIdentifier.speedBuff;
				if ((Object)(object)drone != (Object)null)
				{
					val3.onDeath.AddListener((UnityAction)delegate
					{
						OnEyeDeath(drone);
					});
				}
			}
			if ((Object)(object)Components.EyeMaterialOverride != (Object)null)
			{
				MeshRenderer val4 = (from x in val2.GetComponentsInChildren<MeshRenderer>()
					where ((Object)x).name == "Gib_Eyeball"
					select x).FirstOrDefault();
				((Renderer)val4).material = Components.EyeMaterialOverride;
			}
			if ((Object)(object)Components.GenericSpawnFX != (Object)null)
			{
				Object.Instantiate<GameObject>(Components.GenericSpawnFX, Components.CenterMass);
			}
		}

		private GameObject GetEye()
		{
			if ((Object)(object)Components.DroneFlesh == (Object)null)
			{
				return UKPrefabs.DroneFlesh.Asset;
			}
			return Components.DroneFlesh;
		}

		public void SpawnSigil()
		{
			if ((Object)(object)Components.SummonCirclePrefab == (Object)null || !target.isValid)
			{
				return;
			}
			GameObject newSigil = Object.Instantiate<GameObject>(Components.SummonCirclePrefab);
			GoreZone val = GoreZone.ResolveGoreZone(((Component)this).transform);
			if ((Object)(object)val != (Object)null)
			{
				newSigil.transform.SetParent(((Component)val).transform, true);
			}
			SummonCircle summonCircle = default(SummonCircle);
			if (newSigil.TryGetComponent<SummonCircle>(ref summonCircle))
			{
				summonCircle.SetTarget(target.targetTransform);
				summonCircle.SetOwner(this);
			}
			newSigil.AddComponent<BehaviourRelay>().OnDisabled += delegate
			{
				if (!((Object)(object)((Component)this).gameObject == (Object)null) && activeSigils.Contains(newSigil))
				{
					activeSigils.Remove(newSigil);
				}
			};
			activeSigils.Add(newSigil);
			activeSigils = activeSigils.Where((GameObject x) => (Object)(object)x != (Object)null).ToList();
		}

		public void FireExplosiveProjectile()
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			GameObject lobbedProjectile = GetLobbedProjectile();
			if ((Object)(object)lobbedProjectile == (Object)null)
			{
				return;
			}
			Transform projectileLobPoint = Components.ProjectileLobPoint;
			Vector3 position = projectileLobPoint.position;
			Vector3 forward = projectileLobPoint.forward;
			GameObject val = Object.Instantiate<GameObject>(lobbedProjectile, position, Quaternion.LookRotation(forward));
			GoreZone val2 = GoreZone.ResolveGoreZone(((Component)this).transform);
			if ((Object)(object)val2 != (Object)null)
			{
				val.transform.SetParent(((Component)val2).transform, true);
			}
			Projectile val3 = default(Projectile);
			if (val.TryGetComponent<Projectile>(ref val3))
			{
				val3.target = target;
				Rigidbody val4 = default(Rigidbody);
				if (val.TryGetComponent<Rigidbody>(ref val4))
				{
					val4.AddForce(((Component)this).transform.up * 50f, (ForceMode)2);
				}
				val3.safeEnemyType = (EnemyType)5;
				Projectile obj = val3;
				obj.speed *= Components.EnemyIdentifier.totalSpeedModifier;
				Projectile obj2 = val3;
				obj2.damage *= Components.EnemyIdentifier.totalDamageModifier;
			}
		}

		public Projectile FireTrackingProjectileHalo()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 ringSpawnPosition = GetRingSpawnPosition();
			GameObject homingProjectile = GetHomingProjectile();
			if ((Object)(object)homingProjectile == (Object)null)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(homingProjectile, ringSpawnPosition, Quaternion.LookRotation(ringSpawnPosition - Components.CenterMass.position));
			GoreZone val2 = GoreZone.ResolveGoreZone(((Component)this).transform);
			if ((Object)(object)val2 != (Object)null)
			{
				val.transform.SetParent(((Component)val2).transform, true);
			}
			Projectile val3 = default(Projectile);
			if (val.TryGetComponent<Projectile>(ref val3))
			{
				val3.target = target;
				val3.speed = 10f * Components.EnemyIdentifier.totalSpeedModifier;
				Projectile obj = val3;
				obj.damage *= Components.EnemyIdentifier.totalDamageModifier;
				return val3;
			}
			return null;
		}

		private GameObject GetHomingProjectile()
		{
			if ((Object)(object)Components.HomingProjectilePrefab == (Object)null)
			{
				return UKPrefabs.HomingProjectile.Asset;
			}
			return Components.HomingProjectilePrefab;
		}

		public Projectile FireTrackingProjectileSpherical()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_004f: 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_005c: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			GameObject homingProjectile = GetHomingProjectile();
			if ((Object)(object)homingProjectile == (Object)null)
			{
				return null;
			}
			Transform centerMass = Components.CenterMass;
			Vector3 position = centerMass.position;
			Vector3 onUnitSphere = Random.onUnitSphere;
			position += onUnitSphere * Parameters.shakeProjectileOriginRadius;
			GameObject val = Object.Instantiate<GameObject>(homingProjectile, position, Quaternion.LookRotation(position - Components.CenterMass.position));
			GoreZone val2 = GoreZone.ResolveGoreZone(((Component)this).transform);
			if ((Object)(object)val2 != (Object)null)
			{
				val.transform.SetParent(((Component)val2).transform, true);
			}
			Projectile val3 = default(Projectile);
			if (val.TryGetComponent<Projectile>(ref val3))
			{
				val3.target = target;
				val3.speed = 10f * Components.EnemyIdentifier.totalSpeedModifier;
				Projectile obj = val3;
				obj.damage *= Components.EnemyIdentifier.totalDamageModifier;
				return val3;
			}
			return null;
		}

		private GameObject GetLobbedProjectile()
		{
			if ((Object)(object)Components.LobbedExplosiveProjectilePrefab == (Object)null)
			{
				return UKPrefabs.LobbedProjectileExplosiveHH.Asset;
			}
			return Components.LobbedExplosiveProjectilePrefab;
		}

		private GameObject GetLightShaft()
		{
			if ((Object)(object)Components.LightShaftFX == (Object)null)
			{
				return UKPrefabs.LightShaft.Asset;
			}
			return Components.LightShaftFX;
		}

		private void SpawnLightShaft()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			GameObject lightShaft = GetLightShaft();
			if (!((Object)(object)lightShaft == (Object)null))
			{
				Object.Instantiate<GameObject>(lightShaft, Components.CenterMass.position, Random.rotation).transform.parent = Components.CenterMass;
			}
		}

		public void ResolveTarget()
		{
			if (target != null)
			{
				return;
			}
			HashSet<EnemyIdentifier> hashSet = new HashSet<EnemyIdentifier>(spawnedEyes.Select((Drone x) => ((Component)x).GetComponent<EnemyIdentifier>()));
			hashSet.Add(GetEnemyIdentifier());
			foreach (EnemyIdentifier item in MonoSingleton<EnemyTracker>.Instance.GetCurrentEnemies().OrderBy(delegate(EnemyIdentifier x)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val)).sqrMagnitude;
			}))
			{
				if (hashSet.Contains(item))
				{
					continue;
				}
				SetTarget(((Component)item).transform);
				break;
			}
		}

		public void SetHitboxVisibility(bool visible)
		{
			GameObject[] hitboxes = Components.Hitboxes;
			foreach (GameObject val in hitboxes)
			{
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				((Renderer)component).enabled = visible;
			}
		}

		public void Knockback(Vector3 force)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody rigidbody = Components.Rigidbody;
			rigidbody.velocity += force;
		}

		public void GetHurt(HurtEventData hurtEventData)
		{
			if (!isDead)
			{
				float num = CalcDamage(hurtEventData);
				if (!string.IsNullOrEmpty(hurtEventData.hitter) && hurtEventData.hitter == "cannonball")
				{
					Stun();
				}
				float num2 = health;
				if (isStunned)
				{
					num *= Parameters.stunDamageMultiplier;
				}
				health = Mathf.Max(0f, health - num);
				Components.Machine.health = health;
				float num3 = maxHealth * Parameters.lowHealthThreshold;
				if (health < num3 && num2 >= num3)
				{
					SetEnraged(enraged: true);
				}
				OnHurtGore(hurtEventData);
				OnHurtStyle(hurtEventData);
				if (health <= 0f)
				{
					Die();
				}
			}
		}

		private void OnProjectileDetected(Collider col)
		{
			//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_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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0058: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (CanDodge())
			{
				Vector3 position = ((Component)col).transform.position;
				Vector3 position2 = ((Component)this).transform.position;
				Vector3 vector = position - position2;
				Vector3 val = vector.XZ();
				vector = ((Vector3)(ref val)).normalized;
				val = ((Component)this).transform.forward.XZ();
				float num = Vector3.SignedAngle(((Vector3)(ref val)).normalized, vector, Vector3.up);
				Vector3 direction = ((Component)this).transform.right * (0f - Mathf.Sign(num));
				Dodge(direction);
			}
		}

		private void OnEyeDeath(Drone eye)
		{
			if (!((Object)(object)((Component)this).gameObject == (Object)null) && spawnedEyes.Contains(eye))
			{
				spawnedEyes.Remove(eye);
				if (spawnedEyes.Count == 0)
				{
					Enrage();
				}
			}
		}

		private void OnHurtboxEnter(Collider col)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)col).CompareTag("Player"))
			{
				Vector3 position = Components.CenterMass.position;
				Vector3 position2 = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
				Vector3 vector = position2 - position;
				Vector3 val = vector.XZ();
				Vector3 val2 = ((Vector3)(ref val)).normalized * Parameters.spinMeleeKnockback;
				MonoSingleton<NewMovement>.Instance.GetHurt(Parameters.spinMeleeDamage, false, 1f, false, false, 1f, false);
				MonoSingleton<NewMovement>.Instance.Launch(val2);
			}
		}

		private void OnHookStateChanged(bool isHooked)
		{
			this.isHooked = isHooked;
		}

		private Coroutine InvokeDelayed(Action action, float time)
		{
			return ((MonoBehaviour)this).StartCoroutine(InvokeAfterTimeCoroutine(action, time));
		}

		private IEnumerator ShakeAttackCoroutine()
		{
			float timer = Parameters.shakeProjectileBurstLengthInSeconds;
			int projectilesRemaining = Parameters.shakeProjectileCount;
			float timerPerProjectile = timer / (float)projectilesRemaining;
			while (projectilesRemaining > 0)
			{
				yield return (object)new WaitForSeconds(timerPerProjectile);
				GameObject spread = new GameObject();
				GoreZone gz = GoreZone.ResolveGoreZone(((Component)this).transform);
				if ((Object)(object)gz != (Object)null)
				{
					spread.transform.SetParent(((Component)gz).transform);
				}
				ProjectileSpread spr = spread.AddComponent<ProjectileSpread>();
				spr.dontSpawn = true;
				spr.timeUntilDestroy = Parameters.shakeProjectileBurstLengthInSeconds * 2f;
				int projectileCount = (m_isEnraged ? Parameters.enrageBlueProjectileCount : Parameters.shakeProjectileGroup);
				for (int i = 0; i < projectileCount; i++)
				{
					Projectile proj = FireTrackingProjectileHalo();
					if ((Object)(object)proj != (Object)null)
					{
						((Component)proj).transform.parent = ((Component)spr).transform;
						proj.spreaded = true;
					}
				}
				int num = projectilesRemaining - 1;
				projectilesRemaining = num;
			}
			ActionEnd();
		}

		private IEnumerator EnragedBarrageCoroutine()
		{
			_ = Parameters.barrageAttackLength;
			int projectilesRemaining = Parameters.barrageProjectileCount;
			GameObject spread = new GameObject();
			GoreZone gz = GoreZone.ResolveGoreZone(((Component)this).transform);
			if ((Object)(object)gz != (Object)null)
			{
				spread.transform.SetParent(((Component)gz).transform);
			}
			ProjectileSpread spr = spread.AddComponent<ProjectileSpread>();
			spr.dontSpawn = true;
			spr.timeUntilDestroy = Parameters.barrageAttackProjectileDelay * (float)Parameters.barrageProjectileCount + Parameters.barrageAttackLength;
			while (projectilesRemaining > 0)
			{
				yield return (object)new WaitForSeconds(Parameters.barrageAttackProjectileDelay);
				Projectile proj = FireTrackingProjectileSpherical();
				if ((Object)(object)proj != (Object)null)
				{
					((Component)proj).transform.parent = ((Component)spr).transform;
					proj.spreaded = true;
				}
				int num = projectilesRemaining - 1;
				projectilesRemaining = num;
			}
			ActionEnd();
		}

		private IEnumerator EnragedCarpetBomb()
		{
			float timer = Parameters.carpetBombLength;
			float projectileCountf = timer / (Parameters.carpetBombProjectileDelay + Mathf.Epsilon);
			float projectileDelay = Parameters.carpetBombProjectileDelay;
			int projectileCount = Mathf.FloorToInt(projectileCountf);
			while (projectileCount > 0)
			{
				yield return (object)new WaitForSeconds(projectileDelay);
				FireExplosiveProjectile();
				int num = projectileCount - 1;
				projectileCount = num;
			}
			ActionEnd();
		}

		private IEnumerator InvokeAfterTimeCoroutine(Action action, float time)
		{
			yield return (object)new WaitForSeconds(time);
			action?.Invoke();
		}

		private IEnumerator InvokeAfterAnimation(Action onComplete)
		{
			yield return (object)new WaitForEndOfFrame();
			float lastTime = 0f;
			Func<bool> func = delegate
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				AnimatorStateInfo currentAnimatorStateInfo = Components.Animator.GetCurrentAnimatorStateInfo(0);
				float normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime;
				if (lastTime < normalizedTime)
				{
					lastTime = normalizedTime;
				}
				return normalizedTime < 0f || lastTime > normalizedTime;
			};
			yield return (object)new WaitWhile(func);
			onComplete?.Invoke();
		}

		private IEnumerator ActionFailsafe()
		{
			float timer = 0f;
			while (true)
			{
				timer = ((!isActioning) ? 0f : (timer + Time.deltaTime));
				if (timer > Parameters.maxAttackTimeFailsafe && isActioning)
				{
					ActionEnd();
				}
				yield return (object)new WaitForEndOfFrame();
			}
		}

		public float GetLocationCritDamageMultiplier(string location)
		{
			if (string.IsNullOrEmpty(location))
			{
				return 0f;
			}
			if (location == "Head")
			{
				return 1f;
			}
			if (location == "Limb" || location == "EndLimb")
			{
				return 0.5f;
			}
			return 0f;
		}

		private float CalcDamage(HurtEventData hurtData)
		{
			return CalcDamage(hurtData.multiplier, GetLocationCritDamageMultiplier(hurtData.target.tag), hurtData.critMultiplier);
		}

		private float CalcDamage(float damageMultiplier, float locationDamage, float critMultiplier)
		{
			return damageMultiplier + locationDamage * damageMultiplier * critMultiplier;
		}

		private void OnHurtGore(HurtEventData hurtData)
		{
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: 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_0262: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			float locationCritDamageMultiplier = GetLocationCritDamageMultiplier(hurtData.target.tag);
			float num = CalcDamage(hurtData.multiplier, locationCritDamageMultiplier, hurtData.critMultiplier);
			if (num <= 0f)
			{
				return;
			}
			GoreType? val2 = null;
			if (locationCritDamageMultiplier == 1f && (num >= 1f || health <= 0f))
			{
				val2 = (GoreType)0;
			}
			else if (((num >= 1f || health <= 0f) && hurtData.hitter != "explosion") || (hurtData.hitter == "explosion" && hurtData.target.tag == "EndLimb"))
			{
				val2 = ((!hurtData.target.CompareTag("Body")) ? new GoreType?((GoreType)1) : new GoreType?((GoreType)2));
			}
			else if (Components.EnemyIdentifier.hitter != "explosion")
			{
				val2 = (GoreType)3;
			}
			if (val2.HasValue)
			{
				val = MonoSingleton<BloodsplatterManager>.Instance.GetGore(val2.Value, Components.EnemyIdentifier.underwater, Components.EnemyIdentifier.sandified, Components.EnemyIdentifier.blessed, (EnemyIdentifier)null);
			}
			GoreZone val3 = null;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			val3 = (((Object)(object)val3 == (Object)null) ? GoreZone.ResolveGoreZone(((Component)this).transform) : val3);
			val.transform.position = hurtData.target.transform.position;
			if (Components.EnemyIdentifier.hitter == "drill")
			{
				Transform transform = val.transform;
				transform.localScale *= 2f;
			}
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3.goreZone != (Object)null)
			{
				val.transform.SetParent(val3.goreZone, true);
			}
			Bloodsplatter val4 = default(Bloodsplatter);
			if (!val.TryGetComponent<Bloodsplatter>(ref val4))
			{
				return;
			}
			CollisionModule collision = ((Component)val4).GetComponent<ParticleSystem>().collision;
			if (hurtData.hitter == "shotgun" || hurtData.hitter == "shotgunzone" || hurtData.hitter == "explosion")
			{
				if (Random.Range(0f, 1f) > 0.5f)
				{
					((CollisionModule)(ref collision)).enabled = false;
				}
				val4.hpAmount = 3;
			}
			else if (hurtData.hitter == "nail")
			{
				val4.hpAmount = 1;
				AudioSource component = ((Component)val4).GetComponent<AudioSource>();
				component.volume *= 0.8f;
			}
			val4.GetReady();
		}

		private void OnHurtStyle(HurtEventData hurtData)
		{
			if (hurtData.hitter == "enemy")
			{
				return;
			}
			StyleCalculator instance = MonoSingleton<StyleCalculator>.Instance;
			if (health <= 0f)
			{
				if (hurtData.hitter == "explosion" || hurtData.hitter == "ffexplosion" || hurtData.hitter == "railcannon")
				{
					instance.shud.AddPoints(120, "ultrakill.fireworks", hurtData.sourceWeapon, Components.EnemyIdentifier, -1, "", "");
				}
				else if (hurtData.hitter == "ground slam")
				{
					instance.shud.AddPoints(160, "ultrakill.airslam", hurtData.sourceWeapon, Components.EnemyIdentifier, -1, "", "");
				}
				else if (hurtData.hitter != "deathzone")
				{
					instance.shud.AddPoints(50, "ultrakill.airshot", hurtData.sourceWeapon, Components.EnemyIdentifier, -1, "", "");
				}
			}
			if (!(hurtData.hitter == "secret"))
			{
				instance.HitCalculator(hurtData.hitter, "machine", hurtData.target.tag, isDead, Components.EnemyIdentifier, hurtData.sourceWeapon);
			}
		}

		public float GetHealth()
		{
			return health;
		}

		public EnemyIdentifier GetEnemyIdentifier()
		{
			return Components.EnemyIdentifier;
		}

		private Vector3 GetRingSpawnPosition()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = Components.CenterMass.position;
			Vector2 val = Vector2.op_Implicit(Random.onUnitSphere);
			((Vector2)(ref val)).Normalize();
			Vector3 val2 = position + Vector3.up;
			if (target != null)
			{
				val2 = target.position;
			}
			Quaternion val3 = Quaternion.LookRotation(val2 - position);
			Vector3 val4 = val3 * new Vector3(val.x, val.y, 0f);
			return position + val4 * Parameters.shakeProjectileOriginRadius;
		}

		private void SetDroneTarget(Drone drone, EnemyTarget target)
		{
			try
			{
				FieldInfo field = typeof(Drone).GetField("eid", BindingFlags.Instance | BindingFlags.NonPublic);
				object? value = field.GetValue(drone);
				EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
				val.target = target;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
			DroneFlesh obj = default(DroneFlesh);
			if (((Component)drone).TryGetComponent<DroneFlesh>(ref obj))
			{
				try
				{
					FieldInfo field2 = typeof(DroneFlesh).GetField("eid", BindingFlags.Instance | BindingFlags.NonPublic);
					object? value2 = field2.GetValue(obj);
					EnemyIdentifier val2 = (EnemyIdentifier)((value2 is EnemyIdentifier) ? value2 : null);
					val2.target = target;
				}
				catch (Exception ex2)
				{
					Debug.LogError((object)ex2);
				}
			}
		}

		public void SetTarget(Transform target)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Components.EnemyIdentifier.target = new EnemyTarget(target);
			foreach (Drone spawnedEye in spawnedEyes)
			{
				SetDroneTarget(spawnedEye, this.target);
			}
		}

		private bool TargetLineOfSightCheck()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			if (target == null || isBlind)
			{
				return false;
			}
			Vector3 position = Components.CenterMass.position;
			Vector3 position2 = target.position;
			Vector3 val = position2 - position;
			return !Physics.Raycast(position, val, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1);
		}

		public void SetParams(CarcassParameters parameters)
		{
			this.parameters = parameters;
		}

		private void OnDestroy()
		{
			DestroyAllEyes();
			DestroyAllSigils();
		}
	}
	public class CarcassAnimation : MonoBehaviour
	{
		[SerializeField]
		private Carcass carcass;

		[SerializeField]
		private Transform vibrationTarget;

		[SerializeField]
		private Animator animator;

		private static readonly int dash = Animator.StringToHash("Dash");

		private static readonly int spin = Animator.StringToHash("Spin");

		private static readonly int dodge = Animator.StringToHash("Dodge");

		private static readonly int shake = Animator.StringToHash("Shake");

		private static readonly int stunned = Animator.StringToHash("Stunned");

		private static readonly int writhe = Animator.StringToHash("Writhe");

		private static readonly int summon = Animator.StringToHash("Summon");

		private static readonly int killEyes = Animator.StringToHash("KillEyes");

		private static readonly int death = Animator.StringToHash("Death");

		private static readonly string retreatingID = "Retreating";

		[SerializeField]
		private bool vibrate;

		[SerializeField]
		private float vibrationRange = 0.15f;

		private Vector3 vibrationStartPosition;

		public UnityEvent OnFireExplosiveProjectile;

		public UnityEvent OnSummonSigil;

		public UnityEvent OnActionDone;

		public UnityEvent OnDodge;

		public Carcass Carcass
		{
			get
			{
				if ((Object)(object)carcass == (Object)null)
				{
					carcass = ((Component)this).GetComponentInParent<Carcass>();
				}
				return carcass;
			}
		}

		public Animator Animator
		{
			get
			{
				if ((Object)(object)animator == (Object)null)
				{
					animator = ((Component)this).GetComponent<Animator>();
				}
				return animator;
			}
		}

		public bool IsVibrating => vibrate;

		public void SetVibrationRange(float value)
		{
			vibrationRange = value;
		}

		public void SetVisible(bool visible)
		{
			if (!((Object)(object)vibrationTarget == (Object)null))
			{
				((Component)vibrationTarget).gameObject.SetActive(visible);
			}
		}

		public void SetVibrating(bool shaking)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			vibrate = shaking;
			if ((Object)(object)vibrationTarget != (Object)null)
			{
				if (shaking)
				{
					vibrationStartPosition = vibrationTarget.localPosition;
				}
				else
				{
					vibrationTarget.localPosition = vibrationStartPosition;
				}
			}
		}

		private void SetRetreatingBlend(float normalizedBlend)
		{
			Animator.SetFloat(retreatingID, normalizedBlend);
		}

		private void Update()
		{
			ResolveVibrate();
			ResolveRetreatBlend();
		}

		private void ResolveRetreatBlend()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 velocity = Carcass.Components.Rigidbody.velocity;
			float num = Mathf.Min(1f, ((Vector3)(ref velocity)).magnitude / 3f);
			Vector3 forward = ((Component)Carcass).transform.forward;
			float num2 = Vector3.Dot(velocity.XZ(), -forward.XZ());
			num2 = Mathf.Max(0f, num2);
			SetRetreatingBlend(num2 * num);
		}

		private void ResolveVibrate()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (vibrate && !((Object)(object)vibrationTarget == (Object)null))
			{
				vibrationTarget.localPosition = vibrationStartPosition + Random.onUnitSphere * vibrationRange;
			}
		}

		public void FireExplosiveProjectile()
		{
			UnityEvent onFireExplosiveProjectile = OnFireExplosiveProjectile;
			if (onFireExplosiveProjectile != null)
			{
				onFireExplosiveProjectile.Invoke();
			}
		}

		public void SpawnSigil()
		{
			UnityEvent onSummonSigil = OnSummonSigil;
			if (onSummonSigil != null)
			{
				onSummonSigil.Invoke();
			}
		}

		public void ActionDone()
		{
			UnityEvent onActionDone = OnActionDone;
			if (onActionDone != null)
			{
				onActionDone.Invoke();
			}
		}

		public void Dash()
		{
			Animator.Play(dash, 0, 0f);
		}

		public void Shake()
		{
			Animator.Play(shake, 0, 0f);
		}

		public void Stunned()
		{
			Animator.Play(stunned, 0, 0f);
		}

		public void Dodge()
		{
			Animator.Play(dodge, 0, 0f);
			UnityEvent onDodge = OnDodge;
			if (onDodge != null)
			{
				onDodge.Invoke();
			}
		}

		public void Spin()
		{
			Animator.Play(spin, 0, 0f);
		}

		public void Summon()
		{
			Animator.Play(summon, 0, 0f);
		}

		public void Writhe()
		{
			Animator.Play(writhe, 0, 0f);
		}

		public void KillEyes()
		{
			Animator.Play(killEyes, 0, 0f);
		}

		public void Death()
		{
			Animator.Play(death, 0, 0f);
		}
	}
	public static class CarcassCFG
	{
	}
	[RequireComponent(typeof(Carcass))]
	public class CarcassComponents : MonoBehaviour
	{
		[Header("Component References")]
		[SerializeField]
		private Transform rootTransform;

		[SerializeField]
		private Transform projectileLobPoint;

		[SerializeField]
		private Transform centerMass;

		[SerializeField]
		private HashedTrigger spinHitbox;

		[SerializeField]
		private Rigidbody rb;

		[SerializeField]
		private Animator animator;

		[SerializeField]
		private CarcassAnimation animation;

		[SerializeField]
		private Machine machine;

		[SerializeField]
		private EnemyIdentifier eid;

		[SerializeField]
		private ProjectileDetector projectileDetector;

		[SerializeField]
		private HookDetector hookDetector;

		[SerializeField]
		private MaterialChanger materialChanger;

		[SerializeField]
		private GameObject[] hitboxes;

		[Header("Asset References")]
		[SerializeField]
		private GameObject healOrbPrefab;

		[SerializeField]
		private GameObject summonCirclePrefab;

		[SerializeField]
		private GameObject psychosisFXPrefab;

		[SerializeField]
		private GameObject healAuraFX;

		[SerializeField]
		private GameObject healFX;

		[SerializeField]
		private GameObject stunnedFX;

		[SerializeField]
		private GameObject genericSpawnFX;

		[SerializeField]
		private GameObject hookSnapFX;

		[SerializeField]
		private GameObject bloodSprayFX;

		[SerializeField]
		private GameObject carcassScreamPrefab;

		[SerializeField]
		private GameObject carcassDeathFX;

		[SerializeField]
		private Material eyeMaterialOverride;

		[SerializeField]
		private Material[] enragedMaterials;

		[Header("ULTRAKILL ASSETS - Will auto-populate if left null.")]
		[SerializeField]
		private GameObject droneFlesh;

		[SerializeField]
		private GameObject homingProjectilePrefab;

		[SerializeField]
		private GameObject lobbedExplosiveProjectilePrefab;

		[SerializeField]
		private GameObject lightShaftFX;

		public Transform RootTransform => rootTransform;

		public Transform ProjectileLobPoint => projectileLobPoint;

		public Transform CenterMass => centerMass;

		public HashedTrigger SpinHitbox => spinHitbox;

		public Rigidbody Rigidbody => rb;

		public Animator Animator => animator;

		public CarcassAnimation Animation => animation;

		public Machine Machine => machine;

		public EnemyIdentifier EnemyIdentifier => eid;

		public ProjectileDetector ProjectileDetector => projectileDetector;

		public HookDetector HookDetector => hookDetector;

		public MaterialChanger MaterialChanger => materialChanger;

		public GameObject[] Hitboxes
		{
			get
			{
				if (hitboxes == null)
				{
					return Array.Empty<GameObject>();
				}
				return hitboxes;
			}
		}

		public GameObject HealOrbPrefab => healOrbPrefab;

		public GameObject SummonCirclePrefab => summonCirclePrefab;

		public GameObject PsychosisFXPrefab => psychosisFXPrefab;

		public GameObject HealAuraFX => healAuraFX;

		public GameObject HealFX => healFX;

		public GameObject StunnedFX => stunnedFX;

		public GameObject GenericSpawnFX => genericSpawnFX;

		public GameObject HookSnapFX => hookSnapFX;

		public GameObject BloodSprayFX => bloodSprayFX;

		public GameObject CarcassScreamPrefab => carcassScreamPrefab;

		public GameObject CarcassDeathFX => carcassDeathFX;

		public Material EyeMaterialOverride => eyeMaterialOverride;

		public Material[] EnragedMaterials => enragedMaterials;

		public GameObject DroneFlesh => droneFlesh;

		public GameObject HomingProjectilePrefab => homingProjectilePrefab;

		public GameObject LobbedExplosiveProjectilePrefab => lobbedExplosiveProjectilePrefab;

		public GameObject LightShaftFX => lightShaftFX;
	}
	[Serializable]
	public class CarcassParameters
	{
		public float lowHealthThreshold = 0.4f;

		public float healCooldown = 9f;

		public float lateralFlySpeed = 30f;

		public float verticalFlySpeed = 10f;

		public float fallSpeed = 20f;

		public float strafeSpeed = 15f;

		public float desiredFlyHeight = 7f;

		public float movementSmoothing = 8f;

		public float directionChangeDelay = 2f;

		public float strafeObstacleCheckDistance = 8f;

		public float minTargetDistance = 16f;

		public float maxTargetDistance = 18f;

		public float targetCheckDelay = 1f;

		public float attackDelay = 3f;

		public float speedWhileAttackingMultiplier = 0.25f;

		public float enragedSpeedMultiplier = 1.5f;

		public float maxAttackTimeFailsafe = 8f;

		public float spinMaxRange = 35f;

		public int spinMeleeDamage = 20;

		public float spinMeleeKnockback = 15f;

		public float shakeProjectileOriginRadius = 4f;

		public float shakeProjectileBurstLengthInSeconds = 2.2f;

		public int shakeProjectileCount = 3;

		public int shakeProjectileGroup = 3;

		public int eyeSpawnCount = 3;

		public float eyeSpawnDelay = 0.14f;

		public float eyeHealDelay = 0.3f;

		public float eyeInitialHealDelay = 0.4f;

		public float eyeHealPerEye = 6.666f;

		public float eyeHealth = 2f;

		public float eyeSpawnCooldown = 12f;

		public float stunTime = 2.5f;

		public float enrageAddEnrageTimeOnStun = 8.5f;

		public float stunDamageMultiplier = 1.2f;

		public float dodgeForce = 65f;

		public float dodgeCooldownTime = 2f;

		public float dodgeLength = 1.1f;

		public float dodgeBrakeSpeed = 0.45f;

		public float dodgeStaminaCost = 2f;

		public float dodgeActionTimerAddition = 1.4f;

		public float dodgeMinRange = 19f;

		public float enrageLength = 16f;

		public float enrageAttackTimerMultiplier = 1.5f;

		public float enrageDashForce = 100f;

		public float enrageDashLength = 0.8f;

		public float enrageDashBrakeForce = 0.04f;

		public float enrageDashMaxRange = 40f;

		public float enrageDashActionDelay = 0.7f;

		public int enrageBlueProjectileCount = 4;

		public float enrageHookBiteSpeedMultiplier = 2f;

		public float hookBiteDelay = 1f;

		public float hookCooldown = 6f;

		public float hookPlayerCooldown = 2.2f;

		public int hookBiteYellowHP = 0;

		public int barrageProjectileCount = 24;

		public float barrageAttackLength = 4f;

		public float barrageAttackProjectileDelay = 0.25f;

		public float carpetBombLength = 3f;

		public float carpetBombProjectileDelay = 0.4f;

		public bool enableEnrageWildAttacks;
	}
	public class CarcassParametersAsset : ScriptableObject
	{
		public float lowHealthThreshold = 0.4f;

		public float healCooldown = 9f;

		public float lateralFlySpeed = 30f;

		public float verticalFlySpeed = 10f;

		public float fallSpeed = 20f;

		public float strafeSpeed = 15f;

		public float desiredFlyHeight = 7f;

		public float movementSmoothing = 8f;

		public float directionChangeDelay = 2f;

		public float strafeObstacleCheckDistance = 8f;

		public float minTargetDistance = 16f;

		public float maxTargetDistance = 18f;

		public float targetCheckDelay = 1f;

		public float attackDelay = 3f;

		public float speedWhileAttackingMultiplier = 0.25f;

		public float enragedSpeedMultiplier = 1.5f;

		public float maxAttackTimeFailsafe = 8f;

		public float spinMaxRange = 35f;

		public int spinMeleeDamage = 20;

		public float spinMeleeKnockback = 15f;

		public float shakeProjectileOriginRadius = 4f;

		public float shakeProjectileBurstLengthInSeconds = 2.2f;

		public int shakeProjectileCount = 3;

		public int shakeProjectileGroup = 3;

		public int eyeSpawnCount = 3;

		public float eyeSpawnDelay = 0.14f;

		public float eyeHealDelay = 0.3f;

		public float eyeInitialHealDelay = 0.4f;

		public float eyeHealPerEye = 6.666f;

		public float eyeHealth = 2f;

		public float eyeSpawnCooldown = 12f;

		public float stunTime = 2.5f;

		public float enrageAddEnrageTimeOnStun = 8.5f;

		public float stunDamageMultiplier = 1.2f;

		public float dodgeForce = 65f;

		public float dodgeCooldownTime = 2f;

		public float dodgeLength = 1.1f;

		public float dodgeBrakeSpeed = 0.45f;

		public float dodgeStaminaCost = 2f;

		public float dodgeActionTimerAddition = 1.4f;

		public float dodgeMinRange = 19f;

		public float enrageLength = 16f;

		public float enrageAttackTimerMultiplier = 1.5f;

		public float enrageDashForce = 100f;

		public float enrageDashLength = 0.8f;

		public float enrageDashBrakeForce = 0.04f;

		public float enrageDashMaxRange = 40f;

		public float enrageDashActionDelay = 0.7f;

		public int enrageBlueProjectileCount = 4;

		public float enrageHookBiteSpeedMultiplier = 2f;

		public float hookBiteDelay = 1f;

		public float hookCooldown = 6f;

		public float hookPlayerCooldown = 2.2f;

		public int hookBiteYellowHP = 0;

		public int barrageProjectileCount = 24;

		public float barrageAttackLength = 4f;

		public float barrageAttackProjectileDelay = 0.25f;

		public float carpetBombLength = 3f;

		public float carpetBombProjectileDelay = 0.4f;

		public bool enableEnrageWildAttacks;

		private CarcassParameters _parameters;

		public CarcassParameters Parameters
		{
			get
			{
				if (_parameters == null)
				{
					_parameters = Convert();
				}
				return _parameters;
			}
		}

		private CarcassParameters Convert()
		{
			CarcassParameters carcassParameters = new CarcassParameters();
			carcassParameters.lowHealthThreshold = lowHealthThreshold;
			carcassParameters.healCooldown = healCooldown;
			carcassParameters.lateralFlySpeed = lateralFlySpeed;
			carcassParameters.verticalFlySpeed = verticalFlySpeed;
			carcassParameters.fallSpeed = fallSpeed;
			carcassParameters.strafeSpeed = strafeSpeed;
			carcassParameters.desiredFlyHeight = desiredFlyHeight;
			carcassParameters.movementSmoothing = movementSmoothing;
			carcassParameters.directionChangeDelay = directionChangeDelay;
			carcassParameters.strafeObstacleCheckDistance = strafeObstacleCheckDistance;
			carcassParameters.minTargetDistance = minTargetDistance;
			carcassParameters.maxTargetDistance = maxTargetDistance;
			carcassParameters.targetCheckDelay = targetCheckDelay;
			carcassParameters.attackDelay = attackDelay;
			carcassParameters.speedWhileAttackingMultiplier = speedWhileAttackingMultiplier;
			carcassParameters.enragedSpeedMultiplier = enragedSpeedMultiplier;
			carcassParameters.maxAttackTimeFailsafe = maxAttackTimeFailsafe;
			carcassParameters.spinMaxRange = spinMaxRange;
			carcassParameters.spinMeleeDamage = spinMeleeDamage;
			carcassParameters.spinMeleeKnockback = spinMeleeKnockback;
			carcassParameters.shakeProjectileOriginRadius = shakeProjectileOriginRadius;
			carcassParameters.shakeProjectileBurstLengthInSeconds = shakeProjectileBurstLengthInSeconds;
			carcassParameters.shakeProjectileCount = shakeProjectileCount;
			carcassParameters.shakeProjectileGroup = shakeProjectileGroup;
			carcassParameters.eyeSpawnCount = eyeSpawnCount;
			carcassParameters.eyeSpawnDelay = eyeSpawnDelay;
			carcassParameters.eyeHealDelay = eyeHealDelay;
			carcassParameters.eyeInitialHealDelay = eyeInitialHealDelay;
			carcassParameters.eyeHealPerEye = eyeHealPerEye;
			carcassParameters.eyeHealth = eyeHealth;
			carcassParameters.eyeSpawnCooldown = eyeSpawnCooldown;
			carcassParameters.stunTime = stunTime;
			carcassParameters.enrageAddEnrageTimeOnStun = enrageAddEnrageTimeOnStun;
			carcassParameters.stunDamageMultiplier = stunDamageMultiplier;
			carcassParameters.dodgeForce = dodgeForce;
			carcassParameters.dodgeCooldownTime = dodgeCooldownTime;
			carcassParameters.dodgeLength = dodgeLength;
			carcassParameters.dodgeBrakeSpeed = dodgeBrakeSpeed;
			carcassParameters.enrageLength = enrageLength;
			carcassParameters.enrageAttackTimerMultiplier = enrageAttackTimerMultiplier;
			carcassParameters.enrageDashForce = enrageDashForce;
			carcassParameters.enrageDashLength = enrageDashLength;
			carcassParameters.enrageDashBrakeForce = enrageDashBrakeForce;
			carcassParameters.enrageDashMaxRange = enrageDashMaxRange;
			carcassParameters.enrageDashActionDelay = enrageDashActionDelay;
			carcassParameters.enrageBlueProjectileCount = enrageBlueProjectileCount;
			carcassParameters.enrageHookBiteSpeedMultiplier = enrageHookBiteSpeedMultiplier;
			carcassParameters.hookBiteDelay = hookBiteDelay;
			carcassParameters.hookCooldown = hookCooldown;
			carcassParameters.hookBiteYellowHP = hookBiteYellowHP;
			carcassParameters.barrageProjectileCount = barrageProjectileCount;
			carcassParameters.barrageAttackLength = barrageAttackLength;
			carcassParameters.barrageAttackProjectileDelay = barrageAttackProjectileDelay;
			carcassParameters.carpetBombLength = carpetBombLength;
			carcassParameters.carpetBombProjectileDelay = carpetBombProjectileDelay;
			carcassParameters.enableEnrageWildAttacks = enableEnrageWildAttacks;
			return carcassParameters;
		}
	}
	public class CarcassHealOrb : MonoBehaviour
	{
		private Carcass owner;

		[SerializeField]
		private Transform target;

		[SerializeField]
		private float healingRange = 3.5f;

		[SerializeField]
		private float healAmount = 1.5f;

		[SerializeField]
		private float flyAcceleration = 150f;

		[SerializeField]
		private float flySpeed = 30f;

		[SerializeField]
		private float randomSpawnForce = 15f;

		[SerializeField]
		private bool triggerEyeSpawnOnPickup = true;

		private Vector3 velocity;

		private bool targetSet;

		public Carcass Owner => owner;

		public void SetSpawnEye(bool enabled)
		{
			triggerEyeSpawnOnPickup = enabled;
		}

		public void SetTarget(Transform target)
		{
			targetSet = true;
			this.target = target;
		}

		public void SetOwner(Carcass owner)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			this.owner = owner;
			if ((Object)(object)owner != (Object)null)
			{
				SetTarget(owner.Components.CenterMass);
			}
			Vector3 val = Random.onUnitSphere * randomSpawnForce;
			val.y = Mathf.Abs(val.y);
			velocity = val;
		}

		private void Update()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)owner != (Object)null && owner.Dead)
			{
				Die();
			}
			else if (targetSet && (Object)(object)target == (Object)null)
			{
				Die();
			}
			else if (!((Object)(object)target == (Object)null))
			{
				Vector3 position = target.position;
				Vector3 position2 = ((Component)this).transform.position;
				Vector3 val = position - position2;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < healingRange)
				{
					Collected();
					return;
				}
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				velocity += normalized * flyAcceleration * Time.deltaTime;
				velocity = Vector3.ClampMagnitude(velocity, flySpeed);
				((Component)this).transform.position = position2 + velocity * Time.deltaTime;
			}
		}

		private void Die()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void Collected()
		{
			if ((Object)(object)owner != (Object)null)
			{
				owner.Heal(healAmount);
				if (triggerEyeSpawnOnPickup)
				{
					owner.SpawnEye();
				}
			}
			Die();
		}
	}
	public class GrabbyArm : MonoBehaviour
	{
		[SerializeField]
		private Animator animator;

		[SerializeField]
		private GameObject healOrbPrefab;

		[SerializeField]
		private GameObject spawnFX;

		[SerializeField]
		private HashedTrigger hurtBox;

		[SerializeField]
		private float normalizedStartTime = 0.25f;

		private static int[] attackAnimationHashes = new int[4]
		{
			Animator.StringToHash("Scratch"),
			Animator.StringToHash("Punch"),
			Animator.StringToHash("Slash"),
			Animator.StringToHash("Grab")
		};

		private Transform target;

		private bool collected;

		private bool targetIsPlayer;

		private float timeLeft = 2f;

		private bool dying;

		private Carcass owner;

		public Carcass Owner => owner;

		private void Start()
		{
			//IL_005b: 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)
			hurtBox.OnTriggerEntered += HurtBox_OnTriggerEntered;
			animator.Play(attackAnimationHashes[Random.Range(0, attackAnimationHashes.Length)], 0, normalizedStartTime);
			if ((Object)(object)spawnFX != (Object)null)
			{
				Object.Instantiate<GameObject>(spawnFX, ((Component)this).transform.position, Quaternion.identity);
			}
		}

		public void SetTarget(Transform target)
		{
			this.target = target;
			targetIsPlayer = false;
			if ((Object)(object)target != (Object)null)
			{
				targetIsPlayer = (Object)(object)((Component)target).GetComponentInParent<NewMovement>() != (Object)null;
			}
		}

		private void HurtBox_OnTriggerEntered(Collider obj)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!ColliderIsTarget(obj) || collected)
			{
				return;
			}
			collected = true;
			if ((Object)(object)healOrbPrefab != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(healOrbPrefab, ((Component)this).transform.position, Quaternion.identity);
				GoreZone val2 = GoreZone.ResolveGoreZone(((Component)this).transform);
				if ((Object)(object)val2 != (Object)null)
				{
					val.transform.SetParent(((Component)val2).transform, true);
				}
				CarcassHealOrb carcassHealOrb = default(CarcassHealOrb);
				if ((Object)(object)owner != (Object)null && val.TryGetComponent<CarcassHealOrb>(ref carcassHealOrb))
				{
					carcassHealOrb.SetOwner(owner);
				}
			}
		}

		private void Update()
		{
			timeLeft -= Time.deltaTime;
			if (timeLeft <= 0f && !dying)
			{
				Despawn();
			}
		}

		private void Despawn()
		{
			if (!dying)
			{
				dying = true;
				((Component)hurtBox).gameObject.SetActive(false);
				((MonoBehaviour)this).StartCoroutine(Death());
			}
		}

		private IEnumerator Death()
		{
			yield return (object)new WaitForSeconds(1f);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void SetOwner(Carcass carcass)
		{
			owner = carcass;
		}

		private bool ColliderIsTarget(Collider col)
		{
			if (((Component)col).CompareTag("Player"))
			{
				return true;
			}
			if (!targetIsPlayer && ((Component)col).CompareTag("Enemy"))
			{
				return true;
			}
			return false;
		}
	}
	public class SummonCircle : MonoBehaviour
	{
		[SerializeField]
		private GameObject grabbyHandPrefab;

		[SerializeField]
		private GameObject activateFX;

		[Seria

plugins/Carcass/CarcassLoader.dll

Decompiled 4 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CarcassEnemy;
using CarcassLoader.Assets;
using CarcassLoader.Properties;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CarcassLoader")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Loader mod for the CarcassRuntime with packaged assets")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CarcassLoader")]
[assembly: AssemblyTitle("CarcassLoader")]
[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 CarcassLoader
{
	public class AssetLoader
	{
		private Dictionary<string, Object> loadedAssets = new Dictionary<string, Object>();

		public AssetBundle Bundle { get; }

		public AssetLoader(AssetBundle bundle)
		{
			Bundle = bundle;
		}

		public AssetLoader(byte[] bundleBytes)
		{
			Bundle = AssetBundle.LoadFromMemory(bundleBytes);
		}

		public AssetLoader(string filePath)
		{
			Bundle = AssetBundle.LoadFromFile(filePath);
		}

		public T LoadAsset<T>(string assetName) where T : Object
		{
			if (loadedAssets.ContainsKey(assetName))
			{
				return (T)(object)loadedAssets[assetName];
			}
			T val = Bundle.LoadAsset<T>(assetName);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)$"{assetName} of type {typeof(T)} not found in Assetbundle.");
				return default(T);
			}
			loadedAssets.Add(assetName, (Object)(object)val);
			return val;
		}

		public T[] LoadAllAssets<T>() where T : Object
		{
			T[] array = Bundle.LoadAllAssets<T>();
			T[] array2 = array;
			foreach (T val in array2)
			{
				if (!((Object)(object)val == (Object)null) && !loadedAssets.ContainsKey(((Object)val).name))
				{
					loadedAssets.Add(((Object)val).name, (Object)(object)val);
				}
			}
			return array;
		}

		public void Unload(bool unloadAllLoadedObjects = true)
		{
			Bundle.Unload(unloadAllLoadedObjects);
		}
	}
	public class DebugSpawner : MonoBehaviour
	{
		private static GameObject carcassPrefab;

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)106))
			{
				SpawnCarcass();
			}
			if (Input.GetKeyDown((KeyCode)257))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.SpinAttack();
				});
			}
			if (Input.GetKeyDown((KeyCode)258))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.ShakeAttack();
				});
			}
			if (Input.GetKeyDown((KeyCode)260))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.SummonEyes();
				});
			}
			if (Input.GetKeyDown((KeyCode)261))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.StartHealing();
				});
			}
			if (Input.GetKeyDown((KeyCode)262))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.SummonSigil();
				});
			}
			if (Input.GetKeyDown((KeyCode)263))
			{
				ForEachCarcassDo(delegate(Carcass c)
				{
					c.Enrage();
				});
			}
		}

		private void SpawnCarcass()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)MonoSingleton<CameraController>.Instance).transform;
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(transform.position, transform.forward);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, float.PositiveInfinity, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1))
			{
				Object.Instantiate<GameObject>(CarcassAssets.Carcass, ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.1f, Quaternion.identity);
			}
		}

		private void ForEachCarcassDo(Action<Carcass> onInvoke)
		{
			Carcass[] array = Object.FindObjectsOfType<Carcass>();
			foreach (Carcass obj in array)
			{
				onInvoke?.Invoke(obj);
			}
		}
	}
	[BepInPlugin("Hydraxous.ULTRAKILL.CarcassLoader", "CarcassLoader", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_NAME = "CarcassLoader";

		public const string PLUGIN_GUID = "Hydraxous.ULTRAKILL.CarcassLoader";

		public const string PLUGIN_VERSION = "1.0.0";

		private const string CARCASS_RUNTIME = "CarcassEnemy.dll";

		private static Harmony harmony;

		public static AssetLoader AssetLoader { get; private set; }

		public static Plugin Instance { get; private set; }

		public static ConfigEntry<bool> EnableInCyberGrind { get; private set; }

		private void Awake()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			if (!LoadRuntime())
			{
				((Behaviour)this).enabled = false;
				((BaseUnityPlugin)this).Logger.LogFatal((object)"Carcass failed to load.");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"CarcassEnemy.dll loaded successfully.");
			Instance = this;
			AssetLoader = new AssetLoader(Resources.Carcass);
			harmony = new Harmony("Hydraxous.ULTRAKILL.CarcassLoader.harmony");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"CarcassLoader is loaded!");
			EnableInCyberGrind = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableInCyberGrind", true, "Enables Carcass In Cybergrind");
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
			AssetLoader.Unload();
		}

		private bool LoadRuntime()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string path = Path.Combine(directoryName, "CarcassEnemy.dll");
			if (!File.Exists(path))
			{
				((BaseUnityPlugin)this).Logger.LogFatal((object)"CarcassEnemy.dll runtime could not be found!");
				return false;
			}
			try
			{
				Assembly assembly = Assembly.LoadFile(path);
				if (assembly == null)
				{
					((BaseUnityPlugin)this).Logger.LogFatal((object)"CarcassEnemy.dll runtime is null! Your dll may be corrupted.");
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogFatal((object)ex);
			}
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CarcassLoader";

		public const string PLUGIN_NAME = "CarcassLoader";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace CarcassLoader.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("CarcassLoader.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] Carcass
		{
			get
			{
				object @object = ResourceManager.GetObject("Carcass", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace CarcassLoader.Patches
{
	[HarmonyPatch(typeof(EndlessGrid))]
	public static class InjectEndless
	{
		private static bool injected;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void OnStart(EndlessGrid __instance, ref PrefabDatabase ___prefabs)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (!injected && Plugin.EnableInCyberGrind.Value)
			{
				injected = true;
				EndlessEnemy[] specialEnemies = ___prefabs.specialEnemies;
				EndlessEnemy[] array = (EndlessEnemy[])(object)new EndlessEnemy[specialEnemies.Length + 1];
				Array.Copy(specialEnemies, array, specialEnemies.Length);
				EndlessEnemy val = ScriptableObject.CreateInstance<EndlessEnemy>();
				((Object)val).name = "CarcassEndlessData";
				val.spawnCost = 60;
				val.spawnWave = 16;
				val.costIncreasePerSpawn = 30;
				val.enemyType = (EnemyType)5;
				val.prefab = CarcassAssets.Carcass;
				array[^1] = val;
				___prefabs.specialEnemies = array;
			}
		}
	}
	[HarmonyPatch(typeof(SpawnMenu))]
	public static class InjectSpawnMenu
	{
		private static bool injected;

		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void Start(ref SpawnableObjectsDatabase ___objects)
		{
			if (!injected)
			{
				SpawnableObject carcassFunkoSpawnableObject = CarcassAssets.GetCarcassFunkoSpawnableObject();
				SpawnableObject carcassSpawnableObject = CarcassAssets.GetCarcassSpawnableObject();
				SpawnableObject[] enemies = ___objects.enemies;
				SpawnableObject[] array = (SpawnableObject[])(object)new SpawnableObject[enemies.Length + 1];
				Array.Copy(enemies, array, enemies.Length);
				array[^1] = carcassSpawnableObject;
				___objects.enemies = array;
				SpawnableObject[] objects = ___objects.objects;
				SpawnableObject[] array2 = (SpawnableObject[])(object)new SpawnableObject[objects.Length + 1];
				Array.Copy(objects, array2, objects.Length);
				array2[^1] = carcassFunkoSpawnableObject;
				___objects.objects = array2;
				injected = true;
			}
		}

		[HarmonyPatch("RebuildIcons")]
		[HarmonyPostfix]
		private static void AddEnemyIcon(ref Dictionary<string, Sprite> ___spriteIcons)
		{
			___spriteIcons.Add(((Object)CarcassAssets.CarcassIcon).name, CarcassAssets.CarcassIcon);
			___spriteIcons.Add(((Object)CarcassAssets.FunkoSpawnIcon).name, CarcassAssets.FunkoSpawnIcon);
		}
	}
	[HarmonyPatch(typeof(EnemyInfoPage))]
	public static class InjectTerminalEntry
	{
		private static bool injected;

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void Start(ref SpawnableObjectsDatabase ___objects)
		{
			if (injected)
			{
				return;
			}
			SpawnableObject carcassSpawnableObject = CarcassAssets.GetCarcassSpawnableObject();
			SpawnableObject[] enemies = ___objects.enemies;
			for (int i = 0; i < enemies.Length; i++)
			{
				if (!((Object)(object)enemies[i] == (Object)null) && (Object)(object)enemies[i] == (Object)(object)carcassSpawnableObject)
				{
					return;
				}
			}
			SpawnableObject[] array = (SpawnableObject[])(object)new SpawnableObject[enemies.Length + 1];
			Array.Copy(enemies, array, enemies.Length);
			array[^1] = carcassSpawnableObject;
			___objects.enemies = array;
			injected = true;
		}
	}
}
namespace CarcassLoader.Assets
{
	public static class CarcassAssets
	{
		private static SpawnableObject carcassSpawnable;

		private static SpawnableObject funkoSpawnable;

		public static GameObject Carcass => Plugin.AssetLoader.LoadAsset<GameObject>("Carcass");

		public static GameObject CarcassPreview => Plugin.AssetLoader.LoadAsset<GameObject>("CarcassPreview");

		public static GameObject CarcassFunko => Plugin.AssetLoader.LoadAsset<GameObject>("CarcassFunko");

		public static GameObject CarcassFunkoMesh => Plugin.AssetLoader.LoadAsset<GameObject>("CarcassFunkoMesh");

		public static Sprite CarcassIcon => Plugin.AssetLoader.LoadAsset<Sprite>("carcass_icon");

		public static Sprite FunkoSpawnIcon => Plugin.AssetLoader.LoadAsset<Sprite>("CarcassFunkoPopSpawnIcon");

		public static Material CarcassEyeMaterial => Plugin.AssetLoader.LoadAsset<Material>("CarcassEye_Material");

		public static SpawnableObject GetCarcassSpawnableObject()
		{
			if ((Object)(object)carcassSpawnable == (Object)null)
			{
				carcassSpawnable = BuildCarcassObject();
			}
			return carcassSpawnable;
		}

		private static SpawnableObject BuildCarcassObject()
		{
			//IL_0036: 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_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)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "Carcass_SpawnableObject";
			val.identifier = "Carcass";
			val.objectName = "CARCASS";
			val.gameObject = Carcass;
			val.spawnableObjectType = (SpawnableObjectDataType)1;
			val.enemyType = (EnemyType)3;
			val.iconKey = ((Object)CarcassIcon).name;
			val.gridIcon = CarcassIcon;
			val.backgroundColor = new Color(0.349f, 0.349f, 0.349f, 1f);
			val.type = "SUPREME HUSK/UNFINISHED PRIME";
			val.description = "While it’s extremely rare to find a husk powerful enough to become a prime soul, it’s not uncommon for lesser husks to find their undoing in such power.\n\nA Carcass is the result of a prime soul that has failed to fully develop, resulting in what can be called “a portable flesh prison”. While its power greatly surpasses that of lesser husks, it is still very dependent on its physical body to the point that it would instantly disintegrate without it.\n\nThe surgical markings on its body shows that an attempt was made to contain its energy, instead it is left in an irreversible berzerk state. However, trapped in such a situation, the Carcass has adapted to its power and is able to mimic most of a normal flesh prison’s abilities. Additionally it is able to partially manifest itself at a distance by using a ritualistic pentagram.";
			val.strategy = "- Once unleashed, Carcass’s summoning circle will activate after making contact with its target. Upon the circle’s activation, Carcass will attempt to drain and re-purpose the life energy of the target by manifesting part of itself below them. When the circle becomes active, it will emit a bright light and its symbols will change shape. The manifestations can be avoided by remaining in the air, out of their reach.\n\n- Carcass will manifest eyes to assist them in battle. While the eyes may serve well as healing, if all of the eyes are destroyed it will cause Carcass to become enraged. Typically Carcass will avoid close range combat. When enraged, it will charge and pursue you with all of its strength.";
			val.preview = CarcassPreview;
			return val;
		}

		public static SpawnableObject GetCarcassFunkoSpawnableObject()
		{
			if ((Object)(object)funkoSpawnable == (Object)null)
			{
				funkoSpawnable = BuildFunkoObject();
			}
			return funkoSpawnable;
		}

		private static SpawnableObject BuildFunkoObject()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
			((Object)val).name = "CarcassFunko_SpawnableObject";
			val.identifier = "Carcass Funko";
			val.objectName = "Carcass Funko";
			val.gameObject = CarcassFunko;
			val.spawnableObjectType = (SpawnableObjectDataType)0;
			val.iconKey = ((Object)FunkoSpawnIcon).name;
			val.gridIcon = FunkoSpawnIcon;
			val.backgroundColor = new Color(0.349f, 0.349f, 0.349f, 1f);
			return val;
		}
	}
}