Decompiled source of FromDuskTillDawn v0.1.0

DuskMod.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CameraShake;
using IL.flanne.Core;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.flanne;
using On.flanne.Core;
using On.flanne.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using flanne;
using flanne.Core;
using flanne.PerkSystem;
using flanne.PerkSystem.Actions;
using flanne.PerkSystem.Triggers;
using flanne.Player;
using flanne.Player.Buffs;
using flanne.PowerupSystem;
using flanne.TitleScreen;
using flanne.UI;
using flanne.UIExtensions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Dragonyck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © Dragonyck, 2023")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DuskMod")]
[assembly: AssemblyTitle("DuskMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace DuskMod;

internal class AddTargetComponentAction : Action
{
	public override void Activate(GameObject target)
	{
		target.AddComponent<TargetEnemyBehaviour>();
	}
}
internal class BleedAction : Action
{
	public override void Activate(GameObject target)
	{
		Health component = target.GetComponent<Health>();
		if (Object.op_Implicit((Object)(object)component) && (!Object.op_Implicit((Object)(object)component) || !component.isDead))
		{
			BleedManager.instance.PeriodizeTarget(component);
		}
	}
}
internal class BleedExplosionAction : Action
{
	public float damage => PlayerController.Instance.gun.damage;

	public override void Activate(GameObject target)
	{
		//IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: 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)
		Health component = target.GetComponent<Health>();
		if (!Object.op_Implicit((Object)(object)component) || (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)BleedManager.instance) && !BleedManager.instance.IsOnPeriod(component)))
		{
			return;
		}
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(target.transform.position), 2f, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
		foreach (Collider2D val in array)
		{
			Health component2 = ((Component)val).GetComponent<Health>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.TakeDamage(Prefabs.bleed, Mathf.FloorToInt(damage), 1f);
			}
		}
		Object.Destroy((Object)(object)Object.Instantiate<GameObject>(Prefabs.bleedExplosionFX, target.transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform), 0.2f);
	}
}
public class CarcassDropAction : Action
{
	public int chance = 13;

	public override void Init()
	{
		((Action)this).Init();
	}

	public override void Activate(GameObject target)
	{
		//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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		if (Random.Range(0, 100) <= chance)
		{
			bool flag = BurnSystem.SharedInstance.IsBurning(target);
			bool flag2 = CurseSystem.Instance.IsCursed(target);
			bool flag3 = FreezeSystem.SharedInstance.IsFrozen(target);
			if (flag || flag2 || flag3)
			{
				CarcassBehaviour component = Object.Instantiate<GameObject>(Prefabs.carcass, target.transform.position, Quaternion.identity).GetComponent<CarcassBehaviour>();
				component.isBurn = flag;
				component.isCurse = flag2;
				component.isFreeze = flag3;
				BoxCollider2D component2 = target.GetComponent<BoxCollider2D>();
				CircleCollider2D component3 = target.GetComponent<CircleCollider2D>();
				float num = (Object.op_Implicit((Object)(object)component2) ? (Math.Max(component2.size.x, component2.size.y) / 2f) : (Object.op_Implicit((Object)(object)component3) ? component3.radius : 1f));
				((Component)component).transform.localScale = Vector2.op_Implicit(Vector2.one * num / 0.16f);
				Object.Destroy((Object)(object)((Component)component).gameObject, 15f);
				((Component)component).transform.SetParent(((Component)ObjectPooler.SharedInstance).transform);
			}
		}
	}
}
public class DealPoisonRemainingAction : Action
{
	public override void Init()
	{
		((Action)this).Init();
	}

	public override void Activate(GameObject target)
	{
		Health component = target.GetComponent<Health>();
		PoisonBehaviour b = null;
		if (Object.op_Implicit((Object)(object)component) && PoisonManager.instance.IsPoisoned(component, out b))
		{
			b.DealRemainingDamage();
		}
	}
}
public class DeathPreventionAction : Action
{
	public bool activated = false;

	public override void Init()
	{
		((Action)this).Init();
	}

	public override void Activate(GameObject target)
	{
		if (!activated)
		{
			activated = true;
			((Component)PlayerController.Instance).GetComponentInChildren<ReaperBehaviour>().preventDeath = true;
		}
	}
}
internal class DragonBallDropAction : Action
{
	public int chance = 7;

	public override void Init()
	{
		((Action)this).Init();
		if (!Object.op_Implicit((Object)(object)DragonBallBehaviour.instance))
		{
			((Component)PlayerController.Instance).gameObject.AddComponent<DragonBallBehaviour>();
		}
	}

	public override void Activate(GameObject target)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (DragonBallBehaviour.instance.collectedDragonballs < 7)
		{
			if (Random.Range(0, 100) <= chance)
			{
			}
			GameObject val = Object.Instantiate<GameObject>(Prefabs.dragonball, target.transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform);
			((Component)val.transform.GetChild(DragonBallBehaviour.instance.collectedDragonballs)).gameObject.SetActive(true);
		}
	}
}
internal class ExplosionOnHitAction : Action
{
	public float radius = 2f;

	public float dmgMult = 0.35f;

	public override void Activate(GameObject target)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		Object.Destroy((Object)(object)Object.Instantiate<GameObject>(Prefabs.redExplosionEffect, target.transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform), 0.3f);
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(target.transform.position), radius, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
		foreach (Collider2D val in array)
		{
			((Component)val).gameObject.GetComponent<Health>().TakeDamage((DamageType)3, Mathf.FloorToInt(PlayerController.Instance.gun.damage * dmgMult), 1f);
		}
	}
}
internal class HealOrIncreaseMaxHPAction : Action
{
	public int healAmount = 1;

	public override void Activate(GameObject target)
	{
		PlayerHealth playerHealth = PlayerController.Instance.playerHealth;
		if (playerHealth.hp == playerHealth.maxHP)
		{
			PlayerController.Instance.stats[(StatType)15].AddFlatBonus(healAmount);
		}
		playerHealth.Heal(healAmount);
	}
}
public class ModCritOnTagKillAction : Action
{
	public float critDmgBonus = 0.01f;

	public override void Activate(GameObject target)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)target.GetComponentInChildren<Target>()))
		{
			PlayerController.Instance.stats[Prefabs.criticalDamage].AddMultiplierBonus(critDmgBonus);
		}
	}
}
internal class PoisonAction : Action
{
	public override void Activate(GameObject target)
	{
		Health component = target.GetComponent<Health>();
		if (Object.op_Implicit((Object)(object)component) && (!Object.op_Implicit((Object)(object)component) || !component.isDead))
		{
			PoisonManager.instance.PoisonizeTarget(component);
		}
	}
}
public class ReloadOverTimeAction : Action
{
	public bool reload;

	public ReloadOverTimeAction(bool r)
	{
		reload = r;
	}

	public override void Activate(GameObject target)
	{
		ReloadOverTimeBehaviour component = target.GetComponent<ReloadOverTimeBehaviour>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.reload = reload;
		}
	}
}
public class SmogSpawnAction : Action
{
	public int chance = 60;

	public override void Init()
	{
		((Action)this).Init();
	}

	public override void Activate(GameObject target)
	{
		if (Random.Range(0, 100) <= chance && MainPlugin.debug)
		{
			Debug.LogWarning((object)"Smog Spawned");
		}
	}
}
public class SoulStackingAction : Action
{
	public int souls = 0;

	public int soulStack = 0;

	public int min = 800;

	public float statMult = 0.5f;

	public float buffDuration = 1f;

	public override void Init()
	{
		((Action)this).Init();
	}

	public override void Activate(GameObject target)
	{
		souls++;
		soulStack++;
		if (soulStack >= 13)
		{
			soulStack = 0;
			if (Random.Range(0f, 101f) <= (float)(souls / min))
			{
				ModStat();
			}
		}
	}

	private void ModStat()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)PlayerController.Instance))
		{
			return;
		}
		StatsHolder componentInChildren = ((Component)PlayerController.Instance).GetComponentInChildren<StatsHolder>();
		if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			Array values = Enum.GetValues(typeof(StatType));
			StatType type = (StatType)values.GetValue(Random.Range(0, values.Length - 1));
			PlayerBuffs componentInChildren2 = ((Component)PlayerController.Instance).GetComponentInChildren<PlayerBuffs>();
			if (Object.op_Implicit((Object)(object)componentInChildren2))
			{
				TemporaryStatBuff val = new TemporaryStatBuff();
				val.statChanges = (StatChange[])(object)new StatChange[1]
				{
					new StatChange
					{
						type = type,
						value = statMult,
						isFlatMod = false
					}
				};
				val.duration = buffDuration;
				componentInChildren2.Add((Buff)(object)val);
			}
		}
	}
}
public class AIProjectileShootSpecial : AISpecial
{
	public GameObject projectile;

	public float projectileSpeed = 4f;

	public float projectileDelay = 0f;

	public int projectileCount = 1;

	public SoundEffectSO sound;

	public Animator animator;

	public override void Use(AIComponent ai, Transform target)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		animator = ((Component)ai).GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)animator))
		{
			animator.SetTrigger("Special");
		}
		Vector3 direction = target.position - ai.specialPoint.position;
		((MonoBehaviour)ai).StartCoroutine(ShootCR(direction, ((Component)ai.specialPoint).transform));
	}

	private IEnumerator ShootCR(Vector3 direction, Transform spawn)
	{
		//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)
		for (int i = 0; i < projectileCount; i++)
		{
			GameObject projectileInstance = Object.Instantiate<GameObject>(projectile, ((Component)ObjectPooler.SharedInstance).transform);
			projectileInstance.transform.position = spawn.position;
			projectileInstance.GetComponent<MoveComponent2D>().vector = Vector2.op_Implicit(projectileSpeed * ((Vector3)(ref direction)).normalized);
			SoundEffectSO soundEffectSO = sound;
			if ((Object)(object)soundEffectSO != (Object)null)
			{
				soundEffectSO.Play((AudioSource)null);
			}
			yield return (object)new WaitForSeconds(projectileDelay);
		}
	}
}
public class WingedBossSpecial : MonoBehaviour
{
	public GameObject projectile;

	public float projectileSpeed = 4f;

	public float projectileDelay = 0f;

	public int projectileCount = 4;

	public SoundEffectSO sound;

	public Animator animator;

	public float stopwatch;

	public void Start()
	{
		animator = ((Component)this).GetComponent<Animator>();
	}

	public void FixedUpdate()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= 5f)
		{
			stopwatch = 0f;
			Vector3 direction = ((Component)PlayerController.Instance).transform.position - ((Component)this).transform.position;
			Shoot(direction);
		}
	}

	public void Shoot(Vector3 direction)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)animator))
		{
			animator.SetTrigger("Special");
		}
		float num = 360f / (float)projectileCount;
		for (int i = 0; i < projectileCount; i++)
		{
			Vector3 val = Quaternion.AngleAxis(num * (float)i, Vector3.forward) * direction;
			GameObject val2 = Object.Instantiate<GameObject>(projectile, ((Component)ObjectPooler.SharedInstance).transform);
			val2.transform.position = ((Component)this).transform.position;
			val2.GetComponent<MoveComponent2D>().vector = Vector2.op_Implicit(projectileSpeed * ((Vector3)(ref val)).normalized);
			SoundEffectSO val3 = sound;
			if ((Object)(object)val3 != (Object)null)
			{
				val3.Play((AudioSource)null);
			}
		}
	}
}
public class AnimEventHandler : MonoBehaviour
{
	public void EnableCollider()
	{
		((Behaviour)((Component)this).GetComponent<Collider2D>()).enabled = true;
	}
}
public class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name)
	{
		object obj = MainAssetBundle.LoadAsset(name, typeof(T));
		return (T)obj;
	}

	public static void PopulateAssets()
	{
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DuskMod.assets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
public class AIPlayStillAnim : MonoBehaviour
{
	public Animator animator;

	public MoveComponent2D move2D;

	private bool walk;

	public void Start()
	{
		animator = ((Component)this).GetComponent<Animator>();
		move2D = ((Component)this).GetComponent<MoveComponent2D>();
	}

	public void FixedUpdate()
	{
		//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)
		if (!Object.op_Implicit((Object)(object)move2D) || !Object.op_Implicit((Object)(object)animator))
		{
			return;
		}
		Vector2 vector = move2D.vector;
		float magnitude = ((Vector2)(ref vector)).magnitude;
		if (magnitude > 0.5f)
		{
			if (!walk)
			{
				walk = true;
				animator.SetBool("walk", walk);
			}
		}
		else if (walk)
		{
			walk = false;
			animator.SetBool("walk", walk);
		}
	}
}
internal class AnimEventReload : MonoBehaviour
{
	public SoundEffectSO clipout = Prefabs.fmg9clipout;

	public SoundEffectSO clipin = Prefabs.fmg9clipin;

	public SoundEffectSO chamba = Prefabs.fmg9chamba;

	public void ClipOut()
	{
		clipout.Play((AudioSource)null);
	}

	public void ClipIn()
	{
		clipin.Play((AudioSource)null);
	}

	public void Chamba()
	{
		chamba.Play((AudioSource)null);
	}
}
internal class BleedBehaviour : MonoBehaviour
{
	public GameObject bleedFX = Prefabs.bleedFX;

	public Health target;

	public float basePercentage = 0.05f;

	public int stacks = 1;

	public float stopwatch;

	public float healthPercentage => 0.05f * (float)stacks;

	public int damage => Object.op_Implicit((Object)(object)target) ? Mathf.CeilToInt((float)target.maxHP * healthPercentage) : 0;

	public void Start()
	{
		target = ((Component)this).GetComponent<Health>();
	}

	public void FixedUpdate()
	{
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)target))
		{
			return;
		}
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= (float)(1 / stacks))
		{
			stopwatch = 0f;
			NotificationExtensions.PostNotification((object)((Component)this).gameObject, BleedManager.DamageEvent, (object)target);
			if (target.HP <= damage)
			{
				NotificationExtensions.PostNotification((object)((Component)this).gameObject, BleedManager.KillEvent, (object)target);
			}
			target.TakeDamage(Prefabs.bleed, damage, 1f);
			Object.Destroy((Object)(object)Object.Instantiate<GameObject>(bleedFX, ((Component)target).transform.position, Quaternion.identity, ((Component)target).transform), 0.25f);
		}
	}

	public void OnDisable()
	{
		BleedManager.instance.Dispiriodize(target);
		Object.Destroy((Object)(object)this);
	}
}
internal class BleedManager : MonoBehaviour
{
	public static BleedManager instance;

	public bool canStack = false;

	public Dictionary<Health, BleedBehaviour> bleedingTargets = new Dictionary<Health, BleedBehaviour>();

	public static string InflictEvent = "Bleed.InflictEvent";

	public static string KillEvent = "Bleed.KillEvent";

	public static string DamageEvent = "Bleed.DamageEvent";

	public void Awake()
	{
		instance = this;
	}

	public void Dispiriodize(Health target)
	{
		if (Object.op_Implicit((Object)(object)target) && bleedingTargets.ContainsKey(target))
		{
			bleedingTargets.Remove(target);
		}
	}

	public void PeriodizeTarget(Health target, float multiplier = 1f, int startingStacks = 1)
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			return;
		}
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"Bleed Inflicted");
		}
		NotificationExtensions.PostNotification((object)((Component)this).gameObject, InflictEvent, (object)target);
		BleedBehaviour value = null;
		if (bleedingTargets.TryGetValue(target, out value))
		{
			value.basePercentage *= multiplier;
			if (!canStack)
			{
				return;
			}
			value.stacks++;
		}
		bleedingTargets.Add(target, AddBleed(((Component)target).gameObject, multiplier, startingStacks));
	}

	public BleedBehaviour AddBleed(GameObject target, float mult, int stack)
	{
		BleedBehaviour bleedBehaviour = target.AddComponent<BleedBehaviour>();
		bleedBehaviour.basePercentage *= mult;
		bleedBehaviour.stacks = stack;
		return bleedBehaviour;
	}

	public bool IsOnPeriod(Health target)
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			return false;
		}
		return bleedingTargets.ContainsKey(target);
	}

	public bool IsOnPeriod(Health target, out BleedBehaviour b)
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			b = null;
			return false;
		}
		return bleedingTargets.TryGetValue(target, out b);
	}
}
internal class BleedPierceProjectile : MonoBehaviour
{
	public void OnDisable()
	{
		Object.Destroy((Object)(object)this);
	}
}
internal class BossEnrageBehaviour : MonoBehaviour
{
	public int useCount = 0;

	public bool addedUse = false;

	public AIComponent ai;

	public ElderBuffSpecial elder;

	public void Awake()
	{
		ai = ((Component)this).GetComponent<AIComponent>();
		elder = ((Component)this).GetComponent<ElderBuffSpecial>();
		if (Object.op_Implicit((Object)(object)elder))
		{
			elder.healthMult = 1f;
			elder.speedMult = 0.4f;
			elder.scale = 1.8f;
			elder.radius = 3.5f;
		}
	}

	public void Update()
	{
		if (!Object.op_Implicit((Object)(object)ai) || Object.op_Implicit((Object)(object)elder))
		{
			return;
		}
		if (ai.specialTimer > 0f)
		{
			if (!addedUse)
			{
				addedUse = true;
				useCount++;
			}
		}
		else if (addedUse)
		{
			addedUse = false;
		}
		if (useCount == 2)
		{
			useCount = 0;
			ai.specialTimer = 0f;
		}
	}

	public void OnDisable()
	{
		Object.Destroy((Object)(object)this);
	}
}
internal class BossHealthBarBehaviour : MonoBehaviour
{
	public static BossHealthBarBehaviour instance;

	public RectTransform bossHealthBarRoot;

	public List<Tuple<Health, Image>> bossHealthList = new List<Tuple<Health, Image>>();

	public TMP_FontAsset font = Prefabs.lantern;

	public void Awake()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		instance = this;
		bossHealthBarRoot = new GameObject("BossHealthBarRoot", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
		((Component)bossHealthBarRoot).transform.SetParent(((Component)this).transform);
		((Transform)bossHealthBarRoot).localPosition = Vector2.op_Implicit(new Vector2(0f, -28f));
		((Transform)bossHealthBarRoot).localScale = Vector2.op_Implicit(Vector2.one);
		VerticalLayoutGroup val = ((Component)bossHealthBarRoot).gameObject.AddComponent<VerticalLayoutGroup>();
		((LayoutGroup)val).childAlignment = (TextAnchor)4;
		((HorizontalOrVerticalLayoutGroup)val).spacing = 28f;
		NotificationExtensions.AddObserver((object)this, (Action<object, object>)UpdateHealthBar, Health.TookDamageEvent);
		NotificationExtensions.AddObserver((object)this, (Action<object, object>)UpdateHealthBar, Health.DeathEvent);
	}

	public void NewHealthBar(Health targetHealth)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Prefabs.bossHealthUI, (Transform)(object)bossHealthBarRoot);
		((Transform)val.GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(Vector2.zero);
		TextMeshProUGUI componentInChildren = val.GetComponentInChildren<TextMeshProUGUI>();
		((TMP_Text)componentInChildren).font = font;
		((TMP_Text)componentInChildren).text = ((Component)targetHealth).gameObject.BossName();
		((TMP_Text)componentInChildren).transform.localScale = Vector2.op_Implicit(Vector2.one * 0.4f);
		bossHealthList.Add(new Tuple<Health, Image>(targetHealth, val.GetComponentsInChildren<Image>()[1]));
	}

	public void UpdateHealthBar(object sender, object args)
	{
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		Health health = (Health)((sender is Health) ? sender : null);
		if (!((Component)health).gameObject.IsBoss())
		{
			return;
		}
		Tuple<Health, Image> tuple = bossHealthList.Find((Tuple<Health, Image> h) => (Object)(object)h.Item1 == (Object)(object)health);
		if (tuple == null)
		{
			return;
		}
		Image item = tuple.Item2;
		if (health.HP == 0)
		{
			Object.Destroy((Object)(object)((Component)((Component)tuple.Item2).transform.parent).gameObject);
			return;
		}
		float num2 = (item.fillAmount = health.CurrentHealthPercentage());
		if (num2 <= 0.5f && !Object.op_Implicit((Object)(object)((Component)health).gameObject.GetComponent<BossEnrageBehaviour>()))
		{
			Image[] componentsInChildren = ((Component)((Component)tuple.Item2).transform.parent).GetComponentsInChildren<Image>();
			((Graphic)componentsInChildren[1]).color = Prefabs.colorDict["darkRed"].Item1;
			((Graphic)componentsInChildren[2]).color = Prefabs.colorDict["red"].Item1;
			((Component)health).gameObject.AddComponent<BossEnrageBehaviour>();
		}
	}

	public void Update()
	{
		if (Object.op_Implicit((Object)(object)bossHealthBarRoot))
		{
			((Component)bossHealthBarRoot).gameObject.SetActive(!PauseController.isPaused);
		}
	}

	public void OnDisable()
	{
		NotificationExtensions.RemoveObserver((object)this, (Action<object, object>)UpdateHealthBar, Health.TookDamageEvent);
		NotificationExtensions.RemoveObserver((object)this, (Action<object, object>)UpdateHealthBar, Health.DeathEvent);
	}
}
internal class BulletPiercingPeriod : MonoBehaviour
{
	public TrailRenderer trail;

	public Color endColor;

	public void Start()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		trail = ((Component)this).GetComponent<TrailRenderer>();
		if (Object.op_Implicit((Object)(object)trail))
		{
			endColor = trail.endColor;
			trail.endColor = Prefabs.colorDict["red"].Item1;
		}
	}

	public void OnDisable()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)trail))
		{
			trail.endColor = endColor;
		}
		Object.Destroy((Object)(object)this);
	}
}
public class CarcassBehaviour : MonoBehaviour
{
	public bool isBurn = false;

	public bool isCurse = false;

	public bool isFreeze = false;

	public int burnDamage = 3;

	public void OnCollisionEnter2D(Collision2D collider)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if (!collider.gameObject.IsEnemyOrBoss())
		{
			return;
		}
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), 2f, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
		foreach (Collider2D val in array)
		{
			if (isBurn)
			{
				BurnSystem.SharedInstance.Burn(((Component)val).gameObject, burnDamage);
			}
			if (isCurse)
			{
				CurseSystem.Instance.Curse(((Component)val).gameObject);
			}
			if (isFreeze)
			{
				FreezeSystem.SharedInstance.Freeze(((Component)val).gameObject);
			}
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
internal class CopyTransform : MonoBehaviour
{
	public bool copyPosition;

	public bool copyLocalPosition;

	public bool copyRotation;

	public bool copyLocalRotation;

	public bool copyScale;

	public Transform target;

	public void FixedUpdate()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		if (copyPosition)
		{
			((Component)this).transform.position = target.position;
		}
		if (copyLocalPosition)
		{
			((Component)this).transform.localPosition = target.localPosition;
		}
		if (copyRotation)
		{
			((Component)this).transform.rotation = target.rotation;
		}
		if (copyLocalRotation)
		{
			((Component)this).transform.localRotation = target.localRotation;
		}
		if (copyScale)
		{
			((Component)this).transform.localScale = target.localScale;
		}
	}
}
internal class CurseStackHolder : MonoBehaviour
{
	public int stacks = 1;
}
public class DestroyOnCollision : MonoBehaviour
{
	public void OnCollisionEnter2D(Collision2D collision)
	{
		if (!Object.op_Implicit((Object)(object)collision.collider) || ((Component)collision.collider).gameObject.IsEnemyOrBoss())
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class DestroyOnInvisible : MonoBehaviour
{
	public void OnBecameInvisible()
	{
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
internal class DragonAI : EntityAI
{
	public float actionStopwatch;

	public int actionCasts;

	public int maxActionCasts = 3;

	public float actionTimer;

	public float actionCooldown = 1.5f;

	public float projectileSpeed = 8f;

	public int dragonBalls = 0;

	public float actionRange = 5f;

	public SoundEffectSO actionSound = Prefabs.elderDragonAttack;

	public SoundEffectSO specialSound = Prefabs.elderDragonSpecial;

	public float dragonballMult => (dragonBalls > 0) ? (1f + (float)dragonBalls * 0.1f) : 1f;

	protected override void FixedUpdate()
	{
		base.FixedUpdate();
		if (!startupFinished)
		{
			return;
		}
		actionStopwatch += Time.fixedDeltaTime;
		if (base.distance <= actionRange && actionStopwatch >= actionCooldown)
		{
			if (!inAction)
			{
				inAction = true;
				if (Object.op_Implicit((Object)(object)actionSound))
				{
					actionSound.Play((AudioSource)null);
				}
				animator.SetTrigger("Special");
			}
			actionTimer += Time.fixedDeltaTime;
			if (actionCasts < maxActionCasts)
			{
				if (actionTimer >= 0.25f)
				{
					actionTimer = 0f;
					FireFireFireball();
					actionCasts++;
				}
			}
			else
			{
				actionCasts = 0;
				actionStopwatch = 0f;
				actionTimer = 0f;
				animator.SetTrigger("SpecialEnd");
			}
		}
		else if (inAction)
		{
			inAction = false;
		}
	}

	protected override void MoveObject()
	{
		if (!inAction)
		{
			base.MoveObject();
		}
	}

	protected override void FlipDirection(Vector2 direction)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		base.FlipDirection(direction);
	}

	public void FireFireFirewave()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: 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)
		if (Object.op_Implicit((Object)(object)target))
		{
			Vector3 val = target.transform.position - ((Component)this).transform.position;
			float num = 90f / (float)maxActionCasts;
			Vector3 val2 = Quaternion.AngleAxis(num * (float)actionCasts, Vector3.forward) * val;
			Vector2 val3 = Vector2.op_Implicit(Object.op_Implicit((Object)(object)firePos) ? ((Component)firePos).transform.position : ((Component)this).transform.position);
			Projectile component = Object.Instantiate<GameObject>(Prefabs.elderDragonProjectileWave, Vector2.op_Implicit(val3), Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform).GetComponent<Projectile>();
			component.vector = Vector2.op_Implicit(((Vector3)(ref val2)).normalized * projectileSpeed);
			component.angle = Mathf.Atan2(val2.y, val2.x) * 57.29578f;
			component.size = 1f * dragonballMult;
			component.damage = player.stats[(StatType)4].Modify(dragonballMult);
			component.knockback = player.stats[(StatType)9].Modify(dragonballMult);
			component.bounce = 0;
			component.piercing = 999;
			component.owner = ((Component)this).gameObject;
		}
	}

	public void FireFireFireball()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: 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)
		if (Object.op_Implicit((Object)(object)target))
		{
			Vector3 val = target.transform.position - ((Component)this).transform.position;
			float num = 90f / (float)maxActionCasts;
			Vector3 val2 = Quaternion.AngleAxis(num * (float)actionCasts, Vector3.forward) * val;
			Vector2 val3 = Vector2.op_Implicit(Object.op_Implicit((Object)(object)firePos) ? ((Component)firePos).transform.position : ((Component)this).transform.position);
			Projectile component = Object.Instantiate<GameObject>(Prefabs.elderDragonProjectileFireball, Vector2.op_Implicit(val3), Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform).GetComponent<Projectile>();
			component.vector = Vector2.op_Implicit(((Vector3)(ref val2)).normalized * projectileSpeed);
			component.angle = Mathf.Atan2(val2.y, val2.x) * 57.29578f;
			component.size = 1f * dragonballMult;
			component.damage = player.stats[(StatType)4].Modify(dragonballMult);
			component.knockback = player.stats[(StatType)9].Modify(dragonballMult);
			component.bounce = 0;
			component.piercing = Mathf.CeilToInt(player.stats[(StatType)14].Modify(0f));
			component.owner = ((Component)this).gameObject;
		}
	}
}
internal class DragonBallBehaviour : MonoBehaviour
{
	public static DragonBallBehaviour instance;

	public int collectedDragonballs = 0;

	public void Awake()
	{
		instance = this;
	}
}
internal class DragonBallPickupBehaviour : MonoBehaviour
{
	public SoundEffectSO pickupSFX = Prefabs.dragonballPickupSFX;

	public void OnCollisionEnter2D(Collision2D collider)
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)collider.gameObject.GetComponent<PlayerHealth>()))
		{
			pickupSFX.Play((AudioSource)null);
			((Component)MinimapBehaviour.instance.minimapDragonballs[DragonBallBehaviour.instance.collectedDragonballs]).gameObject.SetActive(true);
			DragonBallBehaviour.instance.collectedDragonballs++;
			Object.Destroy((Object)(object)Object.Instantiate<GameObject>(Prefabs.dragonballPickupFX, ((Component)this).transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform), 0.3f);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class DragonSummonBehaviour : MonoBehaviour
{
	public Summon summon;

	public SoundEffectSO blackDragonSpawn = Prefabs.blackDragonSpawn;

	public SoundEffectSO blackDragonAttack = Prefabs.blackDragonAttack;

	public ParticleSystem hatchParticles;

	public ShootingSummon shootingSummon;

	public int burnDamage = 3;

	public float size = 0.75f;

	public float baseEvolutionSize = 0.75f;

	public float evolution1Size = 1.8f;

	public float evolution2Size = 3f;

	public Sprite sprite;

	public bool canEvolve = false;

	public int currentEvolution = 0;

	public float evolutionSpeed;

	public float evolutionTime = 30f;

	public float evolutionStopwatch;

	public Animator animator;

	public Orbital orbit;

	public void Start()
	{
		//IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		animator = ((Component)this).GetComponent<Animator>();
		orbit = ((Component)this).GetComponentInParent<Orbital>();
		NotificationExtensions.AddObserver((object)this, (Action<object, object>)OnImpact, Summon.SummonOnHitNotification);
		Prefabs.flamethrowerProjectile.transform.localScale = Vector2.op_Implicit(Vector2.one * size);
		shootingSummon = ((Component)summon).GetComponent<ShootingSummon>();
		shootingSummon.numProjectiles = 1;
		shootingSummon.projectilePrefab = Prefabs.flamethrowerProjectile;
		shootingSummon.baseDamage = 0;
		((AttackingSummon)shootingSummon).attackCooldown = 0.65f;
		shootingSummon.projectileSpeed = 22f;
		shootingSummon.inheritPlayerDamage = true;
		shootingSummon.OP.AddObject(((Object)shootingSummon.projectilePrefab).name, shootingSummon.projectilePrefab, 50, true);
		shootingSummon.pierce = 999;
	}

	public void FixedUpdate()
	{
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: 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_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_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Expected O, but got Unknown
		if (canEvolve)
		{
			evolutionSpeed += Time.fixedDeltaTime / evolutionTime;
			if (currentEvolution == 0)
			{
				if (Object.op_Implicit((Object)(object)orbit))
				{
					orbit.radius = Mathf.Lerp(1f, 1.5f, evolutionSpeed);
				}
				size = Mathf.Lerp(baseEvolutionSize, evolution1Size, evolutionSpeed);
			}
			else
			{
				if (Object.op_Implicit((Object)(object)orbit))
				{
					orbit.radius = Mathf.Lerp(1.5f, 2f, evolutionSpeed);
				}
				size = Mathf.Lerp(evolution1Size, evolution2Size, evolutionSpeed);
			}
			evolutionStopwatch += Time.fixedDeltaTime;
			if (evolutionStopwatch >= evolutionTime)
			{
				evolutionStopwatch = 0f;
				currentEvolution++;
				evolutionSpeed = 0f;
				if (currentEvolution == 1)
				{
					Object.Destroy((Object)(object)Object.Instantiate<GameObject>(Prefabs.fireTransformationEffect, ((Component)this).transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform), 0.3f);
					blackDragonSpawn.Play((AudioSource)null);
					if (Object.op_Implicit((Object)(object)animator))
					{
						animator.runtimeAnimatorController = Prefabs.blackDragonAnimator;
					}
					shootingSummon.projectilePrefab = Prefabs.blackDragonProjectile;
					shootingSummon.OP.AddObject(((Object)shootingSummon.projectilePrefab).name, shootingSummon.projectilePrefab, 50, true);
					shootingSummon.shooter.onShoot.AddListener((UnityAction)delegate
					{
						if (Random.Range(0, 100) <= 35)
						{
							blackDragonAttack.Play((AudioSource)null);
						}
					});
				}
				else
				{
					GameObject val = Object.Instantiate<GameObject>(Prefabs.fireTransformationEffect, ((Component)this).transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform);
					val.transform.localScale = Vector2.op_Implicit(Vector2.one * 4f);
					Object.Destroy((Object)(object)val, 0.3f);
					Object.Instantiate<GameObject>(Prefabs.elderDragon, ((Component)this).transform.position, Quaternion.identity);
					Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject);
				}
			}
		}
		if (Object.op_Implicit((Object)(object)shootingSummon))
		{
			((Component)this).transform.parent.localScale = Vector2.op_Implicit(Vector2.one * size);
		}
	}

	public void OnImpact(object sender, object args)
	{
		if (!((Object)((sender is Summon) ? sender : null) != (Object)(object)summon))
		{
			GameObject val = (GameObject)((args is GameObject) ? args : null);
			if (val.tag.Contains("Enemy"))
			{
				BurnSystem.SharedInstance.Burn(val, burnDamage);
			}
		}
	}

	public void OnDestroy()
	{
		NotificationExtensions.RemoveObserver((object)this, (Action<object, object>)OnImpact, Summon.SummonOnHitNotification);
	}
}
internal class ElderBuffSpecial : MonoBehaviour
{
	public GameObject scaler;

	public float radius = 2f;

	public float scale = 1.4f;

	public float healthMult = 0.5f;

	public float speedMult = 0.15f;

	public float stopwatch;

	public void Start()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		scaler = new GameObject("scaler");
		scaler.transform.SetParent(((Component)ObjectPooler.SharedInstance).transform);
		scaler.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
		scaler.transform.localScale = Vector2.op_Implicit(Vector2.one * scale);
	}

	public void FixedUpdate()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= 1f)
		{
			stopwatch = 0f;
			BuffNearby();
		}
		scaler.transform.localScale = Vector2.op_Implicit(Vector2.one * scale);
	}

	public void BuffNearby()
	{
		//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_0019: Unknown result type (might be due to invalid IL or missing references)
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), radius, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
		foreach (Collider2D val in array)
		{
			if ((Object)(object)((Component)val).gameObject != (Object)(object)((Component)this).gameObject)
			{
				EnemyTimedBuffBehaviour component = ((Component)val).gameObject.GetComponent<EnemyTimedBuffBehaviour>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					component = ((Component)val).gameObject.AddComponent<EnemyTimedBuffBehaviour>();
					component.scalerTransform = scaler.transform;
					component.healthMult = healthMult;
					component.speedMult = speedMult;
				}
				else
				{
					component.speedMult = speedMult;
					component.healthMult = healthMult;
					component.duration += 1f;
					component.UpdateBuff();
				}
			}
		}
	}

	public void OnDisable()
	{
		Object.Destroy((Object)(object)this);
	}
}
public class EnemyTimedBuffBehaviour : MonoBehaviour
{
	public Transform scalerTransform;

	public float duration = 1.1f;

	public float healthMult = 0f;

	public float speedMult = 0f;

	public float stopwatch;

	public Health health;

	public int ogHealth;

	public int ogMaxHP;

	public AIComponent ai;

	public SpriteRenderer sprite;

	public Material buffMaterial = Prefabs.redBuffMat;

	public Material ogMaterial;

	public PropertyInfo property;

	public void Start()
	{
		((Component)this).transform.SetParent(scalerTransform);
		AddBuff();
	}

	public void AddBuff()
	{
		if (healthMult > 0f)
		{
			health = ((Component)this).GetComponent<Health>();
			if (Object.op_Implicit((Object)(object)health))
			{
				ogHealth = health.HP;
				ogMaxHP = health.maxHP;
				Health obj = health;
				obj.maxHP += Mathf.CeilToInt((float)ogMaxHP * healthMult);
				property = ((object)health).GetType().GetProperty("HP");
				if (property != null)
				{
					property.SetValue(health, Mathf.CeilToInt((float)ogHealth + (float)ogHealth * healthMult));
				}
			}
		}
		sprite = ((Component)this).GetComponent<SpriteRenderer>();
		if (Object.op_Implicit((Object)(object)sprite))
		{
			ogMaterial = ((Renderer)sprite).material;
			((Renderer)sprite).material = buffMaterial;
		}
		if (speedMult != 0f)
		{
			ai = ((Component)this).GetComponent<AIComponent>();
			if (Object.op_Implicit((Object)(object)ai))
			{
				AIComponent obj2 = ai;
				obj2.maxMoveSpeed += ai.maxMoveSpeed * speedMult;
				AIComponent obj3 = ai;
				obj3.acceleration += ai.acceleration * speedMult;
			}
		}
	}

	public void FixedUpdate()
	{
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= duration)
		{
			RemoveBuff();
		}
	}

	public void UpdateBuff()
	{
		RemoveBuff(destroy: false);
		AddBuff();
	}

	public void RemoveBuff(bool destroy = true)
	{
		if (healthMult > 0f && Object.op_Implicit((Object)(object)health))
		{
			if (property != null)
			{
				property.SetValue(health, ogHealth);
			}
			health.maxHP = ogMaxHP;
		}
		if (Object.op_Implicit((Object)(object)sprite))
		{
			((Renderer)sprite).material = ogMaterial;
		}
		if (speedMult != 0f && Object.op_Implicit((Object)(object)ai))
		{
			ai.maxMoveSpeed = ai.baseMaxMoveSpeed;
			ai.acceleration = ai.baseAcceleration;
		}
		if (destroy)
		{
			((Component)this).transform.SetParent(((Component)ObjectPooler.SharedInstance).transform);
			Object.Destroy((Object)(object)this);
		}
	}

	public void OnDisable()
	{
		RemoveBuff();
	}

	public void OnDestroy()
	{
		RemoveBuff();
	}
}
internal class EntityAI : MonoBehaviour
{
	public GameObject target;

	public MoveComponent2D move;

	public Rigidbody2D rigidBody;

	public Animator animator;

	public float speed = 3.5f;

	public float size = 2f;

	public float pushForce = 3f;

	public bool enemy = false;

	public bool customTarget = false;

	public bool focusBosses = true;

	public SoundEffectSO spawnSound = Prefabs.elderDragonSpawn;

	public bool startupFinished;

	public bool inAction;

	public Transform firePos;

	public PlayerController player;

	public bool walk;

	public float distance => Object.op_Implicit((Object)(object)target) ? Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(target.transform.position)) : (-999f);

	protected virtual void Awake()
	{
		move = ((Component)this).GetComponent<MoveComponent2D>();
		rigidBody = ((Component)this).GetComponent<Rigidbody2D>();
		animator = ((Component)this).GetComponent<Animator>();
		firePos = ((Component)this).transform.GetChild(0);
		player = PlayerController.Instance;
	}

	protected virtual void Start()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		CameraShaker.ShakeOn = true;
		((Component)this).transform.localScale = Vector2.op_Implicit(Vector2.one * size);
		if (Object.op_Implicit((Object)(object)spawnSound))
		{
			spawnSound.Play((AudioSource)null);
		}
		if (!customTarget)
		{
			if (!enemy)
			{
				FindTarget();
			}
			else
			{
				target = ((Component)PlayerController.Instance).gameObject;
			}
		}
	}

	public void Collide(Collision2D collision)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		MoveComponent2D component = ((Component)collision.collider).GetComponent<MoveComponent2D>();
		if (Object.op_Implicit((Object)(object)component))
		{
			if (((Component)collision.collider).gameObject.IsPassiveEnemy())
			{
				move.vector = ((Vector2)(ref component.vectorLastFrame)).normalized * 3f;
			}
			else if (!enemy && ((Component)collision.collider).gameObject.IsEnemyOrBoss())
			{
				component.vector = ((Vector2)(ref move.vectorLastFrame)).normalized * pushForce;
			}
		}
	}

	protected virtual void OnCollisionEnter2D(Collision2D collision)
	{
		Collide(collision);
	}

	protected virtual void OnBecameInvisible()
	{
		if (!enemy)
		{
			TeleportToPlayer();
		}
	}

	public void TeleportToPlayer(float radius = 3f)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = Vector2.op_Implicit(Random.insideUnitCircle * radius + Vector2.op_Implicit(((Component)PlayerController.Instance).transform.position));
		target = null;
	}

	protected virtual void FixedUpdate()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		if (!startupFinished)
		{
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			startupFinished = !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Spawn");
			if (startupFinished)
			{
				CameraShaker.ShakeOn = true;
			}
		}
		if (!Object.op_Implicit((Object)(object)target) || (Object.op_Implicit((Object)(object)target) && !target.activeInHierarchy))
		{
			FindTarget();
		}
		MoveObject();
	}

	protected virtual void FindTarget()
	{
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		if (!enemy && focusBosses && Object.op_Implicit((Object)(object)BossHealthBarBehaviour.instance) && BossHealthBarBehaviour.instance.bossHealthList.Count > 0)
		{
			GameObject gameObject = ((Component)BossHealthBarBehaviour.instance.bossHealthList.FirstOrDefault().Item1).gameObject;
			if ((Object)(object)target != (Object)(object)gameObject)
			{
				target = gameObject;
			}
		}
		else
		{
			target = AIController.SharedInstance.GetNearestEnemy(Vector2.op_Implicit(((Component)this).transform.position));
		}
	}

	protected virtual void SetTarget(GameObject t)
	{
		target = t;
	}

	protected virtual void MoveObject()
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: 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)
		if (!startupFinished)
		{
			return;
		}
		if (!enemy)
		{
			if (customTarget)
			{
				return;
			}
			FindTarget();
		}
		if (!Object.op_Implicit((Object)(object)move) || !Object.op_Implicit((Object)(object)animator) || !Object.op_Implicit((Object)(object)target))
		{
			return;
		}
		Vector2 direction = Vector2.op_Implicit(target.transform.position - ((Component)this).transform.position);
		FlipDirection(direction);
		if (Vector3.Dot(Vector2.op_Implicit(move.vector), Vector2.op_Implicit(((Vector2)(ref direction)).normalized)) < speed)
		{
			MoveComponent2D obj = move;
			obj.vector += ((Vector2)(ref direction)).normalized * speed * Time.fixedDeltaTime;
		}
		Vector2 vector = move.vector;
		float magnitude = ((Vector2)(ref vector)).magnitude;
		if (magnitude > 0.5f)
		{
			if (!walk)
			{
				walk = true;
				animator.SetBool("walk", walk);
			}
		}
		else if (walk)
		{
			walk = false;
			animator.SetBool("walk", walk);
		}
	}

	protected virtual void FlipDirection(Vector2 direction)
	{
		//IL_0001: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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)
		if (direction.x < 0f)
		{
			((Component)this).transform.localScale = Vector2.op_Implicit(new Vector2(0f - size, size));
		}
		if (direction.x > 0f)
		{
			((Component)this).transform.localScale = Vector2.op_Implicit(Vector2.one * size);
		}
		if (!inAction)
		{
		}
	}
}
public class EscToQuitPauseState : MonoBehaviour
{
	public GameController controller;

	public float stopwatch;

	public void Update()
	{
		if (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.playerInput) && (Object)(object)((StateMachine)controller).CurrentState == (Object)(object)((Component)this).GetComponent<PauseState>())
		{
			controller.playerInput.actions["Move"].started += EscToQuitPauseState_started;
			stopwatch += 0.013f;
			if (stopwatch >= 0.6f)
			{
				controller.playerInput.actions["Pause"].started += Unpause;
			}
		}
	}

	private void EscToQuitPauseState_started(CallbackContext obj)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Invalid comparison between Unknown and I4
		KeyControl val = (KeyControl)((CallbackContext)(ref obj)).action.activeControl;
		if (val != null && (int)val.keyCode != 33)
		{
		}
	}

	public void Unpause(CallbackContext obj)
	{
		((Component)this).GetComponent<PauseState>().OnResume();
		stopwatch = 0f;
	}
}
internal class ExplosionEffectOnDisable : MonoBehaviour
{
	public float effectDuration = 0.3f;

	public float effectScale = 1f;

	public void OnDisable()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Prefabs.redExplosionEffect, ((Component)this).transform.position, Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform);
		val.transform.localScale = Vector2.op_Implicit(Vector2.one * effectScale);
		Object.Destroy((Object)(object)val, effectDuration);
	}
}
public class FogTintBehaviour : MonoBehaviour
{
	public void Start()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)PlayerController.Instance))
		{
			RawImage componentInChildren = ((Component)PlayerController.Instance).GetComponentInChildren<RawImage>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				((Graphic)componentInChildren).material.color = Color.clear;
			}
		}
	}
}
internal class ForceLocalPosition : MonoBehaviour
{
	public Vector3 localPos;

	public void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)this).transform.localPosition != localPos)
		{
			((Component)this).transform.localPosition = localPos;
		}
	}
}
internal class LaserSightBehaviour : MonoBehaviour
{
	public LineRenderer laser;

	public Transform dot;

	public Transform origin;

	public float distance = 10f;

	public bool disOnly = false;

	public void Awake()
	{
		//IL_0022: 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)
		dot = Object.Instantiate<GameObject>(Prefabs.fmg9RedDot, ((Component)this).transform).transform;
		origin = new GameObject("origin").transform;
		origin.SetParent(((Component)this).gameObject.transform);
		origin.localPosition = Vector2.op_Implicit(new Vector2(-0.2f, 0f));
		laser = ((Component)this).GetComponent<LineRenderer>();
	}

	public void Update()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//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_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		if (!PauseController.isPaused && Object.op_Implicit((Object)(object)laser) && Object.op_Implicit((Object)(object)dot))
		{
			Vector2 val = Vector2.op_Implicit(origin.position);
			laser.SetPosition(0, Vector2.op_Implicit(val));
			Vector2 val2 = Vector2.op_Implicit(((Component)this).transform.right);
			Vector2 zero = Vector2.zero;
			RaycastHit2D val3 = Physics2D.Raycast(val, val2, distance, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
			zero = ((!Object.op_Implicit((Object)(object)((RaycastHit2D)(ref val3)).collider) || disOnly) ? (val + val2 * distance) : ((RaycastHit2D)(ref val3)).point);
			laser.SetPosition(1, Vector2.op_Implicit(zero));
			((Component)dot).transform.position = Vector2.op_Implicit(zero);
		}
	}

	public void OnDestroy()
	{
		Object.Destroy((Object)(object)((Component)dot).gameObject);
		Object.Destroy((Object)(object)((Component)origin).gameObject);
	}
}
public class MinimapBehaviour : MonoBehaviour
{
	public static MinimapBehaviour instance;

	public Dictionary<GameObject, GameObject> minimapIcons = new Dictionary<GameObject, GameObject>();

	public GameObject minimap;

	public SpriteRenderer[] minimapDragonballs;

	public void Awake()
	{
		instance = this;
	}
}
internal class PointAtCursor : MonoBehaviour
{
	public ShootingCursor cursor;

	public void Start()
	{
		cursor = ShootingCursor.Instance;
	}

	public void Update()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cursor) && !PauseController.isPaused)
		{
			Vector2 val = Vector2.op_Implicit(Camera.main.ScreenToWorldPoint(Vector2.op_Implicit(cursor.cursorPosition)));
			Vector2 val2 = Vector2.op_Implicit(((Component)this).transform.position);
			Vector2 val3 = val - val2;
			float num = Mathf.Atan2(val3.y, val3.x) * 57.29578f;
			((Component)this).transform.rotation = Quaternion.AngleAxis(num, Vector3.forward);
		}
	}
}
internal class PoisonBehaviour : MonoBehaviour
{
	public GameObject bleedFX = Prefabs.bleedFX;

	public Health target;

	public float stopwatch;

	public float durationStopwatch;

	public int baseDamage = 10;

	public float baseDuration;

	public float baseDamageCoefficient;

	public int ticksPerSec = 8;

	public GameObject poisonEffect;

	public StatMod summonDamageMod => Object.op_Implicit((Object)(object)PlayerController.Instance) ? PlayerController.Instance.stats[(StatType)4] : null;

	public float damage => summonDamageMod.Modify((float)baseDamage);

	public void Start()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		target = ((Component)this).GetComponent<Health>();
		poisonEffect = Object.Instantiate<GameObject>(Prefabs.critFX, ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform);
	}

	public void FixedUpdate()
	{
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)target))
		{
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= (float)(1 / ticksPerSec))
			{
				stopwatch = 0f;
				NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.DamageEvent, (object)target);
				if (MainPlugin.debug)
				{
					Debug.LogWarning((object)"Poison Damage");
				}
				NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.DamageEvent, (object)target);
				if ((float)target.HP <= damage)
				{
					if (MainPlugin.debug)
					{
						Debug.LogWarning((object)"Poison Kill");
					}
					NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.KillEvent, (object)target);
				}
				target.TakeDamage(Prefabs.poison, Mathf.FloorToInt(damage / (float)ticksPerSec), 1f);
			}
		}
		durationStopwatch += Time.fixedDeltaTime;
		if (durationStopwatch >= baseDuration)
		{
			PoisonManager.instance.Dispoisonize(target);
			Object.Destroy((Object)(object)poisonEffect);
			Object.Destroy((Object)(object)this);
		}
	}

	public void DealRemainingDamage()
	{
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.FloorToInt(damage / (float)ticksPerSec * (baseDuration * (float)ticksPerSec));
		NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.DamageEvent, (object)target);
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"Dealt Remaining Poison Damage");
		}
		NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.DamageEvent, (object)target);
		if ((float)target.HP <= num)
		{
			if (MainPlugin.debug)
			{
				Debug.LogWarning((object)"Poison Kill");
			}
			NotificationExtensions.PostNotification((object)((Component)this).gameObject, PoisonManager.KillEvent, (object)target);
		}
		target.TakeDamage(Prefabs.poison, Mathf.FloorToInt(num), 1f);
		PoisonManager.instance.Dispoisonize(target);
		Object.Destroy((Object)(object)poisonEffect);
		Object.Destroy((Object)(object)this);
	}

	public void OnDisable()
	{
		PoisonManager.instance.Dispoisonize(target);
		Object.Destroy((Object)(object)poisonEffect);
		Object.Destroy((Object)(object)this);
	}
}
internal class PoisonManager : MonoBehaviour
{
	public static PoisonManager instance;

	public bool canStack = false;

	public Dictionary<Health, PoisonBehaviour> poisonedTargets = new Dictionary<Health, PoisonBehaviour>();

	public static string InflictEvent = "Poison.InflictEvent";

	public static string KillEvent = "Poison.KillEvent";

	public static string DamageEvent = "Poison.DamageEvent";

	public float baseDuration = 6f;

	public float baseDamageMult = 1f;

	public void Awake()
	{
		instance = this;
	}

	public void Dispoisonize(Health target)
	{
		if (Object.op_Implicit((Object)(object)target) && poisonedTargets.ContainsKey(target))
		{
			poisonedTargets.Remove(target);
		}
	}

	public void PoisonizeTarget(Health target)
	{
		if (Object.op_Implicit((Object)(object)target))
		{
			if (MainPlugin.debug)
			{
				Debug.LogWarning((object)"Poison Inflicted");
			}
			NotificationExtensions.PostNotification((object)((Component)this).gameObject, InflictEvent, (object)target);
			PoisonBehaviour value = null;
			if (!poisonedTargets.TryGetValue(target, out value))
			{
				poisonedTargets.Add(target, AddPoison(((Component)target).gameObject, baseDamageMult, baseDuration));
			}
		}
	}

	public PoisonBehaviour AddPoison(GameObject target, float mult, float dur)
	{
		PoisonBehaviour poisonBehaviour = target.AddComponent<PoisonBehaviour>();
		poisonBehaviour.baseDamageCoefficient = mult;
		poisonBehaviour.baseDuration = dur;
		return poisonBehaviour;
	}

	public bool IsPoisoned(Health target)
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			return false;
		}
		return poisonedTargets.ContainsKey(target);
	}

	public bool IsPoisoned(Health target, out PoisonBehaviour b)
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			b = null;
			return false;
		}
		return poisonedTargets.TryGetValue(target, out b);
	}
}
public class ReaperBehaviour : MonoBehaviour
{
	public int shpIncrease = 3;

	public UnityEvent onLethalDeath = new UnityEvent();

	public UnityEvent onDeathPrevented = new UnityEvent();

	public UnityAction onGiveUp;

	public bool deadDead = false;

	public bool giveUp = false;

	public bool preventDeath = false;

	public GameController gameController;

	public SoundEffectSO deathPreventSound = Prefabs.preventDeathSFX;

	public void Start()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Expected O, but got Unknown
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		onDeathPrevented.AddListener(new UnityAction(VeryveryDeathActualDeath));
		onGiveUp = (UnityAction)delegate
		{
			giveUp = true;
		};
		NotificationExtensions.AddObserver((object)this, (Action<object, object>)OnKill, Health.DeathEvent);
		PlayerHealth playerHealth = PlayerController.Instance.playerHealth;
		playerHealth.maxSHP += shpIncrease;
		PlayerHealth playerHealth2 = PlayerController.Instance.playerHealth;
		playerHealth2.shp += shpIncrease;
		PlayerController.Instance.playerHealth.onHurt.AddListener(new UnityAction(OnHurt));
		PersistentCallGroup persistentCalls = ((UnityEventBase)PlayerController.Instance.playerHealth.onDeath).m_PersistentCalls;
		((UnityEventBase)onLethalDeath).m_PersistentCalls.m_Calls.AddRange(persistentCalls.m_Calls);
		onLethalDeath.AddListener(new UnityAction(VeryveryDeathActualDeath));
		((UnityEventBase)PlayerController.Instance.playerHealth.onDeath).m_PersistentCalls.Clear();
		gameController = Object.FindObjectOfType<GameController>();
		if (Object.op_Implicit((Object)(object)gameController))
		{
			((UnityEvent)gameController.giveupButton.onClick).AddListener(onGiveUp);
		}
		PlayerDeadState.Enter += new hook_Enter(PlayerDeadState_Enter);
	}

	private void PreventDeath()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		preventDeath = false;
		deathPreventSound.Play((AudioSource)null);
		PlayerHealth playerHealth = PlayerController.Instance.playerHealth;
		playerHealth.shp += 3;
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), 8f, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy));
		foreach (Collider2D val in array)
		{
			GameObject curseFXPrefab = CurseSystem.Instance.curseFXPrefab;
			if (Object.op_Implicit((Object)(object)curseFXPrefab))
			{
				SpawnPrefabFromObjectPool component = curseFXPrefab.GetComponent<SpawnPrefabFromObjectPool>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Object.Instantiate<GameObject>(component.prefab, ((Component)val).transform.position, Quaternion.identity, (Transform)null);
				}
			}
			((Component)val).GetComponent<Health>().AutoKill(true);
		}
	}

	public void PlayerDeadState_Enter(orig_Enter orig, PlayerDeadState self)
	{
		if (!deadDead && !giveUp)
		{
			((StateMachine)((GameState)self).owner).ChangeState<CombatState>();
			return;
		}
		if (giveUp)
		{
			onLethalDeath.Invoke();
		}
		orig.Invoke(self);
	}

	public void Update()
	{
		if (Object.op_Implicit((Object)(object)PlayerController.Instance) && !PauseController.isPaused && !deadDead)
		{
			PlayerController.Instance.MovePlayer();
			PlayerController.Instance.UpdateSprite();
		}
	}

	private void VeryveryDeathActualDeath()
	{
		deadDead = true;
		if (Object.op_Implicit((Object)(object)gameController))
		{
			((StateMachine)gameController).ChangeState<PlayerDeadState>();
		}
	}

	private void OnHurt()
	{
		if (PlayerController.Instance.playerHealth.shp == 0)
		{
			if (preventDeath)
			{
				PreventDeath();
			}
			else
			{
				onLethalDeath.Invoke();
			}
		}
	}

	public void OnDestroy()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		if (Object.op_Implicit((Object)(object)gameController))
		{
			((UnityEvent)gameController.giveupButton.onClick).RemoveListener(onGiveUp);
		}
		NotificationExtensions.RemoveObserver((object)this, (Action<object, object>)OnKill, Health.DeathEvent);
		PlayerDeadState.Enter -= new hook_Enter(PlayerDeadState_Enter);
	}

	public void OnKill(object sender, object args)
	{
		if (((Component)((sender is Health) ? sender : null)).gameObject.tag == "Enemy" && args == null)
		{
			NotificationExtensions.PostNotification((sender is Health) ? sender : null, Health.DeathEvent, (object)this);
		}
	}
}
internal class ReloadOverTimeBehaviour : MonoBehaviour
{
	public PlayerController player;

	public Ammo ammo;

	public bool reload = false;

	public float stopwatch;

	public void Awake()
	{
		player = PlayerController.Instance;
		ammo = player.ammo;
	}

	public void FixedUpdate()
	{
		if (reload && Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)ammo))
		{
			stopwatch += Time.fixedDeltaTime;
			if (Object.op_Implicit((Object)(object)ammo) && stopwatch >= 0.1f / (1f + player.stats[(StatType)1]._multiplierBonus))
			{
				stopwatch = 0f;
				ammo.GainAmmo(1);
			}
		}
	}
}
internal class StatPanelBehaviour : MonoBehaviour
{
	public TextMeshProUGUI gunName;

	public TextMeshProUGUI charName;

	public TextMeshProUGUI gunStats;

	public string _gunStats;

	public TextMeshProUGUI charStats;

	public string _charStats;

	public float stopwatch;

	public void Start()
	{
		_gunStats = ((TMP_Text)gunStats).text;
		_charStats = ((TMP_Text)charStats).text;
		UpdateStats();
	}

	public void FixedUpdate()
	{
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= 1f)
		{
			UpdateStats();
		}
	}

	public void UpdateStats()
	{
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		PlayerController instance = PlayerController.Instance;
		Gun gun = PlayerController.Instance.gun;
		((TMP_Text)gunName).text = gun.gunData.nameString;
		((TMP_Text)gunStats).text = string.Format(_gunStats, Mathf.FloorToInt(gun.damage), Math.Round((decimal)gun.shotCooldown, 2), gun.numOfProjectiles, gun.reloadDuration, instance.stats[(StatType)9].Modify(gun.gunData.knockback), Mathf.Max(0, (int)instance.stats[(StatType)13].Modify((float)gun.gunData.bounce)), Mathf.Max(0, (int)instance.stats[(StatType)14].Modify((float)gun.gunData.piercing)), instance.stats[(StatType)7].Modify(gun.gunData.projectileSpeed), gun.spread, gun.stats[(StatType)8].Modify(1f), Math.Round((decimal)instance.stats[Prefabs.criticalChance]._multiplierBonus * 100m, 0), Math.Round((decimal)instance.stats[Prefabs.criticalDamage]._multiplierBonus * 100m, 0));
		((TMP_Text)charName).text = instance.loadedCharacter.nameString;
		((TMP_Text)charStats).text = string.Format(_charStats, instance.stats[(StatType)4].Modify(1f), instance.stats[(StatType)5].Modify(1f), instance.playerHealth.maxHP, instance.playerHealth.maxSHP, instance.finalMoveSpeed, instance.stats[(StatType)11].Modify(1f), instance.stats[(StatType)19].Modify(1f), instance.stats[(StatType)20].Modify(1f), instance.stats[(StatType)17].Modify(1f), instance.stats[(StatType)18].Modify(1f), instance.stats[(StatType)16].Modify(1f), ScoreCalculator.SharedInstance._enemiesKilled);
	}

	public void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)PlayerController.Instance))
		{
		}
	}
}
internal class Target : MonoBehaviour
{
}
public class TargetEnemyBehaviour : MonoBehaviour
{
	public float cooldown = 5f;

	public float stopwatch;

	public GameObject tagInstance;

	public void FixedUpdate()
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)tagInstance) || (Object.op_Implicit((Object)(object)tagInstance) && !((Component)tagInstance.transform.parent).gameObject.activeInHierarchy))
		{
			stopwatch += Time.fixedDeltaTime;
		}
		if (!(stopwatch >= cooldown))
		{
			return;
		}
		stopwatch = 0f;
		List<Collider2D> list = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), 20f, 1 << LayerMask.op_Implicit(TagLayerUtil.Enemy)).ToList();
		foreach (Collider2D item in list)
		{
			if (((Component)item).gameObject.IsBoss())
			{
				list.Add(item);
			}
		}
		list.RemoveAll((Collider2D x) => ((Component)x).gameObject.IsPassiveEnemy());
		Collider2D val = list[Random.Range(0, list.Count + 1)];
		if (!Object.op_Implicit((Object)(object)tagInstance))
		{
			tagInstance = Object.Instantiate<GameObject>(Prefabs.headhunterTag, ((Component)val).transform.position, Quaternion.identity, ((Component)val).transform);
			return;
		}
		tagInstance.transform.position = ((Component)val).transform.position;
		tagInstance.transform.SetParent(((Component)val).transform);
	}
}
public class AITargetState : EntityState
{
	public GameObject target;

	public bool enemy = false;

	public bool customTarget = false;

	public bool focusBosses = true;

	public float distance => Object.op_Implicit((Object)(object)target) ? Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(target.transform.position)) : (-999f);

	public virtual float size()
	{
		return 1f;
	}

	public override void Enter()
	{
		base.Enter();
		if (!customTarget)
		{
			if (!enemy)
			{
				FindTarget();
			}
			else
			{
				target = ((Component)PlayerController.Instance).gameObject;
			}
		}
	}

	public override void FixedUpdate()
	{
		base.FixedUpdate();
		if (!Object.op_Implicit((Object)(object)target) || (Object.op_Implicit((Object)(object)target) && !target.activeInHierarchy))
		{
			FindTarget();
		}
	}

	public virtual void FindTarget()
	{
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		if (!enemy && focusBosses && Object.op_Implicit((Object)(object)BossHealthBarBehaviour.instance) && BossHealthBarBehaviour.instance.bossHealthList.Count > 0)
		{
			GameObject gameObject = ((Component)BossHealthBarBehaviour.instance.bossHealthList.FirstOrDefault().Item1).gameObject;
			if ((Object)(object)target != (Object)(object)gameObject)
			{
				target = gameObject;
			}
		}
		else
		{
			target = AIController.SharedInstance.GetNearestEnemy(Vector2.op_Implicit(((Component)this).transform.position));
		}
	}

	public virtual void FlipDirection(Vector2 direction)
	{
		//IL_0001: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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)
		if (direction.x < 0f)
		{
			((Component)this).transform.localScale = Vector2.op_Implicit(new Vector2(0f - size(), size()));
		}
		if (direction.x > 0f)
		{
			((Component)this).transform.localScale = Vector2.op_Implicit(Vector2.one * size());
		}
	}
}
internal class AIWalkState : AITargetState
{
	public bool walk = false;

	public virtual float speed => 3.5f;

	public virtual float pushForce => 3f;

	public override void FixedUpdate()
	{
		base.FixedUpdate();
		MoveObject();
	}

	public virtual void MoveObject()
	{
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)components.move) || !Object.op_Implicit((Object)(object)components.animator))
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)target))
		{
			Vector2 direction = Vector2.op_Implicit(target.transform.position - ((Component)this).transform.position);
			FlipDirection(direction);
			if (Vector3.Dot(Vector2.op_Implicit(components.move.vector), Vector2.op_Implicit(((Vector2)(ref direction)).normalized)) < speed)
			{
				MoveComponent2D move = components.move;
				move.vector += ((Vector2)(ref direction)).normalized * speed * Time.fixedDeltaTime;
			}
		}
		Vector2 vector = components.move.vector;
		float magnitude = ((Vector2)(ref vector)).magnitude;
		if (magnitude > 0.5f)
		{
			if (!walk)
			{
				walk = true;
				components.animator.SetBool("walk", walk);
			}
		}
		else if (walk)
		{
			walk = false;
			components.animator.SetBool("walk", walk);
		}
	}
}
internal class BaseSpawnState : EntityState
{
	public bool startupFinished;

	public override void FixedUpdate()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		base.FixedUpdate();
		if (!startupFinished)
		{
			AnimatorStateInfo currentAnimatorStateInfo = components.animator.GetCurrentAnimatorStateInfo(0);
			startupFinished = !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Spawn");
		}
		else
		{
			SetNextState();
			Object.Destroy((Object)(object)this);
		}
	}

	public virtual void SetNextState()
	{
		((StateMachine)components.machine).ChangeState<AIWalkState>();
	}
}
internal class ElderDragonBaseState : AIWalkState
{
	public float minActionTimer = 3f;

	public int usedAction = 0;

	public int minActionForSpecial = 2;

	public Transform firePos;

	public int dragonBalls = 0;

	public float actionCD = 4f;

	public float dragonballMult => (dragonBalls > 0) ? (1f + (float)dragonBalls * 0.1f) : 1f;

	public override float size()
	{
		return 3f;
	}

	public override void Enter()
	{
		base.Enter();
		firePos = ((Component)this).transform.GetChild(0);
	}

	public override void FixedUpdate()
	{
		base.FixedUpdate();
		if (fixedDeltaTime >= actionCD && Object.op_Implicit((Object)(object)target))
		{
			if (usedAction < minActionForSpecial)
			{
				usedAction++;
				((StateMachine)components.machine).ChangeState<ElderDragonFireFireFireballsState>();
			}
			else
			{
				usedAction = 0;
				((StateMachine)components.machine).ChangeState<ElderDragonFireFireFirewaveState>();
			}
		}
	}

	public override void Exit()
	{
		base.Exit();
	}

	public override void MoveObject()
	{
		base.MoveObject();
	}
}
internal class ElderDragonFireFireFireballsState : AITargetState
{
	public ElderDragonBaseState baseState;

	public SoundEffectSO fireSound = Prefabs.elderDragonAttack;

	public int maxProjectiles = 3;

	public int projectileCount = 0;

	public float projectileSpeed = 8f;

	public bool firing = false;

	public SoundEffectSO actionSound = Prefabs.elderDragonAttack;

	public override void Enter()
	{
		base.Enter();
		baseState = ((Component)this).GetComponent<ElderDragonBaseState>();
		if (Object.op_Implicit((Object)(object)actionSound))
		{
			actionSound.Play((AudioSource)null);
		}
		components.animator.SetTrigger("Special");
	}

	public override void FixedUpdate()
	{
		base.FixedUpdate();
		if (!(fixedDeltaTime >= 0.25f))
		{
			return;
		}
		fixedDeltaTime = 0f;
		if (projectileCount < maxProjectiles)
		{
			projectileCount++;
			if (projectileCount == maxProjectiles)
			{
				components.animator.SetTrigger("SpecialEnd");
			}
			FireFireFireball();
		}
		else
		{
			((StateMachine)components.machine).ChangeState<ElderDragonBaseState>();
		}
	}

	public override void Exit()
	{
		projectileCount = 0;
		base.Exit();
	}

	public void FireFireFireball()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: 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)
		if (Object.op_Implicit((Object)(object)baseState.target) && Object.op_Implicit((Object)(object)baseState.firePos))
		{
			Vector3 val = baseState.target.transform.position - ((Component)this).transform.position;
			float num = 90f / (float)maxProjectiles;
			Vector3 val2 = Quaternion.AngleAxis(num * (float)projectileCount, Vector3.forward) * val;
			Vector2 val3 = Vector2.op_Implicit(Object.op_Implicit((Object)(object)baseState.firePos) ? ((Component)baseState.firePos).transform.position : ((Component)this).transform.position);
			Projectile component = Object.Instantiate<GameObject>(Prefabs.elderDragonProjectileFireball, Vector2.op_Implicit(val3), Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform).GetComponent<Projectile>();
			component.vector = Vector2.op_Implicit(((Vector3)(ref val2)).normalized * projectileSpeed);
			component.angle = Mathf.Atan2(val2.y, val2.x) * 57.29578f;
			component.size = 1f * baseState.dragonballMult;
			component.damage = components.player.stats[(StatType)4].Modify(baseState.dragonballMult);
			component.knockback = components.player.stats[(StatType)9].Modify(baseState.dragonballMult);
			component.bounce = 0;
			component.piercing = Mathf.CeilToInt(components.player.stats[(StatType)14].Modify(0f));
			component.owner = ((Component)this).gameObject;
		}
	}
}
internal class ElderDragonFireFireFirewaveState : AITargetState
{
	public ElderDragonBaseState baseState;

	public SoundEffectSO fireSound = Prefabs.elderDragonAttack;

	public int maxProjectiles = 6;

	public int projectileCount = 0;

	public float projectileSpeed = 12f;

	public bool firing = false;

	public SoundEffectSO actionSound = Prefabs.elderDragonAttack;

	public override void Enter()
	{
		base.Enter();
		baseState = ((Component)this).GetComponent<ElderDragonBaseState>();
		if (Object.op_Implicit((Object)(object)actionSound))
		{
			actionSound.Play((AudioSource)null);
		}
		components.animator.SetTrigger("Special");
	}

	public override void FixedUpdate()
	{
		base.FixedUpdate();
		if (!(fixedDeltaTime >= 0.4f))
		{
			return;
		}
		fixedDeltaTime = 0f;
		if (projectileCount < maxProjectiles)
		{
			projectileCount++;
			if (projectileCount == maxProjectiles)
			{
				components.animator.SetTrigger("SpecialEnd");
			}
			FireFireFirewave();
		}
		else
		{
			((StateMachine)components.machine).ChangeState<ElderDragonBaseState>();
		}
	}

	public override void FlipDirection(Vector2 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		Vector2 zero = Vector2.zero;
		Vector2 one = Vector2.one;
		direction = ((projectileCount <= 3) ? one : zero);
		base.FlipDirection(direction);
	}

	public override void Exit()
	{
		projectileCount = 0;
		base.Exit();
	}

	public void FireFireFirewave()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00f2: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)baseState.target) && Object.op_Implicit((Object)(object)baseState.firePos))
		{
			Vector3 val = target.transform.position - ((Component)this).transform.position;
			float num = 360f / (float)maxProjectiles;
			Vector3 val2 = Quaternion.AngleAxis(num * (float)projectileCount, Vector3.forward) * val;
			Vector2 val3 = Vector2.op_Implicit(Object.op_Implicit((Object)(object)baseState.firePos) ? ((Component)baseState.firePos).transform.position : ((Component)this).transform.position);
			Projectile component = Object.Instantiate<GameObject>(Prefabs.elderDragonProjectileWave, Vector2.op_Implicit(val3), Quaternion.identity, ((Component)ObjectPooler.SharedInstance).transform).GetComponent<Projectile>();
			component.vector = Vector2.op_Implicit(((Vector3)(ref val2)).normalized * projectileSpeed);
			component.angle = Mathf.Atan2(val2.y, val2.x) * 57.29578f;
			component.size = 1f * baseState.dragonballMult;
			component.damage = components.player.stats[(StatType)4].Modify(baseState.dragonballMult);
			component.knockback = components.player.stats[(StatType)9].Modify(baseState.dragonballMult);
			component.bounce = 0;
			component.piercing = 999;
			component.owner = ((Component)this).gameObject;
		}
	}
}
internal class ElderDragonSpawnState : BaseSpawnState
{
	public SoundEffectSO spawnSound = Prefabs.elderDragonSpawn;

	public override void Enter()
	{
		base.Enter();
		if (Object.op_Implicit((Object)(object)spawnSound))
		{
			spawnSound.Play((AudioSource)null);
		}
	}

	public override void FixedUpdate()
	{
		base.FixedUpdate();
	}

	public override void SetNextState()
	{
		((StateMachine)components.machine).ChangeState<ElderDragonBaseState>();
	}
}
public class EntityState : State
{
	public float deltaTime = 0f;

	public float fixedDeltaTime = 0f;

	public EntityStateMachine.Components components;

	public virtual float duration => 0f;

	public override void Enter()
	{
		((State)this).Enter();
		((Behaviour)this).enabled = true;
		components = ((Component)this).GetComponent<EntityStateMachine>().components;
		deltaTime = 0f;
		fixedDeltaTime = 0f;
	}

	public override void Exit()
	{
		deltaTime = 0f;
		fixedDeltaTime = 0f;
		((Behaviour)this).enabled = false;
		((State)this).Exit();
	}

	public virtual void FixedUpdate()
	{
		fixedDeltaTime += Time.fixedDeltaTime;
	}

	public virtual void Update()
	{
		deltaTime += Time.deltaTime;
	}
}
public class EntityStateMachine : StateMachine
{
	public struct Components
	{
		public Animator animator;

		public MoveComponent2D move;

		public Rigidbody2D rigidBody;

		public EntityStateMachine machine;

		public PlayerController player;

		public Components(GameObject obj)
		{
			machine = obj.GetComponent<EntityStateMachine>();
			animator = obj.GetComponent<Animator>();
			move = obj.GetComponent<MoveComponent2D>();
			rigidBody = obj.GetComponent<Rigidbody2D>();
			player = PlayerController.Instance;
		}
	}

	public Components components;

	public EntityState spawnState;

	public void Awake()
	{
	}

	public void Start()
	{
		components = new Components(((Component)this).gameObject);
		((State)spawnState).Enter();
		base._currentState = (State)(object)spawnState;
	}

	public override void ChangeState<T>()
	{
		((StateMachine)this).ChangeState<T>();
	}
}
public static class Extensions
{
	public static GameObject SpawnDamagePopup(this Health h, float damage, string color, int spriteIndex)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to i