Decompiled source of ReksikCards v1.4.4

ReksikCards.dll

Decompiled 5 days 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+82c9bf0cb3525ac211a62a1f61d8983b37751b6b")]
[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.4")]
	[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.4";

		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 ReksikRuntimeStatMath
	{
		private const float MultiplierEpsilon = 0.0001f;

		public static float ApplyMultiplier(float currentValue, ref float appliedMultiplier, float newMultiplier, float minValue = float.NegativeInfinity, float maxValue = float.PositiveInfinity)
		{
			float num = RemoveMultiplierCore(currentValue, appliedMultiplier);
			appliedMultiplier = Mathf.Max(0.0001f, newMultiplier);
			return ClampFloat(num * appliedMultiplier, minValue, maxValue);
		}

		public static float RemoveMultiplier(float currentValue, ref float appliedMultiplier, float minValue = float.NegativeInfinity, float maxValue = float.PositiveInfinity)
		{
			float value = RemoveMultiplierCore(currentValue, appliedMultiplier);
			appliedMultiplier = 1f;
			return ClampFloat(value, minValue, maxValue);
		}

		public static float ApplyAdditive(float currentValue, ref float appliedAmount, float newAmount, float minValue = float.NegativeInfinity, float maxValue = float.PositiveInfinity)
		{
			float num = currentValue - appliedAmount;
			appliedAmount = newAmount;
			return ClampFloat(num + appliedAmount, minValue, maxValue);
		}

		public static float RemoveAdditive(float currentValue, ref float appliedAmount, float minValue = float.NegativeInfinity, float maxValue = float.PositiveInfinity)
		{
			float value = currentValue - appliedAmount;
			appliedAmount = 0f;
			return ClampFloat(value, minValue, maxValue);
		}

		public static float ApplyMinimumBoost(float currentValue, ref float appliedAmount, float minimumValue)
		{
			float num = currentValue - appliedAmount;
			appliedAmount = Mathf.Max(0f, minimumValue - num);
			return num + appliedAmount;
		}

		public static float RemoveMinimumBoost(float currentValue, ref float appliedAmount)
		{
			return RemoveAdditive(currentValue, ref appliedAmount);
		}

		public static int ApplyAdditive(int currentValue, ref int appliedAmount, int newAmount, int minValue = int.MinValue, int maxValue = int.MaxValue)
		{
			int num = currentValue - appliedAmount;
			appliedAmount = newAmount;
			return Mathf.Clamp(num + appliedAmount, minValue, maxValue);
		}

		public static int RemoveAdditive(int currentValue, ref int appliedAmount, int minValue = int.MinValue, int maxValue = int.MaxValue)
		{
			int num = currentValue - appliedAmount;
			appliedAmount = 0;
			return Mathf.Clamp(num, minValue, maxValue);
		}

		private static float RemoveMultiplierCore(float currentValue, float appliedMultiplier)
		{
			float num = ((Mathf.Abs(appliedMultiplier) < 0.0001f) ? 1f : appliedMultiplier);
			return currentValue / num;
		}

		private static float ClampFloat(float value, float minValue, float maxValue)
		{
			if (!float.IsNegativeInfinity(minValue))
			{
				value = Mathf.Max(minValue, value);
			}
			if (!float.IsPositiveInfinity(maxValue))
			{
				value = Mathf.Min(maxValue, value);
			}
			return value;
		}
	}
	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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0029: 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_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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_007a: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Expected O, but got Unknown
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(title + "_Art");
			Color color = PickColor(title);
			Color color2 = Tint(color, 0.7f, 0.85f);
			Color color3 = Tint(color, 1.18f, 0.28f);
			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 = color2;
			((Renderer)val3).sortingOrder = 0;
			val2.transform.localScale = new Vector3(1.18f, 1.18f, 1f);
			GameObject val4 = new GameObject("Glow");
			val4.transform.SetParent(val.transform, false);
			SpriteRenderer val5 = val4.AddComponent<SpriteRenderer>();
			val5.sprite = ReksikSpriteCache.Circle;
			val5.color = color3;
			((Renderer)val5).sortingOrder = 1;
			val4.transform.localScale = new Vector3(0.92f, 0.92f, 1f);
			GameObject val6 = new GameObject("Burst");
			val6.transform.SetParent(val.transform, false);
			SpriteRenderer val7 = val6.AddComponent<SpriteRenderer>();
			val7.sprite = ReksikSpriteCache.Burst;
			val7.color = Tint(color, 1.1f, 0.24f);
			((Renderer)val7).sortingOrder = 2;
			val6.transform.localScale = new Vector3(0.82f, 0.82f, 1f);
			val6.transform.localRotation = Quaternion.Euler(0f, 0f, 18f);
			GameObject val8 = new GameObject("Diamond");
			val8.transform.SetParent(val.transform, false);
			SpriteRenderer val9 = val8.AddComponent<SpriteRenderer>();
			val9.sprite = ReksikSpriteCache.Diamond;
			val9.color = new Color(1f, 1f, 1f, 0.16f);
			((Renderer)val9).sortingOrder = 3;
			val8.transform.localScale = new Vector3(0.88f, 0.88f, 1f);
			GameObject val10 = new GameObject("Ring");
			val10.transform.SetParent(val.transform, false);
			SpriteRenderer val11 = val10.AddComponent<SpriteRenderer>();
			val11.sprite = ReksikSpriteCache.Ring;
			val11.color = new Color(1f, 1f, 1f, 0.88f);
			((Renderer)val11).sortingOrder = 4;
			val10.transform.localScale = Vector3.one * 0.94f;
			GameObject val12 = new GameObject("Marker");
			val12.transform.SetParent(val.transform, false);
			SpriteRenderer val13 = val12.AddComponent<SpriteRenderer>();
			val13.sprite = ReksikSpriteCache.Circle;
			val13.color = Tint(color, 1.2f, 0.92f);
			((Renderer)val13).sortingOrder = 5;
			val12.transform.localPosition = new Vector3(0f, 0.34f, 0f);
			val12.transform.localScale = new Vector3(0.16f, 0.16f, 1f);
			GameObject val14 = new GameObject("Label");
			val14.transform.SetParent(val.transform, false);
			StatusTextVfxMono statusTextVfxMono = val14.AddComponent<StatusTextVfxMono>();
			string text = MakeLabel(title);
			statusTextVfxMono.Init(val.transform, text, Color.white, Vector3.zero);
			TextMesh component = val14.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);
		}

		private static Color Tint(Color color, float brightness, float alpha)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			return new Color(Mathf.Clamp01(color.r * brightness), Mathf.Clamp01(color.g * brightness), Mathf.Clamp01(color.b * brightness), Mathf.Clamp01(alpha));
		}
	}
	internal static class ReksikSpriteCache
	{
		private static Sprite circleSprite;

		private static Sprite ringSprite;

		private static Sprite squareSprite;

		private static Sprite diamondSprite;

		private static Sprite burstSprite;

		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;
			}
		}

		public static Sprite Diamond
		{
			get
			{
				EnsureBuilt();
				return diamondSprite;
			}
		}

		public static Sprite Burst
		{
			get
			{
				EnsureBuilt();
				return burstSprite;
			}
		}

		private static void EnsureBuilt()
		{
			if (!built)
			{
				built = true;
				circleSprite = CreateCircleSprite(96, 0f);
				ringSprite = CreateCircleSprite(96, 0.78f);
				squareSprite = CreateSquareSprite(96);
				diamondSprite = CreateDiamondSprite(96);
				burstSprite = CreateBurstSprite(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);
		}

		private static Sprite CreateDiamondSprite(int size)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			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.46f;
			Color32[] array = (Color32[])(object)new Color32[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num4 = Mathf.Abs((float)(j - num) + 0.5f);
					float num5 = Mathf.Abs((float)(i - num2) + 0.5f);
					float num6 = num4 + num5;
					byte b = 0;
					if (num6 <= num3)
					{
						float num7 = Mathf.Clamp01((num3 - num6) / 3f);
						b = (byte)Mathf.Clamp(160f + num7 * 95f, 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);
		}

		private static Sprite CreateBurstSprite(int size)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0162: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			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 = (float)size * 0.18f;
			Color32[] array = (Color32[])(object)new Color32[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num5 = (float)(j - num) + 0.5f;
					float num6 = (float)(i - num2) + 0.5f;
					float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6);
					float num8 = Mathf.Atan2(num6, num5);
					float num9 = 0.65f + 0.35f * Mathf.Abs(Mathf.Cos(num8 * 6f));
					float num10 = Mathf.Lerp(num4, num3, num9);
					byte b = 0;
					if (num7 <= num10)
					{
						float num11 = Mathf.Clamp01((num10 - num7) / 3.5f);
						b = (byte)Mathf.Clamp(120f + num11 * 135f, 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
			{
			}
		}

		private static void SpawnTimedSprite(string name, Vector2 worldPos, Sprite sprite, int sortingOrder, Color startColor, Color endColor, float duration, float startScale, float endScale, Transform? context = null, float zRotation = 0f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0060: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.position = new Vector3(worldPos.x, worldPos.y, 0f);
			val.transform.localRotation = Quaternion.Euler(0f, 0f, zRotation);
			ApplyContext(val, context);
			SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
			val2.sprite = sprite;
			val2.color = startColor;
			((Renderer)val2).sortingOrder = sortingOrder;
			if (contextValid)
			{
				((Renderer)val2).sortingLayerID = contextSortingLayerID;
			}
			TimedSpriteVfxMono timedSpriteVfxMono = val.AddComponent<TimedSpriteVfxMono>();
			timedSpriteVfxMono.Init(val2, duration, startScale, endScale, startColor, endColor);
		}

		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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0090: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				float num = Mathf.Max(0.1f, radius * 0.25f);
				float num2 = 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);
				Color startColor2 = default(Color);
				((Color)(ref startColor2))..ctor(color.r, color.g, color.b, color.a * 0.18f);
				Color endColor2 = default(Color);
				((Color)(ref endColor2))..ctor(color.r, color.g, color.b, 0f);
				SpawnTimedSprite("ShockwaveRing", worldPos, ReksikSpriteCache.Ring, 1000, startColor, endColor, duration, num, num2, context);
				SpawnTimedSprite("ShockwaveFill", worldPos, ReksikSpriteCache.Circle, 998, startColor2, endColor2, duration * 0.85f, num * 0.65f, num2 * 0.6f, context, Random.Range(0f, 360f));
				SpawnTimedSprite("ShockwaveBurst", worldPos, ReksikSpriteCache.Burst, 1002, new Color(color.r, color.g, color.b, color.a * 0.55f), endColor, duration * 0.7f, num * 0.35f, num2 * 0.4f, context, Random.Range(0f, 360f));
			}
			catch
			{
			}
		}

		public static void PlayPulse(Vector2 worldPos, float radius, float duration, Color color, Transform? context = null)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c6: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			try
			{
				float num = Mathf.Max(0.08f, radius * 0.2f);
				float num2 = 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);
				Color startColor2 = default(Color);
				((Color)(ref startColor2))..ctor(color.r, color.g, color.b, color.a * 0.75f);
				Color startColor3 = default(Color);
				((Color)(ref startColor3))..ctor(1f, 1f, 1f, Mathf.Clamp01(color.a * 0.45f));
				SpawnTimedSprite("PulseFill", worldPos, ReksikSpriteCache.Circle, 999, startColor, endColor, duration, num, num2, context, Random.Range(0f, 360f));
				SpawnTimedSprite("PulseRing", worldPos, ReksikSpriteCache.Ring, 1001, startColor2, endColor, duration * 0.9f, num * 0.85f, num2 * 1.1f, context);
				SpawnTimedSprite("PulseDiamond", worldPos, ReksikSpriteCache.Diamond, 1000, startColor3, endColor, duration * 0.75f, num * 0.55f, num2 * 0.75f, context, 45f + Random.Range(-15f, 15f));
			}
			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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)origin == (Object)null)
			{
				return;
			}
			try
			{
				Vector3 val = origin.position + origin.right * 0.35f;
				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);
				SpawnTimedSprite("MuzzleBurst", Vector2.op_Implicit(val), ReksikSpriteCache.Burst, 1102, startColor, endColor, 0.1f, size * 0.3f, size * 1.05f, origin, origin.eulerAngles.z);
				SpawnTimedSprite("MuzzleRing", Vector2.op_Implicit(val), ReksikSpriteCache.Ring, 1101, new Color(color.r, color.g, color.b, color.a * 0.7f), endColor, 0.12f, size * 0.22f, size * 1.25f, origin);
				SpawnTimedSprite("MuzzleCore", Vector2.op_Implicit(val), ReksikSpriteCache.Circle, 1100, new Color(1f, 1f, 1f, Mathf.Clamp01(color.a * 0.85f)), new Color(1f, 1f, 1f, 0f), 0.09f, size * 0.18f, size * 0.7f, origin);
			}
			catch
			{
			}
		}

		public static void AttachSimpleTrail(GameObject projectile, Color color, float time = 0.25f, float startWidth = 0.2f, float endWidth = 0.02f)
		{
			//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_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_00ac: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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;
				val.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
				{
					new Keyframe(0f, 1f),
					new Keyframe(0.35f, 0.85f),
					new Keyframe(1f, 0f)
				});
				((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 = Color.Lerp(val3, Color.white, 0.18f);
				Color val5 = default(Color);
				((Color)(ref val5))..ctor(color.r, color.g, color.b, 0f);
				Gradient val6 = new Gradient();
				val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
				{
					new GradientColorKey(val4, 0f),
					new GradientColorKey(val3, 0.45f),
					new GradientColorKey(val3, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
				{
					new GradientAlphaKey(val3.a, 0f),
					new GradientAlphaKey(val3.a * 0.55f, 0.35f),
					new GradientAlphaKey(0f, 1f)
				});
				val.colorGradient = val6;
			}
			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 TextMesh shadowMesh = 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			this.target = target;
			this.offset = offset;
			textMesh = ((Component)this).gameObject.GetComponent<TextMesh>();
			if ((Object)(object)textMesh == (Object)null)
			{
				textMesh = ((Component)this).gameObject.AddComponent<TextMesh>();
			}
			shadowMesh = EnsureShadow(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;
				if ((Object)(object)shadowMesh != (Object)null)
				{
					shadowMesh.font = builtinResource;
				}
			}
			SyncShadow(textMesh.text, color);
			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;
				}
				if ((Object)(object)shadowMesh != (Object)null)
				{
					MeshRenderer component2 = ((Component)shadowMesh).GetComponent<MeshRenderer>();
					if ((Object)(object)component2 != (Object)null)
					{
						if ((Object)(object)componentInChildren != (Object)null)
						{
							((Renderer)component2).sortingLayerID = componentInChildren.sortingLayerID;
						}
						((Renderer)component2).sortingOrder = 1999;
					}
				}
			}
			catch
			{
			}
			timed = false;
		}

		public void SetText(string text)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)textMesh != (Object)null)
			{
				textMesh.text = text;
				SyncShadow(text, textMesh.color);
			}
		}

		public void SetColor(Color color)
		{
			//IL_0018: 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)
			if ((Object)(object)textMesh != (Object)null)
			{
				textMesh.color = color;
				SyncShadow(textMesh.text, color);
			}
		}

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

		private void LateUpdate()
		{
			//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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;
			}
			float num = 0.03f * Mathf.Sin(Time.time * 3f);
			((Component)this).transform.position = target.position + offset + Vector3.up * num;
			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);
			}
		}

		private static TextMesh EnsureShadow(TextMesh mainText)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)mainText).transform.Find("Shadow");
			GameObject val2 = (GameObject)(((Object)(object)val != (Object)null) ? ((object)((Component)val).gameObject) : ((object)new GameObject("Shadow")));
			val2.transform.SetParent(((Component)mainText).transform, false);
			val2.transform.localPosition = new Vector3(0.02f, -0.02f, 0.01f);
			TextMesh val3 = val2.GetComponent<TextMesh>();
			if ((Object)(object)val3 == (Object)null)
			{
				val3 = val2.AddComponent<TextMesh>();
			}
			val3.anchor = (TextAnchor)4;
			val3.alignment = (TextAlignment)1;
			val3.characterSize = 0.12f;
			val3.fontSize = 80;
			return val3;
		}

		private void SyncShadow(string text, Color mainColor)
		{
			//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)
			if (!((Object)(object)shadowMesh == (Object)null))
			{
				shadowMesh.text = text;
				shadowMesh.characterSize = textMesh.characterSize;
				shadowMesh.fontSize = textMesh.fontSize;
				shadowMesh.color = new Color(0f, 0f, 0f, Mathf.Clamp01(mainColor.a * 0.6f));
			}
		}
	}
	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;

		private float baseRotation;

		private float spinDegreesPerSecond;

		private float stretchAmount;

		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)
			//IL_004a: 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;
			baseRotation = ((Component)this).transform.localEulerAngles.z;
			spinDegreesPerSecond = Random.Range(-55f, 55f);
			stretchAmount = Random.Range(0.02f, 0.08f);
		}

		private void Update()
		{
			//IL_00ac: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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 = 1f - Mathf.Pow(1f - Mathf.Clamp01(num), 3f);
			float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(num));
			float num4 = Mathf.Lerp(startScale, endScale, num2);
			float num5 = 1f + Mathf.Sin(num * MathF.PI) * stretchAmount;
			((Component)this).transform.localScale = new Vector3(num4 * num5, num4 / num5, 1f);
			((Component)this).transform.localRotation = Quaternion.Euler(0f, 0f, baseRotation + spinDegreesPerSecond * num);
			if ((Object)(object)sr != (Object)null)
			{
				sr.color = Color.Lerp(startColor, endColor, num3);
			}
		}
	}
}
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__54 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DaniilTankMono <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: 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;
					}
					<>4__this.RefreshFortressModifiers();
					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;
					<>4__this.EndFortress();
					<>4__this.fortressRoutine = null;
					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__51 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DaniilTankMono <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: 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;
					}
					<>4__this.RefreshSecondWindModifiers();
					<>2__current = (object)new WaitForSeconds(<>4__this.SecondWindDuration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.EndSecondWind();
					<>4__this.secondWindRoutine = null;
					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 appliedPassiveRegenBonus;

		private float appliedSecondWindMoveMultiplier = 1f;

		private float appliedSecondWindSmoothingBoost;

		private float appliedFortressRegenBonus;

		private float appliedFortressSmoothingBoost;

		private bool secondWindActive;

		private bool fortressActive;

		private Coroutine? secondWindRoutine;

		private Coroutine? fortressRoutine;

		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();
				if (secondWindActive)
				{
					RefreshSecondWindModifiers();
				}
				if (fortressActive)
				{
					RefreshFortressModifiers();
				}
			}
		}

		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;
			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))
			{
				healthHandler.regeneration = ReksikRuntimeStatMath.ApplyAdditive(healthHandler.regeneration, ref 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 (secondWindRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(secondWindRoutine);
				secondWindRoutine = null;
			}
			if (fortressRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(fortressRoutine);
				fortressRoutine = null;
			}
			EndSecondWind();
			EndFortress();
			if ((Object)(object)healthHandler != (Object)null)
			{
				healthHandler.regeneration = ReksikRuntimeStatMath.RemoveAdditive(healthHandler.regeneration, ref appliedPassiveRegenBonus);
			}
		}

		private void Update()
		{
			//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_00ab: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null)
			{
				return;
			}
			if (player.data.dead)
			{
				usedSecondWind = false;
				EndSecondWind();
				EndFortress();
			}
			else
			{
				if (usedSecondWind)
				{
					return;
				}
				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);
					if (secondWindRoutine != null)
					{
						((MonoBehaviour)this).StopCoroutine(secondWindRoutine);
					}
					EndSecondWind();
					secondWindRoutine = ((MonoBehaviour)this).StartCoroutine(SecondWindRoutine());
				}
			}
		}

		[IteratorStateMachine(typeof(<SecondWindRoutine>d__51))]
		private IEnumerator SecondWindRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SecondWindRoutine>d__51(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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (!((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));
				if (fortressRoutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(fortressRoutine);
					fortressRoutine = null;
				}
				EndFortress();
				fortressRoutine = ((MonoBehaviour)this).StartCoroutine(FortressRoutine());
			}
		}

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

		private void RefreshSecondWindModifiers()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !((Object)(object)stats == (Object)null) && !((Object)(object)player.data == (Object)null))
			{
				secondWindActive = true;
				ReksikVfx.SetAura(((Component)player).transform, "DaniilSecondWindAura", enabled: true, 1.45f, new Color(0.2f, 0.95f, 0.35f, 0.3f));
				stats.secondsToTakeDamageOver = ReksikRuntimeStatMath.ApplyMinimumBoost(stats.secondsToTakeDamageOver, ref appliedSecondWindSmoothingBoost, 4f + 0.5f * (float)(level - 1));
				stats.movementSpeed = ReksikRuntimeStatMath.ApplyMultiplier(stats.movementSpeed, ref appliedSecondWindMoveMultiplier, Mathf.Clamp(0.85f + 0.03f * (float)(level - 1), 0.85f, 1f), 0.01f);
			}
		}

		private void EndSecondWind()
		{
			if (secondWindActive)
			{
				secondWindActive = false;
				if ((Object)(object)stats != (Object)null)
				{
					stats.secondsToTakeDamageOver = ReksikRuntimeStatMath.RemoveMinimumBoost(stats.secondsToTakeDamageOver, ref appliedSecondWindSmoothingBoost);
					stats.movementSpeed = ReksikRuntimeStatMath.RemoveMultiplier(stats.movementSpeed, ref appliedSecondWindMoveMultiplier, 0.01f);
				}
				if ((Object)(object)player != (Object)null)
				{
					ReksikVfx.RemoveStatus(((Component)p