Decompiled source of Planetside Of Gunymede PreRelease v1.3.208

plugins/Planetside.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Alexandria;
using Alexandria.Assetbundle;
using Alexandria.CharacterAPI;
using Alexandria.DungeonAPI;
using Alexandria.EnemyAPI;
using Alexandria.Integrations;
using Alexandria.ItemAPI;
using Alexandria.Misc;
using Alexandria.NPCAPI;
using Alexandria.PrefabAPI;
using AmmonomiconAPI;
using BepInEx;
using Brave.BulletScript;
using BreakAbleAPI;
using ChallengeAPI;
using Dungeonator;
using EnemyBulletBuilder;
using FullInspector;
using FullSerializer;
using Gungeon;
using GungeonAPI;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using InControl;
using Ionic.Zip;
using ItemAPI;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using Newtonsoft.Json.Linq;
using NpcApi;
using Pathfinding;
using Planetside;
using Planetside.APIs;
using Planetside.Components;
using Planetside.Components.Effect_Components;
using Planetside.Components.Other_Components;
using Planetside.Controllers;
using Planetside.Controllers.ContainmentBreach.BossChanges.Misc;
using Planetside.DungeonPlaceables;
using Planetside.DungeonPlaceables.TrespassObjects;
using Planetside.EnemySetupCode.EnemyRelatedStuff.Behavior_Stuff;
using Planetside.Misc_Stuff;
using Planetside.NPC_Stuff;
using Planetside.SoundAPI;
using Planetside.Static_Storage;
using Planetside.Toolboxes;
using SaveAPI;
using SynergyAPI;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Video;
using tk2dRuntime.TileMap;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d6d7a494-722e-4763-959b-c2d6b6a42b01")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class TimeStopBehavior : BasicAttackBehavior
{
	private enum State
	{
		PreCharging,
		Charging,
		TimeStopped,
		TimeRestart
	}

	public bool m_laserActive;

	public bool IsTimeStopped;

	public float AlaserAngle;

	public BasicBeamController m_laserBeam;

	public ProjectileModule beamModule;

	public Transform beamTransform;

	private List<AIActor> EnemiesToDeFreeze = new List<AIActor>();

	public float chargeTime;

	public float firingTime;

	private State m_state;

	private float m_timer;

	private Vector2 m_targetPosition;

	private SpeculativeRigidbody m_backupTarget;

	private BulletScriptSource m_bulletSource;

	public bool HasTriggeredScript;

	public BulletScriptSelector BulletScript;

	public Transform ShootPoint;

	public string ChargeAnimation;

	public string FireAnimation;

	public string PostFireAnimation;

	public bool LockInPlaceWhileAttacking;

	public bool TimeStopped => IsTimeStopped;

	public bool LaserActive => m_laserActive;

	public override void Start()
	{
		((BasicAttackBehavior)this).Start();
		((BraveBehaviour)((BehaviorBase)this).m_aiActor).healthHaver.OnDeath += delegate
		{
		};
	}

	public override void Upkeep()
	{
		//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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		((BasicAttackBehavior)this).Upkeep();
		if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.TargetRigidbody))
		{
			m_targetPosition = ((BehaviorBase)this).m_aiActor.TargetRigidbody.GetUnitCenter((ColliderType)2);
			m_backupTarget = ((BehaviorBase)this).m_aiActor.TargetRigidbody;
		}
		else if (Object.op_Implicit((Object)(object)m_backupTarget))
		{
			m_targetPosition = m_backupTarget.GetUnitCenter((ColliderType)2);
		}
	}

	public override BehaviorResult Update()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		//IL_0018: 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_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		((BasicAttackBehavior)this).Update();
		BehaviorResult val = ((BasicAttackBehavior)this).Update();
		if ((int)val > 0)
		{
			return val;
		}
		if (!((AttackBehaviorBase)this).IsReady())
		{
			return (BehaviorResult)0;
		}
		PrechargeFiringLaser();
		HasTriggeredScript = false;
		m_state = State.PreCharging;
		((BehaviorBase)this).m_aiActor.SuppressTargetSwitch = true;
		((BehaviorBase)this).m_aiActor.ClearPath();
		((BehaviorBase)this).m_updateEveryFrame = true;
		if (!string.IsNullOrEmpty(ChargeAnimation))
		{
			((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled(ChargeAnimation, true, (string)null, -1f, false);
		}
		return (BehaviorResult)4;
	}

	public override ContinuousBehaviorResult ContinuousUpdate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: 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)
		((BehaviorBase)this).ContinuousUpdate();
		if (m_state == State.PreCharging)
		{
			if (!LaserActive)
			{
				ChargeFiringLaser(chargeTime);
				m_timer = chargeTime;
				m_state = State.Charging;
			}
		}
		else
		{
			if (m_state == State.Charging)
			{
				m_timer -= ((BehaviorBase)this).m_deltaTime;
				if (m_timer <= 0f)
				{
					m_state = State.TimeStopped;
					StartTimeStop();
					m_timer = firingTime;
				}
				return (ContinuousBehaviorResult)0;
			}
			if (m_state == State.TimeStopped)
			{
				if (!HasTriggeredScript)
				{
					HasTriggeredScript = true;
					if (BulletScript != null && !BulletScript.IsNull)
					{
						if (!Object.op_Implicit((Object)(object)m_bulletSource))
						{
							m_bulletSource = GameObjectExtensions.GetOrAddComponent<BulletScriptSource>(((Component)ShootPoint).gameObject);
						}
						m_bulletSource.BulletManager = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).bulletBank;
						m_bulletSource.BulletScript = BulletScript;
						m_bulletSource.Initialize();
					}
				}
				m_timer -= ((BehaviorBase)this).m_deltaTime;
				if (m_timer <= 0f || !TimeStopped)
				{
					if ((Object)(object)m_bulletSource != (Object)null)
					{
						m_bulletSource.ForceStop();
					}
					return (ContinuousBehaviorResult)1;
				}
			}
		}
		return (ContinuousBehaviorResult)0;
	}

	public override void EndContinuousUpdate()
	{
		((BehaviorBase)this).EndContinuousUpdate();
		if (!string.IsNullOrEmpty(FireAnimation))
		{
			((BehaviorBase)this).m_aiAnimator.EndAnimationIf(FireAnimation);
		}
		StopFiringLaser();
		((BehaviorBase)this).m_aiAnimator.LockFacingDirection = false;
		((BehaviorBase)this).m_aiActor.SuppressTargetSwitch = false;
		((BehaviorBase)this).m_updateEveryFrame = false;
		((BasicAttackBehavior)this).UpdateCooldowns();
	}

	public override bool IsOverridable()
	{
		return false;
	}

	public void PrechargeFiringLaser()
	{
	}

	public void ChargeFiringLaser(float time)
	{
	}

	public void StartTimeStop()
	{
		AkSoundEngine.PostEvent("Play_OBJ_time_bell_01", ((Component)((BehaviorBase)this).m_aiActor).gameObject);
		RoomHandler absoluteParentRoom = ((DungeonPlaceableBehaviour)((BehaviorBase)this).m_aiActor).GetAbsoluteParentRoom();
		List<AIActor> activeEnemies = absoluteParentRoom.GetActiveEnemies((ActiveEnemyType)0);
		if (activeEnemies == null)
		{
			return;
		}
		foreach (AIActor item in activeEnemies)
		{
			if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)((BehaviorBase)this).m_aiActor)
			{
				item.LocalTimeScale = 0f;
				((BraveBehaviour)item).aiAnimator.FpsScale = 0f;
				((BraveBehaviour)item).behaviorSpeculator.LocalTimeScale = 0f;
				EnemiesToDeFreeze.Add(item);
			}
		}
	}

	public void StopFiringLaser()
	{
		if (TimeStopped)
		{
			StopTimeStop();
			if (!string.IsNullOrEmpty(PostFireAnimation))
			{
				((BehaviorBase)this).m_aiAnimator.PlayUntilFinished(PostFireAnimation, true, (string)null, -1f, false);
			}
			m_laserActive = false;
			IsTimeStopped = false;
		}
	}

	public void StopTimeStop()
	{
		foreach (AIActor item in EnemiesToDeFreeze)
		{
			if ((Object)(object)item != (Object)null)
			{
				item.LocalTimeScale = 1f;
				((BraveBehaviour)item).aiAnimator.FpsScale = 1f;
				((BraveBehaviour)item).behaviorSpeculator.LocalTimeScale = 1f;
				EnemiesToDeFreeze.Remove(item);
			}
		}
	}
}
public class AddDashComponent : BraveBehaviour
{
	public static GameObject shootpoint;

	public float distortionMaxRadius = 50f;

	public float distortionDuration = 1f;

	public float distortionIntensity = 0.5f;

	public float distortionThickness = 0.2f;

	public float WaitTime;

	public AddDashComponent()
	{
		WaitTime = 10f;
	}

	public void Start()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		GameObject val = new GameObject();
		val.transform.parent = ((BraveBehaviour)((BraveBehaviour)this).aiActor).transform;
		val.transform.position = Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldCenter);
		GameObject shootPoint = val;
		((Component)((BraveBehaviour)this).aiActor).gameObject.AddComponent<AfterImageTrailController>().spawnShadows = false;
		((Component)((BraveBehaviour)this).aiActor).gameObject.AddComponent<tk2dSpriteAttachPoint>();
		((Component)((BraveBehaviour)this).aiActor).gameObject.AddComponent<ObjectVisibilityManager>();
		((GameActor)((BraveBehaviour)this).aiActor).HasShadow = true;
		((GameActor)((BraveBehaviour)this).aiActor).ShadowObject = ((GameActor)EnemyDatabase.GetOrLoadByGuid("4db03291a12144d69fe940d5a01de376")).ShadowObject;
		DashBehavior item = new DashBehavior
		{
			ShootPoint = shootPoint,
			dashDistance = 7f,
			dashTime = 0.2f,
			doubleDashChance = 0f,
			enableShadowTrail = false,
			Cooldown = 3f,
			dashDirection = (DashDirection)30,
			warpDashAnimLength = true,
			hideShadow = true,
			InitialCooldown = 1f,
			chargeAnim = null,
			RequiresLineOfSight = false
		};
		((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator.AttackBehaviors.Add((AttackBehaviorBase)(object)item);
	}

	private void OnPreDeath(Vector2 obj)
	{
	}
}
public class AIBeamShooter2 : BraveBehaviour
{
	public string shootAnim;

	public AIAnimator specifyAnimator;

	public Transform beamTransform;

	public VFXPool chargeVfx;

	public Projectile beamProjectile;

	public ProjectileModule beamModule;

	public bool TurnDuringDissipation = true;

	public bool PreventBeamContinuation;

	[Header("Depth")]
	public float heightOffset = 1.9f;

	public float northAngleTolerance = 90f;

	public float northRampHeight;

	public float otherRampHeight = 5f;

	public Vector2 firingEllipseCenter;

	public float firingEllipseA;

	public float firingEllipseB;

	public float eyeballFudgeAngle;

	private bool m_firingLaser;

	private float m_laserAngle;

	public BasicBeamController m_laserBeam;

	private BodyPartController m_bodyPart;

	public float LaserAngle => m_laserAngle;

	public bool IsFiringLaser => m_firingLaser;

	public Vector2 LaserFiringCenter => Vector3Extensions.XY(beamTransform.position) + firingEllipseCenter;

	public AIAnimator CurrentAiAnimator => (!Object.op_Implicit((Object)(object)specifyAnimator)) ? ((BraveBehaviour)this).aiAnimator : specifyAnimator;

	public float MaxBeamLength { get; set; }

	public BeamController LaserBeam => (BeamController)(object)m_laserBeam;

	public bool IgnoreAiActorPlayerChecks { get; set; }

	public void SetLaserAngle(float alaserAngle)
	{
		m_laserAngle = alaserAngle;
		if (m_firingLaser)
		{
			((BraveBehaviour)this).aiAnimator.FacingDirection = alaserAngle;
		}
	}

	public void Start()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		((BraveBehaviour)this).healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged);
		if (Object.op_Implicit((Object)(object)specifyAnimator))
		{
			m_bodyPart = ((Component)specifyAnimator).GetComponent<BodyPartController>();
		}
	}

	public void Update()
	{
	}

	public void LateUpdate()
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Invalid comparison between Unknown and I4
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)m_laserBeam) && MaxBeamLength > 0f)
		{
			((BraveBehaviour)m_laserBeam).projectile.baseData.range = MaxBeamLength;
			m_laserBeam.ShowImpactOnMaxDistanceEnd = true;
		}
		if (m_firingLaser && Object.op_Implicit((Object)(object)m_laserBeam))
		{
			((BeamController)m_laserBeam).LateUpdatePosition(GetTrueLaserOrigin());
		}
		else if (Object.op_Implicit((Object)(object)m_laserBeam) && (int)m_laserBeam.State == 3)
		{
			((BeamController)m_laserBeam).LateUpdatePosition(GetTrueLaserOrigin());
		}
		else if (m_firingLaser && !Object.op_Implicit((Object)(object)m_laserBeam))
		{
			StopFiringLaser();
		}
	}

	public override void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)m_laserBeam))
		{
			((BeamController)m_laserBeam).CeaseAttack();
		}
		((BraveBehaviour)this).OnDestroy();
	}

	public void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection)
	{
		if (resultValue <= 0f)
		{
			if (m_firingLaser)
			{
				chargeVfx.DestroyAll();
				StopFiringLaser();
			}
			if (Object.op_Implicit((Object)(object)m_laserBeam))
			{
				((BeamController)m_laserBeam).DestroyBeam();
				m_laserBeam = null;
			}
		}
	}

	public void StartFiringLaser(float laserAngle)
	{
		m_firingLaser = true;
		SetLaserAngle(laserAngle);
		if (Object.op_Implicit((Object)(object)m_bodyPart))
		{
			m_bodyPart.OverrideFacingDirection = true;
		}
		if (!string.IsNullOrEmpty(shootAnim))
		{
			CurrentAiAnimator.LockFacingDirection = true;
			CurrentAiAnimator.PlayUntilCancelled(shootAnim, true, (string)null, -1f, false);
		}
		chargeVfx.DestroyAll();
		((MonoBehaviour)this).StartCoroutine(FireBeam((!Object.op_Implicit((Object)(object)beamProjectile)) ? beamModule.GetCurrentProjectile() : beamProjectile));
	}

	public void StopFiringLaser()
	{
		m_firingLaser = false;
		if (Object.op_Implicit((Object)(object)m_bodyPart))
		{
			m_bodyPart.OverrideFacingDirection = false;
		}
		if (!string.IsNullOrEmpty(shootAnim))
		{
			CurrentAiAnimator.LockFacingDirection = false;
			CurrentAiAnimator.EndAnimationIf(shootAnim);
		}
	}

	public IEnumerator FireBeam(Projectile projectile)
	{
		GameObject beamObject = Object.Instantiate<GameObject>(((Component)projectile).gameObject);
		m_laserBeam = beamObject.GetComponent<BasicBeamController>();
		((BeamController)m_laserBeam).Owner = (GameActor)(object)((BraveBehaviour)this).aiActor;
		((BeamController)m_laserBeam).HitsPlayers = projectile.collidesWithPlayer || (!IgnoreAiActorPlayerChecks && Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor) && ((BraveBehaviour)this).aiActor.CanTargetPlayers);
		((BeamController)m_laserBeam).HitsEnemies = projectile.collidesWithEnemies || (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor) && ((BraveBehaviour)this).aiActor.CanTargetEnemies);
		bool facingNorth = BraveMathCollege.AbsAngleBetween(LaserAngle, 90f) < northAngleTolerance;
		m_laserBeam.HeightOffset = heightOffset;
		m_laserBeam.RampHeightOffset = ((!facingNorth) ? otherRampHeight : northRampHeight);
		m_laserBeam.ContinueBeamArtToWall = !PreventBeamContinuation;
		bool firstFrame = true;
		while ((Object)(object)m_laserBeam != (Object)null && m_firingLaser)
		{
			float clampedAngle = BraveMathCollege.ClampAngle360(LaserAngle);
			Vector2 dirVec = Vector2.op_Implicit(new Vector3(Mathf.Cos(clampedAngle * ((float)Math.PI / 180f)), Mathf.Sin(clampedAngle * ((float)Math.PI / 180f))) * 10f);
			((BeamController)m_laserBeam).Origin = Vector2.op_Implicit(GetTrueLaserOrigin());
			((BeamController)m_laserBeam).Direction = dirVec;
			if (firstFrame)
			{
				yield return null;
				firstFrame = false;
				continue;
			}
			facingNorth = BraveMathCollege.AbsAngleBetween(LaserAngle, 90f) < northAngleTolerance;
			m_laserBeam.RampHeightOffset = ((!facingNorth) ? otherRampHeight : northRampHeight);
			yield return null;
			while (Time.timeScale == 0f)
			{
				yield return null;
			}
		}
		if (!m_firingLaser && (Object)(object)m_laserBeam != (Object)null)
		{
			((BeamController)m_laserBeam).CeaseAttack();
		}
		if (TurnDuringDissipation && Object.op_Implicit((Object)(object)m_laserBeam))
		{
			m_laserBeam.SelfUpdate = false;
			while (Object.op_Implicit((Object)(object)m_laserBeam))
			{
				((BeamController)m_laserBeam).Origin = Vector2.op_Implicit(GetTrueLaserOrigin());
				yield return null;
			}
		}
		m_laserBeam = null;
	}

	private Vector3 GetTrueLaserOrigin()
	{
		//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_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_005e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = LaserFiringCenter;
		if (firingEllipseA != 0f && firingEllipseB != 0f)
		{
			float num = Mathf.Lerp(eyeballFudgeAngle, 0f, BraveMathCollege.AbsAngleBetween(90f, Mathf.Abs(BraveMathCollege.ClampAngle180(LaserAngle))) / 90f);
			val = BraveMathCollege.GetEllipsePoint(val, firingEllipseA, firingEllipseB, LaserAngle + num);
		}
		return Vector2.op_Implicit(val);
	}
}
public class UmbraMinionsbehavior : BraveBehaviour
{
	public static List<int> Lootdrops = new List<int> { 73, 85, 120, 224, 600, 78, 565 };

	public bool DropsChests;

	public int ChestAmount;

	public bool DropsPickups;

	public int PickupAmount;

	public bool TriggersUnlock;

	public float HPMultiplier;

	public float CooldownMulitplier;

	public bool GainsSkulls;

	public int SkullAmount;

	public float distortionMaxRadius = 50f;

	public float distortionDuration = 1f;

	public float distortionIntensity = 0.5f;

	public float distortionThickness = 0.2f;

	public float TimeUntilInvulnerabilityGone;

	public UmbraMinionsbehavior()
	{
		TimeUntilInvulnerabilityGone = 10f;
		DropsChests = false;
		DropsPickups = false;
		PickupAmount = 1;
		ChestAmount = 1;
		TriggersUnlock = false;
		HPMultiplier = 1f;
		GainsSkulls = false;
		SkullAmount = 3;
		CooldownMulitplier = 1f;
	}

	public void Start()
	{
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Expected O, but got Unknown
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.SetHealthMaximum(((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.GetCurrentHealth() * HPMultiplier, (float?)null, true);
		((DungeonPlaceableBehaviour)((BraveBehaviour)this).aiActor).GetAbsoluteParentRoom().SealRoom();
		BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator;
		behaviorSpeculator.CooldownScale *= CooldownMulitplier;
		((MonoBehaviour)this).StartCoroutine(Speed(((BraveBehaviour)this).aiActor));
		AIActor aiActor = ((BraveBehaviour)this).aiActor;
		aiActor.MovementSpeed *= 1.25f;
		((BraveBehaviour)this).healthHaver.OnPreDeath += OnPreDeath;
		((BraveBehaviour)this).healthHaver.OnDeath += Die;
		((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.bossHealthBar = (BossBarType)1;
		if (GainsSkulls)
		{
			((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677")).bulletBank.GetBullet("homing"));
			GameObject val = new GameObject();
			val = new GameObject("fuck");
			val.transform.parent = ((BraveBehaviour)((BraveBehaviour)this).aiActor).transform;
			val.transform.position = Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldCenter);
			GameObject gameObject = ((Component)((BraveBehaviour)((BraveBehaviour)this).aiActor).transform.Find("fuck")).gameObject;
			CustomSpinBulletsBehavior item = new CustomSpinBulletsBehavior
			{
				ShootPoint = gameObject,
				OverrideBulletName = "homing",
				NumBullets = 2,
				BulletMinRadius = 2.4f,
				BulletMaxRadius = 2.5f,
				BulletCircleSpeed = 75,
				BulletsIgnoreTiles = true,
				RegenTimer = 0.1f,
				AmountOFLines = SkullAmount
			};
			((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator.OtherBehaviors.Add((BehaviorBase)(object)item);
		}
	}

	public IEnumerator Speed(AIActor actor)
	{
		if ((Object)(object)actor != (Object)null)
		{
			((BraveBehaviour)this).aiActor.HasBeenEngaged = false;
			((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.PreventAllDamage = true;
			yield return (object)new WaitForSeconds(TimeUntilInvulnerabilityGone);
			((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.PreventAllDamage = false;
			((BraveBehaviour)this).aiActor.HasBeenEngaged = true;
			AkSoundEngine.PostEvent("Play_Baboom", ((Component)this).gameObject);
			Exploder.DoDistortionWave(((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldCenter, distortionIntensity, distortionThickness, distortionMaxRadius, distortionDuration);
		}
	}

	private void Die(Vector2 finalDamageDirection)
	{
		//IL_0041: 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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer;
		((BraveBehaviour)this).aiActor.ParentRoom.UnsealRoom();
		if (DropsPickups)
		{
			for (int i = 0; i < PickupAmount; i++)
			{
				int num = BraveUtility.RandomElement<int>(Lootdrops);
				IntVector2 bestRewardLocation = primaryPlayer.CurrentRoom.GetBestRewardLocation(IntVector2.One * 3, (RewardLocationStyle)1, true);
				LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(num)).gameObject, ((IntVector2)(ref bestRewardLocation)).ToCenterVector3(0f), new Vector2(0f, 0f), 1.2f, false, true, false);
				LootEngine.DoDefaultItemPoof(((IntVector2)(ref bestRewardLocation)).ToVector2(), false, true);
			}
		}
		if (DropsChests)
		{
			for (int j = 0; j < ChestAmount; j++)
			{
				IntVector2 bestRewardLocation2 = primaryPlayer.CurrentRoom.GetBestRewardLocation(IntVector2.One * 3, (RewardLocationStyle)1, true);
				Chest val = GameManager.Instance.RewardManager.SpawnRewardChestAt(bestRewardLocation2, -1f, (ItemQuality)(-100));
				val.RegisterChestOnMinimap(((DungeonPlaceableBehaviour)val).GetAbsoluteParentRoom());
			}
		}
		if (!TriggersUnlock)
		{
		}
	}

	private void OnPreDeath(Vector2 obj)
	{
		//IL_0007: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)this).transform.position);
		AkSoundEngine.PostEvent("Play_BOSS_lichB_grab_01", ((Component)this).gameObject);
		GameObject val = Object.Instantiate<GameObject>(StaticVFXStorage.hellDragController.HellDragVFX);
		tk2dBaseSprite component = val.GetComponent<tk2dBaseSprite>();
		component.usesOverrideMaterial = true;
		component.PlaceAtLocalPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.UnitCenter), (Anchor)1);
		((BraveBehaviour)component).renderer.material.shader = ShaderCache.Acquire("Brave/Effects/StencilMasked");
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.enabled = false;
	}
}
public class UmbraController : BraveBehaviour
{
	public class LockOnFloor : MonoBehaviour
	{
		public List<tk2dSprite> tk2DSprites_1;

		public List<tk2dSprite> tk2DSprites_2;

		public Transform trans_1;

		public Transform trans_2;

		private float e = 0f;

		private float e_ = 0f;

		public void SetState(bool State)
		{
			e_ = (State ? 1 : 0);
		}

		public void Update()
		{
			//IL_0038: 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)
			e = Mathf.MoveTowards(e, e_, Time.deltaTime);
			trans_1.Rotate(new Vector3(0f, 0f, 150f * Time.deltaTime));
			trans_2.Rotate(new Vector3(0f, 0f, -125f * Time.deltaTime));
			foreach (tk2dSprite item in tk2DSprites_1)
			{
				((BraveBehaviour)item).renderer.material.SetFloat("_Fade", MathToolbox.EaseOut(e));
			}
			foreach (tk2dSprite item2 in tk2DSprites_2)
			{
				((BraveBehaviour)item2).renderer.material.SetFloat("_Fade", MathToolbox.EaseOut(e));
			}
		}
	}

	public class LockOnEffect : MonoBehaviour
	{
		private float Offset = 0.25f;

		public tk2dSprite mainSprite;

		public List<tk2dSprite> tk2DSprites;

		public Transform trans;

		private float e = 0f;

		private float e_ = 0f;

		public Vector2 LockInPos;

		public void SetState(bool State)
		{
			e_ = (State ? 1 : 0);
		}

		public void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = Vector2.op_Implicit(LockInPos);
			e = Mathf.MoveTowards(e, e_, Time.deltaTime * 5f);
			trans.Rotate(new Vector3(0f, 0f, 270f * Time.deltaTime));
			Offset = Mathf.Lerp(1.25f, 0.5f, MathToolbox.EaseIn(e));
			((BraveBehaviour)mainSprite).renderer.material.SetFloat("_Fade", MathToolbox.EaseIn(e));
			int num = 0;
			foreach (tk2dSprite tk2DSprite in tk2DSprites)
			{
				((BraveBehaviour)tk2DSprite).renderer.material.SetFloat("_Fade", MathToolbox.EaseIn(e));
				Vector3 localPosition = Vector3.zero;
				switch (num)
				{
				case 0:
					localPosition = Vector2.op_Implicit(new Vector2(0f - Offset, 0f - Offset));
					break;
				case 1:
					localPosition = Vector2.op_Implicit(new Vector2(0f - Offset, Offset));
					break;
				case 2:
					localPosition = Vector2.op_Implicit(new Vector2(Offset, 0f - Offset));
					break;
				case 3:
					localPosition = Vector2.op_Implicit(new Vector2(Offset, Offset));
					break;
				}
				((BraveBehaviour)tk2DSprite).transform.localPosition = localPosition;
				num++;
			}
		}
	}

	public class UmbraVFX : MonoBehaviour
	{
		public tk2dSpriteAnimator InnerEye;

		public tk2dSpriteAnimator Lens;

		public AIActor Owner;

		private float radius;

		private float E = 0f;

		public bool InRange = false;

		public LockOnEffect lockOnInst;

		public bool isActive = false;

		public bool IsDying;

		public void StartUp()
		{
			InnerEye.Play();
			Lens.Play();
			if (Object.op_Implicit((Object)(object)Owner))
			{
				radius = Mathf.Max(2.25f, Mathf.Min(9.5f, Mathf.Sqrt(((BraveBehaviour)Owner).healthHaver.GetMaxHealth()) * 0.5f));
			}
		}

		public void Kill()
		{
			IsDying = true;
			InnerEye.PlayAndDestroyObject("umbraleye_inner_close", (Action)null);
			Lens.PlayAndDisableObject("umbraleye_lens_close", (GameObject)null);
		}

		public void Update()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			E += Time.deltaTime;
			if (IsDying)
			{
				((BraveBehaviour)Lens).transform.position = ((BraveBehaviour)InnerEye).transform.position + new Vector3(Random.Range(-0.0625f, 0.0625f), Random.Range(-0.0625f, 0.0625f));
				((BraveBehaviour)Lens).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)Lens).transform.position, ((BraveBehaviour)Lens).transform.position.z - 10f);
				return;
			}
			bool PlayerIsHere = true;
			Vector3 lookAt = GetLookAt(ref PlayerIsHere);
			if (PlayerIsHere)
			{
				Vector3 val = lookAt - ((BraveBehaviour)InnerEye).transform.position;
				Vector3 val2 = ((Vector3)(ref val)).normalized * 0.12f;
				((BraveBehaviour)Lens).transform.position = ((BraveBehaviour)InnerEye).transform.position + val2 + new Vector3(Random.Range(-0.0625f, 0.0625f), Random.Range(-0.0625f, 0.0625f));
				((BraveBehaviour)Lens).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)Lens).transform.position, ((BraveBehaviour)Lens).transform.position.z - 10f);
			}
			else
			{
				((BraveBehaviour)Lens).transform.position = ((BraveBehaviour)InnerEye).transform.position + new Vector3(Random.Range(-0.0625f, 0.0625f), Random.Range(-0.0625f, 0.0625f));
				((BraveBehaviour)Lens).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)Lens).transform.position, ((BraveBehaviour)Lens).transform.position.z - 10f);
			}
			if (Object.op_Implicit((Object)(object)lockOnInst))
			{
				lockOnInst.LockInPos = Vector2.op_Implicit(lookAt + new Vector3(0.625f, 0.625f));
			}
			if (!isActive)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)Owner))
			{
				if (Vector2.Distance(Vector2.op_Implicit(lookAt), Vector2.op_Implicit(Vector2Extensions.ToVector3ZisY(((BraveBehaviour)Owner).sprite.WorldCenter, 0f))) < radius)
				{
					if (!InRange)
					{
						InRange = true;
						if ((Object)(object)lockOnInst == (Object)null)
						{
							lockOnInst = Object.Instantiate<GameObject>(UmbralLockOnSmall).GetComponent<LockOnEffect>();
							lockOnInst.LockInPos = Vector2.op_Implicit(lookAt + new Vector3(0.625f, 0.625f));
						}
						AkSoundEngine.PostEvent("Play_ENM_iceslime_charge_01", ((Component)lockOnInst).gameObject);
						lockOnInst.SetState(State: true);
					}
				}
				else if (InRange)
				{
					if ((Object)(object)lockOnInst != (Object)null)
					{
						lockOnInst.SetState(State: false);
						AkSoundEngine.PostEvent("Play_ENM_iceslime_charge_01", ((Component)lockOnInst).gameObject);
					}
					InRange = false;
				}
			}
			else
			{
				InRange = false;
			}
		}

		public void FixedUpdate()
		{
			//IL_0073: 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_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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			E += 360f * Time.fixedDeltaTime;
			if (!((Object)(object)Owner == (Object)null) && !((Object)(object)((BraveBehaviour)Owner).sprite == (Object)null) && !((Object)(object)((BraveBehaviour)InnerEye).sprite == (Object)null))
			{
				Vector3 val = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)Owner).sprite.WorldCenter, 0f) + MathToolbox.GetUnitOnCircle3(E, radius);
				Vector3 val2 = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)Owner).sprite.WorldCenter, 0f) + MathToolbox.GetUnitOnCircle3(E + 120f, radius);
				Vector3 val3 = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)Owner).sprite.WorldCenter, 0f) + MathToolbox.GetUnitOnCircle3(E + 240f, radius);
				GlobalSparksDoer.DoSingleParticle(Vector3Extensions.WithZ(val, 0f), Vector3.up * Random.Range(0.025f, 0.075f), (float?)0.25f, (float?)0.5f, (Color?)Color.red, (SparksType)2);
				GlobalSparksDoer.DoSingleParticle(Vector3Extensions.WithZ(val2, 0f), Vector3.up * Random.Range(0.025f, 0.075f), (float?)0.25f, (float?)0.5f, (Color?)Color.red, (SparksType)2);
				GlobalSparksDoer.DoSingleParticle(Vector3Extensions.WithZ(val3, 0f), Vector3.up * Random.Range(0.025f, 0.075f), (float?)0.25f, (float?)0.5f, (Color?)Color.red, (SparksType)2);
				Vector2 val4 = Vector2.op_Implicit(((BraveBehaviour)InnerEye).transform.position + new Vector3(1.5f, 0.75f));
				Vector2 val5 = Vector2.op_Implicit(((BraveBehaviour)InnerEye).transform.position - new Vector3(1.5f, 0.75f));
				GlobalSparksDoer.DoRandomParticleBurst(2, Vector2.op_Implicit(val4), Vector2.op_Implicit(val5), Vector2.op_Implicit(MathToolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Random.Range(1, 4))), 0f, 0.5f, (float?)0.125f, (float?)1f, (Color?)Color.black, (SparksType)1);
			}
		}

		public Vector3 GetLookAt(ref bool PlayerIsHere)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			if ((Object)(object)Owner == (Object)null)
			{
				return ((BraveBehaviour)GameManager.Instance.GetActivePlayerClosestToPoint(Vector2.op_Implicit(((Component)this).transform.position), false)).transform.position;
			}
			if ((Object)(object)Owner.TargetRigidbody == (Object)null)
			{
				PlayerIsHere = false;
				return Vector2.op_Implicit(Vector2.zero);
			}
			return ((BraveBehaviour)Owner.TargetRigidbody).transform.position;
		}

		public void OnDestroy()
		{
		}
	}

	public class Baboomer : Script
	{
		private class BigBullet : Bullet
		{
			private class SmallBullet : Bullet
			{
				public SmallBullet()
					: base("reversible", false, false, true)
				{
				}

				public override IEnumerator Top()
				{
					((Bullet)this).ChangeSpeed(new Speed(12f, (SpeedType)0), 120);
					yield break;
				}
			}

			public BigBullet()
				: base("big_one", false, false, true)
			{
			}

			public override void Initialize()
			{
				((BraveBehaviour)base.Projectile).spriteAnimator.StopAndResetFrameToDefault();
				((Bullet)this).Initialize();
			}

			public override IEnumerator Top()
			{
				((BraveBehaviour)base.Projectile).specRigidbody.CollideWithTileMap = false;
				((BraveBehaviour)base.Projectile).specRigidbody.CollideWithOthers = false;
				yield return ((Bullet)this).Wait(60);
				((Bullet)this).PostWwiseEvent("Play_ENM_bulletking_slam_01", (string)null);
				base.Speed = 0f;
				((BraveBehaviour)base.Projectile).spriteAnimator.Play();
				((Bullet)this).Vanish(true);
			}

			public override void OnBulletDestruction(DestroyType destroyType, SpeculativeRigidbody hitRigidbody, bool preventSpawningProjectiles)
			{
				//IL_0036: 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_0050: Expected O, but got Unknown
				//IL_0050: Expected O, but got Unknown
				//IL_007f: 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_0099: Expected O, but got Unknown
				//IL_0099: Expected O, but got Unknown
				if (!preventSpawningProjectiles)
				{
					float num = ((Bullet)this).RandomAngle();
					float num2 = 16f;
					float num3 = 360f / num2;
					for (int i = 0; (float)i < num2; i++)
					{
						((Bullet)this).Fire(new Direction(num3 * (float)i + num, (DirectionType)1, -1f), new Speed(7f, (SpeedType)0), (Bullet)(object)new SmallBullet());
					}
					num = ((Bullet)this).RandomAngle();
					for (int j = 0; (float)j < num2; j++)
					{
						((Bullet)this).Fire(new Direction(num3 * (float)j + num, (DirectionType)1, -1f), new Speed(3f, (SpeedType)0), (Bullet)(object)new SmallBullet());
					}
					num = ((Bullet)this).RandomAngle();
					((Bullet)this).PostWwiseEvent("Play_ENM_bulletking_slam_01", (string)null);
				}
			}
		}

		public override IEnumerator Top()
		{
			((Bullet)this).PostWwiseEvent("Play_ENM_bulletking_slam_01", (string)null);
			((Bullet)this).Fire(Offset.OverridePosition(((Bullet)this).Position + new Vector2(0f, 30f)), new Direction(-90f, (DirectionType)1, -1f), new Speed(30f, (SpeedType)0), (Bullet)(object)new BigBullet());
			yield break;
		}
	}

	public class SmallSlam : Script
	{
		public class OopsANull : Bullet
		{
			private const float ExpandSpeed = 4.5f;

			private const float SpinSpeed = 40f;

			private SmallSlam m_parent;

			private float m_angle;

			private float m_spinSpeed;

			private float m_radius;

			private string m_bulletype;

			public OopsANull(string BulletType, SmallSlam parent, float angle = 0f, float aradius = 0f)
				: base(BulletType, false, false, true)
			{
				m_parent = parent;
				m_angle = angle;
				m_radius = aradius;
				m_bulletype = BulletType;
				((Bullet)this).SuppressVfx = true;
			}

			public override IEnumerator Top()
			{
				((Bullet)this).ChangeDirection(new Direction(180f * m_angle, (DirectionType)2, -1f), 60);
				yield return ((Bullet)this).Wait(60);
				((Bullet)this).ChangeDirection(new Direction(180f * m_angle, (DirectionType)2, -1f), 60);
				yield return ((Bullet)this).Wait(60);
				((Bullet)this).Vanish(false);
			}

			private IEnumerator ChangeSpinSpeedTask(float newSpinSpeed, int term)
			{
				float delta = (newSpinSpeed - m_spinSpeed) / (float)term;
				for (int i = 0; i < term; i++)
				{
					m_spinSpeed += delta;
					yield return ((Bullet)this).Wait(1);
				}
			}
		}

		public override IEnumerator Top()
		{
			((Bullet)this).PostWwiseEvent("Play_ENM_bulletking_slam_01", (string)null);
			_ = ((Bullet)this).AimDirection;
			((Bullet)this).Fire(new Direction(0f, (DirectionType)1, -1f), new Speed(0f, (SpeedType)0), (Bullet)(object)new OopsANull("bigBullet", this, -1f));
			float delta = 60f;
			for (int j = 0; j < 6; j++)
			{
				((Bullet)this).Fire(new Direction((0f - (float)j) * delta, (DirectionType)1, -1f), new Speed(2.25f, (SpeedType)0), (Bullet)(object)new OopsANull("sweep", this, 1f));
			}
			for (int i = 0; i < 6; i++)
			{
				((Bullet)this).Fire(new Direction((0f - (float)i) * delta, (DirectionType)1, -1f), new Speed(2.25f, (SpeedType)0), (Bullet)(object)new OopsANull("sweep", this, -1f));
			}
			yield break;
		}
	}

	public static GameObject UmbralEye;

	public static GameObject UmbralLockOnSmall;

	public static GameObject UmbralLockOnFloor;

	private bool isOomfing = false;

	public Action<Vector2> OnDeath;

	public Action<Projectile> OnCreatedProjectile;

	private ImprovedAfterImage improvedAfterImage;

	public bool SilentSpawn = false;

	private float CooldownBlastMult = 1f;

	private float CooldownNearMult = 1f;

	public UmbraVFX umbraEffect;

	private bool IsGooning = true;

	private int Ammo = 0;

	public float Restore = 0f;

	public float CooldownAttackRadius = 1.25f;

	public float CooldownAttackBullet = 0.5f;

	public bool CanTeleport;

	public bool CanDash;

	public static void InitEffect()
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Expected O, but got Unknown
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0496: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_051d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0546: Unknown result type (might be due to invalid IL or missing references)
		//IL_056f: Unknown result type (might be due to invalid IL or missing references)
		UmbralEye = PrefabBuilder.BuildObject("UmbralEye");
		tk2dSprite val = UmbralEye.AddComponent<tk2dSprite>();
		((tk2dBaseSprite)val).SetSprite(StaticSpriteDefinitions.VFX_Sheet_Data, "umbral_eye_001");
		tk2dSpriteAnimator orAddComponent = GameObjectExtensions.GetOrAddComponent<tk2dSpriteAnimator>(UmbralEye);
		orAddComponent.library = StaticSpriteDefinitions.VFX_Animation_Data;
		orAddComponent.Library = StaticSpriteDefinitions.VFX_Animation_Data;
		orAddComponent.defaultClipId = StaticSpriteDefinitions.VFX_Animation_Data.GetClipIdByName("umbraleye_inner_open");
		((BraveBehaviour)orAddComponent).sprite.usesOverrideMaterial = true;
		Material val2 = new Material(ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"));
		val2.SetFloat("_EmissivePower", 3f);
		val2.SetFloat("_EmissiveColorPower", 5f);
		val2.SetColor("_EmissiveColor", new Color(255f, 0f, 0f, 255f));
		val2.mainTexture = ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).renderer.material.mainTexture;
		((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).renderer.material = val2;
		GameObject val3 = PrefabBuilder.BuildObject("UmbralLens");
		tk2dSprite val4 = val3.AddComponent<tk2dSprite>();
		((tk2dBaseSprite)val4).SetSprite(StaticSpriteDefinitions.VFX_Sheet_Data, "umbral_eyeinner_001");
		tk2dSpriteAnimator orAddComponent2 = GameObjectExtensions.GetOrAddComponent<tk2dSpriteAnimator>(val3);
		orAddComponent2.library = StaticSpriteDefinitions.VFX_Animation_Data;
		orAddComponent2.Library = StaticSpriteDefinitions.VFX_Animation_Data;
		orAddComponent2.defaultClipId = StaticSpriteDefinitions.VFX_Animation_Data.GetClipIdByName("umbraleye_lens_open");
		((BraveBehaviour)orAddComponent2).sprite.usesOverrideMaterial = true;
		val2 = new Material(ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"));
		val2.SetFloat("_EmissivePower", 50f);
		val2.SetFloat("_EmissiveColorPower", 1000f);
		val2.SetColor("_EmissiveColor", new Color(255f, 151f, 0f, 255f));
		val2.mainTexture = ((BraveBehaviour)((BraveBehaviour)orAddComponent2).sprite).renderer.material.mainTexture;
		((BraveBehaviour)((BraveBehaviour)orAddComponent2).sprite).renderer.material = val2;
		((tk2dBaseSprite)val).SortingOrder = 7;
		((tk2dBaseSprite)val).HeightOffGround = 3f;
		((tk2dBaseSprite)val4).SortingOrder = 10;
		((tk2dBaseSprite)val4).HeightOffGround = 5f;
		val3.transform.SetParent(UmbralEye.transform, false);
		UmbraVFX umbraVFX = UmbralEye.gameObject.AddComponent<UmbraVFX>();
		umbraVFX.InnerEye = orAddComponent;
		umbraVFX.Lens = orAddComponent2;
		UmbralLockOnSmall = PrefabBuilder.BuildObject("UmbralLockIn");
		tk2dSprite val5 = UmbralLockOnSmall.AddComponent<tk2dSprite>();
		((tk2dBaseSprite)val5).SetSprite(StaticSpriteDefinitions.VFX_Sheet_Data, "lockin_umbral1");
		((tk2dBaseSprite)val5).SortingOrder = 10;
		((tk2dBaseSprite)val5).HeightOffGround = 5f;
		((BraveBehaviour)val5).sprite.usesOverrideMaterial = true;
		((BraveBehaviour)((BraveBehaviour)val5).sprite).renderer.material.shader = Shader.Find("Brave/Internal/SimpleAlphaFadeUnlit");
		GameObject val6 = PrefabBuilder.BuildObject("Holder");
		val6.transform.SetParent(UmbralLockOnSmall.transform, false);
		LockOnEffect lockOnEffect = UmbralLockOnSmall.gameObject.AddComponent<LockOnEffect>();
		lockOnEffect.mainSprite = val5;
		lockOnEffect.trans = val6.transform;
		lockOnEffect.tk2DSprites = new List<tk2dSprite>
		{
			CreateEffectSmall(val6, "1", flipX: false, flipY: false, new Vector2(-0.25f, -0.25f)),
			CreateEffectSmall(val6, "2", flipX: false, flipY: true, new Vector2(-0.25f, 0.25f)),
			CreateEffectSmall(val6, "3", flipX: true, flipY: false, new Vector2(0.25f, -0.25f)),
			CreateEffectSmall(val6, "4", flipX: true, flipY: true, new Vector2(0.25f, 0.25f))
		};
		UmbralLockOnFloor = PrefabBuilder.BuildObject("UmbralLockInFloor");
		GameObject val7 = PrefabBuilder.BuildObject("Holder1");
		GameObject val8 = PrefabBuilder.BuildObject("Holder2");
		val7.transform.SetParent(UmbralLockOnFloor.transform, false);
		val8.transform.SetParent(UmbralLockOnFloor.transform, false);
		LockOnFloor lockOnFloor = UmbralLockOnFloor.AddComponent<LockOnFloor>();
		lockOnFloor.trans_1 = val7.transform;
		lockOnFloor.trans_2 = val8.transform;
		lockOnFloor.tk2DSprites_1 = new List<tk2dSprite>
		{
			CreateEffect(val7, "lockin_umbral_floor_001", "1_Large", flipX: false, flipY: false, new Vector2(-0.75f, 0.75f)),
			CreateEffect(val7, "lockin_umbral_floor_001", "2_Large", flipX: false, flipY: true, new Vector2(-0.75f, -0.75f)),
			CreateEffect(val7, "lockin_umbral_floor_001", "3_Large", flipX: true, flipY: false, new Vector2(0.75f, 0.75f)),
			CreateEffect(val7, "lockin_umbral_floor_001", "4_Large", flipX: true, flipY: true, new Vector2(0.75f, -0.75f))
		};
		lockOnFloor.tk2DSprites_2 = new List<tk2dSprite>
		{
			CreateEffect(val8, "lockin_umbral_floor_002", "11_Large", flipX: false, flipY: false, new Vector2(-0.75f, 0.75f)),
			CreateEffect(val8, "lockin_umbral_floor_002", "12_Large", flipX: false, flipY: true, new Vector2(-0.75f, -0.75f)),
			CreateEffect(val8, "lockin_umbral_floor_002", "13_Large", flipX: true, flipY: false, new Vector2(0.75f, 0.75f)),
			CreateEffect(val8, "lockin_umbral_floor_002", "14_Large", flipX: true, flipY: true, new Vector2(0.75f, -0.75f))
		};
	}

	private static tk2dSprite CreateEffectSmall(GameObject parent, string name, bool flipX, bool flipY, Vector2 offset)
	{
		//IL_0072: 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)
		GameObject val = PrefabBuilder.BuildObject("UmbralLockIn" + name);
		tk2dSprite val2 = val.AddComponent<tk2dSprite>();
		((tk2dBaseSprite)val2).SetSprite(StaticSpriteDefinitions.VFX_Sheet_Data, "lockin_umbral2");
		((tk2dBaseSprite)val2).SortingOrder = 10;
		((tk2dBaseSprite)val2).HeightOffGround = 5f;
		((tk2dBaseSprite)val2).FlipX = flipX;
		((tk2dBaseSprite)val2).FlipY = flipY;
		((Component)val2).gameObject.transform.SetParent(parent.transform, false);
		((Component)val2).gameObject.transform.localPosition = Vector2.op_Implicit(offset);
		((BraveBehaviour)val2).sprite.usesOverrideMaterial = true;
		((BraveBehaviour)((BraveBehaviour)val2).sprite).renderer.material.shader = Shader.Find("Brave/Internal/SimpleAlphaFadeUnlit");
		return val2;
	}

	private static tk2dSprite CreateEffect(GameObject parent, string p, string name, bool flipX, bool flipY, Vector2 offset)
	{
		//IL_006e: 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)
		GameObject val = PrefabBuilder.BuildObject("UmbralLockIn" + name);
		tk2dSprite val2 = val.AddComponent<tk2dSprite>();
		((tk2dBaseSprite)val2).SetSprite(StaticSpriteDefinitions.VFX_Sheet_Data, p);
		((tk2dBaseSprite)val2).SortingOrder = 1;
		((tk2dBaseSprite)val2).HeightOffGround = -1f;
		((tk2dBaseSprite)val2).FlipX = flipX;
		((tk2dBaseSprite)val2).FlipY = flipY;
		((Component)val2).gameObject.transform.SetParent(parent.transform, false);
		((Component)val2).gameObject.transform.localPosition = Vector2.op_Implicit(offset);
		((BraveBehaviour)val2).sprite.usesOverrideMaterial = true;
		((BraveBehaviour)((BraveBehaviour)val2).sprite).renderer.material.shader = Shader.Find("Brave/Internal/SimpleAlphaFadeUnlit");
		return val2;
	}

	public void UnBecomeUmbra()
	{
		if (!isOomfing)
		{
			((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath -= OnPreKill;
			isOomfing = true;
			((MonoBehaviour)this).StartCoroutine(DoWaitForKill());
		}
	}

	public IEnumerator DoWaitForKill()
	{
		while (IsGooning)
		{
			yield return null;
		}
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor))
		{
			((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath -= OnDeath;
			if (Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank))
			{
				AIBulletBank bulletBank = ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank;
				bulletBank.OnProjectileCreated = (Action<Projectile>)Delegate.Remove(bulletBank.OnProjectileCreated, OnCreatedProjectile);
			}
			AIActor aiActor = ((BraveBehaviour)this).aiActor;
			aiActor.AssignedCurrencyToDrop /= 3;
			BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator;
			behaviorSpeculator.CooldownScale /= 0.7f;
			AIActor aiActor2 = ((BraveBehaviour)this).aiActor;
			aiActor2.MovementSpeed /= 1.15f;
			if (Object.op_Implicit((Object)(object)improvedAfterImage))
			{
				Object.Destroy((Object)(object)improvedAfterImage);
			}
			((Component)umbraEffect).gameObject.transform.SetParent((Transform)null, true);
			umbraEffect.Kill();
			if (Object.op_Implicit((Object)(object)umbraEffect.lockOnInst))
			{
				umbraEffect.lockOnInst.SetState(State: false);
				Object.Destroy((Object)(object)umbraEffect.lockOnInst, 0.5f);
			}
			UpdateBlackPhantomShaders(((BraveBehaviour)this).aiActor);
			((BraveBehaviour)this).aiActor.UnbecomeBlackPhantom();
			((BraveBehaviour)this).aiActor.BecomeBlackPhantom();
			Object.Destroy((Object)(object)this);
		}
	}

	public void OnPreKill(Vector2 vector2)
	{
		((Component)umbraEffect).gameObject.transform.SetParent((Transform)null, true);
		umbraEffect.Kill();
		if (Object.op_Implicit((Object)(object)umbraEffect.lockOnInst))
		{
			umbraEffect.lockOnInst.SetState(State: false);
			Object.Destroy((Object)(object)umbraEffect.lockOnInst, 0.5f);
		}
	}

	public void Start()
	{
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.usesOverrideMaterial = true;
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.shader = Shader.Find("Brave/PlayerShaderEevee");
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetTexture("_EeveeTex", StaticTextures.NebulaTexture);
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_StencilVal", 0f);
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_FlatColor", 0f);
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_Perpendicular", 0f);
		BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator;
		behaviorSpeculator.CooldownScale *= 0.7f;
		AIActor aiActor = ((BraveBehaviour)this).aiActor;
		aiActor.AssignedCurrencyToDrop *= 3;
		AIActor aiActor2 = ((BraveBehaviour)this).aiActor;
		aiActor2.MovementSpeed *= 1.15f;
		improvedAfterImage = ((Component)((BraveBehaviour)this).aiActor).gameObject.AddComponent<ImprovedAfterImage>();
		improvedAfterImage.dashColor = Color.black;
		improvedAfterImage.spawnShadows = true;
		improvedAfterImage.shadowTimeDelay = 0.025f;
		improvedAfterImage.shadowLifetime = 1.5f;
		umbraEffect = ((GameActor)(object)((BraveBehaviour)this).aiActor).SmarterPlayEffectOnActor(UmbralEye, new Vector3(0f, 1.5f, 3f)).GetComponent<UmbraVFX>();
		umbraEffect.Owner = ((BraveBehaviour)this).aiActor;
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver) && (((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.IsBoss || ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.IsSubboss))
		{
			CooldownBlastMult = 0.66f;
			CooldownNearMult = 0.2f;
		}
		((MonoBehaviour)this).StartCoroutine(DoWait());
		((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath += OnPreKill;
		OnDeath = delegate
		{
			((Component)umbraEffect).gameObject.transform.SetParent((Transform)null, true);
			umbraEffect.Kill();
			if (Object.op_Implicit((Object)(object)umbraEffect.lockOnInst))
			{
				umbraEffect.lockOnInst.SetState(State: false);
				Object.Destroy((Object)(object)umbraEffect.lockOnInst, 0.5f);
			}
		};
		OnCreatedProjectile = delegate
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (CooldownAttackBullet <= 0f && Ammo > 0 && !umbraEffect.IsDying)
			{
				Ammo--;
				CooldownAttackBullet = 1f;
				bool PlayerIsHere = true;
				Vector3 position = ((Component)umbraEffect).transform.position;
				Vector3 lookAt = umbraEffect.GetLookAt(ref PlayerIsHere);
				((MonoBehaviour)GameManager.Instance).StartCoroutine(DoAttackOfDoom(position, lookAt));
			}
		};
		((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath += OnDeath;
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank))
		{
			AIBulletBank bulletBank = ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank;
			bulletBank.OnProjectileCreated = (Action<Projectile>)Delegate.Combine(bulletBank.OnProjectileCreated, OnCreatedProjectile);
		}
	}

	private void UpdateBlackPhantomShaders(AIActor aIActor)
	{
		if (((BraveBehaviour)aIActor).healthHaver.bodySprites.Count == aIActor.m_cachedBodySpriteCount)
		{
			return;
		}
		aIActor.m_cachedBodySpriteCount = ((BraveBehaviour)aIActor).healthHaver.bodySprites.Count;
		for (int i = 0; i < ((BraveBehaviour)aIActor).healthHaver.bodySprites.Count; i++)
		{
			tk2dBaseSprite val = ((BraveBehaviour)aIActor).healthHaver.bodySprites[i];
			val.usesOverrideMaterial = true;
			Material material = ((BraveBehaviour)val).renderer.material;
			if ((Object)(object)aIActor.m_cachedBodySpriteShader == (Object)null)
			{
				aIActor.m_cachedBodySpriteShader = material.shader;
			}
			if ((Object)(object)aIActor.OverrideBlackPhantomShader != (Object)null)
			{
				material.shader = aIActor.OverrideBlackPhantomShader;
			}
			else
			{
				material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
				material.SetFloat("_PhantomGradientScale", aIActor.BlackPhantomProperties.GradientScale);
				material.SetFloat("_PhantomContrastPower", aIActor.BlackPhantomProperties.ContrastPower);
				if ((Object)(object)val != (Object)(object)((BraveBehaviour)aIActor).sprite)
				{
					material.SetFloat("_ApplyFade", 0f);
				}
			}
			((BraveBehaviour)val).renderer.material = material;
		}
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)aIActor).aiShooter) && Object.op_Implicit((Object)(object)((BraveBehaviour)aIActor).aiShooter.CurrentGun))
		{
			tk2dBaseSprite sprite = ((BraveBehaviour)aIActor).aiShooter.CurrentGun.GetSprite();
			sprite.usesOverrideMaterial = true;
			Material material2 = ((BraveBehaviour)sprite).renderer.material;
			if ((Object)(object)aIActor.m_cachedGunSpriteShader == (Object)null)
			{
				aIActor.m_cachedGunSpriteShader = material2.shader;
			}
			if ((Object)(object)aIActor.OverrideBlackPhantomShader != (Object)null)
			{
				material2.shader = aIActor.OverrideBlackPhantomShader;
			}
			else
			{
				material2.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
				material2.SetFloat("_PhantomGradientScale", aIActor.BlackPhantomProperties.GradientScale);
				material2.SetFloat("_PhantomContrastPower", aIActor.BlackPhantomProperties.ContrastPower);
				material2.SetFloat("_ApplyFade", 0.3f);
			}
			((BraveBehaviour)sprite).renderer.material = material2;
		}
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_PhantomGradientScale", aIActor.BlackPhantomProperties.GradientScale);
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_PhantomContrastPower", aIActor.BlackPhantomProperties.ContrastPower);
		((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_ApplyFade", 0.3f);
	}

	public IEnumerator DoWait()
	{
		while ((int)((BraveBehaviour)this).aiActor.State != 2)
		{
			yield return null;
		}
		Transform transform = ((GameActor)(object)((BraveBehaviour)this).aiActor).SmarterPlayEffectOnActor(StaticVFXStorage.JammedDeathVFX, Vector2.op_Implicit(Vector2.zero)).transform;
		transform.localScale *= 1.6f;
		if (!SilentSpawn)
		{
			AIActor aiActor = ((BraveBehaviour)this).aiActor;
			if (aiActor != null)
			{
				BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)aiActor).behaviorSpeculator;
				if (behaviorSpeculator != null)
				{
					behaviorSpeculator.Stun(1f, true);
				}
			}
		}
		if (!SilentSpawn)
		{
			AkSoundEngine.PostEvent("Play_ENM_cannonball_intro_01", ((Component)((BraveBehaviour)this).aiActor).gameObject);
		}
		((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.invulnerabilityPeriod = -3.5f;
		float cached = ((BraveBehaviour)this).aiActor.MovementSpeed;
		((BraveBehaviour)this).aiActor.MovementSpeed = 0f;
		umbraEffect.StartUp();
		float e = 0f;
		float rng = Random.Range(0.85f, 1.15f);
		if (!SilentSpawn)
		{
			while (e < 1f)
			{
				e += Time.deltaTime * rng;
				if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody))
				{
					Vector2 unitDimensions = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.HitboxPixelCollider.UnitDimensions;
					Vector2 a = unitDimensions * 0.5f;
					Mathf.RoundToInt(6f * Mathf.Min(30f, Mathf.Min(new float[1] { unitDimensions.x * unitDimensions.y })));
					int num3 = 2;
					Vector2 vector = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.HitboxPixelCollider.UnitBottomLeft;
					Vector2 vector2 = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.HitboxPixelCollider.UnitTopRight;
					PixelCollider pixelCollider = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.GetPixelCollider((ColliderType)1);
					if (pixelCollider != null && (int)pixelCollider.ColliderGenerationMode == 0)
					{
						vector = Vector2.Min(vector, pixelCollider.UnitBottomLeft);
						vector2 = Vector2.Max(vector2, pixelCollider.UnitTopRight);
					}
					vector += Vector2.Min(a * 0.15f, new Vector2(0.25f, 0.25f));
					vector2 -= Vector2.Min(a * 0.15f, new Vector2(0.25f, 0.25f));
					vector2.y -= Mathf.Min(a.y * 0.1f, 0.1f);
					GlobalSparksDoer.DoRandomParticleBurst(num3, Vector2.op_Implicit(vector), Vector2.op_Implicit(vector2), Vector2.op_Implicit(MathToolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), 11f - e * 10f)), 0f, 0.5f, (float?)0.3f, (float?)1f, (Color?)Color.black, (SparksType)1);
					GlobalSparksDoer.DoRandomParticleBurst(num3, Vector2.op_Implicit(vector), Vector2.op_Implicit(vector2), Vector2.op_Implicit(Vector2.up * (31f - e * 30f)), 0f, 0.5f, (float?)0.3f, (float?)1f, (Color?)Color.black, (SparksType)1);
				}
				yield return null;
			}
			AkSoundEngine.PostEvent("Play_ENM_kali_blast_01", ((Component)((BraveBehaviour)this).aiActor).gameObject);
			AkSoundEngine.PostEvent("Play_ENM_kali_blast_01", ((Component)((BraveBehaviour)this).aiActor).gameObject);
		}
		umbraEffect.isActive = true;
		if (!SilentSpawn)
		{
			Exploder.DoDistortionWave(Vector2.op_Implicit(((BraveBehaviour)this).transform.position), 100f, 0.333f, 50f, 0.3f);
		}
		e = 0f;
		while (e < 1f)
		{
			e += Time.deltaTime * 2f;
			((BraveBehaviour)this).aiActor.MovementSpeed = Mathf.Lerp(0f, cached, e);
			yield return null;
		}
		IsGooning = false;
	}

	public void Update()
	{
		if (!((BraveBehaviour)this).aiActor.IsBlackPhantom && (Object)(object)((BraveBehaviour)this).aiActor != (Object)null && !isOomfing)
		{
			((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.shader = Shader.Find("Brave/PlayerShaderEevee");
			((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetTexture("_EeveeTex", StaticTextures.NebulaTexture);
			((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_StencilVal", 0f);
			((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_FlatColor", 0f);
			((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).renderer.material.SetFloat("_Perpendicular", 0f);
			((BraveBehaviour)this).aiActor.BecomeBlackPhantom();
		}
		if (!((Object)(object)umbraEffect == (Object)null) && !umbraEffect.IsDying)
		{
			AIActor aiActor = ((BraveBehaviour)this).aiActor;
			if (Object.op_Implicit((Object)(object)((aiActor != null) ? ((BraveBehaviour)aiActor).behaviorSpeculator : null)))
			{
				DoUmbraTicks(((BraveBehaviour)((BraveBehaviour)this).aiActor).behaviorSpeculator.IsStunned ? 0.33f : 1f);
			}
			else
			{
				DoUmbraTicks(1f);
			}
		}
	}

	private void DoUmbraTicks(float mult)
	{
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		if (CooldownAttackBullet > 0f)
		{
			CooldownAttackBullet -= BraveTime.DeltaTime * mult * CooldownBlastMult;
		}
		if (CooldownAttackRadius > 0f)
		{
			CooldownAttackRadius -= BraveTime.DeltaTime * mult * CooldownNearMult;
		}
		if (Ammo < 6)
		{
			Restore += Time.deltaTime;
			if (Restore >= 0.5f)
			{
				Restore = 0f;
				Ammo++;
			}
		}
		if (umbraEffect.InRange && CooldownAttackRadius <= 0f && Ammo > 0)
		{
			Ammo--;
			CooldownAttackRadius = 0.25f;
			Restore -= 0.25f;
			bool PlayerIsHere = true;
			Vector3 position = ((Component)umbraEffect).transform.position;
			Vector3 lookAt = umbraEffect.GetLookAt(ref PlayerIsHere);
			((MonoBehaviour)GameManager.Instance).StartCoroutine(DoAttackOfDoom(position, lookAt));
		}
	}

	public override void OnDestroy()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor))
		{
			GameObject val = Object.Instantiate<GameObject>(StaticVFXStorage.DragunBoulderLandVFX, ((BraveBehaviour)this).transform.position, Quaternion.identity);
			Object.Destroy((Object)(object)val, 2.5f);
			for (int i = 0; i < 64; i++)
			{
				GlobalSparksDoer.DoSingleParticle(((BraveBehaviour)this).transform.position, Vector2.op_Implicit(MathToolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Random.Range(2.2f, 6.1f))), (float?)0.25f, (float?)4f, (Color?)Color.red, (SparksType)2);
			}
			? val2 = ((BraveBehaviour)this).aiActor;
			Object obj = ResourceCache.Acquire("Global VFX/VFX_Curse");
			((GameActor)val2).PlayEffectOnActor((GameObject)(object)((obj is GameObject) ? obj : null), Vector3.zero, false, false, false);
			EnemyToolbox.SpawnBulletScript((GameActor)(object)((BraveBehaviour)this).aiActor, ((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldCenter, OuroborosController.BulletBankDummy.GetComponent<AIBulletBank>(), (BulletScriptSelector)(object)new CustomBulletScriptSelector(typeof(Baboomer)), "Reflection");
		}
		((BraveBehaviour)this).OnDestroy();
	}

	public IEnumerator DoAttackOfDoom(Vector3 start, Vector3 end)
	{
		//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_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)
		LockOnFloor t = Object.Instantiate<GameObject>(UmbralLockOnFloor, end, Quaternion.identity).GetComponent<LockOnFloor>();
		t.SetState(State: true);
		Vector2 unitOnCircle = MathToolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), 1f);
		Vector2 m = ((Vector2)(ref unitOnCircle)).normalized * 8f;
		AkSoundEngine.PostEvent("Play_ENM_cannonarmor_charge_01", ((Component)t).gameObject);
		yield return (object)new WaitForSeconds(0.5f);
		AkSoundEngine.PostEvent("Play_ENM_creecher_burst_01", ((Component)t).gameObject);
		for (int i = 0; i < 16; i++)
		{
			GlobalSparksDoer.DoSingleParticle(start, Vector2.op_Implicit(MathToolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Random.Range(2.2f, 6.1f))), (float?)0.5f, (float?)0.35f, (Color?)(Color.red * 2f), (SparksType)2);
		}
		float e = 0f;
		while (e < 1f)
		{
			if ((Object)(object)this == (Object)null)
			{
				if (Object.op_Implicit((Object)(object)t))
				{
					t.SetState(State: false);
					Object.Destroy((Object)(object)((Component)t).gameObject, 0.5f);
				}
				yield break;
			}
			e += Time.deltaTime;
			Vector3 newPosition = Vector3.Lerp(start, end, e) + Vector2Extensions.ToVector3ZUp(m, 0f) * MathToolbox.EaseInAndBack(e);
			GlobalSparksDoer.DoSingleParticle(newPosition, Vector3.zero, (float?)((MathToolbox.EaseInAndBack(e) + 0.25f) * 0.5f), (float?)2f, (Color?)(Color.red * 1.25f), (SparksType)2);
			yield return null;
		}
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor))
		{
			GameObject effect = Object.Instantiate<GameObject>(StaticVFXStorage.DragunBoulderLandVFX, end, Quaternion.identity);
			Object.Destroy((Object)(object)effect, 2.5f);
			AkSoundEngine.PostEvent("Play_ENM_bulletking_skull_01", ((Component)t).gameObject);
			EnemyToolbox.SpawnBulletScript((GameActor)(object)((BraveBehaviour)this).aiActor, Vector2.op_Implicit(end), OuroborosController.BulletBankDummy.GetComponent<AIBulletBank>(), (BulletScriptSelector)(object)new CustomBulletScriptSelector(typeof(SmallSlam)), "Reflection");
		}
		t.SetState(State: false);
		Object.Destroy((Object)(object)((Component)t).gameObject, 0.5f);
	}
}
public class CustomBeholsterLaserBehavior : BasicAttackBehavior
{
	public enum StopType
	{
		None,
		All,
		Attack,
		Charge
	}

	private enum State
	{
		PreCharging,
		Charging,
		Firing
	}

	public enum FiringType
	{
		TOWARDS_PLAYER,
		TOWARDS_PLAYER_AND_NORTHANGLEVARIANCE,
		ONLY_NORTHANGLEVARIANCE,
		FACINGDIRECTION_AND_CLAMPED_ANGLE
	}

	public enum TrackingType
	{
		Follow,
		ConstantTurn
	}

	public bool hurtsOtherHealthhavers;

	public bool m_laserActive;

	public bool IsfiringLaser;

	public float AlaserAngle;

	public BasicBeamController m_laserBeam;

	public VFXPool chargeUpVfx;

	public VFXPool chargeDownVfx;

	public ProjectileModule beamModule;

	public Transform beamTransform;

	public bool DoesSpeedLerp;

	public bool DoesReverseSpeedLerp;

	public float InitialStartingSpeed;

	public float TimeToReachFullSpeed;

	public float TimeToStayAtZeroSpeedAt;

	public float EndingSpeed;

	public float TimeToReachEndingSpeed;

	public bool FacesLaserAngle;

	public TrackingType trackingType;

	public FiringType firingType;

	public float initialAimOffset;

	public float AdditionalHeightOffset;

	public float chargeTime;

	public float firingTime;

	public float maxTurnRate;

	public float turnRateAcceleration;

	public bool useDegreeCatchUp;

	public float minDegreesForCatchUp;

	public float degreeCatchUpSpeed;

	public bool useUnitCatchUp;

	public float minUnitForCatchUp;

	public float maxUnitForCatchUp;

	public float unitCatchUpSpeed;

	public bool useUnitOvershoot;

	public float minUnitForOvershoot;

	public float unitOvershootTime;

	public float unitOvershootSpeed;

	private State m_state;

	private float m_timer;

	public bool LocksFacingDirection;

	private Vector2 m_targetPosition;

	private float m_currentUnitTurnRate;

	private float m_unitOvershootFixedDirection;

	private float m_unitOvershootTimer;

	private SpeculativeRigidbody m_backupTarget;

	private BulletScriptSource m_bulletSource;

	public bool HasTriggeredScript;

	public BulletScriptSelector BulletScript;

	public Transform ShootPoint;

	public StopType StopDuring;

	public bool ImmuneToBlanks = false;

	public bool FiresDirectlyTowardsPlayer;

	public bool UsesCustomAngle;

	public float RampHeight;

	public string ChargeAnimation;

	public string FireAnimation;

	public string PostFireAnimation;

	public BeamSelection beamSelection;

	public List<AIBeamShooter2> specificBeamShooters;

	private List<AIBeamShooter2> m_allBeamShooters;

	private readonly List<AIBeamShooter2> m_currentBeamShooters = new List<AIBeamShooter2>();

	public string LaserFiringSound;

	public string StopLaserFiringSound;

	public string EnemyChargeSound;

	public string BeamChargingSound;

	public bool UsesBaseSounds;

	public bool LockInPlaceWhileAttacking;

	public bool UsesBeamProjectileWithoutModule;

	public Vector2 LaserFiringCenter => Vector3Extensions.XY(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position);

	public bool FiringLaser => IsfiringLaser;

	public bool LaserActive => m_laserActive;

	public float LaserAngle => AlaserAngle;

	public BasicBeamController LaserBeam => m_laserBeam;

	public CustomBeholsterLaserBehavior()
	{
		RampHeight = 5f;
		LocksFacingDirection = true;
		DoesSpeedLerp = false;
		DoesReverseSpeedLerp = false;
		FacesLaserAngle = false;
		AdditionalHeightOffset = 0f;
		StopDuring = StopType.None;
		hurtsOtherHealthhavers = true;
	}

	public override void Start()
	{
		((BasicAttackBehavior)this).Start();
		((BraveBehaviour)((BehaviorBase)this).m_aiActor).healthHaver.OnPreDeath += delegate
		{
			if ((Object)(object)m_laserBeam != (Object)null)
			{
				((BeamController)m_laserBeam).DestroyBeam();
				m_laserBeam = null;
			}
			if (BulletScript != null && Object.op_Implicit((Object)(object)m_bulletSource) && !m_bulletSource.IsEnded)
			{
				m_bulletSource.ForceStop();
			}
		};
	}

	private bool ShowSpecificBeamShooter()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		return (int)beamSelection == 2;
	}

	public void SetLaserAngle(float alaserAngle)
	{
		AlaserAngle = alaserAngle;
		if (IsfiringLaser)
		{
			((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection = alaserAngle;
		}
	}

	public override void Upkeep()
	{
		//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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		((BasicAttackBehavior)this).Upkeep();
		if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.TargetRigidbody))
		{
			m_targetPosition = ((BehaviorBase)this).m_aiActor.TargetRigidbody.GetUnitCenter((ColliderType)2);
			m_backupTarget = ((BehaviorBase)this).m_aiActor.TargetRigidbody;
		}
		else if (Object.op_Implicit((Object)(object)m_backupTarget))
		{
			m_targetPosition = m_backupTarget.GetUnitCenter((ColliderType)2);
		}
	}

	public override BehaviorResult Update()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		//IL_0018: 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_002e: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Invalid comparison between Unknown and I4
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Invalid comparison between Unknown and I4
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Invalid comparison between Unknown and I4
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		((BasicAttackBehavior)this).Update();
		BehaviorResult val = ((BasicAttackBehavior)this).Update();
		if ((int)val > 0)
		{
			return val;
		}
		if (!((AttackBehaviorBase)this).IsReady())
		{
			return (BehaviorResult)0;
		}
		PrechargeFiringLaser();
		HasTriggeredScript = false;
		m_state = State.PreCharging;
		if (LockInPlaceWhileAttacking)
		{
			((BehaviorBase)this).m_aiActor.SuppressTargetSwitch = true;
			((BehaviorBase)this).m_aiActor.ClearPath();
		}
		((BehaviorBase)this).m_updateEveryFrame = true;
		m_allBeamShooters = new List<AIBeamShooter2>(((Component)((BehaviorBase)this).m_aiActor).GetComponents<AIBeamShooter2>());
		if ((int)beamSelection == 0)
		{
			Component[] components = ((Component)((BehaviorBase)this).m_aiActor).gameObject.GetComponents(typeof(AIBeamShooter2));
			for (int i = 0; i < components.Length; i++)
			{
				AIBeamShooter2 item = (AIBeamShooter2)(object)components[i];
				m_currentBeamShooters.Add(item);
			}
		}
		else if ((int)beamSelection == 1)
		{
			m_currentBeamShooters.Add(BraveUtility.RandomElement<AIBeamShooter2>(m_allBeamShooters));
		}
		else if ((int)beamSelection == 2)
		{
			foreach (AIBeamShooter2 specificBeamShooter in specificBeamShooters)
			{
				m_currentBeamShooters.Add(specificBeamShooter);
			}
		}
		if (!string.IsNullOrEmpty(ChargeAnimation))
		{
			((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled(ChargeAnimation, true, (string)null, -1f, false);
		}
		if ((StopDuring == StopType.Charge) | (StopDuring == StopType.All))
		{
			StopMoving();
		}
		return (BehaviorResult)4;
	}

	public override ContinuousBehaviorResult ContinuousUpdate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: 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)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		((BehaviorBase)this).ContinuousUpdate();
		if (m_state == State.PreCharging)
		{
			if (!LaserActive)
			{
				ChargeFiringLaser(chargeTime);
				m_timer = 0f;
				m_state = State.Charging;
			}
		}
		else
		{
			if (m_state == State.Charging)
			{
				m_timer += ((BehaviorBase)this).m_deltaTime;
				if (m_timer >= chargeTime)
				{
					m_state = State.Firing;
					StartFiringTheLaser();
					m_timer = 0f;
				}
				return (ContinuousBehaviorResult)0;
			}
			if (m_state == State.Firing)
			{
				if (FacesLaserAngle)
				{
					((BehaviorBase)this).m_aiAnimator.LockFacingDirection = true;
					((BehaviorBase)this).m_aiAnimator.FacingDirection = AlaserAngle;
				}
				if (!HasTriggeredScript)
				{
					HasTriggeredScript = true;
					if (BulletScript != null && !BulletScript.IsNull)
					{
						if (!Object.op_Implicit((Object)(object)m_bulletSource))
						{
							m_bulletSource = GameObjectExtensions.GetOrAddComponent<BulletScriptSource>(((Component)ShootPoint).gameObject);
						}
						m_bulletSource.BulletManager = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).bulletBank;
						m_bulletSource.BulletScript = BulletScript;
						m_bulletSource.Initialize();
					}
				}
				m_timer += ((BehaviorBase)this).m_deltaTime;
				if (m_timer >= firingTime || !FiringLaser)
				{
					if ((Object)(object)m_bulletSource != (Object)null)
					{
						m_bulletSource.ForceStop();
					}
					((BehaviorBase)this).m_aiAnimator.LockFacingDirection = false;
					return (ContinuousBehaviorResult)1;
				}
				for (int i = 0; i < m_currentBeamShooters.Count; i++)
				{
					if (m_currentBeamShooters[0].IsFiringLaser)
					{
						continue;
					}
					AIBeamShooter2 aIBeamShooter = m_currentBeamShooters[i];
					Vector2 val = Vector2.op_Implicit(((BraveBehaviour)aIBeamShooter).transform.position);
					float alaserAngle;
					if (trackingType == TrackingType.Follow)
					{
						float num = Vector2.Distance(m_targetPosition, val);
						float num2 = Vector2Extensions.ToAngle(m_targetPosition - val);
						float num3 = BraveMathCollege.ClampAngle180(num2 - AlaserAngle);
						float num4 = num3 * num * ((float)Math.PI / 180f);
						float num5 = maxTurnRate;
						float num6 = Mathf.Sign(num3);
						if (m_unitOvershootTimer > 0f)
						{
							num6 = m_unitOvershootFixedDirection;
							m_unitOvershootTimer -= ((BehaviorBase)this).m_deltaTime;
							num5 = unitOvershootSpeed;
						}
						m_currentUnitTurnRate = Mathf.Clamp(m_currentUnitTurnRate + num6 * turnRateAcceleration * ((BehaviorBase)this).m_deltaTime, 0f - num5, num5);
						float num7 = m_currentUnitTurnRate / num * 57.29578f;
						float num8 = 0f;
						if (useDegreeCatchUp && Mathf.Abs(num3) > minDegreesForCatchUp)
						{
							float num9 = Mathf.InverseLerp(minDegreesForCatchUp, 180f, Mathf.Abs(num3)) * degreeCatchUpSpeed;
							num8 = Mathf.Max(num8, num9);
						}
						if (useUnitCatchUp && Mathf.Abs(num4) > minUnitForCatchUp)
						{
							float num10 = Mathf.InverseLerp(minUnitForCatchUp, maxUnitForCatchUp, Mathf.Abs(num4)) * unitCatchUpSpeed;
							float num11 = num10 / num * 57.29578f;
							num8 = Mathf.Max(num8, num11);
						}
						if (useUnitOvershoot && Mathf.Abs(num4) < minUnitForOvershoot)
						{
							m_unitOvershootFixedDirection = ((!(m_currentUnitTurnRate <= 0f)) ? 1 : (-1));
							m_unitOvershootTimer = unitOvershootTime;
						}
						num8 *= Mathf.Sign(num3);
						alaserAngle = BraveMathCollege.ClampAngle360(AlaserAngle + (num7 + num8) * ((BehaviorBase)this).m_deltaTime);
					}
					else
					{
						float num12 = maxTurnRate;
						if (DoesSpeedLerp)
						{
							float num13 = m_timer / TimeToReachFullSpeed - TimeToStayAtZeroSpeedAt;
							num13 = Mathf.Max(num13, 0f);
							num12 = Mathf.Lerp(InitialStartingSpeed, maxTurnRate, Mathf.Min(num13, 1f));
						}
						if (DoesReverseSpeedLerp)
						{
							float num14 = firingTime - TimeToStayAtZeroSpeedAt - TimeToReachEndingSpeed;
							float num15 = firingTime - TimeToStayAtZeroSpeedAt;
							if (m_timer > num14)
							{
								num12 = Mathf.Lerp(EndingSpeed, maxTurnRate, num15 - m_timer);
							}
						}
						alaserAngle = BraveMathCollege.ClampAngle360(AlaserAngle + num12 * ((BehaviorBase)this).m_deltaTime);
					}
					if (IsfiringLaser)
					{
						AlaserAngle = alaserAngle;
					}
					return (ContinuousBehaviorResult)0;
				}
			}
		}
		return (ContinuousBehaviorResult)0;
	}

	public override void EndContinuousUpdate()
	{
		((BehaviorBase)this).EndContinuousUpdate();
		if ((Object)(object)m_bulletSource != (Object)null && !m_bulletSource.IsEnded)
		{
			m_bulletSource.ForceStop();
		}
		if (!string.IsNullOrEmpty(FireAnimation))
		{
			((BehaviorBase)this).m_aiAnimator.EndAnimationIf(FireAnimation);
		}
		StopFiringLaser();
		((BehaviorBase)this).m_aiAnimator.LockFacingDirection = false;
		((BehaviorBase)this).m_aiActor.SuppressTargetSwitch = false;
		((BehaviorBase)this).m_updateEveryFrame = false;
		((BasicAttackBehavior)this).UpdateCooldowns();
	}

	public override bool IsOverridable()
	{
		return false;
	}

	public void PrechargeFiringLaser()
	{
		if (LocksFacingDirection)
		{
			((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.LockFacingDirection = true;
		}
		if (EnemyChargeSound != null && !UsesBaseSounds)
		{
			AkSoundEngine.PostEvent(EnemyChargeSound, ((Component)((BehaviorBase)this).m_aiActor).gameObject);
		}
		else if (UsesBaseSounds)
		{
			AkSoundEngine.PostEvent("Play_ENM_beholster_charging_01", ((Component)((BehaviorBase)this).m_aiActor).gameObject);
		}
	}

	public void ChargeFiringLaser(float time)
	{
		if (BeamChargingSound != null && !UsesBaseSounds)
		{
			AkSoundEngine.PostEvent(BeamChargingSound, ((Component)((BehaviorBase)this).m_aiActor).gameObject);
		}
		else if (UsesBaseSounds)
		{
			AkSoundEngine.PostEvent("Play_ENM_beholster_charging_01", ((Component)((BehaviorBase)this).m_aiActor).gameObject);
		}
		m_laserActive = true;
	}

	public void StartFiringTheLaser()
	{
		if ((StopDuring == StopType.Attack) | (StopDuring == StopType.All))
		{
			StopMoving(StopDuring == StopType.All);
		}
		MonoBehaviour component = ((Component)((BehaviorBase)this).m_aiActor).GetComponent<MonoBehaviour>();
		if (!string.IsNullOrEmpty(FireAnimation))
		{
			((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled(FireAnimation, true, (string)null, -1f, false);
		}
		float facingDirection = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection;
		if (LocksFacingDirection)
		{
			((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.LockFacingDirection = true;
		}
		SetLaserAngle(facingDirection);
		IsfiringLaser = true;
		for (int i = 0; i < m_currentBeamShooters.Count; i++)
		{
			AIBeamShooter2 aibeamShooter = m_currentBeamShooters[i];
			component.StartCoroutine(FireBeam(aibeamShooter));
		}
	}

	public void StopFiringLaser()
	{
		if (IsfiringLaser)
		{
			if (!string.IsNullOrEmpty(PostFireAnimation))
			{
				((BehaviorBase)this).m_aiAnimator.PlayUntilFinished(PostFireAnimation, true, (string)null, -1f, false);
			}
			base.m_behaviorSpeculator.PreventMovement = false;
			m_laserActive = false;
			IsfiringLaser = false;
			((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.LockFacingDirection = false;
			m_currentBeamShooters.Clear();
		}
	}

	public IEnumerator FireBeam(AIBeamShooter2 aibeamShooter2)
	{
		GameObject beamObject = ((!UsesBeamProjectileWithoutModule) ? Object.Instantiate<GameObject>(((Component)aibeamShooter2.beamModule.GetCurrentProjectile()).gameObject) : Object.Instantiate<GameObject>(((Component)aibeamShooter2.beamProjectile).gameObject));
		if ((Object)(object)beamObject == (Object)null)
		{
			ETGModConsole.Log((object)"CANNOT FIND beamObject!", false);
			StopFiringLaser();
			yield break;
		}
		BasicBeamController beamCont = beamObject.GetComponent<BasicBeamController>();
		List<AIActor> activeEnemies = ((BehaviorBase)this).m_aiActor.ParentRoom.GetActiveEnemies((ActiveEnemyType)0);
		for (int i = 0; i < activeEnemies.Count; i++)
		{
			AIActor aiactor = activeEnemies[i];
			if (Object.op_Implicit((Object)(object)aiactor) && (Object)(object)aiactor != (Object)(object)((BehaviorBase)this).m_aiActor && Object.op_Implicit((Object)(object)((BraveBehaviour)aiactor).healthHaver))
			{
				((BeamController)beamCont).IgnoreRigidbodes.Add(((BraveBehaviour)aiactor).specRigidbody);
			}
		}
		((BeamController)beamCont).Owner = (GameActor)(object)((BehaviorBase)this).m_aiActor;
		((BeamController)beamCont).HitsPlayers = true;
		((BeamController)beamCont).HitsEnemies = true;
		if (UsesBaseSounds)
		{
			LaserFiringSound = "Play_ENM_deathray_shot_01";
		}
		else if (LaserFiringSound != null && !UsesBaseSounds)
		{
			beamCont.startAudioEvent = LaserFiringSound;
		}
		if (StopLaserFiringSound != null && !UsesBaseSounds)
		{
			beamCont.endAudioEvent = StopLaserFiringSound;
		}
		else if (UsesBaseSounds)
		{
			beamCont.endAudioEvent = "Stop_ENM_deathray_loop_01";
		}
		beamCont.HeightOffset = 0f;
		beamCont.RampHeightOffset = 0f;
		beamCont.ContinueBeamArtToWall = true;
		float enemyTickCooldown = 0f;
		beamCont.OverrideHitChecks = delegate(SpeculativeRigidbody hitRigidbody, Vector2 val3)
		{
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			Projectile val = null;
			val = ((!UsesBeamProjectileWithoutModule) ? aibeamShooter2.beamModule.GetCurrentProjectile() : aibeamShooter2.beamProjectile);
			HealthHaver val2 = ((!Object.op_Implicit((Object)(object)hitRigidbody)) ? null : ((BraveBehaviour)hitRigidbody).healthHaver);
			if (Object.op_Implicit((Object)(object)hitRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)hitRigidbody).projectile) && Object.op_Implicit((Object)(object)((Component)hitRigidbody).GetComponent<BeholsterBounceRocket>()))
			{
				BounceProjModifier component = ((Component)hitRigidbody).GetComponent<BounceProjModifier>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.numberOfBounces = 0;
				}
				((BraveBehaviour)hitRigidbody).projectile.DieInAir(false, true, true, false);
			}
			bool flag = (Object)(object)((Component)hitRigidbody).GetComponent<PlayerController>() != (Object)null && ((BeamController)beamCont).HitsPlayers;
			if ((hurtsOtherHealthhavers | Object.op_Implicit((Object)(object)beamCont)) && (Object)(object)val2 != (Object)null)
			{
				if (Object.op_Implicit((Object)(object)((BraveBehaviour)val2).aiActor))
				{
					if (enemyTickCooldown <= 0f)
					{
						val2.ApplyDamage(ProjectileData.FixedFallbackDamageToEnemies, val3, ((BehaviorBase)this).m_aiActor.GetActorName(), val.damageTypes, (DamageCategory)0, false, (PixelCollider)null, false);
						enemyTickCooldown = 0.1f;
					}
				}
				else
				{
					val2.ApplyDamage(val.baseData.damage, val3, ((BehaviorBase)this).m_aiActor.GetActorName(), val.damageTypes, (DamageCategory)0, false, (PixelCollider)null, false);
				}
			}
			if (Object.op_Implicit((Object)(object)((BraveBehaviour)hitRigidbody).majorBreakable))
			{
				((BraveBehaviour)hitRigidbody).majorBreakable.ApplyDamage(26f * BraveTime.DeltaTime, val3, false, false, false);
			}
		};
		_ = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection;
		if (firingType == FiringType.ONLY_NORTHANGLEVARIANCE)
		{
			AlaserAngle = 0f;
		}
		bool firstFrame = true;
		while ((Object)(object)beamCont != (Object)null && IsfiringLaser)
		{
			enemyTickCooldown = Mathf.Max(enemyTickCooldown - BraveTime.DeltaTime, 0f);
			float clampedAngle = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection;
			if (firingType == FiringType.TOWARDS_PLAYER)
			{
				clampedAngle = AlaserAngle;
			}
			else if (firingType == FiringType.TOWARDS_PLAYER_AND_NORTHANGLEVARIANCE)
			{
				clampedAngle = BraveMathCollege.ClampAngle360(aibeamShooter2.northAngleTolerance) + AlaserAngle;
			}
			else if (firingType == FiringType.ONLY_NORTHANGLEVARIANCE)
			{
				clampedAngle = BraveMathCollege.ClampAngle360(aibeamShooter2.northAngleTolerance) + AlaserAngle;
			}
			else if (firingType == FiringType.FACINGDIRECTION_AND_CLAMPED_ANGLE)
			{
				clampedAngle += BraveMathCollege.ClampAngle360(aibeamShooter2.northAngleTolerance);
			}
			beamCont.RampHeightOffset = RampHeight;
			Vector3 dirVec2 = new Vector3(Mathf.Cos(clampedAngle * ((float)Math.PI / 180f)), Mathf.Sin(clampedAngle * ((float)M