Decompiled source of EpicCards v1.0.12

BepInEx/plugins/Epicninjaman-EpicCards/EpicCards.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BossSlothsCards.Extensions;
using EpicCards.Cards;
using EpicCards.Effects;
using EpicCards.MonoBehaviours;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using Photon.Pun;
using UnboundLib;
using UnboundLib.Cards;
using UnityEngine;
using UnityEngine.Events;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public static class ExtensionMethods
{
	public static void RemovePlayerDiedAction(this PlayerManager pm, Action<Player, int> listener)
	{
		Action<Player, int> source = (Action<Player, int>)ExtensionMethods.GetFieldValue((object)pm, "PlayerDiedAction");
		source = (Action<Player, int>)Delegate.Remove(source, listener);
		ExtensionMethods.SetFieldValue((object)pm, "PlayerDiedAction", (object)source);
	}
}
namespace BossSlothsCards.Extensions
{
	public static class PlayerManagerExtension
	{
		public static Player GetRandomEnemy(this PlayerManager playerManager, Player player)
		{
			if (playerManager.players.Count == 1)
			{
				return null;
			}
			List<Player> list = new List<Player>(playerManager.players);
			Player[] playersInTeam = playerManager.GetPlayersInTeam(player.teamID);
			foreach (Player item in playersInTeam)
			{
				list.Remove(item);
			}
			return list[Random.Range(0, list.Count)];
		}

		public static Player GetPlayerWithID(this PlayerManager playerManager, int playerID)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			return (Player)typeof(PlayerManager).InvokeMember("GetPlayerWithID", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, playerManager, new object[1] { playerID });
		}
	}
}
namespace EpicCards
{
	internal class Assets
	{
		private static readonly AssetBundle Bundle = AssetUtils.LoadAssetBundleFromResources("epiccardsart", typeof(EpicCards).Assembly);

		private static readonly AssetBundle Bundle2 = AssetUtils.LoadAssetBundleFromResources("nodsgoofyaahcards", typeof(EpicCards).Assembly);

		public static GameObject GrowRayArt = Bundle.LoadAsset<GameObject>("C_GrowRay");

		public static GameObject AntManArt = Bundle2.LoadAsset<GameObject>("C_AntMan");

		public static GameObject CopyCatArt = Bundle.LoadAsset<GameObject>("C_CopyCat");

		public static GameObject MatrixArt = Bundle2.LoadAsset<GameObject>("C_Matrix");

		public static GameObject ConfettiPop = Bundle.LoadAsset<GameObject>("ConfettiPop");

		public static GameObject MatrixField = Bundle.LoadAsset<GameObject>("MatrixField");

		public static GameObject WallCardArt = Bundle.LoadAsset<GameObject>("C_WallCard");
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.epicninjaman.rounds.EpicCards", "EpicCards", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class EpicCards : BaseUnityPlugin
	{
		private const string ModId = "com.epicninjaman.rounds.EpicCards";

		private const string ModName = "EpicCards";

		public const string Version = "1.0.0";

		public const string ModInitials = "EC";

		public static EpicCards instance { get; private set; }

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

		private void Start()
		{
			CustomCard.BuildCard<CopyCat>();
			CustomCard.BuildCard<GrowRay>();
			CustomCard.BuildCard<ShrinkBlock>();
			CustomCard.BuildCard<WallCard>();
			instance = this;
		}
	}
}
namespace EpicCards.MonoBehaviours
{
	public class WallSpawner_Mono : MonoBehaviourPunCallbacks
	{
		private const int MaxWalls = 4;

		private List<List<int>> wallBoxes = new List<List<int>>();

		private bool canSpawn = true;

		private Coroutine cooldownCoroutine;

		public bool CanSpawn()
		{
			return canSpawn;
		}

		public void StartCooldown()
		{
			if (cooldownCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(cooldownCoroutine);
			}
			canSpawn = false;
			cooldownCoroutine = ((MonoBehaviour)this).StartCoroutine(CooldownRoutine());
		}

		private IEnumerator CooldownRoutine()
		{
			try
			{
				yield return (object)new WaitForSeconds(2f);
			}
			finally
			{
				canSpawn = true;
				cooldownCoroutine = null;
			}
		}

		public void ResetSpawnState()
		{
			if (cooldownCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(cooldownCoroutine);
				cooldownCoroutine = null;
			}
			canSpawn = true;
		}

		private void OnDisable()
		{
			ResetSpawnState();
		}

		[PunRPC]
		public void RPCA_DestroyExistingBoxes()
		{
			GameObject gameObject = ((Component)MapManager.instance.currentMap.Map).gameObject;
			if (wallBoxes.Count < 4)
			{
				return;
			}
			List<int> list = wallBoxes[wallBoxes.Count - 1];
			foreach (int item in list)
			{
				Transform child = gameObject.transform.GetChild(item);
				if ((Object)(object)child != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)child).gameObject);
				}
			}
			wallBoxes.RemoveAt(0);
		}

		[PunRPC]
		public void RPCA_Box(int childIndex)
		{
			GameObject gameObject = ((Component)MapManager.instance.currentMap.Map).gameObject;
			if (childIndex < 0 || childIndex >= gameObject.transform.childCount)
			{
				return;
			}
			Transform child = gameObject.transform.GetChild(childIndex);
			if ((Object)(object)child != (Object)null)
			{
				Rigidbody2D component = ((Component)child).GetComponent<Rigidbody2D>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.isKinematic = false;
					component.simulated = true;
				}
				BoxCollider2D component2 = ((Component)child).GetComponent<BoxCollider2D>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					((Behaviour)component2).enabled = true;
				}
				((Component)child).gameObject.SetActive(true);
			}
		}

		[PunRPC]
		public void RPCA_AddBoxIndex(int index)
		{
			if (wallBoxes.Count == 0 || wallBoxes[0].Count >= 4)
			{
				wallBoxes.Insert(0, new List<int>());
			}
			List<int> list = wallBoxes[0];
			if (!list.Contains(index))
			{
				list.Add(index);
			}
		}
	}
}
namespace EpicCards.Effects
{
	public class GrowRayEffect : RayHitEffect
	{
		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Collider2D collider = hit.collider;
				if ((Object)(object)collider == (Object)null)
				{
					return (HasToReturn)1;
				}
				Player componentInParent = ((Component)collider).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					return (HasToReturn)1;
				}
				GrowRayReversibleEffect component = ((Component)componentInParent).gameObject.GetComponent<GrowRayReversibleEffect>();
				if ((Object)(object)component == (Object)null)
				{
					GrowRayReversibleEffect growRayReversibleEffect = ((Component)componentInParent).gameObject.AddComponent<GrowRayReversibleEffect>();
					growRayReversibleEffect.Initialize(1.2f, 10f);
				}
				else
				{
					component.ApplyGrowth(1.2f, 10f);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError("Error in GrowRayEffect: " + ex.Message);
			}
			return (HasToReturn)1;
		}
	}
	public class GrowRayReversibleEffect : ReversibleEffect
	{
		private float sizeIncreaseFactor;

		private float duration;

		private float maxSize = 10f;

		private float confettiTriggerSize = 2f;

		private Vector3 initialSize;

		private bool isInitialized = false;

		private Coroutine sizeResetCoroutine;

		public void Initialize(float sizeIncreaseFactor, float duration)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			this.sizeIncreaseFactor = sizeIncreaseFactor;
			this.duration = duration;
			if (!isInitialized)
			{
				initialSize = ((Component)base.player).transform.localScale;
				isInitialized = true;
			}
			ApplyGrowth(sizeIncreaseFactor, duration);
			PlayerManager.instance.AddPlayerDiedAction((Action<Player, int>)PlayerDied);
			HealthHandler healthHandler = base.player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		public void ApplyGrowth(float sizeIncreaseFactor, float duration)
		{
			//IL_001a: 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_0054: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			this.sizeIncreaseFactor = sizeIncreaseFactor;
			this.duration = duration;
			if (((Component)base.player).transform.localScale.x < maxSize || ((Component)base.player).transform.localScale.y < maxSize || ((Component)base.player).transform.localScale.z < maxSize)
			{
				Transform transform = ((Component)base.player).transform;
				transform.localScale *= sizeIncreaseFactor;
				if (((Component)base.player).transform.localScale.x > maxSize)
				{
					((Component)base.player).transform.localScale = new Vector3(maxSize, ((Component)base.player).transform.localScale.y, ((Component)base.player).transform.localScale.z);
				}
				if (((Component)base.player).transform.localScale.y > maxSize)
				{
					((Component)base.player).transform.localScale = new Vector3(((Component)base.player).transform.localScale.x, maxSize, ((Component)base.player).transform.localScale.z);
				}
				if (((Component)base.player).transform.localScale.z > maxSize)
				{
					((Component)base.player).transform.localScale = new Vector3(((Component)base.player).transform.localScale.x, ((Component)base.player).transform.localScale.y, maxSize);
				}
				if (sizeResetCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(sizeResetCoroutine);
				}
				sizeResetCoroutine = ((MonoBehaviour)this).StartCoroutine(ResetSizeGradually());
			}
		}

		private IEnumerator ResetSizeGradually()
		{
			float elapsed = 0f;
			Vector3 targetSize = initialSize;
			Vector3 startSize = ((Component)base.player).transform.localScale;
			while (elapsed < duration)
			{
				((Component)base.player).transform.localScale = Vector3.Lerp(startSize, targetSize, elapsed / duration);
				elapsed += Time.deltaTime;
				yield return null;
			}
			((Component)base.player).transform.localScale = targetSize;
			sizeResetCoroutine = null;
		}

		public override void OnOnDestroy()
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)PlayerManager.instance != (Object)null)
			{
				PlayerManager.instance.RemovePlayerDiedAction(PlayerDied);
			}
			if ((Object)(object)base.player != (Object)null && (Object)(object)base.player.data != (Object)null && (Object)(object)base.player.data.healthHandler != (Object)null)
			{
				HealthHandler healthHandler = base.player.data.healthHandler;
				healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
			}
			((Component)base.player).transform.localScale = initialSize;
		}

		private void OnRevive()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((Component)base.player).transform.localScale = initialSize;
		}

		private void PlayerDied(Player diedPlayer, int remainingPlayers)
		{
			//IL_0020: 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_005a: 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_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)
			if ((Object)(object)diedPlayer == (Object)(object)base.player)
			{
				if (((Component)base.player).transform.localScale.x >= confettiTriggerSize || ((Component)base.player).transform.localScale.y >= confettiTriggerSize || ((Component)base.player).transform.localScale.z >= confettiTriggerSize)
				{
					GameObject val = Object.Instantiate<GameObject>(Assets.ConfettiPop, ((Component)base.player).transform.position, Quaternion.identity);
				}
				((Component)base.player).transform.localScale = initialSize;
			}
		}
	}
	public class MatrixEffect : MonoBehaviourPunCallbacks
	{
		private const float FREEZE_DURATION = 10f;

		private const float FIELD_RADIUS = 5f;

		private const float SLOW_FACTOR = 0.2f;

		private const float CHECK_INTERVAL = 0.1f;

		private List<ProjectileHit> slowedBullets = new List<ProjectileHit>();

		private Dictionary<ProjectileHit, Vector2> originalVelocities = new Dictionary<ProjectileHit, Vector2>();

		private PhotonView view;

		private GameObject matrixFieldInstance;

		private bool isFieldActive = false;

		private void Awake()
		{
			view = ((Component)this).GetComponent<PhotonView>();
		}

		public void OnBlock(BlockTriggerType trigger)
		{
			if (view.IsMine)
			{
				view.RPC("RPCA_ActivateSlowField", (RpcTarget)0, Array.Empty<object>());
				SpawnBlockEffect();
			}
		}

		private void SpawnBlockEffect()
		{
			//IL_002b: 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_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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)matrixFieldInstance != (Object)null)
			{
				Object.Destroy((Object)(object)matrixFieldInstance);
			}
			matrixFieldInstance = Object.Instantiate<GameObject>(Assets.MatrixField, ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform);
			ParticleSystem component = matrixFieldInstance.GetComponent<ParticleSystem>();
			if ((Object)(object)component != (Object)null)
			{
				MainModule main = component.main;
				((MainModule)(ref main)).duration = 10f;
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(10f);
				MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
				Color color = ((MinMaxGradient)(ref startColor)).color;
				color.a = 0.3f;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
				matrixFieldInstance.transform.localScale = Vector3.one * 2f;
			}
			Object.Destroy((Object)(object)matrixFieldInstance, 10f);
		}

		[PunRPC]
		private void RPCA_ActivateSlowField()
		{
			isFieldActive = true;
			((MonoBehaviour)this).StartCoroutine(CheckForBullets());
			((MonoBehaviour)this).StartCoroutine(DeactivateFieldAfterDelay());
		}

		private IEnumerator CheckForBullets()
		{
			while (isFieldActive)
			{
				try
				{
					ProjectileHit[] projectiles = Object.FindObjectsOfType<ProjectileHit>();
					ProjectileHit[] array = projectiles;
					foreach (ProjectileHit projectile in array)
					{
						if (!((Object)(object)projectile == (Object)null))
						{
							bool wasInField = slowedBullets.Contains(projectile);
							bool isInField = IsInRange(((Component)projectile).transform.position);
							if (isInField && !wasInField)
							{
								SlowBullet(projectile);
							}
							else if (!isInField && wasInField)
							{
								RestoreBulletSpeed(projectile);
							}
						}
					}
				}
				catch (Exception e)
				{
					Debug.LogError((object)("[MatrixEffect] Error in CheckForBullets: " + e.Message));
				}
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		private IEnumerator DeactivateFieldAfterDelay()
		{
			yield return (object)new WaitForSeconds(10f);
			isFieldActive = false;
			RestoreAllBulletSpeeds();
		}

		private bool IsInRange(Vector3 position)
		{
			//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)
			float num = Vector3.Distance(((Component)this).transform.position, position);
			return num <= 5f;
		}

		private void SlowBullet(ProjectileHit projectile)
		{
			//IL_003a: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)projectile == (Object)null)
			{
				return;
			}
			MoveTransform componentInParent = ((Component)projectile).GetComponentInParent<MoveTransform>();
			if (!((Object)(object)componentInParent != (Object)null) || slowedBullets.Contains(projectile))
			{
				return;
			}
			try
			{
				Vector2 val = Vector2.op_Implicit(componentInParent.velocity);
				originalVelocities[projectile] = val;
				slowedBullets.Add(projectile);
				componentInParent.velocity = Vector2.op_Implicit(val * 0.2f);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[MatrixEffect] Error in SlowBullet: " + ex.Message));
			}
		}

		private void RestoreBulletSpeed(ProjectileHit projectile)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)projectile == (Object)null || !originalVelocities.ContainsKey(projectile))
			{
				return;
			}
			MoveTransform componentInParent = ((Component)projectile).GetComponentInParent<MoveTransform>();
			if (!((Object)(object)componentInParent != (Object)null))
			{
				return;
			}
			try
			{
				componentInParent.velocity = Vector2.op_Implicit(originalVelocities[projectile]);
				slowedBullets.Remove(projectile);
				originalVelocities.Remove(projectile);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[MatrixEffect] Error in RestoreBulletSpeed: " + ex.Message));
			}
		}

		private void RestoreAllBulletSpeeds()
		{
			ProjectileHit[] array = slowedBullets.ToArray();
			foreach (ProjectileHit val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					RestoreBulletSpeed(val);
				}
			}
			slowedBullets.Clear();
			originalVelocities.Clear();
		}

		private void OnDestroy()
		{
			isFieldActive = false;
			RestoreAllBulletSpeeds();
			if ((Object)(object)matrixFieldInstance != (Object)null)
			{
				Object.Destroy((Object)(object)matrixFieldInstance);
			}
		}
	}
	public class ShrinkOnBlockEffect : MonoBehaviour
	{
		private Player player;

		private Block block;

		private Vector3 initialScale;

		private float shrinkFactor = 0.75f;

		private float resetDuration = 5f;

		private const float minScale = 0.25f;

		private float lastBlockTime;

		private bool isResetting;

		private Coroutine resetCoroutine;

		private void Start()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)this).GetComponent<Player>();
			block = ((Component)player).GetComponent<Block>();
			initialScale = ((Component)player).transform.localScale;
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
			PlayerManager.instance.AddPlayerDiedAction((Action<Player, int>)PlayerDied);
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		private void OnBlock(BlockTriggerType trigger)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if ((int)trigger == 1)
			{
				return;
			}
			Vector3 val = ((Component)player).transform.localScale * shrinkFactor;
			if (val.x >= 0.25f && val.y >= 0.25f && val.z >= 0.25f)
			{
				((Component)player).transform.localScale = val;
				lastBlockTime = Time.time;
				if (resetCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(resetCoroutine);
				}
				resetCoroutine = ((MonoBehaviour)this).StartCoroutine(HandleReset());
			}
		}

		private IEnumerator HandleReset()
		{
			isResetting = true;
			yield return (object)new WaitForSeconds(resetDuration);
			if (Time.time >= lastBlockTime + resetDuration)
			{
				((Component)player).transform.localScale = initialScale;
			}
			isResetting = false;
			resetCoroutine = null;
		}

		private void ResetSize()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (resetCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(resetCoroutine);
				resetCoroutine = null;
			}
			((Component)player).transform.localScale = initialScale;
			isResetting = false;
		}

		private void PlayerDied(Player diedPlayer, int remainingPlayers)
		{
			if ((Object)(object)diedPlayer == (Object)(object)player)
			{
				ResetSize();
			}
		}

		private void OnRevive()
		{
			ResetSize();
		}

		private void OnDestroy()
		{
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
			if ((Object)(object)PlayerManager.instance != (Object)null)
			{
				PlayerManager.instance.RemovePlayerDiedAction(PlayerDied);
			}
			if ((Object)(object)player != (Object)null && (Object)(object)player.data != (Object)null && (Object)(object)player.data.healthHandler != (Object)null)
			{
				HealthHandler healthHandler = player.data.healthHandler;
				healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
			}
			ResetSize();
		}
	}
}
namespace EpicCards.Cards
{
	public class CopyCat : CustomCard
	{
		protected override string GetTitle()
		{
			return "Copycat";
		}

		protected override string GetDescription()
		{
			return "Copy a random valid card from a random enemy";
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			Debug.Log((object)"Adding Copycat card");
			Player randomEnemy = PlayerManager.instance.GetRandomEnemy(player);
			if ((Object)(object)randomEnemy == (Object)null || randomEnemy.data.currentCards.Count == 0)
			{
				return;
			}
			int num = 0;
			while (num <= 50)
			{
				int index = Random.Range(0, randomEnemy.data.currentCards.Count);
				num++;
				if (!Cards.instance.PlayerIsAllowedCard(player, randomEnemy.data.currentCards[index]))
				{
					continue;
				}
				CardInfo val = randomEnemy.data.currentCards[index];
				Cards.instance.AddCardToPlayer(player, val, false, "", 0f, 0f, true);
				CardBarUtils.instance.ShowAtEndOfPhase(player, val);
				break;
			}
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			Debug.Log((object)"Setting up Copycat card");
			cardInfo.allowMultiple = true;
			CardInfoExtension.GetAdditionalData(cardInfo).canBeReassigned = false;
		}

		protected override CardInfoStat[] GetStats()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)0;
		}

		protected override GameObject GetCardArt()
		{
			return Assets.CopyCatArt;
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)0;
		}

		public override string GetModName()
		{
			return "BSC";
		}

		public override void OnRemoveCard()
		{
		}
	}
	internal class GrowRay : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			gun.objectsToSpawn = (ObjectsToSpawn[])(object)new ObjectsToSpawn[1]
			{
				new ObjectsToSpawn
				{
					AddToProjectile = ((Component)new GameObject("GrowRayEffect").AddComponent<GrowRayEffect>()).gameObject
				}
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			gun.attackSpeed *= 0.75f;
			gun.damage *= 0.8f;
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		protected override string GetTitle()
		{
			return "Grow Ray";
		}

		protected override string GetDescription()
		{
			return "Makes your enemies grow larger when hit.";
		}

		protected override GameObject GetCardArt()
		{
			return Assets.GrowRayArt;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Grow Size",
					amount = "+20%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Attack Speed",
					amount = "+25%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Damage",
					amount = "-20%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)4;
		}

		public override string GetModName()
		{
			return "EC";
		}
	}
	internal class Matrix : CustomCard
	{
		private const float BlockCooldownMultiplier = 0.7f;

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			block.cdMultiplier *= 0.7f;
			MatrixEffect orAddComponent = ExtensionMethods.GetOrAddComponent<MatrixEffect>(((Component)player).gameObject, false);
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(orAddComponent.OnBlock));
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			block.cdMultiplier /= 0.7f;
			MatrixEffect component = ((Component)player).gameObject.GetComponent<MatrixEffect>();
			if (Object.op_Implicit((Object)(object)component))
			{
				block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(component.OnBlock));
				Object.Destroy((Object)(object)component);
			}
		}

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

		protected override string GetDescription()
		{
			return "On block, create a field around you slowing all other players and their bullets.";
		}

		protected override GameObject GetCardArt()
		{
			return Assets.MatrixArt;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Block Cooldown",
					amount = "-30%",
					simepleAmount = (SimpleAmount)7
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)3;
		}

		public override string GetModName()
		{
			return "EC";
		}
	}
	internal class ShrinkBlock : CustomCard
	{
		private const float BlockCooldownMultiplier = 1.15f;

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			block.cdMultiplier *= 1.15f;
		}

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

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			Object.Destroy((Object)(object)((Component)player).gameObject.GetComponent<ShrinkOnBlockEffect>());
		}

		protected override string GetTitle()
		{
			return "Ant Man";
		}

		protected override string GetDescription()
		{
			return "Shrink each time you block. Shrink wears off after 5s.";
		}

		protected override GameObject GetCardArt()
		{
			return Assets.AntManArt;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)1;
		}

		protected override CardInfoStat[] GetStats()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Player Size",
					amount = "-25%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Block Cooldown",
					amount = "+15%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)3;
		}

		public override string GetModName()
		{
			return "EC";
		}
	}
	internal class Template : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

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

		protected override string GetDescription()
		{
			return "CardDescription";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Effect",
					amount = "No",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)7;
		}

		public override string GetModName()
		{
			return "EC";
		}
	}
	public class WallCard : CustomCard
	{
		private GameObject wallObj;

		private const float BlockHeight = 2f;

		public const int WallHeight = 4;

		private const float SpawnDistance = 2f;

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

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			Player player2 = player;
			block.cdMultiplier *= 0.85f;
			WallSpawner_Mono component = ((Component)player2).gameObject.GetComponent<WallSpawner_Mono>();
			if (!((Object)(object)component == (Object)null))
			{
				return;
			}
			WallSpawner_Mono wallSpawner = ((Component)player2).gameObject.AddComponent<WallSpawner_Mono>();
			wallObj = new GameObject("wall");
			BlockTrigger val = wallObj.AddComponent<BlockTrigger>();
			val.blockRechargeEvent = new UnityEvent();
			val.successfulBlockEvent = new UnityEvent();
			val.triggerSuperFirstBlock = new UnityEvent();
			val.triggerFirstBlockThatDelaysOthers = new UnityEvent();
			val.triggerEventEarly = new UnityEvent();
			val.triggerEvent = new UnityEvent();
			val.triggerEvent.AddListener((UnityAction)delegate
			{
				if (PhotonNetwork.IsMasterClient && wallSpawner.CanSpawn())
				{
					wallSpawner.StartCooldown();
					((MonoBehaviour)wallSpawner).StartCoroutine(SpawnWallRoutine(player2, wallSpawner));
				}
			});
			wallObj.transform.SetParent(((Component)player2).gameObject.transform);
		}

		private IEnumerator SpawnWallRoutine(Player player, WallSpawner_Mono wallSpawner)
		{
			((Component)wallSpawner).GetComponent<PhotonView>().RPC("RPCA_DestroyExistingBoxes", (RpcTarget)0, Array.Empty<object>());
			yield return (object)new WaitForSeconds(0.1f);
			Vector3 aimDirection = ((Vector3)(ref player.data.aimDirection)).normalized;
			Vector3 spawnPos = ((Component)player).transform.position + aimDirection * 2f;
			for (int i = 0; i < 4; i++)
			{
				Vector3 boxPos = spawnPos + new Vector3(0f, (float)i * 2f, 0f);
				PhotonNetwork.Instantiate("4 map objects/Box_Destructible", boxPos, Quaternion.identity, (byte)0, (object[])null);
				yield return (object)new WaitForSeconds(0.1f);
				GameObject mapObj = ((Component)MapManager.instance.currentMap.Map).gameObject;
				int boxIndex = mapObj.transform.childCount - 1;
				((Component)wallSpawner).GetComponent<PhotonView>().RPC("RPCA_AddBoxIndex", (RpcTarget)0, new object[1] { boxIndex });
				((Component)wallSpawner).GetComponent<PhotonView>().RPC("RPCA_Box", (RpcTarget)0, new object[1] { boxIndex });
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		public override void OnRemoveCard()
		{
			Object.DestroyImmediate((Object)(object)wallObj);
		}

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

		protected override string GetDescription()
		{
			return "Spawn a vertical wall of breakable blocks. Only 4 walls can be active at a time.";
		}

		protected override GameObject GetCardArt()
		{
			return Assets.WallCardArt;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: 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)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Block cooldown",
					amount = "-15%",
					simepleAmount = (SimpleAmount)5
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: 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)
			return (CardThemeColorType)0;
		}

		public override string GetModName()
		{
			return "EC";
		}
	}
}