Decompiled source of JeusticeChaos v1.1.0

JeusticeChaos.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using JeusticeChaos.Art;
using JeusticeChaos.Cards;
using JeusticeChaos.Effects;
using JeusticeHazards.MapObjects;
using Microsoft.CodeAnalysis;
using ModdingUtils.AIMinion;
using ModdingUtils.AIMinion.Extensions;
using ModdingUtils.Extensions;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using Photon.Pun;
using RarityLib.Utils;
using SoundImplementation;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JeusticeChaos
{
	public static class CardArt
	{
		private static Transform _holder;

		private static readonly Dictionary<string, Sprite> Loaded = new Dictionary<string, Sprite>();

		public static GameObject Template<T>(string name) where T : CardArtAnimation
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)_holder == (Object)null)
			{
				GameObject val = new GameObject("JeusticeChaos card art templates (inactive)");
				val.SetActive(false);
				Object.DontDestroyOnLoad((Object)val);
				_holder = val.transform;
			}
			GameObject val2 = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(_holder, false);
			Stretch((RectTransform)val2.transform);
			val2.AddComponent<T>();
			return val2;
		}

		public static void Stretch(RectTransform rt)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.offsetMin = Vector2.zero;
			rt.offsetMax = Vector2.zero;
		}

		public static Sprite Sprite(string name)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (Loaded.TryGetValue(name, out var value))
			{
				return value;
			}
			using (Stream stream = typeof(CardArt).Assembly.GetManifestResourceStream("JeusticeChaos.Art." + name + ".png"))
			{
				if (stream == null)
				{
					JeusticeChaos.Log.LogWarning((object)("Card art piece not found: " + name));
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				ImageConversion.LoadImage(val, array);
				((Texture)val).wrapMode = (TextureWrapMode)1;
				value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}
			Loaded[name] = value;
			return value;
		}
	}
	public abstract class CardArtAnimation : MonoBehaviour
	{
		private static readonly Vector2 FallbackSize = new Vector2(500f, 320f);

		private RectTransform _shaker;

		private float _time;

		protected static readonly Color PlayerColor = new Color(1f, 0.55f, 0.15f);

		protected static readonly Color EnemyColor = new Color(0.3f, 0.6f, 1f);

		protected RectTransform Root { get; private set; }

		protected float Time01 { get; private set; }

		protected abstract float Loop { get; }

		protected float Height
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				Rect rect = ((RectTransform)((Component)this).transform).rect;
				return Mathf.Max(1f, ((Rect)(ref rect)).height);
			}
		}

		protected float Aspect
		{
			get
			{
				//IL_0006: 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_0010: Unknown result type (might be due to invalid IL or missing references)
				Rect rect = ((RectTransform)((Component)this).transform).rect;
				if (!(((Rect)(ref rect)).height > 1f))
				{
					return FallbackSize.x / FallbackSize.y;
				}
				return ((Rect)(ref rect)).width / ((Rect)(ref rect)).height;
			}
		}

		protected abstract void Build();

		protected abstract void Animate(float t);

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			RectTransform val = (RectTransform)((Component)this).transform;
			Transform parent = ((Transform)val).parent;
			RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
			if (!((Object)(object)val2 == (Object)null))
			{
				Rect rect = val2.rect;
				if (!(((Rect)(ref rect)).height < 1f))
				{
					goto IL_0062;
				}
			}
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			val.anchorMax = val3;
			val.anchorMin = val3;
			val.sizeDelta = FallbackSize;
			goto IL_0062;
			IL_0062:
			GameObject val4 = new GameObject("Shaker", new Type[1] { typeof(RectTransform) });
			val4.transform.SetParent(((Component)this).transform, false);
			_shaker = (RectTransform)val4.transform;
			CardArt.Stretch(_shaker);
			Root = _shaker;
			Build();
		}

		private void Update()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			_time = (_time + Time.unscaledDeltaTime) % Loop;
			Time01 = _time / Loop;
			_shaker.anchoredPosition = Vector2.zero;
			Animate(_time);
		}

		protected Vector2 Shift(Vector2 position, Vector2 delta)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			return position + new Vector2(delta.x / Aspect, delta.y);
		}

		protected static Vector2 Rotate(Vector2 v, float degrees)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			float num = degrees * (MathF.PI / 180f);
			return new Vector2(v.x * Mathf.Cos(num) - v.y * Mathf.Sin(num), v.x * Mathf.Sin(num) + v.y * Mathf.Cos(num));
		}

		protected static float Hash(int i)
		{
			float num = Mathf.Sin((float)i * 12.9898f + 78.233f) * 43758.547f;
			return num - Mathf.Floor(num);
		}

		protected Image Piece(string sprite, Color? tint = null)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(sprite, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent((Transform)(object)Root, false);
			Image val2 = val.AddComponent<Image>();
			val2.sprite = CardArt.Sprite(sprite);
			((Graphic)val2).raycastTarget = false;
			((Behaviour)val2).enabled = false;
			if (tint.HasValue)
			{
				((Graphic)val2).color = tint.Value;
			}
			RectTransform val3 = (RectTransform)val.transform;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(0.5f, 0.5f);
			val3.anchorMax = val4;
			val3.anchorMin = val4;
			return val2;
		}

		protected void Place(Image piece, Vector2 position, float size, float angle = 0f, float alpha = 1f, float stretchX = 1f, float stretchY = 1f)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Sprite sprite = piece.sprite;
			float num;
			if (!((Object)(object)sprite != (Object)null))
			{
				num = 1f;
			}
			else
			{
				Rect rect = sprite.rect;
				float width = ((Rect)(ref rect)).width;
				rect = sprite.rect;
				num = width / ((Rect)(ref rect)).height;
			}
			float num2 = num;
			PlaceBox(piece, position, new Vector2(size * num2 * stretchX, size * stretchY), angle, alpha);
		}

		protected void PlaceBox(Image piece, Vector2 position, Vector2 size, float angle = 0f, float alpha = 1f)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = ((Graphic)piece).rectTransform;
			Vector2 anchorMin = (rectTransform.anchorMax = position);
			rectTransform.anchorMin = anchorMin;
			rectTransform.anchoredPosition = Vector2.zero;
			rectTransform.sizeDelta = size * Height;
			((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, angle);
			Color color = ((Graphic)piece).color;
			((Graphic)piece).color = new Color(color.r, color.g, color.b, alpha);
			((Behaviour)piece).enabled = alpha > 0.001f && size.x > 0.001f && size.y > 0.001f;
		}

		protected static void Tint(Image piece, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)piece).color = new Color(color.r, color.g, color.b, ((Graphic)piece).color.a);
		}

		protected static void Hide(Image piece)
		{
			((Behaviour)piece).enabled = false;
		}

		protected void Shake(float strength)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			_shaker.anchoredPosition = Random.insideUnitCircle * strength * Height;
		}

		protected static float EaseOut(float x)
		{
			return 1f - (1f - x) * (1f - x);
		}

		protected static float EaseInOut(float x)
		{
			return x * x * (3f - 2f * x);
		}

		protected static float Phase(float t, float start, float duration)
		{
			return Mathf.Clamp01((t - start) / duration);
		}

		protected static float Spring(float x)
		{
			if (!(x >= 1f))
			{
				return 1f - Mathf.Exp(-6f * x) * Mathf.Cos(10f * x);
			}
			return 1f;
		}
	}
	public abstract class ChaosCard : CustomCard
	{
		public override string GetModName()
		{
			return "Jeustice";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected abstract CardInfoStat[] CardStats();

		protected sealed override CardInfoStat[] GetStats()
		{
			return (from s in CardStats()
				orderby s.positive descending
				select s).ToArray();
		}

		public static int Count(Player player, CardInfo card)
		{
			if ((Object)(object)player == (Object)null || (Object)(object)card == (Object)null || (Object)(object)player.data == (Object)null)
			{
				return 0;
			}
			return player.data.currentCards.Count((CardInfo c) => (Object)(object)c != (Object)null && ((Object)c).name == ((Object)card).name);
		}

		protected static Rarity ModdedRarity(string name, Rarity fallback)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Rarity rarity = RarityUtils.GetRarity(name);
			if ((int)rarity != 0)
			{
				return rarity;
			}
			return fallback;
		}

		protected static CardInfoStat Stat(string stat, string amount, bool positive)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			return new CardInfoStat
			{
				stat = stat,
				amount = amount,
				positive = positive,
				simepleAmount = (SimpleAmount)0
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.jeustice.rounds.chaos", "Jeustice Chaos", "1.1.0")]
	[BepInProcess("Rounds.exe")]
	public class JeusticeChaos : BaseUnityPlugin
	{
		public const string ModId = "com.jeustice.rounds.chaos";

		public const string ModName = "Jeustice Chaos";

		public const string Version = "1.1.0";

		public const string CardModName = "Jeustice";

		public static JeusticeChaos Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.jeustice.rounds.chaos").PatchAll();
		}

		private void Start()
		{
			Unbound.RegisterCredits("Jeustice Chaos", new string[1] { "Jeustice" }, new string[0], new string[0]);
			((MonoBehaviour)this).StartCoroutine(Sounds.LoadAll(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)));
			CustomCard.BuildCard<RussianRoulette>((Action<CardInfo>)delegate(CardInfo card)
			{
				RussianRoulette.Card = card;
			});
			CustomCard.BuildCard<DiscoRounds>((Action<CardInfo>)delegate(CardInfo card)
			{
				DiscoRounds.Card = card;
			});
			CustomCard.BuildCard<Earthquake>((Action<CardInfo>)delegate(CardInfo card)
			{
				Earthquake.Card = card;
			});
			CustomCard.BuildCard<ShieldOMatic>((Action<CardInfo>)delegate(CardInfo card)
			{
				ShieldOMatic.Card = card;
			});
			CustomCard.BuildCard<Copycat>((Action<CardInfo>)delegate(CardInfo card)
			{
				Copycat.Card = card;
			});
			CustomCard.BuildCard<SniperBullets>((Action<CardInfo>)delegate(CardInfo card)
			{
				SniperBullets.Card = card;
			});
			CustomCard.BuildCard<ShrinkRay>((Action<CardInfo>)delegate(CardInfo card)
			{
				ShrinkRay.Card = card;
			});
			CustomCard.BuildCard<Vanish>((Action<CardInfo>)delegate(CardInfo card)
			{
				Vanish.Card = card;
			});
			CustomCard.BuildCard<BigBoned>((Action<CardInfo>)delegate(CardInfo card)
			{
				BigBoned.Card = card;
			});
			CustomCard.BuildCard<Snowball>((Action<CardInfo>)delegate(CardInfo card)
			{
				Snowball.Card = card;
			});
			CustomCard.BuildCard<KegLauncher>((Action<CardInfo>)delegate(CardInfo card)
			{
				KegLauncher.Card = card;
			});
			CustomCard.BuildCard<CoinFlip>((Action<CardInfo>)delegate(CardInfo card)
			{
				CoinFlip.Card = card;
			});
			CustomCard.BuildCard<Flashbang>((Action<CardInfo>)delegate(CardInfo card)
			{
				Flashbang.Card = card;
			});
			CustomCard.BuildCard<StrengthInNumbers>((Action<CardInfo>)delegate(CardInfo card)
			{
				StrengthInNumbers.Card = card;
			});
			CustomCard.BuildCard<MeatBag>((Action<CardInfo>)delegate(CardInfo card)
			{
				MeatBag.Card = card;
			});
			CustomCard.BuildCard<Ninja>((Action<CardInfo>)delegate(CardInfo card)
			{
				Ninja.Card = card;
			});
			CustomCard.BuildCard<TrollRegeneration>((Action<CardInfo>)delegate(CardInfo card)
			{
				TrollRegeneration.Card = card;
			});
			CustomCard.BuildCard<PunchyBullets>((Action<CardInfo>)delegate(CardInfo card)
			{
				PunchyBullets.Card = card;
			});
			CustomCard.BuildCard<HotPotato>((Action<CardInfo>)delegate(CardInfo card)
			{
				HotPotato.Card = card;
			});
			CustomCard.BuildCard<SecondWind>((Action<CardInfo>)delegate(CardInfo card)
			{
				SecondWind.Card = card;
			});
			CustomCard.BuildCard<DoubleTap>((Action<CardInfo>)delegate(CardInfo card)
			{
				DoubleTap.Card = card;
			});
			CustomCard.BuildCard<SugarRush>((Action<CardInfo>)delegate(CardInfo card)
			{
				SugarRush.Card = card;
			});
			CustomCard.BuildCard<BigMag>((Action<CardInfo>)delegate(CardInfo card)
			{
				BigMag.Card = card;
			});
			CustomCard.BuildCard<IronWill>((Action<CardInfo>)delegate(CardInfo card)
			{
				IronWill.Card = card;
			});
			CustomCard.BuildCard<GiantSlayer>((Action<CardInfo>)delegate(CardInfo card)
			{
				GiantSlayer.Card = card;
			});
			if (((BaseUnityPlugin)this).Config.Bind<bool>("Testing", "SandboxTestKeys", false, "Sandbox only: Tab opens the card menu (left-click a card to get it), F9 removes your cards, F10 spawns a dummy, F11 spawns a bot.").Value)
			{
				((Component)this).gameObject.AddComponent<TestTools>();
			}
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)RoundBonus.OnRoundEnd);
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)RoundBonus.OnRoundEnd);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)Copycat.OnGameStart);
			GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)Copycat.OnPickEnd);
			GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)CoinFlip.OnRoundStart);
			GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)StrengthInNumbers.OnRoundStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Vanish.OnPointEnd);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)BigBoned.OnPointStart);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)HotPotato.OnPointStart);
			GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)SugarRush.OnBattleStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)HotPotato.OnPointEnd);
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)HotPotato.OnPointEnd);
		}
	}
	public static class Minions
	{
		private const float PinTime = 0.6f;

		public static void Spawn(Player owner, int teamId, float maxHealth, Func<Vector3> where, Action<Player> ready)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			PlayerFace val = OwnFace(owner);
			AIMinionHandler.CreateAIWithStats(true, owner.playerID, teamId, PhotonNetwork.LocalPlayer.ActorNumber, (AISkill)0, (AIAggression)1, (AI)0, (float?)maxHealth, (BlockModifier)null, (GunAmmoStatModifier)null, (GunStatModifier)null, (CharacterStatModifiersModifier)null, (GravityModifier)null, (List<Type>)null, (List<CardInfo>)null, false, (SpawnLocation)3, val?.eyeID ?? 0, val?.eyeOffset ?? Vector2.zero, val?.mouthID ?? 0, val?.mouthOffset ?? Vector2.zero, val?.detailID ?? 0, val?.detailOffset ?? Vector2.zero, val?.detail2ID ?? 0, val?.detail2Offset ?? Vector2.zero, true, (Func<int, int, IEnumerator>)null, (Action<int, int>)delegate(int minionId, int actorId)
			{
				Player playerWithActorAndPlayerIDs = FindPlayer.GetPlayerWithActorAndPlayerIDs(actorId, minionId);
				if ((Object)(object)playerWithActorAndPlayerIDs == (Object)null)
				{
					JeusticeChaos.Log.LogWarning((object)$"Minion {minionId} not found after spawning");
				}
				else
				{
					NetworkingManager.RPC(typeof(Minions), "RPCA_Ready", new object[2]
					{
						playerWithActorAndPlayerIDs.data.view.ViewID,
						maxHealth
					});
					((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(Pin(playerWithActorAndPlayerIDs, where, ready));
				}
			});
		}

		private static IEnumerator Pin(Player minion, Func<Vector3> where, Action<Player> ready)
		{
			for (float t = 0f; t < 0.6f; t += Time.deltaTime)
			{
				if (!((Object)(object)minion != (Object)null))
				{
					break;
				}
				((Component)minion).transform.position = where();
				Traverse.Create((object)minion.data.playerVel).Field("velocity").SetValue((object)Vector2.zero);
				yield return null;
			}
			if ((Object)(object)minion != (Object)null)
			{
				ready?.Invoke(minion);
			}
		}

		private static PlayerFace OwnFace(Player owner)
		{
			try
			{
				return CharacterCreatorHandler.instance.selectedPlayerFaces[PhotonNetwork.OfflineMode ? owner.playerID : 0];
			}
			catch (Exception)
			{
				return null;
			}
		}

		[UnboundRPC]
		private static void RPCA_Ready(int viewId, float maxHealth)
		{
			PhotonView val = PhotonView.Find(viewId);
			Player val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<Player>() : null);
			if (!((Object)(object)val2 == (Object)null))
			{
				RemoveBrain(val2);
				val2.data.input.controlledElseWhere = true;
				val2.data.maxHealth = maxHealth;
				val2.data.health = maxHealth;
				PlayerAssigner.instance.players.Remove(val2.data);
			}
		}

		private static void RemoveBrain(Player minion)
		{
			MonoBehaviour[] componentsInChildren = ((Component)minion).GetComponentsInChildren<MonoBehaviour>(true);
			foreach (MonoBehaviour val in componentsInChildren)
			{
				if (((object)val).GetType().Name.StartsWith("PlayerAI") && !(val is PlayerAPI))
				{
					Object.Destroy((Object)(object)val);
				}
			}
		}

		public static bool IsMinion(Player player)
		{
			if ((Object)(object)player != (Object)null)
			{
				return CharacterDataExtension.GetAdditionalData(player.data).isAIMinion;
			}
			return false;
		}
	}
	internal static class Sounds
	{
		public static AudioClip Earthquake { get; private set; }

		public static AudioClip Flashbang { get; private set; }

		public static AudioClip Slash { get; private set; }

		public static IEnumerator LoadAll(string folder)
		{
			yield return Load(Path.Combine(folder, "Earthquake.ogg"), delegate(AudioClip clip)
			{
				Earthquake = clip;
			});
			yield return Load(Path.Combine(folder, "Flashbang.ogg"), delegate(AudioClip clip)
			{
				Flashbang = clip;
			});
			yield return Load(Path.Combine(folder, "Slash.ogg"), delegate(AudioClip clip)
			{
				Slash = clip;
			});
		}

		private static IEnumerator Load(string path, Action<AudioClip> done)
		{
			if (!File.Exists(path))
			{
				JeusticeChaos.Log.LogWarning((object)("Sound not found: " + path));
				yield break;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file:///" + path.Replace('\\', '/'), (AudioType)14);
			try
			{
				yield return request.SendWebRequest();
				if (request.isNetworkError || request.isHttpError)
				{
					JeusticeChaos.Log.LogWarning((object)("Could not load sound " + path + ": " + request.error));
					yield break;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(request);
				((Object)content).name = Path.GetFileNameWithoutExtension(path);
				done(content);
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		public static void Play(AudioClip clip, Vector2 position, float pitch, float volume = 1f)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			if (!((Object)(object)clip == (Object)null))
			{
				GameObject val = new GameObject("Sound " + ((Object)clip).name);
				val.transform.position = Vector2.op_Implicit(position);
				AudioSource obj = val.AddComponent<AudioSource>();
				obj.clip = clip;
				obj.spatialBlend = 0f;
				obj.volume = Mathf.Clamp01(volume * Optionshandler.vol_Master * Optionshandler.vol_Sfx);
				obj.pitch = pitch;
				obj.Play();
				Object.Destroy((Object)val, clip.length / Mathf.Max(0.1f, pitch) + 0.1f);
			}
		}
	}
	public class TestTools : MonoBehaviour
	{
		private bool _menuOpen;

		internal static bool InSandbox
		{
			get
			{
				if ((Object)(object)GM_Test.instance != (Object)null)
				{
					return ((Component)GM_Test.instance).gameObject.activeInHierarchy;
				}
				return false;
			}
		}

		private static Player Me => ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.data.view.IsMine && !p.data.dead && !CharacterDataExtension.GetAdditionalData(p.data).isAIMinion));

		private void Update()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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_0153: 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)
			if (!InSandbox)
			{
				if (_menuOpen)
				{
					CloseMenu();
				}
			}
			else
			{
				if (DevConsole.isTyping)
				{
					return;
				}
				if (Input.GetKeyDown((KeyCode)9))
				{
					if (_menuOpen)
					{
						CloseMenu();
					}
					else
					{
						OpenMenu();
					}
				}
				Player me = Me;
				if ((Object)(object)me == (Object)null || _menuOpen)
				{
					return;
				}
				if (Input.GetKeyDown((KeyCode)290))
				{
					JeusticeChaos.Log.LogInfo((object)"Test: removing all cards");
					Cards.instance.RemoveAllCardsFromPlayer(me, true);
				}
				if (Input.GetKeyDown((KeyCode)291))
				{
					JeusticeChaos.Log.LogInfo((object)"Test: spawning a dummy");
					Vector3 at = ((Component)me).transform.position + Vector3.right * 6f;
					Minions.Spawn(me, me.teamID + 1, me.data.maxHealth, () => at, null);
				}
				if (Input.GetKeyDown((KeyCode)292))
				{
					JeusticeChaos.Log.LogInfo((object)"Test: spawning a bot");
					AIMinionHandler.CreateAIWithStats(true, me.playerID, me.teamID + 1, PhotonNetwork.LocalPlayer.ActorNumber, (AISkill)2, (AIAggression)2, (AI)1, (float?)null, (BlockModifier)null, (GunAmmoStatModifier)null, (GunStatModifier)null, (CharacterStatModifiersModifier)null, (GravityModifier)null, (List<Type>)null, (List<CardInfo>)null, false, (SpawnLocation)6, 0, default(Vector2), 0, default(Vector2), 0, default(Vector2), 0, default(Vector2), true, (Func<int, int, IEnumerator>)null, (Action<int, int>)null);
				}
			}
		}

		private void OpenMenu()
		{
			Action[] array = ((IEnumerable<GameObject>)ToggleCardsMenuHandler.cardObjs.Keys.ToList()).Select((Func<GameObject, Action>)delegate(GameObject obj)
			{
				string name = ((Object)obj).name;
				return delegate
				{
					Give(name);
				};
			}).ToArray();
			ToggleCardsMenuHandler.Open(true, true, array, (string[])null);
			_menuOpen = true;
		}

		private void CloseMenu()
		{
			ToggleCardsMenuHandler.Close();
			_menuOpen = false;
		}

		private static void Give(string cardName)
		{
			CardInfo cardInfoWithName = CardManager.GetCardInfoWithName(cardName);
			Player me = Me;
			if (!((Object)(object)cardInfoWithName == (Object)null) && !((Object)(object)me == (Object)null))
			{
				JeusticeChaos.Log.LogInfo((object)$"Test: giving {cardInfoWithName.cardName} to player {me.playerID} (card menu)");
				Cards.instance.AddCardToPlayer(me, cardInfoWithName, false, "", 0f, 0f, true);
			}
		}
	}
	public static class SharedRandom
	{
		public static float Roll(float seed, int salt)
		{
			int num = BitConverter.ToInt32(BitConverter.GetBytes(seed), 0) ^ (int)(salt * 2654435769u);
			int num2 = (num ^ (num >>> 16)) * 2146121005;
			int num3 = (num2 ^ (num2 >>> 15)) * -2073254261;
			return (float)(uint)((num3 ^ (num3 >>> 16)) & 0xFFFFFF) / 16777216f;
		}
	}
	public static class PlayerDps
	{
		public const float BaseBulletDamage = 55f;

		public const float Base = 70f;

		public static float Estimate(Player player)
		{
			Gun val = (((Object)(object)player != (Object)null) ? player.data.weaponHandler.gun : null);
			if ((Object)(object)val == (Object)null)
			{
				return 70f;
			}
			GunAmmo componentInChildren = ((Component)val).GetComponentInChildren<GunAmmo>();
			float num = 55f * val.damage * val.bulletDamageMultiplier * (float)Mathf.Max(1, val.numberOfProjectiles) * (float)Mathf.Max(1, val.bursts);
			float num2 = val.attackSpeed / Mathf.Max(0.01f, val.attackSpeedMultiplier);
			int num3 = (((Object)(object)componentInChildren != (Object)null) ? Mathf.Max(1, componentInChildren.maxAmmo) : 3);
			float num4 = (((Object)(object)componentInChildren != (Object)null) ? ((componentInChildren.reloadTime + componentInChildren.reloadTimeAdd) * componentInChildren.reloadTimeMultiplier) : 1.5f);
			float num5 = Mathf.Max(0.05f, (float)num3 * num2 + num4);
			return Mathf.Max(0f, (float)num3 * num / num5);
		}
	}
	public static class BulletLook
	{
		public static void Paint(GameObject bullet, Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ac: 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_00e0: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			SpawnedAttack component = bullet.GetComponent<SpawnedAttack>();
			if ((Object)(object)component != (Object)null)
			{
				component.SetColor(color);
			}
			SpriteRenderer[] componentsInChildren = bullet.GetComponentsInChildren<SpriteRenderer>(true);
			foreach (SpriteRenderer val in componentsInChildren)
			{
				val.color = new Color(color.r, color.g, color.b, val.color.a);
			}
			TrailRenderer[] componentsInChildren2 = bullet.GetComponentsInChildren<TrailRenderer>(true);
			foreach (TrailRenderer val2 in componentsInChildren2)
			{
				val2.startColor = new Color(color.r, color.g, color.b, val2.startColor.a);
				val2.endColor = new Color(color.r, color.g, color.b, val2.endColor.a);
			}
			LineRenderer[] componentsInChildren3 = bullet.GetComponentsInChildren<LineRenderer>(true);
			foreach (LineRenderer val3 in componentsInChildren3)
			{
				val3.startColor = new Color(color.r, color.g, color.b, val3.startColor.a);
				val3.endColor = new Color(color.r, color.g, color.b, val3.endColor.a);
			}
			ParticleSystem[] componentsInChildren4 = bullet.GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren4.Length; i++)
			{
				MainModule main = componentsInChildren4[i].main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
			}
		}

		public static void Scale(GameObject bullet, float factor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = bullet.transform;
			transform.localScale *= factor;
			TrailRenderer[] componentsInChildren = bullet.GetComponentsInChildren<TrailRenderer>(true);
			foreach (TrailRenderer obj in componentsInChildren)
			{
				obj.widthMultiplier *= factor;
			}
			LineRenderer[] componentsInChildren2 = bullet.GetComponentsInChildren<LineRenderer>(true);
			foreach (LineRenderer obj2 in componentsInChildren2)
			{
				obj2.widthMultiplier *= factor;
			}
		}
	}
	public static class Smoke
	{
		private static Material _material;

		private static Material Material
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				//IL_0041: Expected O, but got Unknown
				if ((Object)(object)_material == (Object)null)
				{
					GameObject val = new GameObject("material probe");
					_material = new Material(((Renderer)val.AddComponent<SpriteRenderer>()).sharedMaterial)
					{
						mainTexture = (Texture)(object)Sprites.Circle.texture
					};
					Object.Destroy((Object)val);
				}
				return _material;
			}
		}

		public static void Puff(Vector3 position, float size = 1f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01b2: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: 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)
			GameObject val = new GameObject("Smoke puff");
			val.transform.position = position;
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).duration = 0.2f;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1.1f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(1.5f * size, 4.5f * size);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.9f * size, 1.8f * size);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.55f, 0.55f, 0.6f, 0.85f), new Color(0.8f, 0.8f, 0.85f, 0.85f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)2;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
			{
				new Burst(0f, (short)28)
			});
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = 0.6f * size;
			SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.7f, 1f, 1.6f));
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.8f, 0.3f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val2.limitVelocityOverLifetime;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0.5f);
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.15f;
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).material = Material;
			((Renderer)component).sortingOrder = 50;
			val2.Play();
		}
	}
	public class Ghosting
	{
		private readonly List<Renderer> _parts = new List<Renderer>();

		public Ghosting(IEnumerable<Transform> roots)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			foreach (Transform root in roots)
			{
				Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val in componentsInChildren)
				{
					if (val.enabled && !(val is SpriteMask))
					{
						ParticleSystemRenderer val2 = (ParticleSystemRenderer)(object)((val is ParticleSystemRenderer) ? val : null);
						if (val2 == null || (int)val2.maskInteraction == 1)
						{
							_parts.Add(val);
						}
					}
				}
			}
			Apply();
		}

		public void Apply()
		{
			bool enabled = Time.frameCount % 2 == 0;
			foreach (Renderer part in _parts)
			{
				if ((Object)(object)part != (Object)null)
				{
					part.enabled = enabled;
				}
			}
		}

		public void Restore()
		{
			foreach (Renderer part in _parts)
			{
				if ((Object)(object)part != (Object)null)
				{
					part.enabled = true;
				}
			}
		}
	}
	public static class Sprites
	{
		private static Sprite _circle;

		private static Sprite _ring;

		private static Sprite _square;

		public static Sprite Circle => _circle ?? (_circle = Make(ring: false));

		public static Sprite Ring => _ring ?? (_ring = Make(ring: true));

		public static Sprite Square
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				//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_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_square == (Object)null)
				{
					Texture2D val = new Texture2D(4, 4, (TextureFormat)4, false);
					Color[] array = (Color[])(object)new Color[16];
					for (int i = 0; i < array.Length; i++)
					{
						array[i] = Color.white;
					}
					val.SetPixels(array);
					val.Apply();
					_square = Sprite.Create(val, new Rect(0f, 0f, 4f, 4f), new Vector2(0.5f, 0.5f), 4f);
				}
				return _square;
			}
		}

		private static Sprite Make(bool ring)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			float num = 64f;
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num)) / num;
					float num3 = Mathf.Clamp01((1f - num2) * 128f / 2f);
					if (ring)
					{
						num3 *= Mathf.Clamp01((num2 - 0.8f) * 128f / 2f);
					}
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 128f);
		}

		public static SpriteRenderer Create(string name, Sprite sprite, Vector3 position, float diameter, Color color, int order = 10)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.position = position;
			val.transform.localScale = Vector3.one * diameter;
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			obj.color = color;
			((Renderer)obj).sortingOrder = order;
			return obj;
		}
	}
}
namespace JeusticeChaos.Effects
{
	[HarmonyPatch(typeof(Gun), "BulletInit")]
	internal static class BulletPatch
	{
		private const int RouletteSalt = 1;

		private const int DiscoSpeedSalt = 2;

		private const int DiscoColorSalt = 3;

		private static void Postfix(Gun __instance, GameObject bullet, int usedNumberOfProjectiles, float damageM, float randomSeed)
		{
			//IL_0085: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			ProjectileHit component = bullet.GetComponent<ProjectileHit>();
			Player val = (((Object)(object)component != (Object)null) ? component.ownPlayer : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			if (ChaosCard.Count(val, DiscoRounds.Card) > 0)
			{
				MoveTransform component2 = bullet.GetComponent<MoveTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					float num = 0.3f * Mathf.Pow(10f, SharedRandom.Roll(randomSeed, 2));
					component2.localForce *= num;
				}
				BulletLook.Paint(bullet, Color.HSVToRGB(SharedRandom.Roll(randomSeed, 3), 0.85f, 1f));
			}
			int num2 = ChaosCard.Count(val, RussianRoulette.Card);
			bool flag = false;
			for (int i = 0; i < num2; i++)
			{
				if (SharedRandom.Roll(randomSeed, 1 + 100 * i) < 0.15f)
				{
					component.damage *= 4f;
					flag = true;
				}
			}
			if (flag)
			{
				BulletLook.Paint(bullet, new Color(1f, 0.08f, 0.08f));
				BulletLook.Scale(bullet, 2f);
			}
			SnowballMono component3 = ((Component)val).GetComponent<SnowballMono>();
			if ((Object)(object)component3 != (Object)null && component3.Stacks > 0)
			{
				component.damage *= component3.DamageMultiplier;
				BulletLook.Scale(bullet, component3.LookScale);
			}
			KegLauncherMono component4 = ((Component)val).GetComponent<KegLauncherMono>();
			if ((Object)(object)component4 != (Object)null && component4.NextIsKeg())
			{
				KegBullet.Make(bullet);
			}
			VanishMono.OnShot(val);
		}
	}
	[HarmonyPatch(typeof(Player), "FullReset")]
	internal static class CardResetPatch
	{
		private static void Prefix(Player __instance)
		{
			Assembly ours = typeof(CardResetPatch).Assembly;
			List<MonoBehaviour> list = (from c in ((Component)__instance).GetComponentsInChildren<MonoBehaviour>(true)
				where (Object)(object)c != (Object)null && ((object)c).GetType().Assembly == ours
				select c).ToList();
			foreach (MonoBehaviour item in list)
			{
				if ((Object)(object)item != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)item);
				}
			}
			if (list.Count > 0)
			{
				JeusticeChaos.Log.LogInfo((object)$"Card reset: removed {list.Count} Jeustice Chaos effects from player {__instance.playerID}");
			}
		}
	}
	public class RoundBonus : ReversibleEffect
	{
		public int smartBounceAdd;

		public float ammoRegMult = 1f;

		private int _smartBounceDelta;

		private float _ammoRegDelta;

		public override void OnAwake()
		{
			((ReversibleEffect)this).SetLivesToEffect(int.MaxValue);
		}

		public override void OnStart()
		{
			_smartBounceDelta = smartBounceAdd;
			_ammoRegDelta = base.gunAmmo.ammoReg * (ammoRegMult - 1f);
			Gun gun = base.gun;
			gun.smartBounce += _smartBounceDelta;
			GunAmmo gunAmmo = base.gunAmmo;
			gunAmmo.ammoReg += _ammoRegDelta;
		}

		public void Revert()
		{
			((ReversibleEffect)this).ClearModifiers(true);
			Gun gun = base.gun;
			gun.smartBounce -= _smartBounceDelta;
			GunAmmo gunAmmo = base.gunAmmo;
			gunAmmo.ammoReg -= _ammoRegDelta;
			_smartBounceDelta = 0;
			_ammoRegDelta = 0f;
		}

		public override void OnOnDestroy()
		{
			Revert();
		}

		public static void ClearAll<T>() where T : RoundBonus
		{
			T[] array = Object.FindObjectsOfType<T>();
			foreach (T val in array)
			{
				val.Revert();
				Object.Destroy((Object)(object)val);
			}
		}

		internal static IEnumerator OnRoundEnd(IGameModeHandler gm)
		{
			ClearAll<RoundBonus>();
			yield break;
		}
	}
	[HarmonyPatch(typeof(CharacterStatModifiers), "ResetStats")]
	internal static class RoundBonusResetPatch
	{
		private static void Prefix(CharacterStatModifiers __instance)
		{
			RoundBonus[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<RoundBonus>();
			foreach (RoundBonus obj in componentsInChildren)
			{
				obj.Revert();
				Object.Destroy((Object)(object)obj);
			}
		}
	}
}
namespace JeusticeChaos.Cards
{
	public class BigBoned : ChaosCard
	{
		public static CardInfo Card;

		public const float SizeMultiplier = 1.6f;

		protected override string GetTitle()
		{
			return "Big Boned";
		}

		protected override string GetDescription()
		{
			return "Bigger is better: +1% HP and speed per 1% of extra size.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<BigBonedArt>("Big Boned art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)6;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				ChaosCard.Stat("Size", "+60%", positive: false),
				ChaosCard.Stat("HP", "+60%", positive: true),
				ChaosCard.Stat("Speed", "+60%", positive: true)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			statModifiers.sizeMultiplier = 1.6f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BigBonedMono orAddComponent = ExtensionMethods.GetOrAddComponent<BigBonedMono>(((Component)player).gameObject, false);
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)JeusticeChaos.Instance, 2, (Action)orAddComponent.Recalculate);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (ChaosCard.Count(player, Card) <= 1)
			{
				Object.Destroy((Object)(object)((Component)player).GetComponent<BigBonedMono>());
			}
		}

		internal static IEnumerator OnPointStart(IGameModeHandler gm)
		{
			BigBonedMono[] array = Object.FindObjectsOfType<BigBonedMono>();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Recalculate();
			}
			yield break;
		}
	}
	public class BigBonedMono : MonoBehaviour
	{
		private BigBonedBonus _bonus;

		public void Recalculate()
		{
			if (!((Object)(object)this == (Object)null))
			{
				if ((Object)(object)_bonus != (Object)null)
				{
					((ReversibleEffect)_bonus).Destroy();
				}
				CharacterStatModifiers component = ((Component)this).GetComponent<CharacterStatModifiers>();
				float num = Mathf.Max(0f, component.sizeMultiplier - 1f);
				_bonus = ((Component)this).gameObject.AddComponent<BigBonedBonus>();
				((ReversibleEffect)_bonus).SetLivesToEffect(int.MaxValue);
				((ReversibleEffect)_bonus).characterDataModifier.maxHealth_mult = 1f + num;
				((ReversibleEffect)_bonus).characterStatModifiersModifier.movementSpeed_mult = 1f + num;
				JeusticeChaos.Log.LogInfo((object)$"Big Boned: player {((Component)this).GetComponent<Player>().playerID} extra size {num:P0} -> +{num:P0} HP and speed");
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_bonus != (Object)null)
			{
				((ReversibleEffect)_bonus).Destroy();
			}
		}
	}
	public class BigBonedBonus : ReversibleEffect
	{
	}
	public class BigMag : ChaosCard
	{
		public static CardInfo Card;

		protected override string GetTitle()
		{
			return "Big Mag";
		}

		protected override string GetDescription()
		{
			return "More bullets, longer reload.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<BigMagArt>("Big Mag art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)0;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				ChaosCard.Stat("Ammo", "+6", positive: true),
				ChaosCard.Stat("Reload speed", "-25%", positive: false)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			gun.ammo = 6;
			gun.reloadTime = 1.3333334f;
		}
	}
	public class CoinFlip : ChaosCard
	{
		public static CardInfo Card;

		public const float HeadsDamage = 1.6f;

		public const float TailsHealth = 0.6f;

		protected override string GetTitle()
		{
			return "Coin Flip";
		}

		protected override string GetDescription()
		{
			return "Flip a coin each round. Extra copies stack on the same flip.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<CoinFlipArt>("Coin Flip art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)0;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				ChaosCard.Stat("Heads", "+60% DMG", positive: true),
				ChaosCard.Stat("Tails", "-40% HP", positive: false)
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (TestTools.InSandbox)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)JeusticeChaos.Instance, 2, (Action)delegate
				{
					NetworkingManager.RPC(typeof(CoinFlip), "RPCA_Flip", new object[3]
					{
						player.playerID,
						Random.value < 0.5f,
						ChaosCard.Count(player, Card)
					});
				});
			}
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (ChaosCard.Count(player, Card) <= 1)
			{
				Object.Destroy((Object)(object)((Component)player).GetComponent<CoinFlipBonus>());
			}
		}

		internal static IEnumerator OnRoundStart(IGameModeHandler gm)
		{
			if (!PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode)
			{
				yield break;
			}
			foreach (Player player in PlayerManager.instance.players)
			{
				int num = ChaosCard.Count(player, Card);
				if (num > 0)
				{
					NetworkingManager.RPC(typeof(CoinFlip), "RPCA_Flip", new object[3]
					{
						player.playerID,
						Random.value < 0.5f,
						num
					});
				}
			}
		}

		[UnboundRPC]
		private static void RPCA_Flip(int playerId, bool heads, int copies)
		{
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
			if (!((Object)(object)val == (Object)null))
			{
				CoinFlipBonus component = ((Component)val).GetComponent<CoinFlipBonus>();
				if ((Object)(object)component != (Object)null)
				{
					component.Revert();
					Object.Destroy((Object)(object)component);
				}
				CoinFlipBonus coinFlipBonus = ((Component)val).gameObject.AddComponent<CoinFlipBonus>();
				if (heads)
				{
					((ReversibleEffect)coinFlipBonus).gunStatModifier.damage_mult = Mathf.Pow(1.6f, (float)copies);
				}
				else
				{
					((ReversibleEffect)coinFlipBonus).characterDataModifier.maxHealth_mult = Mathf.Pow(0.6f, (float)copies);
				}
				JeusticeChaos.Log.LogInfo((object)string.Format("Coin Flip: player {0} got {1} ({2} copies)", playerId, heads ? "heads" : "tails", copies));
				((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(Popup(val, heads));
			}
		}

		private static IEnumerator Popup(Player player, bool heads)
		{
			Sprite result = CardArt.Sprite(heads ? "coin_heads" : "coin_tails");
			Sprite other = CardArt.Sprite(heads ? "coin_tails" : "coin_heads");
			SpriteRenderer coin = Sprites.Create("Coin Flip coin", result, ((Component)player).transform.position, 1f, Color.white, 100);
			float num;
			if (!((Object)(object)result != (Object)null))
			{
				num = 1.8f;
			}
			else
			{
				Bounds bounds = result.bounds;
				num = 1.8f / ((Bounds)(ref bounds)).size.x;
			}
			float baseScale = num;
			for (float t = 0f; t < 3.1000001f; t += Time.deltaTime)
			{
				if ((Object)(object)player == (Object)null)
				{
					break;
				}
				float num2 = Mathf.Clamp01(t / 1.1f);
				float num3 = Mathf.Cos((1f - (1f - num2) * (1f - num2)) * 5f * 2f * MathF.PI);
				float num4 = Mathf.Sin(num2 * MathF.PI) * 0.8f;
				coin.sprite = ((num3 >= 0f) ? result : other);
				float num5 = ((t > 1.1f) ? (1f + 0.25f * Mathf.Exp(-8f * (t - 1.1f)) * Mathf.Sin(18f * (t - 1.1f))) : 1f);
				((Component)coin).transform.position = ((Component)player).transform.position + Vector3.up * (3.2f + num4);
				((Component)coin).transform.localScale = new Vector3(baseScale * Mathf.Max(0.05f, Mathf.Abs(num3)) * num5, baseScale * num5, 1f);
				coin.color = new Color(1f, 1f, 1f, Mathf.Clamp01((3.1000001f - t) / 0.4f));
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)coin).gameObject);
		}
	}
	public class CoinFlipBonus : RoundBonus
	{
	}
	public class Copycat : ChaosCard
	{
		public static CardInfo Card;

		private static readonly Dictionary<int, int> Stolen = new Dictionary<int, int>();

		private static bool IsHost
		{
			get
			{
				if (!PhotonNetwork.IsMasterClient)
				{
					return PhotonNetwork.OfflineMode;
				}
				return true;
			}
		}

		protected override string GetTitle()
		{
			return "Copycat";
		}

		protected override string GetDescription()
		{
			return "Steal a random card from an opponent. It's yours for good.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<CopycatArt>("Copycat art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[1] { ChaosCard.Stat("Cards", "+1 stolen", positive: true) };
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (TestTools.InSandbox && IsHost)
			{
				((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(StealPending(player));
			}
		}

		internal static IEnumerator OnGameStart(IGameModeHandler gm)
		{
			Stolen.Clear();
			yield break;
		}

		internal static IEnumerator OnPickEnd(IGameModeHandler gm)
		{
			if (!IsHost)
			{
				yield break;
			}
			foreach (Player item in PlayerManager.instance.players.ToList())
			{
				yield return StealPending(item);
			}
		}

		private static IEnumerator StealPending(Player thief)
		{
			yield return null;
			Stolen.TryGetValue(thief.playerID, out var done);
			int pending = ChaosCard.Count(thief, Card) - done;
			for (int i = 0; i < pending; i++)
			{
				done = (Stolen[thief.playerID] = done + 1);
				List<(Player, CardInfo)> list = (from x in PlayerManager.instance.players.Where((Player p) => p.teamID != thief.teamID).SelectMany((Player p) => from c in p.data.currentCards
						where (Object)(object)c != (Object)null
						select (victim: p, card: c))
					where ((Object)x.card).name != ((Object)Card).name && Cards.instance.PlayerIsAllowedCard(thief, x.card)
					select x).ToList();
				if (list.Count == 0)
				{
					JeusticeChaos.Log.LogInfo((object)$"Copycat: player {thief.playerID} found nothing to steal");
					continue;
				}
				var (val, card) = list[Random.Range(0, list.Count)];
				JeusticeChaos.Log.LogInfo((object)$"Copycat: player {thief.playerID} steals {card.cardName} from player {val.playerID}");
				Cards.instance.RemoveCardFromPlayer(val, card, (SelectionType)2, true);
				yield return (object)new WaitForSecondsRealtime(0.1f);
				Cards.instance.AddCardToPlayer(thief, card, false, "CC", 0f, 0f, true);
				yield return (object)new WaitForSecondsRealtime(0.1f);
			}
		}
	}
	public class DiscoRounds : ChaosCard
	{
		public static CardInfo Card;

		public const float MinSpeed = 0.3f;

		public const float MaxSpeed = 3f;

		protected override string GetTitle()
		{
			return "Disco Rounds";
		}

		protected override string GetDescription()
		{
			return "Every bullet gets a random color and speed.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<DiscoRoundsArt>("Disco Rounds art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)0;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)8;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				ChaosCard.Stat("Damage", "+10%", positive: true),
				ChaosCard.Stat("Bullet speed", "30-300%", positive: true)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			gun.damage = 1.1f;
		}
	}
	public class DoubleTap : ChaosCard
	{
		public static CardInfo Card;

		public const float Chance = 0.25f;

		public const float Delay = 0.1f;

		protected override string GetTitle()
		{
			return "Double Tap";
		}

		protected override string GetDescription()
		{
			return "25% chance to fire a free extra shot.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<DoubleTapArt>("Double Tap art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[4]
			{
				ChaosCard.Stat("Free shot", "25%", positive: true),
				ChaosCard.Stat("Ammo", "+3", positive: true),
				ChaosCard.Stat("ATKSPD", "+25%", positive: true),
				ChaosCard.Stat("Damage", "-10%", positive: false)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			gun.ammo = 3;
			gun.attackSpeed = 0.8f;
			gun.damage = 0.9f;
		}
	}
	[HarmonyPatch(typeof(Gun), "Attack")]
	internal static class DoubleTapPatch
	{
		private static readonly FieldRef<Gun, float> SinceAttack = AccessTools.FieldRefAccess<Gun, float>("sinceAttack");

		private static void Postfix(Gun __instance, bool __result, bool forceAttack)
		{
			if (!__result || forceAttack || (Object)(object)__instance.player == (Object)null || !__instance.player.data.view.IsMine)
			{
				return;
			}
			int num = ChaosCard.Count(__instance.player, DoubleTap.Card);
			for (int i = 0; i < num; i++)
			{
				if (Random.value < 0.25f)
				{
					((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(ExtraShot(__instance, 0.1f * (float)(i + 1)));
				}
			}
		}

		private static IEnumerator ExtraShot(Gun gun, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if (!((Object)(object)gun == (Object)null) && !((Object)(object)gun.player == (Object)null) && !gun.player.data.dead)
			{
				float num = SinceAttack.Invoke(gun);
				((Weapon)gun).Attack(0f, true, 1f, 1f, false);
				SinceAttack.Invoke(gun) = num;
			}
		}
	}
	public class Earthquake : ChaosCard
	{
		public static CardInfo Card;

		public const float Window = 4f;

		public const float Cooldown = 6f;

		public const float GravityMultiplier = 2f;

		public const float DpsMultiplier = 2f;

		public const float MinRadius = 2f;

		public const float MaxRadius = 14f;

		public const float RadiusPerFallUnit = 0.48f;

		public const float KnockUpSpeed = 40f;

		public const float ObjectForce = 2500f;

		public const float MaxObjectForce = 12000f;

		protected override string GetTitle()
		{
			return "Earthquake";
		}

		protected override string GetDescription()
		{
			return "Block: +100% gravity, and landing makes a quake. Bigger fall, bigger quake.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<EarthquakeArt>("Earthquake art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)6;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[4]
			{
				ChaosCard.Stat("Damage", "+30%", positive: true),
				ChaosCard.Stat("Quake", "200% DPS", positive: true),
				ChaosCard.Stat("Window", "4s", positive: true),
				ChaosCard.Stat("Cooldown", "6s", positive: false)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			gun.damage = 1.3f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<EarthquakeMono>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (ChaosCard.Count(player, Card) <= 1)
			{
				Object.Destroy((Object)(object)((Component)player).GetComponent<EarthquakeMono>());
			}
		}
	}
	public class EarthquakeMono : MonoBehaviour
	{
		private Player _player;

		private float _armedUntil = -1f;

		private float _readyAt;

		private float _gravityAdded;

		private bool _wasGrounded = true;

		private float _highestY;

		private bool Armed => Time.time < _armedUntil;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			Block block = _player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}

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

		private void OnBlock(BlockTriggerType trigger)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (_player.data.view.IsMine && !(Time.time < _readyAt))
			{
				_readyAt = Time.time + 6f;
				_armedUntil = Time.time + 4f;
				_highestY = ((Component)_player).transform.position.y;
				if (_gravityAdded == 0f)
				{
					_gravityAdded = ((Component)_player.data).GetComponent<Gravity>().gravityForce * 1f;
					Gravity component = ((Component)_player.data).GetComponent<Gravity>();
					component.gravityForce += _gravityAdded;
				}
			}
		}

		private void Disarm()
		{
			_armedUntil = -1f;
			if (_gravityAdded != 0f && (Object)(object)_player != (Object)null)
			{
				Gravity component = ((Component)_player.data).GetComponent<Gravity>();
				component.gravityForce -= _gravityAdded;
			}
			_gravityAdded = 0f;
		}

		private void Update()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_player == (Object)null || !_player.data.view.IsMine)
			{
				return;
			}
			bool isGrounded = _player.data.isGrounded;
			if (!Armed)
			{
				if (_gravityAdded != 0f)
				{
					Disarm();
				}
				_wasGrounded = isGrounded;
				return;
			}
			if (_player.data.dead)
			{
				Disarm();
				return;
			}
			float y = ((Component)_player).transform.position.y;
			if (!isGrounded)
			{
				_highestY = Mathf.Max(_highestY, y);
			}
			else if (!_wasGrounded)
			{
				float num = Mathf.Max(0f, _highestY - y);
				float num2 = Mathf.Clamp(2f + num * 0.48f, 2f, 14f);
				float num3 = PlayerDps.Estimate(_player);
				float num4 = num3 * 2f * (float)ChaosCard.Count(_player, Earthquake.Card);
				Vector2 val = Vector2.op_Implicit(((Component)_player).transform.position);
				JeusticeChaos.Log.LogInfo((object)$"Earthquake by player {_player.playerID}: fall {num:F1}, radius {num2:F1}, damage {num4:F0}, DPS {num3:F0}");
				NetworkingManager.RPC(typeof(EarthquakeMono), "RPCA_Quake", new object[5] { _player.playerID, val, num4, num2, num3 });
				Disarm();
			}
			if (isGrounded)
			{
				_highestY = y;
			}
			_wasGrounded = isGrounded;
		}

		[UnboundRPC]
		private static void RPCA_Quake(int playerId, Vector2 center, float damage, float radius, float dps)
		{
			//IL_0028: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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)
			ShakeObjects(PlayerManager.instance.players.Find((Player p) => p.playerID == playerId), center, damage, radius, dps);
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
			((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(Shockwave(center, radius));
			float num = Mathf.InverseLerp(2f, 14f, radius);
			Sounds.Play(Sounds.Earthquake, center, Mathf.Lerp(1.1f, 0.9f, num));
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!((Object)(object)player == (Object)(object)val) && !player.data.dead && player.data.view.IsMine)
				{
					float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), center);
					if (!(num2 > radius))
					{
						float num3 = Mathf.Lerp(1f, 0.5f, num2 / radius);
						((Damagable)player.data.healthHandler).CallTakeDamage(Vector2.up * damage * num3, center, (GameObject)null, val, true);
						player.data.healthHandler.CallTakeForce(Vector2.up * 40f * num3 * 100f, (ForceMode2D)1, false, true, 0f);
					}
				}
			}
		}

		private static void ShakeObjects(Player owner, Vector2 center, float damage, float radius, float dps)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Min(2500f * dps / 70f, 12000f);
			HashSet<NetworkPhysicsObject> hashSet = new HashSet<NetworkPhysicsObject>();
			HashSet<DamagableEvent> hashSet2 = new HashSet<DamagableEvent>();
			Collider2D[] array = Physics2D.OverlapCircleAll(center, radius);
			foreach (Collider2D val in array)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null))
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)val).transform.position) - center;
					Vector2 val3 = ((Vector2)(ref val2)).normalized + Vector2.up;
					Vector2 normalized = ((Vector2)(ref val3)).normalized;
					Bounds bounds = val.bounds;
					float num2 = Mathf.Clamp01(1f - Vector2.Distance(center, Vector2.op_Implicit(((Bounds)(ref bounds)).ClosestPoint(Vector2.op_Implicit(center)))) / radius);
					DamagableEvent componentInParent = ((Component)val).GetComponentInParent<DamagableEvent>();
					if ((Object)(object)componentInParent != (Object)null && !componentInParent.dead && (Object)(object)owner != (Object)null && owner.data.view.IsMine && hashSet2.Add(componentInParent))
					{
						((Damagable)componentInParent).TakeDamage(normalized * damage * Mathf.Lerp(0.5f, 1f, num2), center, (GameObject)null, owner, true, false);
					}
					NetworkPhysicsObject componentInParent2 = ((Component)val).GetComponentInParent<NetworkPhysicsObject>();
					if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.photonView != (Object)null && componentInParent2.photonView.IsMine && hashSet.Add(componentInParent2))
					{
						componentInParent2.BulletPush(normalized * num * num2, Vector2.zero, (CharacterData)null);
					}
				}
			}
		}

		private static IEnumerator Shockwave(Vector2 center, float radius)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpriteRenderer ring = Sprites.Create("Earthquake shockwave", Sprites.Ring, Vector2.op_Implicit(center), 0.1f, new Color(0.65f, 0.45f, 0.2f, 0.9f));
			for (float t = 0f; t < 0.35f; t += Time.deltaTime)
			{
				float num = t / 0.35f;
				((Component)ring).transform.localScale = Vector3.one * Mathf.Lerp(1f, radius * 2f, Mathf.Sqrt(num));
				ring.color = new Color(0.65f, 0.45f, 0.2f, 0.9f * (1f - num));
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)ring).gameObject);
			try
			{
				GamefeelManager.GameFeel(Vector2.up * Mathf.Lerp(4f, 12f, radius / 14f));
			}
			catch
			{
			}
		}
	}
	public class Flashbang : ChaosCard
	{
		public static CardInfo Card;

		public const float Cooldown = 8f;

		public const float MoveSpeed = 1.25f;

		public const float BlindTime = 2f;

		public const float Radius = 8f;

		public const float MaxFlight = 2f;

		internal static float CooldownFor(Player player)
		{
			return 8f * Mathf.Pow(0.5f, (float)Mathf.Max(0, ChaosCard.Count(player, Card) - 1));
		}

		protected override string GetTitle()
		{
			return "Flashbang";
		}

		protected override string GetDescription()
		{
			return "Blocking throws a flashbang at your cursor. Anyone near the bang can't see, you too.";
		}

		protected override GameObject GetCardArt()
		{
			return CardArt.Template<FlashbangArt>("Flashbang art");
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		protected override CardInfoStat[] CardStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				ChaosCard.Stat("Speed", "+25%", positive: true),
				ChaosCard.Stat("Blind", "2s", positive: true),
				ChaosCard.Stat("Cooldown", "8s", positive: false)
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			statModifiers.movementSpeed = 1.25f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<FlashbangMono>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (ChaosCard.Count(player, Card) <= 1)
			{
				Object.Destroy((Object)(object)((Component)player).GetComponent<FlashbangMono>());
			}
		}
	}
	public class FlashbangMono : MonoBehaviour
	{
		private const float FallbackSpeed = 60f;

		private const float FallbackGravity = 30f;

		private static readonly Dictionary<string, FlashbangProjectile> Flying = new Dictionary<string, FlashbangProjectile>();

		private Player _player;

		private float _readyAt;

		private int _throws;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			Block block = _player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}

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

		private void OnBlock(BlockTriggerType trigger)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (_player.data.view.IsMine && !(Time.time < _readyAt) && !_player.data.dead)
			{
				_readyAt = Time.time + Flashbang.CooldownFor(_player);
				Vector2 val = Vector2.op_Implicit(_player.data.aimDirection);
				Vector2 val2 = ((((Vector2)(ref val)).sqrMagnitude > 0.01f) ? ((Vector2)(ref val)).normalized : Vector2.right);
				BaseBullet(_player.data.weaponHandler.gun, out var speed, out var gravity);
				NetworkingManager.RPC(typeof(FlashbangMono), "RPCA_Throw", new object[5]
				{
					_player.playerID,
					_throws++,
					Vector2.op_Implicit(((Component)_player).transform.position),
					val2 * speed,
					gravity
				});
			}
		}

		private static void BaseBullet(Gun gun, out float speed, out float gravity)
		{
			speed = 60f;
			gravity = 30f;
			GameObject val = (((Object)(object)gun != (Object)null && gun.projectiles != null && gun.projectiles.Length != 0) ? gun.projectiles[0].objectToSpawn : null);
			MoveTransform val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<MoveTransform>() : null);
			if ((Object)(object)val2 != (Object)null && ((Vector3)(ref val2.localForce)).magnitude > 1f)
			{
				speed = ((Vector3)(ref val2.localForce)).magnitude * val2.multiplier;
				gravity = val2.gravity * val2.multiplier * val2.multiplier;
			}
		}

		[UnboundRPC]
		private static void RPCA_Throw(int playerId, int throwId, Vector2 start, Vector2 velocity, float gravity)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//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_00de: Unknown result type (might be due to invalid IL or missing references)
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
			if (!((Object)(object)val == (Object)null))
			{
				Sprite val2 = CardArt.Sprite("flashbang");
				SpriteRenderer val3 = Sprites.Create("Flashbang picture", val2, Vector2.op_Implicit(start), 1f, Color.white, 60);
				Transform transform = ((Component)val3).transform;
				Vector3 one = Vector3.one;
				float num;
				if (!((Object)(object)val2 != (Object)null))
				{
					num = 1f;
				}
				else
				{
					Bounds bounds = val2.bounds;
					num = 1.1f / ((Bounds)(ref bounds)).size.y;
				}
				transform.localScale = one * num;
				GameObject val4 = new GameObject("Flashbang");
				val4.transform.position = Vector2.op_Implicit(start);
				((Component)val3).transform.SetParent(val4.transform, true);
				FlashbangProjectile flashbangProjectile = val4.AddComponent<FlashbangProjectile>();
				flashbangProjectile.Init(val, ((Component)val3).transform, velocity, gravity, $"{playerId}:{throwId}", throwId);
				Flying[flashbangProjectile.Key] = flashbangProjectile;
			}
		}

		[UnboundRPC]
		private static void RPCA_Bang(int playerId, string key, Vector2 at, float blindTime)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (Flying.TryGetValue(key, out var value))
			{
				Flying.Remove(key);
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)value).gameObject);
				}
			}
			Sounds.Play(Sounds.Flashbang, at, 1f);
			((MonoBehaviour)JeusticeChaos.Instance).StartCoroutine(Flash(at));
			foreach (Player player in PlayerManager.instance.players)
			{
				if (player.data.view.IsMine && !player.data.dead && !CharacterDataExtension.GetAdditionalData(player.data).isAIMinion && Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), at) <= 8f)
				{
					JeusticeChaos.Log.LogInfo((object)$"Flashbang: player {player.playerID} blinded for {blindTime}s");
					Whiteout.Show(blindTime);
				}
			}
		}

		internal static void Bang(FlashbangProjectile projectile, Vector2 at)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			float num = 2f;
			NetworkingManager.RPC(typeof(FlashbangMono), "RPCA_Bang", new object[4]
			{
				projectile.Owner.playerID,
				projectile.Key,
				at,
				num
			});
		}

		private static IEnumerator Flash(Vector2 center)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpriteRenderer disc = Sprites.Create("Flashbang flash", Sprites.Circle, Vector2.op_Implicit(center), 0.1f, new Color(1f, 1f, 1f, 0.8f), 55);
			for (float t = 0f; t < 0.3f; t += Time.deltaTime)
			{
				float num = t / 0.3f;
				((Component)disc).transform.localScale = Vector3.one * Mathf.Lerp(1f, 16f, Mathf.Sqrt(num));
				disc.color = new Color(1f, 1f, 1f, 0.8f * (1f - num));
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)disc).gameObject);
		}
	}
	public class FlashbangProjectile : MonoBehaviour
	{
		private const float OwnerGrace = 0.2f;

		private const float PlayerSweep = 0.45f;

		private Transform _picture;

		private int _mask;

		private int _playerMask;

		private Vector2 _velocity;

		private float _gravity;

		private float _age;

		private float _spin;

		private float _angle;

		private bool _stopped;

		public Player Owner { get; private set; }

		public string Key { get; private set; }

		public void Init(Player owner, Transform picture, Vector2 velocity, float gravity, string key, int seed)
		{
			//IL_0017: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			Owner = owner;
			Key = key;
			_picture = picture;
			_velocity = velocity;
			_gravity = gravity;
			_spin = ((seed % 2 == 0) ? 1f : (-1f)) * 720f;
			Gun gun = owner.data.weaponHandler.gun;
			GameObject val = (((Object)(object)gun != (Object)null && gun.projectiles != null && gun.projectiles.Length != 0) ? gun.projectiles[0].objectToSpawn : null);
			RayCastTrail val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<RayCastTrail>() : null);
			_mask = (((Object)(object)val2 != (Object)null) ? LayerMask.op_Implicit(val2.mask) : (-5));
			_playerMask = (((Object)(object)val2 != (Object)null) ? LayerMask.op_Implicit(val2.playerMask) : (-5));
			Face();
		}

		private void Face()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (((Vector2)(ref _velocity)).sqrMagnitude > 0.0001f)
			{
				((Component)this).transform.rotation = Quaternion.LookRotation(Vector2.op_Implicit(_velocity), Vector3.forward);
			}
			_picture.rotation = Quaternion.Euler(0f, 0f, _angle);
		}

		private void Update()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_00a2: 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)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			_age += Time.deltaTime;
			bool mine = (Object)(object)Owner != (Object)null && Owner.data.view.IsMine;
			if (_stopped)
			{
				if (_age > 5f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
			_velocity += Vector2.down * _gravity * Time.deltaTime;
			Vector2 val2 = val + _velocity * Time.deltaTime;
			((Component)this).transform.position = Vector2.op_Implicit(val2);
			_angle += _spin * Time.deltaTime;
			Face();
			if (TryHit(val, val2, out var point))
			{
				((Component)this).transform.position = Vector2.op_Implicit(point);
				Stop(mine, point);
			}
			else if (_age >= 2f)
			{
				Stop(mine, val2);
			}
		}

		private void Stop(bool mine, Vector2 at)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			_stopped = true;
			if (mine)
			{
				FlashbangMono.Bang(this, at);
			}
		}

		private bool TryHit(Vector2 from, Vector2 to, out Vector2 point)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Invalid comparison between Unknown and I4
			point = to;
			Vector2 val = to - from;
			float magnitude = ((Vector2)(ref val)).magnitude;
			if (magnitude <= 0f)
			{
				return false;
			}
			float num = float.MaxValue;
			RaycastHit2D[] array = Physics2D.RaycastAll(from, val, magnitude, _mask);
			RaycastHit2D[] array2 = Physics2D.CircleCastAll(from, 0.45f, val, magnitude, _playerMask);
			RaycastHit2D[][] array3 = new RaycastHit2D[2][] { array, array2 };
			foreach (RaycastHit2D[] array4 in array3)
			{
				for (int j = 0; j < array4.Length; j++)
				{
					RaycastHit2D val2 = array4[j];
					if (!RaycastHit2D.op_Implicit(val2) || (Object)(object)((Raycas