Decompiled source of ReksikCards v1.4.3

ReksikCards.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using ReksikCards.Cards;
using ReksikCards.Monos;
using ReksikCards.Vfx;
using UnboundLib.Cards;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ReksikCards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+06681d24c624bed043b2be7b60a855fb091af6f1")]
[assembly: AssemblyProduct("ReksikCards")]
[assembly: AssemblyTitle("ReksikCards")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ReksikCards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.reksikcards.rounds", "ReksikCards", "1.4.3")]
	[BepInProcess("Rounds.exe")]
	public class ReksikCardsPlugin : BaseUnityPlugin
	{
		public const string ModId = "com.reksikcards.rounds";

		public const string ModName = "ReksikCards";

		public const string Version = "1.4.3";

		public const string ModInitials = "Reksik";

		public static ReksikCardsPlugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.reksikcards.rounds");
			val.PatchAll();
		}

		private void Start()
		{
			Instance = this;
			CustomCard.BuildCard<RexCard>();
			CustomCard.BuildCard<ViktorCard>();
			CustomCard.BuildCard<DaniilCard>();
			CustomCard.BuildCard<DmitriyCard>();
			CustomCard.BuildCard<RetiredTankerCard>();
			CustomCard.BuildCard<AgentCard>();
			CustomCard.BuildCard<EgorCard>();
			CustomCard.BuildCard<NazarCard>();
			CustomCard.BuildCard<MatveyCard>();
			CustomCard.BuildCard<MatusovskyCard>();
			CustomCard.BuildCard<RomanCard>();
			CustomCard.BuildCard<TuksonCard>();
			CustomCard.BuildCard<NesenCard>();
			CustomCard.BuildCard<RostislavCard>();
			CustomCard.BuildCard<FedrCard>();
			CustomCard.BuildCard<MaksimCard>();
			CustomCard.BuildCard<SosnovkaCard>();
			CustomCard.BuildCard<ArtemCard>();
			CustomCard.BuildCard<Subject8Card>();
		}
	}
	internal static class ReksikUtils
	{
		[CompilerGenerated]
		private sealed class <EnemyPlayers>d__1 : IEnumerable<Player>, IEnumerable, IEnumerator<Player>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private Player <>2__current;

			private int <>l__initialThreadId;

			private Player self;

			public Player <>3__self;

			private List<Player>.Enumerator <>s__1;

			private Player <p>5__2;

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

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

			[DebuggerHidden]
			public <EnemyPlayers>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = default(List<Player>.Enumerator);
				<p>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if ((Object)(object)PlayerManager.instance == (Object)null || PlayerManager.instance.players == null || (Object)(object)self == (Object)null)
						{
							return false;
						}
						<>s__1 = PlayerManager.instance.players.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<p>5__2 = null;
						break;
					}
					while (<>s__1.MoveNext())
					{
						<p>5__2 = <>s__1.Current;
						if ((Object)(object)<p>5__2 == (Object)null || <p>5__2.teamID == self.teamID)
						{
							continue;
						}
						<>2__current = <p>5__2;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>s__1 = default(List<Player>.Enumerator);
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__1).Dispose();
			}

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

			[DebuggerHidden]
			IEnumerator<Player> IEnumerable<Player>.GetEnumerator()
			{
				<EnemyPlayers>d__1 <EnemyPlayers>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<EnemyPlayers>d__ = this;
				}
				else
				{
					<EnemyPlayers>d__ = new <EnemyPlayers>d__1(0);
				}
				<EnemyPlayers>d__.self = <>3__self;
				return <EnemyPlayers>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<Player>)this).GetEnumerator();
			}
		}

		private static readonly FieldInfo PlayerVelocityField = typeof(PlayerVelocity).GetField("velocity", BindingFlags.Instance | BindingFlags.NonPublic);

		[IteratorStateMachine(typeof(<EnemyPlayers>d__1))]
		public static IEnumerable<Player> EnemyPlayers(Player self)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EnemyPlayers>d__1(-2)
			{
				<>3__self = self
			};
		}

		public static Player? GetClosestEnemy(Player self)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)self == (Object)null)
			{
				return null;
			}
			Vector2 val = Vector2.op_Implicit(((Component)self).transform.position);
			Player result = null;
			float num = float.MaxValue;
			foreach (Player item in EnemyPlayers(self))
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item.data == (Object)null) && !item.data.dead)
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)item).transform.position) - val;
					float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						result = item;
					}
				}
			}
			return result;
		}

		public static Player? GetClosestEnemy(Player self, float maxRange)
		{
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)self == (Object)null)
			{
				return null;
			}
			if (maxRange <= 0f)
			{
				return null;
			}
			Vector2 val = Vector2.op_Implicit(((Component)self).transform.position);
			float num = maxRange * maxRange;
			Player result = null;
			float num2 = num;
			foreach (Player item in EnemyPlayers(self))
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item.data == (Object)null) && !item.data.dead)
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)item).transform.position) - val;
					float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude;
					if (sqrMagnitude <= num2)
					{
						num2 = sqrMagnitude;
						result = item;
					}
				}
			}
			return result;
		}

		public static float GetDamageFactor(Player p)
		{
			try
			{
				if ((Object)(object)p == (Object)null || (Object)(object)p.data == (Object)null || (Object)(object)p.data.weaponHandler == (Object)null || (Object)(object)p.data.weaponHandler.gun == (Object)null)
				{
					return 1f;
				}
				float damage = p.data.weaponHandler.gun.damage;
				if (float.IsNaN(damage) || float.IsInfinity(damage))
				{
					return 1f;
				}
				return Mathf.Clamp(damage, 0.05f, 50f);
			}
			catch
			{
				return 1f;
			}
		}

		public static float HealthFraction(Player p)
		{
			if ((Object)(object)p == (Object)null || (Object)(object)p.data == (Object)null)
			{
				return 1f;
			}
			if (p.data.maxHealth <= 0f)
			{
				return 1f;
			}
			return Mathf.Clamp01(p.data.health / p.data.maxHealth);
		}

		public static void Heal(Player p, float amount)
		{
			if (!((Object)(object)p == (Object)null) && !((Object)(object)p.data == (Object)null))
			{
				p.data.health = Mathf.Min(p.data.maxHealth, p.data.health + amount);
			}
		}

		public static void AddVelocity(Player p, Vector2 add)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)p == (Object)null || (Object)(object)p.data == (Object)null)
			{
				return;
			}
			if (PlayerVelocityField != null && (Object)(object)p.data.playerVel != (Object)null)
			{
				try
				{
					Vector2 val = (Vector2)PlayerVelocityField.GetValue(p.data.playerVel);
					PlayerVelocityField.SetValue(p.data.playerVel, val + add);
					return;
				}
				catch (Exception)
				{
				}
			}
			MoveTransform componentInChildren = ((Component)p).GetComponentInChildren<MoveTransform>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.velocity += new Vector3(add.x, add.y, 0f);
			}
		}

		public static string GetNickname(Player p)
		{
			try
			{
				object obj = (((Object)(object)p == (Object)null) ? null : p.data);
				if (obj == null)
				{
					return string.Empty;
				}
				Type type = obj.GetType();
				object obj2 = null;
				FieldInfo field = type.GetField("view", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				obj2 = ((!(field != null)) ? type.GetProperty("view", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj, null) : field.GetValue(obj));
				if (obj2 == null)
				{
					return string.Empty;
				}
				object obj3 = obj2.GetType().GetProperty("Owner", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj2, null);
				if (obj3 == null)
				{
					return string.Empty;
				}
				string text = obj3.GetType().GetProperty("NickName", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj3, null) as string;
				return text ?? string.Empty;
			}
			catch
			{
				return string.Empty;
			}
		}
	}
}
namespace ReksikCards.Vfx
{
	public class CardArtSpawnFixMono : MonoBehaviour
	{
		private bool applied;

		private void Awake()
		{
			TryApply();
		}

		private void OnEnable()
		{
			TryApply();
		}

		private void Start()
		{
			TryApply();
		}

		private void LateUpdate()
		{
			if (!applied)
			{
				TryApply();
			}
		}

		private void TryApply()
		{
			if (applied)
			{
				return;
			}
			Transform parent = ((Component)this).transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return;
			}
			try
			{
				Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if ((Object)(object)componentsInChildren[i] != (Object)null)
					{
						componentsInChildren[i].enabled = true;
					}
				}
				int layer = ((Component)parent).gameObject.layer;
				ReksikVfx.SetLayerRecursive(((Component)this).gameObject, layer);
				Renderer componentInChildren = ((Component)parent).GetComponentInChildren<Renderer>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						if (!((Object)(object)componentsInChildren[j] == (Object)null))
						{
							componentsInChildren[j].sortingLayerID = componentInChildren.sortingLayerID;
						}
					}
				}
				applied = true;
			}
			catch
			{
			}
		}
	}
	internal static class ReksikCardArtCache
	{
		private static readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static GameObject GetOrCreate(string title)
		{
			title = (title ?? string.Empty).Trim();
			if (title.Length == 0)
			{
				title = "Card";
			}
			if (Prefabs.TryGetValue(title, out GameObject value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			GameObject val = CreateArtPrefab(title);
			DisableAllRenderers(val);
			((Object)val).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)val);
			Prefabs[title] = val;
			return val;
		}

		private static void DisableAllRenderers(GameObject root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			try
			{
				Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if ((Object)(object)componentsInChildren[i] != (Object)null)
					{
						componentsInChildren[i].enabled = false;
					}
				}
			}
			catch
			{
			}
		}

		private static GameObject CreateArtPrefab(string title)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00a8: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(title + "_Art");
			val.AddComponent<CardArtSpawnFixMono>();
			GameObject val2 = new GameObject("BG");
			val2.transform.SetParent(val.transform, false);
			SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>();
			val3.sprite = ReksikSpriteCache.Square;
			val3.color = PickColor(title);
			((Renderer)val3).sortingOrder = 0;
			GameObject val4 = new GameObject("Ring");
			val4.transform.SetParent(val.transform, false);
			SpriteRenderer val5 = val4.AddComponent<SpriteRenderer>();
			val5.sprite = ReksikSpriteCache.Ring;
			val5.color = new Color(1f, 1f, 1f, 0.85f);
			((Renderer)val5).sortingOrder = 1;
			val4.transform.localScale = Vector3.one * 0.9f;
			GameObject val6 = new GameObject("Label");
			val6.transform.SetParent(val.transform, false);
			StatusTextVfxMono statusTextVfxMono = val6.AddComponent<StatusTextVfxMono>();
			string text = MakeLabel(title);
			statusTextVfxMono.Init(val.transform, text, Color.white, Vector3.zero);
			TextMesh component = val6.GetComponent<TextMesh>();
			if ((Object)(object)component != (Object)null)
			{
				component.characterSize = 0.18f;
				component.fontSize = 120;
				component.color = Color.white;
			}
			val.transform.localScale = Vector3.one * 0.75f;
			return val;
		}

		private static string MakeLabel(string title)
		{
			string text = (title ?? string.Empty).Trim();
			if (text.Length == 0)
			{
				return "?";
			}
			string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length >= 2)
			{
				string text2 = ((array[0].Length > 0) ? array[0].Substring(0, 1) : "");
				string text3 = ((array[1].Length > 0) ? array[1].Substring(0, 1) : "");
				string text4 = (text2 + text3).ToUpperInvariant();
				return (text4.Length > 0) ? text4 : text.Substring(0, Mathf.Min(2, text.Length)).ToUpperInvariant();
			}
			return text.Substring(0, Mathf.Min(2, text.Length)).ToUpperInvariant();
		}

		private static Color PickColor(string title)
		{
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			string text = (title ?? string.Empty).Trim().ToLowerInvariant();
			if (text.Contains("rex"))
			{
				return ReksikVfx.BossColor;
			}
			if (text.Contains("viktor"))
			{
				return ReksikVfx.ExplosionColor;
			}
			if (text.Contains("daniil"))
			{
				return new Color(0.2f, 0.8f, 0.35f, 0.85f);
			}
			if (text.Contains("dmitriy"))
			{
				return new Color(0.25f, 0.6f, 0.95f, 0.85f);
			}
			if (text.Contains("egor"))
			{
				return new Color(0.35f, 0.7f, 1f, 0.85f);
			}
			if (text.Contains("nazar"))
			{
				return new Color(0.9f, 0.85f, 0.25f, 0.85f);
			}
			if (text.Contains("matvey"))
			{
				return ReksikVfx.ChillColor;
			}
			if (text.Contains("matousovsky") || text.Contains("matus"))
			{
				return ReksikVfx.CurseColor;
			}
			if (text.Contains("roman"))
			{
				return new Color(0.75f, 0.75f, 0.75f, 0.85f);
			}
			if (text.Contains("tukson"))
			{
				return ReksikVfx.YangColor;
			}
			if (text.Contains("nesen"))
			{
				return ReksikVfx.YinColor;
			}
			if (text.Contains("rostislav"))
			{
				return ReksikVfx.RockColor;
			}
			if (text.Contains("fedr"))
			{
				return ReksikVfx.TechColor;
			}
			if (text.Contains("maksim") || text.Contains("maxim"))
			{
				return new Color(0.75f, 1f, 0.25f, 0.85f);
			}
			if (text.Contains("sosnovka") || text.Contains("artem"))
			{
				return ReksikVfx.WoodColor;
			}
			if (text.Contains("tanker"))
			{
				return new Color(0.65f, 0.65f, 0.7f, 0.85f);
			}
			if (text.Contains("agent"))
			{
				return new Color(0.95f, 0.25f, 0.25f, 0.85f);
			}
			if (text.Contains("subject"))
			{
				return ReksikVfx.MindColor;
			}
			return new Color(0.55f, 0.55f, 0.55f, 0.85f);
		}
	}
	internal static class ReksikSpriteCache
	{
		private static Sprite circleSprite;

		private static Sprite ringSprite;

		private static Sprite squareSprite;

		private static bool built;

		public static Sprite Circle
		{
			get
			{
				EnsureBuilt();
				return circleSprite;
			}
		}

		public static Sprite Ring
		{
			get
			{
				EnsureBuilt();
				return ringSprite;
			}
		}

		public static Sprite Square
		{
			get
			{
				EnsureBuilt();
				return squareSprite;
			}
		}

		private static void EnsureBuilt()
		{
			if (!built)
			{
				built = true;
				circleSprite = CreateCircleSprite(96, 0f);
				ringSprite = CreateCircleSprite(96, 0.78f);
				squareSprite = CreateSquareSprite(96);
			}
		}

		private static Sprite CreateSquareSprite(int size)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0070: 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)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			Color32[] array = (Color32[])(object)new Color32[size * size];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			}
			val.SetPixels32(array);
			val.Apply(false, false);
			return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 96f);
		}

		private static Sprite CreateCircleSprite(int size, float ringCutoff)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			int num = size / 2;
			int num2 = size / 2;
			float num3 = (float)size * 0.48f;
			float num4 = num3 * num3;
			float num5 = Mathf.Clamp01(ringCutoff) * num3;
			float num6 = num5 * num5;
			Color32[] array = (Color32[])(object)new Color32[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num7 = (float)(j - num) + 0.5f;
					float num8 = (float)(i - num2) + 0.5f;
					float num9 = num7 * num7 + num8 * num8;
					bool flag = num9 <= num4;
					bool flag2 = num9 <= num6;
					byte b = 0;
					if (flag && (!flag2 || ringCutoff <= 0f))
					{
						float num10 = Mathf.Sqrt(num9);
						float num11 = Mathf.Clamp01((num3 - num10) / 2f);
						b = (byte)Mathf.Clamp(num11 * 255f, 0f, 255f);
						b = ((!(ringCutoff <= 0f)) ? ((byte)Mathf.Clamp(120f + num11 * 90f, 0f, 255f)) : ((byte)Mathf.Clamp(180f + num11 * 75f, 0f, 255f)));
					}
					array[i * size + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b);
				}
			}
			val.SetPixels32(array);
			val.Apply(false, false);
			return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 96f);
		}
	}
	internal static class ReksikVfx
	{
		public static readonly Color BossColor = new Color(0.7f, 0.15f, 1f, 0.65f);

		public static readonly Color ExplosionColor = new Color(1f, 0.55f, 0.15f, 0.7f);

		public static readonly Color TechColor = new Color(0.2f, 0.95f, 1f, 0.7f);

		public static readonly Color ChillColor = new Color(0.55f, 0.85f, 1f, 0.65f);

		public static readonly Color CurseColor = new Color(0.55f, 0.1f, 0.1f, 0.7f);

		public static readonly Color WoodColor = new Color(0.75f, 0.55f, 0.25f, 0.7f);

		public static readonly Color YinColor = new Color(0.15f, 0.15f, 0.2f, 0.8f);

		public static readonly Color YangColor = new Color(0.95f, 0.95f, 0.95f, 0.8f);

		public static readonly Color MindColor = new Color(0.95f, 0.2f, 0.95f, 0.7f);

		public static readonly Color RockColor = new Color(0.95f, 0.2f, 0.25f, 0.75f);

		public static readonly Color GrowthColor = new Color(0.35f, 0.95f, 0.55f, 0.7f);

		private const string RootName = "ReksikVfxRoot";

		private static bool contextValid;

		private static int contextLayer;

		private static int contextSortingLayerID;

		public static void SetContextFrom(Transform? reference)
		{
			if ((Object)(object)reference == (Object)null)
			{
				return;
			}
			try
			{
				contextLayer = ((Component)reference).gameObject.layer;
				contextSortingLayerID = TryGetSortingLayerID(reference);
				contextValid = true;
			}
			catch
			{
			}
		}

		private static int TryGetSortingLayerID(Transform reference)
		{
			try
			{
				Renderer componentInChildren = ((Component)reference).GetComponentInChildren<Renderer>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					return componentInChildren.sortingLayerID;
				}
			}
			catch
			{
			}
			return 0;
		}

		internal static void SetLayerRecursive(GameObject go, int layer)
		{
			if ((Object)(object)go == (Object)null)
			{
				return;
			}
			go.layer = layer;
			Transform transform = go.transform;
			for (int i = 0; i < transform.childCount; i++)
			{
				Transform child = transform.GetChild(i);
				if ((Object)(object)child != (Object)null)
				{
					SetLayerRecursive(((Component)child).gameObject, layer);
				}
			}
		}

		private static void ApplyContext(GameObject go, Transform? reference = null)
		{
			if ((Object)(object)go == (Object)null)
			{
				return;
			}
			if ((Object)(object)reference != (Object)null)
			{
				SetContextFrom(reference);
			}
			if (!contextValid)
			{
				return;
			}
			try
			{
				SetLayerRecursive(go, contextLayer);
				Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if (!((Object)(object)componentsInChildren[i] == (Object)null))
					{
						componentsInChildren[i].sortingLayerID = contextSortingLayerID;
					}
				}
			}
			catch
			{
			}
		}

		public static Transform GetOrCreateRoot(Transform parent)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			SetContextFrom(parent);
			Transform val = parent.Find("ReksikVfxRoot");
			if ((Object)(object)val != (Object)null)
			{
				if (contextValid)
				{
					try
					{
						SetLayerRecursive(((Component)val).gameObject, contextLayer);
					}
					catch
					{
					}
				}
				return val;
			}
			GameObject val2 = new GameObject("ReksikVfxRoot");
			val2.transform.SetParent(parent, false);
			val2.transform.localPosition = Vector3.zero;
			ApplyContext(val2, parent);
			return val2.transform;
		}

		public static void PlayShockwave(Vector2 worldPos, float radius, float duration, Color color, Transform? context = null)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0013: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = new GameObject("Shockwave");
				val.transform.position = new Vector3(worldPos.x, worldPos.y, 0f);
				ApplyContext(val, context);
				SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
				val2.sprite = ReksikSpriteCache.Ring;
				val2.color = color;
				((Renderer)val2).sortingOrder = 1000;
				if (contextValid)
				{
					((Renderer)val2).sortingLayerID = contextSortingLayerID;
				}
				TimedSpriteVfxMono timedSpriteVfxMono = val.AddComponent<TimedSpriteVfxMono>();
				float startScale = Mathf.Max(0.1f, radius * 0.25f);
				float endScale = Mathf.Max(0.2f, radius * 2f);
				Color startColor = default(Color);
				((Color)(ref startColor))..ctor(color.r, color.g, color.b, color.a);
				Color endColor = default(Color);
				((Color)(ref endColor))..ctor(color.r, color.g, color.b, 0f);
				timedSpriteVfxMono.Init(val2, duration, startScale, endScale, startColor, endColor);
			}
			catch
			{
			}
		}

		public static void PlayPulse(Vector2 worldPos, float radius, float duration, Color color, Transform? context = null)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0013: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = new GameObject("Pulse");
				val.transform.position = new Vector3(worldPos.x, worldPos.y, 0f);
				ApplyContext(val, context);
				SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
				val2.sprite = ReksikSpriteCache.Circle;
				val2.color = color;
				((Renderer)val2).sortingOrder = 999;
				if (contextValid)
				{
					((Renderer)val2).sortingLayerID = contextSortingLayerID;
				}
				TimedSpriteVfxMono timedSpriteVfxMono = val.AddComponent<TimedSpriteVfxMono>();
				float startScale = Mathf.Max(0.08f, radius * 0.2f);
				float endScale = Mathf.Max(0.2f, radius * 1.2f);
				Color startColor = default(Color);
				((Color)(ref startColor))..ctor(color.r, color.g, color.b, color.a * 0.55f);
				Color endColor = default(Color);
				((Color)(ref endColor))..ctor(color.r, color.g, color.b, 0f);
				timedSpriteVfxMono.Init(val2, duration, startScale, endScale, startColor, endColor);
			}
			catch
			{
			}
		}

		public static void PlayMuzzleFlash(Transform? origin, float size, Color color)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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)
			if ((Object)(object)origin == (Object)null)
			{
				return;
			}
			try
			{
				Vector3 position = origin.position + origin.right * 0.35f;
				GameObject val = new GameObject("MuzzleFlash");
				val.transform.position = position;
				ApplyContext(val, origin);
				SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
				val2.sprite = ReksikSpriteCache.Circle;
				val2.color = color;
				((Renderer)val2).sortingOrder = 1100;
				if (contextValid)
				{
					((Renderer)val2).sortingLayerID = contextSortingLayerID;
				}
				TimedSpriteVfxMono timedSpriteVfxMono = val.AddComponent<TimedSpriteVfxMono>();
				Color startColor = default(Color);
				((Color)(ref startColor))..ctor(color.r, color.g, color.b, color.a);
				Color endColor = default(Color);
				((Color)(ref endColor))..ctor(color.r, color.g, color.b, 0f);
				timedSpriteVfxMono.Init(val2, 0.12f, size * 0.35f, size * 1.15f, startColor, endColor);
			}
			catch
			{
			}
		}

		public static void AttachSimpleTrail(GameObject projectile, Color color, float time = 0.25f, float startWidth = 0.2f, float endWidth = 0.02f)
		{
			//IL_00d5: 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)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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: Expected O, but got Unknown
			if ((Object)(object)projectile == (Object)null)
			{
				return;
			}
			try
			{
				ApplyContext(projectile, projectile.transform);
				TrailRenderer val = projectile.GetComponent<TrailRenderer>();
				if ((Object)(object)val == (Object)null)
				{
					val = projectile.AddComponent<TrailRenderer>();
				}
				val.time = Mathf.Max(0.05f, time);
				val.startWidth = startWidth;
				val.endWidth = endWidth;
				val.minVertexDistance = 0.05f;
				((Renderer)val).sortingOrder = 1500;
				if (contextValid)
				{
					((Renderer)val).sortingLayerID = contextSortingLayerID;
				}
				Shader val2 = Shader.Find("Sprites/Default");
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = Shader.Find("Unlit/Color");
				}
				if ((Object)(object)val2 != (Object)null)
				{
					((Renderer)val).material = new Material(val2);
				}
				Color val3 = default(Color);
				((Color)(ref val3))..ctor(color.r, color.g, color.b, Mathf.Clamp01(color.a));
				Color val4 = default(Color);
				((Color)(ref val4))..ctor(color.r, color.g, color.b, 0f);
				Gradient val5 = new Gradient();
				val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(val3, 0f),
					new GradientColorKey(val3, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(val3.a, 0f),
					new GradientAlphaKey(0f, 1f)
				});
				val.colorGradient = val5;
			}
			catch
			{
			}
		}

		public static StatusTextVfxMono GetOrCreateStatusText(Transform parent, string key, Vector3 offset, string initialText, Color color)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Transform orCreateRoot = GetOrCreateRoot(parent);
			Transform val = orCreateRoot.Find(key);
			if ((Object)(object)val != (Object)null)
			{
				StatusTextVfxMono component = ((Component)val).GetComponent<StatusTextVfxMono>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			GameObject val2 = new GameObject(key);
			val2.transform.SetParent(orCreateRoot, false);
			ApplyContext(val2, parent);
			StatusTextVfxMono statusTextVfxMono = val2.AddComponent<StatusTextVfxMono>();
			statusTextVfxMono.Init(parent, initialText, color, offset);
			return statusTextVfxMono;
		}

		public static void RemoveStatus(Transform parent, string key)
		{
			Transform orCreateRoot = GetOrCreateRoot(parent);
			Transform val = orCreateRoot.Find(key);
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		public static SpriteRenderer GetOrCreateAura(Transform parent, string key, float radius, Color color, int sortingOrder = 10)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			Transform orCreateRoot = GetOrCreateRoot(parent);
			Transform val = orCreateRoot.Find(key);
			if ((Object)(object)val != (Object)null)
			{
				SpriteRenderer component = ((Component)val).GetComponent<SpriteRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.color = color;
					val.localScale = new Vector3(radius, radius, 1f);
					return component;
				}
			}
			GameObject val2 = new GameObject(key);
			val2.transform.SetParent(orCreateRoot, false);
			val2.transform.localPosition = Vector3.zero;
			ApplyContext(val2, parent);
			SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>();
			val3.sprite = ReksikSpriteCache.Circle;
			val3.color = color;
			((Renderer)val3).sortingOrder = sortingOrder;
			if (contextValid)
			{
				((Renderer)val3).sortingLayerID = contextSortingLayerID;
			}
			val2.transform.localScale = new Vector3(radius, radius, 1f);
			return val3;
		}

		public static void SetAura(Transform parent, string key, bool enabled, float radius, Color color)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled)
			{
				RemoveStatus(parent, key);
			}
			else
			{
				GetOrCreateAura(parent, key, radius, color);
			}
		}

		public static void SafeLog(string msg)
		{
			try
			{
				Debug.Log((object)("[SD][VFX] " + msg));
			}
			catch
			{
			}
		}
	}
	public class StatusTextVfxMono : MonoBehaviour
	{
		private Transform target = null;

		private TextMesh textMesh = null;

		private Vector3 offset;

		private float endTime;

		private bool timed;

		public void Init(Transform target, string text, Color color, Vector3 offset)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			this.target = target;
			this.offset = offset;
			textMesh = ((Component)this).gameObject.GetComponent<TextMesh>();
			if ((Object)(object)textMesh == (Object)null)
			{
				textMesh = ((Component)this).gameObject.AddComponent<TextMesh>();
			}
			textMesh.text = text;
			textMesh.color = color;
			textMesh.characterSize = 0.12f;
			textMesh.fontSize = 80;
			textMesh.anchor = (TextAnchor)4;
			textMesh.alignment = (TextAlignment)1;
			Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
			if ((Object)(object)builtinResource != (Object)null)
			{
				textMesh.font = builtinResource;
			}
			try
			{
				((Component)this).gameObject.layer = ((Component)target).gameObject.layer;
				Renderer componentInChildren = ((Component)target).GetComponentInChildren<Renderer>();
				MeshRenderer component = ((Component)this).GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					if ((Object)(object)componentInChildren != (Object)null)
					{
						((Renderer)component).sortingLayerID = componentInChildren.sortingLayerID;
					}
					((Renderer)component).sortingOrder = 2000;
				}
			}
			catch
			{
			}
			timed = false;
		}

		public void SetText(string text)
		{
			if ((Object)(object)textMesh != (Object)null)
			{
				textMesh.text = text;
			}
		}

		public void SetColor(Color color)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)textMesh != (Object)null)
			{
				textMesh.color = color;
			}
		}

		public void SetTimed(float seconds)
		{
			timed = true;
			endTime = Time.time + Mathf.Max(0.05f, seconds);
		}

		private void LateUpdate()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			((Component)this).transform.position = target.position + offset;
			if ((Object)(object)Camera.main != (Object)null)
			{
				((Component)this).transform.forward = ((Component)Camera.main).transform.forward;
			}
			try
			{
				((Component)this).gameObject.layer = ((Component)target).gameObject.layer;
			}
			catch
			{
			}
			if (timed && Time.time >= endTime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class TimedSpriteVfxMono : MonoBehaviour
	{
		private SpriteRenderer sr = null;

		private float startTime;

		private float duration;

		private float startScale;

		private float endScale;

		private Color startColor;

		private Color endColor;

		public void Init(SpriteRenderer renderer, float duration, float startScale, float endScale, Color startColor, Color endColor)
		{
			//IL_0029: 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_0031: 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)
			sr = renderer;
			this.duration = Mathf.Max(0.02f, duration);
			this.startScale = startScale;
			this.endScale = endScale;
			this.startColor = startColor;
			this.endColor = endColor;
			startTime = Time.time;
		}

		private void Update()
		{
			//IL_0053: 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_007c: 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)
			float num = (Time.time - startTime) / duration;
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			float num2 = Mathf.Lerp(startScale, endScale, num);
			((Component)this).transform.localScale = new Vector3(num2, num2, 1f);
			if ((Object)(object)sr != (Object)null)
			{
				sr.color = Color.Lerp(startColor, endColor, num);
			}
		}
	}
}
namespace ReksikCards.Monos
{
	public class AgentMarkedMono : MonoBehaviour
	{
		private Player target = null;

		private Block block = null;

		private HealthHandler healthHandler = null;

		private float endTime;

		private bool active;

		private float appliedBlockCdMultiplier = 1f;

		private float appliedRegenPenalty;

		private const string AuraKey = "AgentMarkedAura";

		public static void ApplyOrRefresh(Player p, float duration, float blockCdMultiplier, float regenPenalty)
		{
			if (!((Object)(object)p == (Object)null) && !((Object)(object)p.data == (Object)null))
			{
				AgentMarkedMono agentMarkedMono = ((Component)p).gameObject.GetComponent<AgentMarkedMono>();
				if ((Object)(object)agentMarkedMono == (Object)null)
				{
					agentMarkedMono = ((Component)p).gameObject.AddComponent<AgentMarkedMono>();
				}
				agentMarkedMono.Apply(duration, blockCdMultiplier, regenPenalty);
			}
		}

		private void Start()
		{
			target = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			block = target.data.block;
			healthHandler = target.data.healthHandler;
		}

		private void Apply(float duration, float blockCdMultiplier, float regenPenalty)
		{
			endTime = Mathf.Max(endTime, Time.time + Mathf.Max(0.05f, duration));
			if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null || (Object)(object)block == (Object)null || (Object)(object)healthHandler == (Object)null)
			{
				appliedBlockCdMultiplier = Mathf.Max(1f, blockCdMultiplier);
				appliedRegenPenalty = Mathf.Max(0f, regenPenalty);
				return;
			}
			if (!active)
			{
				active = true;
				appliedBlockCdMultiplier = 1f;
				appliedRegenPenalty = 0f;
			}
			RemoveApplied();
			appliedBlockCdMultiplier = Mathf.Max(1f, blockCdMultiplier);
			appliedRegenPenalty = Mathf.Max(0f, regenPenalty);
			ApplyNow();
		}

		private void Update()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)target == (Object)null) && !((Object)(object)target.data == (Object)null))
			{
				if (!active && (appliedBlockCdMultiplier > 1f || appliedRegenPenalty > 0f) && (Object)(object)block != (Object)null && (Object)(object)healthHandler != (Object)null)
				{
					active = true;
					ApplyNow();
				}
				if (active)
				{
					ReksikVfx.SetAura(((Component)target).transform, "AgentMarkedAura", enabled: true, 1.35f, new Color(0.9f, 0.2f, 0.85f, 0.16f));
				}
				if (active && Time.time >= endTime)
				{
					End();
					Object.Destroy((Object)(object)this);
				}
			}
		}

		private void OnDestroy()
		{
			End();
		}

		private void ApplyNow()
		{
			if ((Object)(object)block != (Object)null)
			{
				Block obj = block;
				obj.cdMultiplier *= appliedBlockCdMultiplier;
			}
			if ((Object)(object)healthHandler != (Object)null)
			{
				HealthHandler obj2 = healthHandler;
				obj2.regeneration -= appliedRegenPenalty;
			}
		}

		private void RemoveApplied()
		{
			if (active)
			{
				if ((Object)(object)block != (Object)null && appliedBlockCdMultiplier != 0f)
				{
					Block obj = block;
					obj.cdMultiplier /= appliedBlockCdMultiplier;
				}
				if ((Object)(object)healthHandler != (Object)null)
				{
					HealthHandler obj2 = healthHandler;
					obj2.regeneration += appliedRegenPenalty;
				}
			}
		}

		private void End()
		{
			if (active)
			{
				RemoveApplied();
				active = false;
				appliedBlockCdMultiplier = 1f;
				appliedRegenPenalty = 0f;
				if ((Object)(object)target != (Object)null)
				{
					ReksikVfx.RemoveStatus(((Component)target).transform, "AgentMarkedAura");
				}
			}
		}
	}
	public class AgentOperativeMono : MonoBehaviour
	{
		private Player player = null;

		private Block block = null;

		private int level = 1;

		private float lastExtractTime;

		private float Cooldown => Mathf.Max(0.4f, 1.1f * Mathf.Pow(0.9f, (float)(level - 1)));

		private float Range => 10f + 1.2f * (float)(level - 1);

		private float BaseExtractDamage => 35f + 12f * (float)(level - 1);

		private float HealMultiplier => 1f + 0.15f * (float)(level - 1);

		private float DebuffDuration => 2.8f + 0.35f * (float)(level - 1);

		private float FearDuration => 2f + 0.25f * (float)(level - 1);

		private float MarkBlockCdMultiplier => 1.25f + 0.08f * (float)(level - 1);

		private float RegenPenalty => 20f + 10f * (float)(level - 1);

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			block = player.data.block;
			if ((Object)(object)block != (Object)null)
			{
				Block obj = block;
				obj.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}

		public void SetLevel(int newLevel)
		{
			level = Mathf.Max(1, newLevel);
		}

		private void OnDestroy()
		{
			try
			{
				if ((Object)(object)block != (Object)null)
				{
					Block obj = block;
					obj.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
				}
			}
			catch
			{
			}
		}

		private void OnBlock(BlockTriggerType triggerType)
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead || Time.time - lastExtractTime < Cooldown)
			{
				return;
			}
			lastExtractTime = Time.time;
			Player closestEnemy = ReksikUtils.GetClosestEnemy(player, Range);
			if (!((Object)(object)closestEnemy == (Object)null) && !((Object)(object)closestEnemy.data == (Object)null) && !closestEnemy.data.dead)
			{
				bool flag = (Object)(object)((Component)closestEnemy).gameObject.GetComponent<DaniilTankMono>() != (Object)null;
				float num = BaseExtractDamage * (flag ? 1.45f : 1f);
				float amount = num * HealMultiplier * (flag ? 1.1f : 1f);
				Damagable component = ((Component)closestEnemy).GetComponent<Damagable>();
				if ((Object)(object)component != (Object)null)
				{
					Vector3 val = ((Component)closestEnemy).transform.position - ((Component)player).transform.position;
					Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref val)).normalized);
					component.TakeDamage(new Vector2(num, num), val2, (GameObject)null, player, true, false);
				}
				ReksikUtils.Heal(player, amount);
				float duration = DebuffDuration + (flag ? 0.75f : 0f);
				AgentMarkedMono.ApplyOrRefresh(closestEnemy, duration, MarkBlockCdMultiplier + (flag ? 0.15f : 0f), RegenPenalty + (flag ? 15f : 0f));
				float moveMul = (flag ? 0.55f : 0.65f);
				FearDebuffMono.ApplyOrRefresh(closestEnemy, FearDuration + (flag ? 0.5f : 0f), moveMul, 0.9f, 1.15f);
				Color color = (flag ? new Color(0.95f, 0.25f, 0.25f, 0.55f) : new Color(0.8f, 0.25f, 0.95f, 0.55f));
				ReksikVfx.PlayPulse(Vector2.op_Implicit(((Component)player).transform.position), 1.05f, 0.12f, color);
				ReksikVfx.PlayPulse(Vector2.op_Implicit(((Component)closestEnemy).transform.position), 1.1f, 0.14f, color);
				ReksikVfx.PlayShockwave(Vector2.op_Implicit(((Component)closestEnemy).transform.position), 6f, 0.16f, color);
			}
		}
	}
	public class CarpenterPlankMono : MonoBehaviour
	{
		private Player player = null;

		private Gun gun = null;

		private Block block = null;

		private CharacterStatModifiers stats = null;

		private int level = 1;

		private int plankShotsRemaining;

		private bool armorActive;

		private float armorEndTime;

		private float lastBlockTime;

		private int basePlankShotsPerBlock = 1;

		private float basePlankDamageMul = 1.35f;

		private float basePlankSizeMul = 1.55f;

		private float basePlankSpeedMul = 0.95f;

		private float baseArmorDuration = 4f;

		private float baseArmorRefundFrac = 0.35f;

		private float baseBlockCooldown = 1.25f;

		private int PlankShotsPerBlock => basePlankShotsPerBlock + (level - 1);

		private float PlankDamageMul => basePlankDamageMul * (1f + 0.2f * (float)(level - 1));

		private float PlankSizeMul => basePlankSizeMul * (1f + 0.08f * (float)(level - 1));

		private float PlankSpeedMul => basePlankSpeedMul * (1f + 0.03f * (float)(level - 1));

		private float ArmorDuration => baseArmorDuration + 0.75f * (float)(level - 1);

		private float ArmorRefundFrac => Mathf.Clamp01(baseArmorRefundFrac + 0.06f * (float)(level - 1));

		private float BlockCooldown => Mathf.Max(0.35f, baseBlockCooldown * Mathf.Pow(0.9f, (float)(level - 1)));

		public void SetLevel(int newLevel)
		{
			level = Mathf.Max(1, newLevel);
		}

		public void Configure(int plankShotsPerBlock, float plankDamageMultiplier, float plankSizeMultiplier, float plankSpeedMultiplier, float armorDuration, float armorRefundFraction, float blockInternalCooldown)
		{
			basePlankShotsPerBlock = Mathf.Max(1, plankShotsPerBlock);
			basePlankDamageMul = Mathf.Max(0.05f, plankDamageMultiplier);
			basePlankSizeMul = Mathf.Max(0.05f, plankSizeMultiplier);
			basePlankSpeedMul = Mathf.Max(0.05f, plankSpeedMultiplier);
			baseArmorDuration = Mathf.Max(0.1f, armorDuration);
			baseArmorRefundFrac = Mathf.Clamp01(armorRefundFraction);
			baseBlockCooldown = Mathf.Max(0.05f, blockInternalCooldown);
		}

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			gun = player.data.weaponHandler.gun;
			block = player.data.block;
			stats = player.data.stats;
			if ((Object)(object)gun != (Object)null)
			{
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectile));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
			if ((Object)(object)stats != (Object)null)
			{
				CharacterStatModifiers obj3 = stats;
				obj3.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(obj3.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
			}
			plankShotsRemaining = 0;
			armorActive = false;
		}

		private void OnDestroy()
		{
			if ((Object)(object)gun != (Object)null)
			{
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectile));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
			if ((Object)(object)stats != (Object)null)
			{
				CharacterStatModifiers obj3 = stats;
				obj3.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Remove(obj3.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
			}
			if ((Object)(object)player != (Object)null)
			{
				ReksikVfx.RemoveStatus(((Component)player).transform, "WoodArmorAura");
				ReksikVfx.RemoveStatus(((Component)player).transform, "PlankShotsText");
			}
		}

		private void Update()
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (armorActive && Time.time >= armorEndTime)
			{
				armorActive = false;
			}
			if ((Object)(object)player != (Object)null)
			{
				ReksikVfx.SetAura(((Component)player).transform, "WoodArmorAura", armorActive, 1.3f + 0.03f * (float)(level - 1), new Color(ReksikVfx.WoodColor.r, ReksikVfx.WoodColor.g, ReksikVfx.WoodColor.b, 0.18f + 0.01f * (float)(level - 1)));
			}
		}

		private void OnDamaged(Vector2 damage, bool selfDamage)
		{
			if (armorActive && !((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead && !selfDamage)
			{
				float num = ((Vector2)(ref damage)).magnitude * ArmorRefundFrac;
				if (num > 0f)
				{
					ReksikUtils.Heal(player, num);
				}
			}
		}

		private void OnBlock(BlockTriggerType triggerType)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead && !(Time.time - lastBlockTime < BlockCooldown))
			{
				lastBlockTime = Time.time;
				plankShotsRemaining += PlankShotsPerBlock;
				armorActive = true;
				armorEndTime = Time.time + ArmorDuration;
				Vector2 worldPos = Vector2.op_Implicit(((Component)player).transform.position);
				ReksikVfx.PlayShockwave(worldPos, 8f + 0.6f * (float)(level - 1), 0.2f, new Color(ReksikVfx.WoodColor.r, ReksikVfx.WoodColor.g, ReksikVfx.WoodColor.b, 0.55f));
				UpdatePlankVfx();
				ReksikUtils.Heal(player, player.data.maxHealth * (0.04f + 0.01f * (float)(level - 1)));
			}
		}

		private void OnShootProjectile(GameObject projectile)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			if (plankShotsRemaining <= 0 || (Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead || (Object)(object)projectile == (Object)null)
			{
				return;
			}
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			if (!((Object)(object)component == (Object)null))
			{
				component.damage *= PlankDamageMul;
				Transform transform = projectile.transform;
				transform.localScale *= PlankSizeMul;
				ReksikVfx.AttachSimpleTrail(projectile, new Color(ReksikVfx.WoodColor.r, ReksikVfx.WoodColor.g, ReksikVfx.WoodColor.b, 0.7f), 0.4f, 0.26f, 0.03f);
				if ((Object)(object)gun != (Object)null)
				{
					ReksikVfx.PlayMuzzleFlash(((Component)gun).transform, 0.75f, new Color(ReksikVfx.WoodColor.r, ReksikVfx.WoodColor.g, ReksikVfx.WoodColor.b, 0.85f));
				}
				MoveTransform component2 = projectile.GetComponent<MoveTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.velocity *= PlankSpeedMul;
				}
				plankShotsRemaining--;
				UpdatePlankVfx();
			}
		}

		private void UpdatePlankVfx()
		{
			//IL_005f: 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)
			if (!((Object)(object)player == (Object)null))
			{
				if (plankShotsRemaining <= 0)
				{
					ReksikVfx.RemoveStatus(((Component)player).transform, "PlankShotsText");
					return;
				}
				StatusTextVfxMono orCreateStatusText = ReksikVfx.GetOrCreateStatusText(((Component)player).transform, "PlankShotsText", new Vector3(0f, 2.05f, 0f), "", new Color(ReksikVfx.WoodColor.r, ReksikVfx.WoodColor.g, ReksikVfx.WoodColor.b, 0.95f));
				orCreateStatusText.SetText("PLANK " + plankShotsRemaining);
			}
		}
	}
	public class DaniilTankMono : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <FortressRoutine>d__48 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DaniilTankMono <>4__this;

			private float <oldRegen>5__1;

			private float <oldOver>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)<>4__this.healthHandler == (Object)null || (Object)(object)<>4__this.stats == (Object)null || (Object)(object)<>4__this.player == (Object)null || (Object)(object)<>4__this.player.data == (Object)null)
					{
						return false;
					}
					ReksikVfx.SetAura(((Component)<>4__this.player).transform, "DaniilFortressAura", enabled: true, 1.6f, new Color(0.2f, 0.95f, 0.35f, 0.25f));
					<oldRegen>5__1 = <>4__this.healthHandler.regeneration;
					<oldOver>5__2 = <>4__this.stats.secondsToTakeDamageOver;
					<>4__this.healthHandler.regeneration = <oldRegen>5__1 + <>4__this.FortressRegenBonus;
					<>4__this.stats.secondsToTakeDamageOver = Mathf.Max(<oldOver>5__2, 5f + 0.4f * (float)(<>4__this.level - 1));
					ReksikUtils.Heal(<>4__this.player, <>4__this.player.data.maxHealth * <>4__this.FortressHealFraction);
					<>2__current = (object)new WaitForSeconds(<>4__this.FortressDuration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ReksikVfx.RemoveStatus(((Component)<>4__this.player).transform, "DaniilFortressAura");
					if ((Object)(object)<>4__this.healthHandler != (Object)null)
					{
						<>4__this.healthHandler.regeneration = <oldRegen>5__1;
					}
					if ((Object)(object)<>4__this.stats != (Object)null)
					{
						<>4__this.stats.secondsToTakeDamageOver = <oldOver>5__2;
					}
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public DaniilTankMono <>4__this;

			private float <oldOver>5__1;

			private float <oldMove>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)<>4__this.stats == (Object)null || (Object)(object)<>4__this.player == (Object)null || (Object)(object)<>4__this.player.data == (Object)null)
					{
						return false;
					}
					ReksikVfx.SetAura(((Component)<>4__this.player).transform, "DaniilSecondWindAura", enabled: true, 1.45f, new Color(0.2f, 0.95f, 0.35f, 0.3f));
					<oldOver>5__1 = <>4__this.stats.secondsToTakeDamageOver;
					<oldMove>5__2 = <>4__this.stats.movementSpeed;
					<>4__this.stats.secondsToTakeDamageOver = Mathf.Max(<oldOver>5__1, 4f + 0.5f * (float)(<>4__this.level - 1));
					<>4__this.stats.movementSpeed = <oldMove>5__2 * Mathf.Clamp(0.85f + 0.03f * (float)(<>4__this.level - 1), 0.85f, 1f);
					<>2__current = (object)new WaitForSeconds(<>4__this.SecondWindDuration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ReksikVfx.RemoveStatus(((Component)<>4__this.player).transform, "DaniilSecondWindAura");
					<>4__this.stats.secondsToTakeDamageOver = <oldOver>5__1;
					<>4__this.stats.movementSpeed = <oldMove>5__2;
					return false;
				}
			}

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

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

		private Player player = null;

		private HealthHandler healthHandler = null;

		private CharacterStatModifiers stats = null;

		private Block block = null;

		private int level = 1;

		private bool initialized;

		private bool usedSecondWind;

		private float baseMoveSpeed;

		private float baseSecondsToTakeDamageOver;

		private float appliedPassiveRegenBonus;

		private const float RegenNerfMul = 0.55f;

		private const float BasePassiveRegenBonus = 35f;

		private const float PassiveRegenPerLevel = 20f;

		private const float BaseDamageRefundFraction = 0.55f;

		private const float DamageRefundPerLevel = 0.07f;

		private const float SecondWindThreshold = 0.2f;

		private const float BaseSecondWindRestoreFraction = 0.65f;

		private const float SecondWindRestorePerLevel = 0.06f;

		private const float BaseSecondWindDuration = 4f;

		private const float SecondWindDurationPerLevel = 0.6f;

		private const float BaseFortressDuration = 3.25f;

		private const float FortressDurationPerLevel = 0.5f;

		private const float BaseFortressRegenBonus = 40f;

		private const float FortressRegenPerLevel = 30f;

		private const float BaseFortressHealFraction = 0.12f;

		private const float FortressHealPerLevel = 0.05f;

		private float PassiveRegenBonus => (35f + 20f * (float)(level - 1)) * 0.55f;

		private float DamageRefundFraction
		{
			get
			{
				float num = 0.55f + 0.07f * (float)(level - 1);
				return Mathf.Clamp(num, 0.1f, 0.92f);
			}
		}

		private float SecondWindRestoreFraction
		{
			get
			{
				float num = 0.65f + 0.06f * (float)(level - 1);
				return Mathf.Clamp(num, 0.25f, 0.95f);
			}
		}

		private float SecondWindDuration => 4f + 0.6f * (float)(level - 1);

		private float FortressDuration => 3.25f + 0.5f * (float)(level - 1);

		private float FortressRegenBonus => (40f + 30f * (float)(level - 1)) * 0.55f;

		private float FortressHealFraction
		{
			get
			{
				float num = 0.12f + 0.05f * (float)(level - 1);
				return Mathf.Clamp(num, 0.02f, 0.4f);
			}
		}

		public void SetLevel(int newLevel)
		{
			level = Mathf.Max(1, newLevel);
			if (initialized)
			{
				ApplyPassiveRegen();
			}
		}

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			healthHandler = player.data.healthHandler;
			stats = player.data.stats;
			block = player.data.block;
			baseMoveSpeed = (((Object)(object)stats != (Object)null) ? stats.movementSpeed : 1f);
			baseSecondsToTakeDamageOver = (((Object)(object)stats != (Object)null) ? stats.secondsToTakeDamageOver : 0f);
			initialized = true;
			ApplyPassiveRegen();
			usedSecondWind = false;
			if ((Object)(object)stats != (Object)null)
			{
				CharacterStatModifiers obj = stats;
				obj.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(obj.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}

		private void ApplyPassiveRegen()
		{
			if (!((Object)(object)healthHandler == (Object)null))
			{
				float passiveRegenBonus = PassiveRegenBonus;
				float num = passiveRegenBonus - appliedPassiveRegenBonus;
				HealthHandler obj = healthHandler;
				obj.regeneration += num;
				appliedPassiveRegenBonus = passiveRegenBonus;
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)stats != (Object)null)
			{
				CharacterStatModifiers obj = stats;
				obj.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Remove(obj.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
			if ((Object)(object)healthHandler != (Object)null)
			{
				HealthHandler obj3 = healthHandler;
				obj3.regeneration -= appliedPassiveRegenBonus;
				appliedPassiveRegenBonus = 0f;
			}
			if ((Object)(object)stats != (Object)null)
			{
				stats.secondsToTakeDamageOver = baseSecondsToTakeDamageOver;
				stats.movementSpeed = baseMoveSpeed;
			}
			if ((Object)(object)player != (Object)null)
			{
				ReksikVfx.RemoveStatus(((Component)player).transform, "DaniilSecondWindAura");
				ReksikVfx.RemoveStatus(((Component)player).transform, "DaniilFortressAura");
			}
		}

		private void Update()
		{
			//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)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				return;
			}
			if (player.data.dead)
			{
				usedSecondWind = false;
			}
			else if (!usedSecondWind)
			{
				float num = ReksikUtils.HealthFraction(player);
				if (num <= 0.2f)
				{
					usedSecondWind = true;
					Vector2 worldPos = Vector2.op_Implicit(((Component)player).transform.position);
					ReksikVfx.PlayShockwave(worldPos, 7f + 0.3f * (float)(level - 1), 0.22f, new Color(0.2f, 0.95f, 0.35f, 0.55f));
					ReksikVfx.PlayPulse(worldPos, 1.25f, 0.2f, new Color(1f, 1f, 1f, 0.55f));
					player.data.health = Mathf.Max(player.data.health, player.data.maxHealth * SecondWindRestoreFraction);
					((MonoBehaviour)this).StopAllCoroutines();
					((MonoBehaviour)this).StartCoroutine(SecondWindRoutine());
				}
			}
		}

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

		private void OnDamaged(Vector2 damage, bool selfDamage)
		{
			if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead && !selfDamage)
			{
				float num = ((Vector2)(ref damage)).magnitude * DamageRefundFraction;
				if (!(num <= 0f))
				{
					ReksikUtils.Heal(player, num);
				}
			}
		}

		private void OnBlock(BlockTriggerType triggerType)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead)
			{
				Vector2 worldPos = Vector2.op_Implicit(((Component)player).transform.position);
				ReksikVfx.PlayShockwave(worldPos, 8f + 0.35f * (float)(level - 1), 0.2f, new Color(0.2f, 0.95f, 0.35f, 0.45f));
				((MonoBehaviour)this).StopCoroutine("FortressRoutine");
				((MonoBehaviour)this).StartCoroutine(FortressRoutine());
			}
		}

		[IteratorStateMachine(typeof(<FortressRoutine>d__48))]
		private IEnumerator FortressRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FortressRoutine>d__48(0)
			{
				<>4__this = this
			};
		}
	}
	public class DmitriyArmorBrokerMono : MonoBehaviour
	{
		private Player player = null;

		private Block block = null;

		private CharacterStatModifiers stats = null;

		private HealthHandler healthHandler = null;

		private int level = 1;

		private float plates;

		private float lastBlockTime;

		private bool reinforceActive;

		private float reinforceEndTime;

		private float reinforcePrevSmoothing;

		private float reinforceAppliedRegen;

		private bool HasDaniil
		{
			get
			{
				if ((Object)(object)player == (Object)null)
				{
					return false;
				}
				return (Object)(object)((Component)player).gameObject.GetComponent<DaniilTankMono>() != (Object)null;
			}
		}

		private float PlateAbsorb => Mathf.Clamp(0.45f + 0.06f * (float)(level - 1), 0.45f, 0.8f);

		private float PlateCap => 300f + 220f * (float)(level - 1);

		private float BlockCooldown => Mathf.Max(0.45f, 1.15f * Mathf.Pow(0.92f, (float)(level - 1)));

		private float HealFactor => 1.15f + 0.25f * (float)(level - 1);

		private float ReinforceDuration => 3f + 0.45f * (float)(level - 1) + (HasDaniil ? 0.75f : 0f);

		private float ReinforceSmoothingAdd => 0.9f + 0.25f * (float)(level - 1) + (HasDaniil ? 0.35f : 0f);

		private float ReinforceRegenBonus => 25f + 18f * (float)(level - 1) + (HasDaniil ? 20f : 0f);

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			block = player.data.block;
			stats = player.data.stats;
			healthHandler = player.data.healthHandler;
			if ((Object)(object)stats != (Object)null)
			{
				CharacterStatModifiers obj = stats;
				obj.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(obj.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}

		public void SetLevel(int newLevel)
		{
			level = Mathf.Max(1, newLevel);
		}

		private void OnDestroy()
		{
			try
			{
				if ((Object)(object)stats != (Object)null)
				{
					CharacterStatModifiers obj = stats;
					obj.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Remove(obj.WasDealtDamageAction, new Action<Vector2, bool>(OnDamaged));
				}
				if ((Object)(object)block != (Object)null)
				{
					Block obj2 = block;
					obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
				}
			}
			catch
			{
			}
			EndReinforce();
			if ((Object)(object)player != (Object)null)
			{
				ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlates");
				ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlatesAura");
				ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyReinforceAura");
			}
		}

		private void Update()
		{
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				return;
			}
			if (player.data.dead)
			{
				plates = 0f;
				EndReinforce();
				ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlates");
				ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlatesAura");
			}
			else
			{
				if (reinforceActive && Time.time >= reinforceEndTime)
				{
					EndReinforce();
				}
				UpdateVfx();
			}
		}

		private void UpdateVfx()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null))
			{
				if (plates > 1f)
				{
					int num = Mathf.Clamp(Mathf.CeilToInt(plates), 0, 9999);
					StatusTextVfxMono orCreateStatusText = ReksikVfx.GetOrCreateStatusText(((Component)player).transform, "DmitriyPlates", new Vector3(0f, 2.05f, 0f), "PLATES", new Color(0.25f, 0.6f, 0.95f, 0.95f));
					orCreateStatusText.SetText($"PLATES {num}");
					float num2 = Mathf.Clamp01(plates / Mathf.Max(1f, PlateCap));
					float radius = 1.25f + 0.35f * num2;
					float num3 = 0.12f + 0.12f * num2;
					ReksikVfx.SetAura(((Component)player).transform, "DmitriyPlatesAura", enabled: true, radius, new Color(0.25f, 0.6f, 0.95f, num3));
				}
				else
				{
					ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlates");
					ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyPlatesAura");
				}
				if (reinforceActive)
				{
					Color color = (HasDaniil ? new Color(0.2f, 0.8f, 0.35f, 0.22f) : new Color(0.25f, 0.6f, 0.95f, 0.2f));
					float radius2 = 1.55f + 0.05f * (float)(level - 1);
					ReksikVfx.SetAura(((Component)player).transform, "DmitriyReinforceAura", enabled: true, radius2, color);
				}
				else
				{
					ReksikVfx.RemoveStatus(((Component)player).transform, "DmitriyReinforceAura");
				}
			}
		}

		private void OnDamaged(Vector2 damage, bool selfDamage)
		{
			if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead && !selfDamage)
			{
				float num = ((Vector2)(ref damage)).magnitude * PlateAbsorb;
				plates = Mathf.Min(PlateCap, plates + num);
			}
		}

		private void OnBlock(BlockTriggerType triggerType)
		{
			//IL_00cd: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead || Time.time - lastBlockTime < BlockCooldown)
			{
				return;
			}
			lastBlockTime = Time.time;
			if (!(plates <= 2f))
			{
				float num = plates;
				plates = 0f;
				float num2 = num * HealFactor;
				if (HasDaniil)
				{
					num2 *= 1.15f;
				}
				ReksikUtils.Heal(player, num2);
				ReksikVfx.PlayPulse(Vector2.op_Implicit(((Component)player).transform.position), 1.15f, 0.2f, new Color(0.25f, 0.6f, 0.95f, 0.55f));
				ReksikVfx.PlayShockwave(Vector2.op_Implicit(((Component)player).transform.position), 7.5f + 0.75f * (float)(level - 1), 0.2f, new Color(0.25f, 0.6f, 0.95f, 0.45f));
				BeginReinforce();
			}
		}

		private void BeginReinforce()
		{
			EndReinforce();
			if (!((Object)(object)stats == (Object)null) && !((Object)(object)healthHandler == (Object)null))
			{
				reinforceActive = true;
				reinforceEndTime = Time.time + ReinforceDuration;
				reinforcePrevSmoothing = stats.secondsToTakeDamageOver;
				stats.secondsToTakeDamageOver = Mathf.Max(reinforcePrevSmoothing, reinforcePrevSmoothing + ReinforceSmoothingAdd);
				reinforceAppliedRegen = ReinforceRegenBonus;
				HealthHandler obj = healthHandler;
				obj.regeneration += reinforceAppliedRegen;
			}
		}

		private void EndReinforce()
		{
			if (!reinforceActive)
			{
				return;
			}
			reinforceActive = false;
			try
			{
				if ((Object)(object)healthHandler != (Object)null)
				{
					HealthHandler obj = healthHandler;
					obj.regeneration -= reinforceAppliedRegen;
				}
				if ((Object)(object)stats != (Object)null)
				{
					stats.secondsToTakeDamageOver = reinforcePrevSmoothing;
				}
			}
			catch
			{
			}
			reinforceAppliedRegen = 0f;
		}
	}
	public class EgorLongshotProjectileMono : MonoBehaviour
	{
		private ProjectileHit projectileHit = null;

		private Vector2 spawnPos;

		private float baseDamage;

		private bool hasBaseDamage;

		private float damageBonusPerUnit = 0.14f;

		private float maxMultiplier = 4.25f;

		public void SetBaseDamage(float dmg)
		{
			baseDamage = Mathf.Max(0.01f, dmg);
			hasBaseDamage = true;
		}

		public void SetParams(float bonusPerUnit, float maxMul)
		{
			damageBonusPerUnit = Mathf.Max(0f, bonusPerUnit);
			maxMultiplier = Mathf.Max(1f, maxMul);
		}

		private void Start()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			spawnPos = Vector2.op_Implicit(((Component)this).transform.position);
			projectileHit = ((Component)this).GetComponent<ProjectileHit>();
			if ((Object)(object)projectileHit == (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
			else if (!hasBaseDamage)
			{
				baseDamage = Mathf.Max(0.01f, projectileHit.damage);
				hasBaseDamage = true;
			}
		}

		private void Update()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)projectileHit == (Object)null)
			{
				return;
			}
			float num = Vector2.Distance(spawnPos, Vector2.op_Implicit(((Component)this).transform.position));
			float num2 = Mathf.Clamp(1f + num * damageBonusPerUnit, 1f, maxMultiplier);
			projectileHit.damage = baseDamage * num2;
			try
			{
				TrailRenderer component = ((Component)this).GetComponent<TrailRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.startWidth = Mathf.Clamp(0.1f * num2, 0.1f, 0.75f);
				}
			}
			catch
			{
			}
		}
	}
	public class EgorSniperMono : MonoBehaviour
	{
		private Player player = null;

		private Gun gun = null;

		private Block block = null;

		private GunAmmo gunAmmo = null;

		private int level = 1;

		private Vector3 lastPos;

		private float stillTime;

		private const int AmmoCap = 1;

		private float nextAmmoEnforceTime;

		private const float BaseStillSpeedThreshold = 0.25f;

		private const float BaseFocusTime = 0.9f;

		private const float BaseFocusDamageMultiplier = 3f;

		private const float BaseFocusProjectileSpeedMultiplier = 1.25f;

		private const float BaseMovingDamageMultiplier = 0.85f;

		private const float BaseRepositionBackstepForce = 18f;

		private float StillSpeedThreshold => 0.25f + 0.05f * (float)(level - 1);

		private float FocusTime => Mathf.Max(0.35f, 0.9f - 0.07f * (float)(level - 1));

		private float FocusDamageMultiplier => 3f + 0.75f * (float)(level - 1);

		private float FocusProjectileSpeedMultiplier => 1.25f + 0.08f * (float)(level - 1);

		private float MovingDamageMultiplier => Mathf.Clamp(0.85f + 0.03f * (float)(level - 1), 0.85f, 1f);

		private float RepositionBackstepForce => 18f + 3f * (float)(level - 1);

		private float LongshotBonusPerUnit => 0.14f + 0.03f * (float)(level - 1);

		private float LongshotMaxMultiplier => 4.25f + 0.5f * (float)(level - 1);

		public void SetGunAmmo(GunAmmo ga)
		{
			gunAmmo = ga;
			EnforceAmmoCap(force: true);
		}

		private void EnforceAmmoCap(bool force = false)
		{
			if (!force && Time.time < nextAmmoEnforceTime)
			{
				return;
			}
			nextAmmoEnforceTime = Time.time + 0.15f;
			try
			{
				if ((Object)(object)gun != (Object)null)
				{
					gun.ammo = Mathf.Min(gun.ammo, 1);
				}
			}
			catch
			{
			}
			if ((Object)(object)gunAmmo == (Object)null)
			{
				return;
			}
			try
			{
				TrySetIntMember(gunAmmo, new string[4] { "maxAmmo", "MaxAmmo", "maxBullets", "maxNumberOfBullets" }, 1);
				int num = TryGetIntMember(gunAmmo, new string[4] { "currentAmmo", "CurrentAmmo", "ammo", "curAmmo" });
				if (num > 1)
				{
					TrySetIntMember(gunAmmo, new string[4] { "currentAmmo", "CurrentAmmo", "ammo", "curAmmo" }, 1);
				}
			}
			catch
			{
			}
		}

		private static bool TrySetIntMember(object obj, string[] names, int value)
		{
			if (obj == null)
			{
				return false;
			}
			Type type = obj.GetType();
			foreach (string name in names)
			{
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null && field.FieldType == typeof(int))
				{
					field.SetValue(obj, value);
					return true;
				}
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.CanWrite && property.PropertyType == typeof(int))
				{
					property.SetValue(obj, value, null);
					return true;
				}
			}
			string[] array = new string[3] { "SetMaxAmmo", "SetAmmo", "SetAmmoCount" };
			foreach (string name2 in array)
			{
				MethodInfo method = type.GetMethod(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method == null)
				{
					continue;
				}
				ParameterInfo[] parameters = method.GetParameters();
				if (parameters.Length == 1 && parameters[0].ParameterType == typeof(int))
				{
					try
					{
						method.Invoke(obj, new object[1] { value });
						return true;
					}
					catch
					{
					}
				}
			}
			return false;
		}

		private static int TryGetIntMember(object obj, string[] names)
		{
			if (obj == null)
			{
				return int.MinValue;
			}
			Type type = obj.GetType();
			foreach (string name in names)
			{
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null && field.FieldType == typeof(int))
				{
					try
					{
						return (int)field.GetValue(obj);
					}
					catch
					{
					}
				}
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.CanRead && property.PropertyType == typeof(int))
				{
					try
					{
						return (int)property.GetValue(obj, null);
					}
					catch
					{
					}
				}
			}
			return int.MinValue;
		}

		public void SetLevel(int newLevel)
		{
			level = Mathf.Max(1, newLevel);
		}

		private void Start()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)this).GetComponentInParent<Player>();
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			gun = player.data.weaponHandler.gun;
			block = player.data.block;
			try
			{
				if ((Object)(object)gunAmmo == (Object)null)
				{
					gunAmmo = ((Component)player).GetComponentInChildren<GunAmmo>();
				}
			}
			catch
			{
			}
			EnforceAmmoCap(force: true);
			lastPos = ((Component)player).transform.position;
			Gun obj2 = gun;
			obj2.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj2.ShootPojectileAction, new Action<GameObject>(OnShootProjectile));
			if ((Object)(object)block != (Object)null)
			{
				Block obj3 = block;
				obj3.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj3.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)gun != (Object)null)
			{
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectile));
			}
			if ((Object)(object)block != (Object)null)
			{
				Block obj2 = block;
				obj2.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj2.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
			if ((Object)(object)player != (Object)null)
			{
				ReksikVfx.RemoveStatus(((Component)player).transform, "EgorFocus");
			}
		}

		private void Update()
		{
			//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_0083: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				return;
			}
			EnforceAmmoCap();
			if (player.data.dead)
			{
				stillTime = 0f;
				lastPos = ((Component)player).transform.position;
				return;
			}
			Vector3 position = ((Component)player).transform.position;
			Vector3 val = position - lastPos;
			float num = ((Vector3)(ref val)).magnitude / Mathf.Max(Time.deltaTime, 0.0001f);
			lastPos = position;
			if (num <= StillSpeedThreshold)
			{
				stillTime += Time.deltaTime;
			}
			else
			{
				stillTime = 0f;
			}
			float focusTime = FocusTime;
			if (stillTime >= focusTime)
			{
				StatusTextVfxMono orCreateStatusText = ReksikVfx.GetOrCreateStatusText(((Component)player).transform, "EgorFocus", new Vector3(0f, 2.25f, 0f), "FOCUS", new Color(0.85f, 0.95f, 1f, 0.95f));
				orCreateStatusText.SetText("FOCUS");
			}
			else if (stillTime > 0.1f)
			{
				int num2 = Mathf.Clamp(Mathf.RoundToInt(stillTime / focusTime * 100f), 0, 99);
				StatusTextVfxMono orCreateStatusText2 = ReksikVfx.GetOrCreateStatusText(((Component)player).transform, "EgorFocus", new Vector3(0f, 2.25f, 0f), "", new Color(0.85f, 0.95f, 1f, 0.95f));
				orCreateStatusText2.SetText("FOCUS " + num2 + "%");
			}
			else
			{
				ReksikVfx.RemoveStatus(((Component)player).transform, "EgorFocus");
			}
		}

		private void OnShootProjectile(GameObject projectile)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)projectile == (Object)null)
			{
				return;
			}
			ReksikVfx.AttachSimpleTrail(projectile, new Color(0.85f, 0.95f, 1f, 0.7f), 0.35f, 0.12f, 0.01f);
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			if (stillTime >= FocusTime)
			{
				component.damage *= FocusDamageMultiplier;
				if ((Object)(object)gun != (Object)null)
				{
					ReksikVfx.PlayMuzzleFlash(((Component)gun).transform, 0.75f, new Color(0.85f, 0.95f, 1f, 0.95f));
				}
				MoveTransform component2 = projectile.GetComponent<MoveTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.velocity *= FocusProjectileSpeedMultiplier;
				}
				Transform transform = projectile.transform;
				transform.localScale *= 0.85f;
				stillTime = 0f;
			}
			else
			{
				component.damage *= MovingDamageMultiplier;
			}
			if ((Object)(object)projectile.GetComponent<EgorLongshotProjectileMono>() == (Object)null)
			{
				EgorLongshotProjectileMono egorLongshotProjectileMono = projectile.AddComponent<EgorLongshotProjectileMono>();
				egorLongshotProjectileMono.SetBaseDamage(component.damage);
				egorLongshotProjectileMono.SetParams(LongshotBonusPerUnit, LongshotMaxMultiplier);
			}
		}

		private void OnBlock(BlockTriggerType triggerType)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be