Decompiled source of AALUND13 Standard Cards v1.2.0

plugins/AALUND13_Standard_Cards.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Cards.Core;
using AALUND13Cards.Core.Cards;
using AALUND13Cards.Core.Extensions;
using AALUND13Cards.Core.Handlers;
using AALUND13Cards.Core.Utils;
using AALUND13Cards.Standard.Cards;
using AALUND13Cards.Standard.Handler;
using AALUND13Cards.Standard.MonoBehaviours.ProjectilesEffects;
using BepInEx;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using HarmonyLib;
using JARL.Bases;
using JARL.Extensions;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RarityLib.Utils;
using Sonigon;
using SoundImplementation;
using TabInfo.Utils;
using UnboundLib;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 AALUND13Cards.Core.Patches
{
	[HarmonyPatch(typeof(Cards), "PlayerIsAllowedCard")]
	internal class AllowedCardPatch
	{
		private static void Postfix(Player player, CardInfo card, ref bool __result)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !((Object)(object)card == (Object)null) && card.categories.Contains(CustomCardCategories.instance.CardCategory("Curse")) && CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse != null)
			{
				Rarity rarityData = RarityUtils.GetRarityData(card.rarity);
				Rarity maxRarityForCurse = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse;
				if (rarityData.relativeRarity < maxRarityForCurse.relativeRarity)
				{
					__result = false;
				}
			}
		}
	}
}
namespace AALUND13Cards.Core.MonoBehaviours.ProjectilesEffects
{
	public class ConnectingBullets : MonoBehaviour
	{
		private static Dictionary<Player, GameObject> PlayerLastBullet = new Dictionary<Player, GameObject>();

		public float DamageInterval = 0.5f;

		public float DamageMultiplier = 0.75f;

		public float MaxDistance = 20f;

		public GameObject ConnectingBulletPrefab;

		private Dictionary<Player, float> lastDamageTime = new Dictionary<Player, float>();

		private GameObject connectingBulletInstance;

		private GameObject connectedBullet;

		private ChildRPC childRPC;

		private ProjectileHit ProjectileHit;

		private ProjectileHit OtherProjectileHit;

		private void Start()
		{
			//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_0081: 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_009c: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			ProjectileHit = ((Component)this).GetComponentInParent<ProjectileHit>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			if (PlayerLastBullet.ContainsKey(ProjectileHit.ownPlayer) && (Object)(object)PlayerLastBullet[ProjectileHit.ownPlayer] != (Object)null && Vector2.Distance(Vector2.op_Implicit(PlayerLastBullet[ProjectileHit.ownPlayer].transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position)) < MaxDistance * ((Component)this).transform.localScale.x)
			{
				connectingBulletInstance = Object.Instantiate<GameObject>(ConnectingBulletPrefab, Vector2.op_Implicit(Vector2.zero), Quaternion.identity);
				LineEffect component = connectingBulletInstance.GetComponent<LineEffect>();
				connectedBullet = PlayerLastBullet[ProjectileHit.ownPlayer];
				OtherProjectileHit = connectedBullet.GetComponent<ProjectileHit>();
				component.fromPos = connectedBullet.transform;
				component.toPos = ((Component)this).gameObject.transform;
				LineRenderer component2 = connectingBulletInstance.GetComponent<LineRenderer>();
				component2.startColor = GetProjectileColor(OtherProjectileHit);
				component2.endColor = GetProjectileColor(ProjectileHit);
				component2.SetPositions((Vector3[])(object)new Vector3[2]
				{
					connectedBullet.transform.position,
					((Component)this).gameObject.transform.position
				});
			}
			PlayerLastBullet[ProjectileHit.ownPlayer] = ((Component)((Component)this).transform.parent).gameObject;
		}

		private Color GetProjectileColor(ProjectileHit projectileHit)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (projectileHit.projectileColor == Color.black)
			{
				return new Color(0.75f, 0.28530002f, 0.0882f);
			}
			return projectileHit.projectileColor * 0.75f;
		}

		private void Update()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)connectedBullet == (Object)null && (Object)(object)connectingBulletInstance != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else if ((Object)(object)connectingBulletInstance != (Object)null && Vector2.Distance(Vector2.op_Implicit(connectedBullet.transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position)) > MaxDistance * ((Component)this).transform.localScale.x)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void FixedUpdate()
		{
			//IL_0028: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)connectingBulletInstance != (Object)null && (Object)(object)connectedBullet != (Object)null)
			{
				DamageBetweenPoints(Vector2.op_Implicit(connectedBullet.transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position));
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)connectingBulletInstance != (Object)null)
			{
				Object.Destroy((Object)(object)connectingBulletInstance);
			}
		}

		private bool CanDamagePlayer(Player player)
		{
			List<HealthHandler> obj = (List<HealthHandler>)ExtensionMethods.GetFieldValue((object)ProjectileHit, "playersHit");
			List<HealthHandler> list = (List<HealthHandler>)ExtensionMethods.GetFieldValue((object)OtherProjectileHit, "playersHit");
			if (obj.Contains(player.data.healthHandler) || list.Contains(player.data.healthHandler))
			{
				return false;
			}
			return true;
		}

		private void DamageBetweenPoints(Vector2 pointA, Vector2 pointB)
		{
			//IL_001d: 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_001f: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			if (!ProjectileHit.ownPlayer.data.view.IsMine)
			{
				return;
			}
			Vector2 val = (pointA + pointB) / 2f;
			RaycastHit2D[] array = Physics2D.LinecastAll(pointA, pointB);
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit2D val2 = array[i];
				Player component = ((Component)((RaycastHit2D)(ref val2)).collider).GetComponent<Player>();
				if ((Object)(object)component != (Object)null && CanDamagePlayer(component))
				{
					if (!lastDamageTime.ContainsKey(component))
					{
						lastDamageTime[component] = 0f;
					}
					if (Time.time - lastDamageTime[component] >= DamageInterval)
					{
						lastDamageTime[component] = Time.time;
						Vector3 val3 = ((Component)component).transform.position - Vector2.op_Implicit(val);
						Vector2 val4 = Vector2.op_Implicit(((Vector3)(ref val3)).normalized);
						((Damagable)component.data.healthHandler).CallTakeDamage(val4 * GetChainDamage(component), Vector2.op_Implicit(((Component)component).transform.position), ProjectileHit.ownWeapon, ProjectileHit.ownPlayer, true);
					}
				}
			}
		}

		private float GetChainDamage(Player targetPlayer)
		{
			float damage = ProjectileHit.damage;
			float damage2 = connectedBullet.GetComponent<ProjectileHit>().damage;
			float percentageDamage = ProjectileHit.percentageDamage;
			float percentageDamage2 = connectedBullet.GetComponent<ProjectileHit>().percentageDamage;
			return ((damage + damage2) / 2f + targetPlayer.data.maxHealth * (percentageDamage + percentageDamage2) / 2f) * DamageMultiplier;
		}
	}
	public class RayHitExecution : RayHitEffect
	{
		[Range(0f, 1f)]
		public float executionPercentage = 0.3f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
				if (!((Object)(object)component == (Object)null) && !component.dead)
				{
					if (!((component.health + CharacterDataExtensions.GetAdditionalData(component).totalArmor) / component.maxHealth > executionPercentage))
					{
						if (component.stats.remainingRespawns > 0)
						{
							component.view.RPC("RPCA_Die_Phoenix", (RpcTarget)0, new object[1] { Vector2.down });
						}
						else
						{
							component.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { Vector2.down });
						}
						component.health = 0f;
						return (HasToReturn)1;
					}
					return (HasToReturn)1;
				}
				return (HasToReturn)1;
			}
			return (HasToReturn)1;
		}
	}
}
namespace AALUND13Cards.Core.MonoBehaviours.CardsEffects
{
	public class CurrentHPRegenMono : MonoBehaviour
	{
		[Tooltip("Percentage of current health to activate the regeneration. If the character's health is above this percentage, regeneration will not be applied.")]
		public float activatePercentage = 0.75f;

		public float CurrentHPRegenPercentage = 0.15f;

		private CharacterData data;

		private float oldRegen;

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
		}

		public void Update()
		{
			if (oldRegen != 0f && data.health / data.maxHealth > activatePercentage)
			{
				HealthHandler healthHandler = data.healthHandler;
				healthHandler.regeneration -= oldRegen;
				oldRegen = 0f;
			}
			else if (data.health / data.maxHealth <= activatePercentage)
			{
				float num = data.health * CurrentHPRegenPercentage;
				HealthHandler healthHandler2 = data.healthHandler;
				healthHandler2.regeneration -= oldRegen;
				HealthHandler healthHandler3 = data.healthHandler;
				healthHandler3.regeneration += num;
				oldRegen = num;
			}
		}
	}
	public class RollBackTeleport : MonoBehaviour
	{
		[Header("Sounds")]
		public SoundEvent SoundTeleport;

		[Header("Teleport Settings")]
		public GameObject SaveTeleportPositionPrefab;

		[Header("Particle Systems")]
		public ParticleSystem[] parts;

		public ParticleSystem[] remainParts;

		private GameObject saveTeleportPosition;

		private CharacterData data;

		private Vector2 SavePosition;

		private bool DoTeleport;

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
			SoundTeleport.variables.audioMixerGroup = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX")[0];
			Block componentInParent = ((Component)this).GetComponentInParent<Block>();
			componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)Delegate.Combine(componentInParent.SuperFirstBlockAction, new Action<BlockTriggerType>(OnBlock));
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(ResetTeleport));
			if (data.view.IsMine)
			{
				saveTeleportPosition = Object.Instantiate<GameObject>(SaveTeleportPositionPrefab);
				saveTeleportPosition.SetActive(false);
			}
		}

		private void OnDestroy()
		{
			Block componentInParent = ((Component)this).GetComponentInParent<Block>();
			componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)Delegate.Remove(componentInParent.SuperFirstBlockAction, new Action<BlockTriggerType>(OnBlock));
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(ResetTeleport));
			if ((Object)(object)saveTeleportPosition != (Object)null)
			{
				Object.Destroy((Object)(object)saveTeleportPosition);
			}
		}

		private void OnDisable()
		{
			ResetTeleport();
		}

		public void OnBlock(BlockTriggerType triggerType)
		{
			//IL_0000: 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_001f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if ((int)triggerType != 0)
			{
				return;
			}
			if (DoTeleport)
			{
				Vector2 val = Vector2.op_Implicit(((Component)data).transform.position);
				((Component)this).GetComponentInParent<PlayerCollision>().IgnoreWallForFrames(2);
				((Component)data).transform.position = Vector2.op_Implicit(SavePosition);
				for (int i = 0; i < remainParts.Length; i++)
				{
					((Component)remainParts[i]).transform.position = Vector2.op_Implicit(val);
					remainParts[i].Play();
				}
				for (int j = 0; j < parts.Length; j++)
				{
					((Component)parts[j]).transform.position = Vector2.op_Implicit(SavePosition);
					parts[j].Play();
				}
				SoundManager.Instance.Play(SoundTeleport, ((Component)data).transform);
				ExtensionMethods.SetFieldValue((object)data.playerVel, "velocity", (object)Vector2.zero);
				data.sinceGrounded = 0f;
				ResetTeleport();
			}
			else
			{
				if ((Object)(object)saveTeleportPosition != (Object)null)
				{
					saveTeleportPosition.transform.position = ((Component)data).transform.position;
					saveTeleportPosition.SetActive(true);
				}
				SavePosition = Vector2.op_Implicit(((Component)data).transform.position);
				DoTeleport = true;
			}
		}

		public void ResetTeleport()
		{
			//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)
			if ((Object)(object)saveTeleportPosition != (Object)null)
			{
				saveTeleportPosition.SetActive(false);
			}
			DoTeleport = false;
			SavePosition = Vector2.zero;
		}
	}
	public class StoreDamageEffect : MonoBehaviour, IOnDoDamageEvent
	{
		public float DamageToStorePercentage = 0.5f;

		public float MaxStoredDamageMultiplier = 5f;

		[Tooltip("Cooldown time in seconds before damage can be stored again after releasing stored damage.")]
		public float CoolddownTime = 5f;

		private float maxStoredDamage = 100f;

		private float storedDamage;

		private float cooldownTimer;

		private bool damageReductionApplied;

		private Player player;

		private DamageSpawnObjects damageSpawnObjects;

		private CustomHealthBar storedDamageBar;

		public void ReleaseStoredDamage()
		{
			//IL_0013: 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)
			if (storedDamage > 0f)
			{
				damageSpawnObjects.SpawnDamage(Vector2.up * storedDamage);
				ResetStoredDamage();
				cooldownTimer = CoolddownTime;
			}
		}

		public void OnDamage(DamageInfo damage)
		{
			if (!(cooldownTimer > 0f))
			{
				float num = ((Vector2)(ref damage.Damage)).magnitude / (1f - DamageToStorePercentage);
				storedDamage = Mathf.Min(maxStoredDamage, storedDamage + num * DamageToStorePercentage);
				if (storedDamage == maxStoredDamage && damageReductionApplied)
				{
					CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction -= DamageToStorePercentage;
					damageReductionApplied = false;
				}
				storedDamageBar.CurrentHealth = storedDamage;
			}
		}

		public void ResetStoredDamage()
		{
			storedDamage = 0f;
			storedDamageBar.CurrentHealth = storedDamage;
			if (!damageReductionApplied)
			{
				CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction += DamageToStorePercentage;
				damageReductionApplied = true;
			}
		}

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			damageSpawnObjects = ((Component)this).GetComponent<DamageSpawnObjects>();
			storedDamageBar = CreateStoredDamageBar();
			DamageEventHandler.Instance.RegisterDamageEvent((object)this, player);
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
			maxStoredDamage = player.data.maxHealth * MaxStoredDamageMultiplier;
			storedDamageBar.SetValues(0f, maxStoredDamage);
			ResetStoredDamage();
		}

		private void OnDestroy()
		{
			DamageEventHandler.Instance.UnregisterDamageEvent((object)this, player);
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
			Object.Destroy((Object)(object)((Component)storedDamageBar).gameObject);
		}

		private void Update()
		{
			maxStoredDamage = player.data.maxHealth * MaxStoredDamageMultiplier;
			storedDamageBar.MaxHealth = maxStoredDamage;
			if (cooldownTimer > 0f)
			{
				cooldownTimer = Mathf.Max(0f, cooldownTimer - TimeHandler.deltaTime);
				if (damageReductionApplied)
				{
					CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction -= DamageToStorePercentage;
					damageReductionApplied = false;
				}
				else if (cooldownTimer <= 0f && !damageReductionApplied)
				{
					CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction += DamageToStorePercentage;
					damageReductionApplied = true;
				}
			}
			if (storedDamage > maxStoredDamage)
			{
				storedDamage = maxStoredDamage;
				storedDamageBar.CurrentHealth = storedDamage;
			}
		}

		private CustomHealthBar CreateStoredDamageBar()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//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)
			GameObject val = new GameObject("Damage Storage Bar");
			CustomHealthBar obj = val.AddComponent<CustomHealthBar>();
			obj.SetColor(new Color(1f, 0.64705884f, 0f, 1f) * 0.8f);
			ExtensionMethods.AddStatusIndicator(player, val, 0f, true);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Healthbar(Clone)/Canvas/Image/White")).gameObject);
			return obj;
		}

		private void OnRevive()
		{
			ResetStoredDamage();
			cooldownTimer = 0f;
		}
	}
}
namespace AALUND13Cards.Standard
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("AALUND13.Cards.Standard", "AALUND13 Standard Cards", "1.2.0")]
	[BepInProcess("Rounds.exe")]
	internal class AAC_Standard : BaseUnityPlugin
	{
		internal const string ModId = "AALUND13.Cards.Standard";

		internal const string ModName = "AALUND13 Standard Cards";

		internal const string Version = "1.2.0";

		private static AssetBundle assets;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			assets = AssetsUtils.LoadAssetBundle("aac_standard_assets", typeof(AAC_Standard).Assembly);
			if ((Object)(object)assets != (Object)null)
			{
				new Harmony("AALUND13.Cards.Standard").PatchAll();
			}
		}

		private void Start()
		{
			if ((Object)(object)assets == (Object)null)
			{
				Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Standard Cards\" assets failled to load, All the cards will be disable in this mod");
				throw new NullReferenceException("Failled to load \"AALUND13 Standard Cards\" assets");
			}
			if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			CardResgester cardResgester = assets.LoadAsset<GameObject>("StandardModCards").GetComponent<CardResgester>();
			cardResgester.RegisterCards();
			AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
			{
				AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Standard Cards", "1.2.0", cardResgester);
			});
			assets.LoadAsset<GameObject>("StandardPhotonPrefabPool").GetComponent<PhotonPrefabPool>().RegisterPrefabs();
		}
	}
	internal class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
			TabInfoManager.RegisterStat(orCreateCategory, "Delay Damage", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).secondToDealDamage != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).secondToDealDamage} seconds"));
			TabInfoManager.RegisterStat(orCreateCategory, "Blocks When Recharge", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).BlocksWhenRecharge != 0), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).BlocksWhenRecharge}"));
			TabInfoManager.RegisterStat(orCreateCategory, "Stun Block Time", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).StunBlockTime != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).StunBlockTime:0}s"));
			TabInfoManager.RegisterStat(orCreateCategory, "Max Rarity For Curse", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).MaxRarityForCurse != null), (Func<Player, string>)((Player p) => GetStandardStatsFromPlayer(p).MaxRarityForCurse.name));
			TabInfoManager.RegisterStat(orCreateCategory, "Damage Reduction", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).DamageReduction != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).DamageReduction * 100f:0}%"));
			TabInfoManager.RegisterStat(orCreateCategory, "Bleed Damage", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).BleedingDamage != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).BleedingDamage * 100f:0}%"));
			TabInfoManager.RegisterStat(orCreateCategory, "Quick Dashes", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).QuickDashes != 0), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).QuickDashes * 100:0}%"));
		}

		private static StandardStats GetStandardStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>();
		}
	}
}
namespace AALUND13Cards.Standard.Patches
{
	[HarmonyPatch(typeof(Block))]
	internal class BlockPatch
	{
		public static Dictionary<Block, bool> BlockRechargeAlreadyTriggered = new Dictionary<Block, bool>();

		[HarmonyPatch("IDoBlock")]
		[HarmonyPrefix]
		public static void IDoBlockPrefix(Block __instance, bool firstBlock, bool dontSetCD, BlockTriggerType triggerType)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!(!firstBlock || dontSetCD) && (int)triggerType == 0)
			{
				BlockRechargeAlreadyTriggered[__instance] = false;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPostfix(Block __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			CharacterData data = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
			__instance.BlockRechargeAction = delegate
			{
				if (!(BlockRechargeAlreadyTriggered.TryGetValue(__instance, out var value) && value))
				{
					for (int i = 0; i < CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().BlocksWhenRecharge; i++)
					{
						float num = (float)ExtensionMethods.GetFieldValue((object)__instance, "timeBetweenBlocks");
						float num2 = (float)i * num;
						((MonoBehaviour)__instance).StartCoroutine("DelayBlock", (object)num2);
					}
					BlockRechargeAlreadyTriggered[__instance] = true;
				}
			};
		}

		[HarmonyPatch("blocked")]
		[HarmonyPrefix]
		public static void BlockedPrefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
		{
			//IL_0011: 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
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			_ = (HealthHandler)ExtensionMethods.GetFieldValue((object)__instance, "health");
			CharacterData data = component.ownPlayer.data;
			CharacterData val = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
			bool flag = false;
			if ((Object)(object)data != (Object)null && CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime > 0f)
			{
				((MonoBehaviour)val.block).StopAllCoroutines();
				val.block.sinceBlock = float.PositiveInfinity;
				val.stunHandler.AddStun(val.stunTime + CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime);
				flag = true;
			}
			if (flag)
			{
				Object.Destroy((Object)(object)projectile);
			}
		}
	}
	[HarmonyPatch(typeof(Gun))]
	public class GunPatch
	{
		[HarmonyPatch("BulletInit")]
		[HarmonyPostfix]
		public static void BulletPostfix(Gun __instance, GameObject bullet)
		{
			PlayerGunActions.InvokeShootAction(__instance.player, __instance, bullet);
		}

		[HarmonyPatch("ApplyProjectileStats")]
		[HarmonyPostfix]
		public static void ApplyProjectileStatsPostfix(Gun __instance, GameObject obj)
		{
			if ((Object)(object)__instance.player != (Object)null && CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<StandardStats>().GravityDamageMultiplier != 0f)
			{
				MoveTransform component = obj.GetComponent<MoveTransform>();
				ProjectileHit component2 = obj.GetComponent<ProjectileHit>();
				StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<StandardStats>();
				float num = Mathf.Max(Mathf.Pow(component.gravity / 100f * orCreate.GravityDamageMultiplier, 0.2f), 1f);
				component2.damage *= num;
			}
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	internal class HealthHandlerPatch
	{
		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamagePrefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, ref bool lethal, bool ignoreBlock)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			StandardStats stats = CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<StandardStats>();
			if (stats.DamageReduction != 0f)
			{
				damage = new Vector2(damage.x * (1f - stats.DamageReduction), damage.y * (1f - stats.DamageReduction));
			}
			if (stats.secondToDealDamage > 0f && !stats.dealDamage)
			{
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(damage.x, damage.y);
				ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(new DelayDamageInfo(val2, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock), stats.secondToDealDamage, (Action)delegate
				{
					stats.dealDamage = true;
				}, (Action)null);
				damage = Vector2.zero;
			}
			else if (stats.dealDamage)
			{
				stats.dealDamage = false;
			}
		}

		[HarmonyPatch("Revive")]
		[HarmonyPrefix]
		public static void RevivePrefix(HealthHandler __instance, bool isFullRevive)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).GetOrCreate<StandardStats>();
			if (orCreate.FrozenTime > 0f)
			{
				CharacterStatModifiers component = ((Component)__instance).GetComponent<CharacterStatModifiers>();
				orCreate.DamageReduction -= NegativeSaturateCurve(orCreate.OldFrozenTime, 10f);
				component.slowSlow -= orCreate.OldFrozenTime;
				orCreate.FrozenTime = 0f;
				orCreate.OldFrozenTime = 0f;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void UpdatePrefix(HealthHandler __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).GetOrCreate<StandardStats>();
			if (orCreate.FrozenTime != orCreate.OldFrozenTime)
			{
				ExtensionMethods.InvokeMethod((object)((Component)__instance).GetComponent<CharacterStatModifiers>(), "DoSlowDown", new object[1] { orCreate.FrozenTime });
			}
			if (orCreate.FrozenTime > 0f)
			{
				CharacterStatModifiers component = ((Component)__instance).GetComponent<CharacterStatModifiers>();
				orCreate.DamageReduction -= NegativeSaturateCurve(orCreate.OldFrozenTime, 10f);
				component.slowSlow -= orCreate.OldFrozenTime;
				orCreate.FrozenTime = Mathf.Max(orCreate.FrozenTime - Time.deltaTime, 0f);
				orCreate.DamageReduction += NegativeSaturateCurve(orCreate.FrozenTime, 10f);
				orCreate.OldFrozenTime = orCreate.FrozenTime;
				component.slowSlow += orCreate.FrozenTime;
			}
		}

		public static float NegativeSaturateCurve(float x, float k)
		{
			float num = x * x;
			return 0f - num / (num + k);
		}
	}
	[HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")]
	internal class ProjectileHitPatch
	{
		private static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, int viewID = -1, int colliderID = -1, bool wasBlocked = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			HitInfo val = new HitInfo();
			val.point = hitPoint;
			val.normal = hitNormal;
			val.collider = null;
			if (viewID != -1)
			{
				PhotonView photonView = PhotonNetwork.GetPhotonView(viewID);
				val.collider = ((Component)photonView).GetComponentInChildren<Collider2D>();
				val.transform = ((Component)photonView).transform;
			}
			else if (colliderID != -1)
			{
				val.collider = ((Component)MapManager.instance.currentMap.Map).GetComponentsInChildren<Collider2D>()[colliderID];
				val.transform = ((Component)val.collider).transform;
			}
			HealthHandler val2 = null;
			if (Object.op_Implicit((Object)(object)val.transform))
			{
				val2 = ((Component)val.transform).GetComponent<HealthHandler>();
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				Player component = ((Component)val2).GetComponent<Player>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (CharacterDataExtensions.GetCustomStatsRegistry(__instance.ownPlayer.data).GetOrCreate<StandardStats>().BleedingDamage > 0f)
				{
					component.data.healthHandler.TakeDamageOverTime(Vector2.op_Implicit(((Component)__instance).transform.forward * __instance.damage * CharacterDataExtensions.GetCustomStatsRegistry(__instance.ownPlayer.data).GetOrCreate<StandardStats>().BleedingDamage), hitPoint, 5f, 1f, Color.red * 0.8f, __instance.ownWeapon, __instance.ownPlayer, true);
				}
			}
			return true;
		}
	}
}
namespace AALUND13Cards.Standard.MonoBehaviours
{
	public class MaximumScale : MonoBehaviour
	{
		public float MaxScale = 5f;

		private void Start()
		{
			//IL_000c: 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_0042: 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)
			((Component)this).transform.localScale = new Vector3(Mathf.Min(((Component)this).transform.localScale.x, MaxScale), Mathf.Min(((Component)this).transform.localScale.y, MaxScale), Mathf.Min(((Component)this).transform.localScale.z, MaxScale));
		}
	}
}
namespace AALUND13Cards.Standard.MonoBehaviours.ProjectilesEffects
{
	public class RayHitApplyFrozenTime : RayHitEffect
	{
		[Range(0f, 10f)]
		public float FrozenTime = 0.3f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
				if (!((Object)(object)component == (Object)null) && !component.dead)
				{
					CharacterDataExtensions.GetCustomStatsRegistry(component).GetOrCreate<StandardStats>().FrozenTime = FrozenTime;
					return (HasToReturn)1;
				}
				return (HasToReturn)1;
			}
			return (HasToReturn)1;
		}
	}
	public class TrailBulletEffect : MonoBehaviour
	{
		public float SyncInterval = 0.5f;

		public float ActvateRange = 5f;

		public GameObject TrailPrefab;

		private PhotonView view;

		private ProjectileHit bullet;

		private PhotonView trailView;

		private GameObject trailObject;

		private float lastSyncTime;

		private bool active;

		private void Start()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			view = ((Component)this).GetComponentInParent<PhotonView>();
			bullet = ((Component)this).GetComponentInParent<ProjectileHit>();
			if (view.IsMine)
			{
				trailObject = PhotonNetwork.Instantiate(((Object)TrailPrefab).name, Vector3.zero, Quaternion.identity, (byte)0, new object[3]
				{
					((Component)this).transform.localScale,
					bullet.ownPlayer.playerID,
					bullet.damage
				});
				trailView = trailObject.GetComponent<PhotonView>();
			}
		}

		private void Update()
		{
			//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_0040: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (view.IsMine)
			{
				Vector3 val = ((Component)this).transform.position;
				if (!active && Vector3.Distance(((Component)this).transform.position, ((Component)bullet.ownPlayer).transform.position) >= ActvateRange)
				{
					Vector3 val2 = ((Component)this).transform.position - ((Component)bullet.ownPlayer).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					val = ((Component)bullet.ownPlayer).transform.position + normalized * ActvateRange;
					active = true;
				}
				if (active && Time.time > lastSyncTime + SyncInterval)
				{
					trailView.RPC("RPCA_AddPosition", (RpcTarget)0, new object[1] { val });
					lastSyncTime = Time.time;
				}
			}
		}

		private void OnDestroy()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (active)
			{
				trailView.RPC("RPCA_AddPosition", (RpcTarget)0, new object[1] { ((Component)this).transform.position });
				trailView.RPC("RPCA_SourceFinished", (RpcTarget)0, Array.Empty<object>());
			}
			else if (!active)
			{
				PhotonNetwork.Destroy(trailObject);
			}
		}
	}
	public class TrailObject
	{
		public Vector3 Start;

		public Vector3 End;

		public Vector3 Current;

		public float Lifetime;

		public float ExpireTime;

		public TrailObject(Vector3 start, Vector3 end, float lifetime, float expireTime)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			Start = start;
			End = end;
			Lifetime = lifetime;
			ExpireTime = expireTime;
			Current = start;
		}

		public void UpdatePosition(float now)
		{
			//IL_001a: 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_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)
			float num = ExpireTime - now;
			float num2 = 1f - num / Lifetime;
			Current = Vector3.Lerp(Start, End, num2);
		}
	}
	public interface ITrailUpdatable
	{
		void Update(Vector3[] positions);
	}
	public class TrailEffect : MonoBehaviour, IPunInstantiateMagicCallback
	{
		public GameObject EffectObject;

		public float Lifetime = 1f;

		private PhotonView view;

		private ParticleSystem effectParticles;

		private readonly Queue<TrailObject> trail = new Queue<TrailObject>();

		private readonly List<ITrailUpdatable> trailUpdatables = new List<ITrailUpdatable>();

		private readonly List<Vector3> positionsBuffer = new List<Vector3>();

		private Vector3 lastPosition;

		private bool active;

		private bool sourceFinished;

		private void Awake()
		{
			view = ((Component)this).GetComponent<PhotonView>();
			((Component)this).GetComponents<ITrailUpdatable>(trailUpdatables);
			effectParticles = EffectObject.GetComponent<ParticleSystem>();
		}

		private void Update()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if (!active)
			{
				return;
			}
			float num = Time.time;
			while (trail.Count > 0 && trail.Peek().ExpireTime <= num)
			{
				trail.Dequeue();
			}
			foreach (TrailObject item in trail)
			{
				item.UpdatePosition(num);
			}
			positionsBuffer.Clear();
			foreach (TrailObject item2 in trail)
			{
				positionsBuffer.Add(item2.Current);
			}
			if (trail.Count > 0)
			{
				positionsBuffer.Add(trail.Last().End);
			}
			Vector3[] positions = positionsBuffer.ToArray();
			foreach (ITrailUpdatable trailUpdatable in trailUpdatables)
			{
				trailUpdatable.Update(positions);
			}
			if (sourceFinished && trail.Count == 0 && view.IsMine)
			{
				PhotonNetwork.Destroy(((Component)this).gameObject);
			}
		}

		[PunRPC]
		public void RPCA_AddPosition(Vector3 position)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0071: 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_0018: 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)
			float num = Time.time;
			if (!active)
			{
				active = true;
				lastPosition = position;
				EffectObject.transform.position = position;
				effectParticles.Play();
			}
			else
			{
				trail.Enqueue(new TrailObject(lastPosition, position, Lifetime, num + Lifetime));
				lastPosition = position;
				EffectObject.transform.position = position;
			}
		}

		[PunRPC]
		public void RPCA_SourceFinished()
		{
			sourceFinished = true;
		}

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//IL_0006: 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)
			((Component)this).transform.localScale = (Vector3)info.photonView.InstantiationData[0];
		}
	}
}
namespace AALUND13Cards.Standard.MonoBehaviours.CardsEffects
{
	public class BerserkEffect : MonoBehaviour, IOnDoDamageEventOverridable
	{
		public const string BERSEAK_START_KEY = "berseak_start";

		public const string BERSEAK_END_KEY = "berseak_end";

		public const float BERSERK_TIME = 10f;

		public UnityEvent OnBerserkEvent;

		private AttackLevel attackLevel;

		private CharacterData characterData;

		private ChildRPC childRPC;

		private float timeToReset;

		private bool berserkActive;

		private float regenAdded;

		private StatChangeTracker tracker;

		private int remainingBerserkModeAmount;

		private void Start()
		{
			characterData = ((Component)this).GetComponentInParent<CharacterData>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			attackLevel = ((Component)this).GetComponent<AttackLevel>();
			HealthHandler healthHandler = characterData.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(Reset));
			DamageEventHandler.Instance.RegisterDamageEvent((object)this, characterData.player);
			childRPC.childRPCs.Add("berseak_start", RPCA_BerserStart);
			childRPC.childRPCs.Add("berseak_end", RPCA_BerserEnd);
		}

		private void OnDestroy()
		{
			HealthHandler healthHandler = characterData.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(Reset));
			DamageEventHandler.Instance.UnregisterDamageEvent((object)this, characterData.player);
			childRPC.childRPCs.Remove("berseak_start");
			childRPC.childRPCs.Remove("berseak_end");
			Reset();
		}

		private void Update()
		{
			if (characterData.player.data.view.IsMine && berserkActive && Time.time >= timeToReset)
			{
				berserkActive = false;
				childRPC.CallFunction("berseak_end");
			}
		}

		public DamageInfo OnDamage(DamageInfo info)
		{
			//IL_0019: 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)
			float num = characterData.health - ((Vector2)(ref info.Damage)).magnitude;
			if (info.IsLethal && num <= characterData.maxHealth * 0.5f && remainingBerserkModeAmount > 0)
			{
				remainingBerserkModeAmount--;
				OnBerserkMode();
				info.IsLethal = false;
			}
			return info;
		}

		public void Reset()
		{
			if (tracker != null)
			{
				StatManager.Remove(tracker);
				tracker = null;
			}
			HealthHandler healthHandler = characterData.healthHandler;
			healthHandler.regeneration -= regenAdded;
			remainingBerserkModeAmount = attackLevel.attackLevel;
			regenAdded = 0f;
			((MonoBehaviour)this).StopAllCoroutines();
		}

		public void OnBerserkMode()
		{
			if (characterData.player.data.view.IsMine)
			{
				timeToReset = Time.time + 10f;
				berserkActive = true;
				childRPC.CallFunction("berseak_start");
			}
		}

		private void RPCA_BerserStart()
		{
			//IL_0010: 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_0099: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			characterData.block.RPCA_DoBlock(true, false, (BlockTriggerType)0, default(Vector3), false);
			UnityEvent onBerserkEvent = OnBerserkEvent;
			if (onBerserkEvent != null)
			{
				onBerserkEvent.Invoke();
			}
			HealthHandler healthHandler = characterData.healthHandler;
			healthHandler.regeneration -= regenAdded;
			regenAdded = characterData.maxHealth / 10f / 2f;
			HealthHandler healthHandler2 = characterData.healthHandler;
			healthHandler2.regeneration += regenAdded;
			if (tracker == null)
			{
				tracker = StatManager.Apply(characterData.player, new StatChanges
				{
					Damage = 2f,
					MovementSpeed = 1.5f
				});
			}
		}

		private void RPCA_BerserEnd()
		{
			HealthHandler healthHandler = characterData.healthHandler;
			healthHandler.regeneration -= regenAdded;
			regenAdded = 0f;
			StatManager.Remove(tracker);
			tracker = null;
		}
	}
	public class LineHurtbox : MonoBehaviour, ITrailUpdatable, IPunInstantiateMagicCallback
	{
		[Header("Sounds")]
		public SoundEvent SoundDamage;

		[Header("View & Player")]
		[Tooltip("The view & player that own this \"LineHurtbox\"")]
		public PhotonView View;

		public Player Player;

		[Header("Settings")]
		public float DamageDelay = 0.1f;

		public float BaseDamage = 100f;

		public float DamageFromTrail = 0.075f;

		public float BaseThickness = 1f;

		public List<Vector3> Positions = new List<Vector3>();

		[Header("Character Effect")]
		public float Silence;

		public float Slow;

		public bool FastSlow;

		[Header("Scale Character Effect")]
		public bool ScaleSilence;

		public bool ScaleSlow;

		[Header("Scale Settings")]
		public bool ScaleDamage;

		public bool ScaleThickness;

		private Dictionary<Damagable, float> LastDamageMap = new Dictionary<Damagable, float>();

		private void Update()
		{
			if (View.IsMine)
			{
				Damagable[] damagableBetweenPoints = GetDamagableBetweenPoints(Positions);
				foreach (Damagable damagable in damagableBetweenPoints)
				{
					DoDamage(damagable);
				}
			}
		}

		private Damagable[] GetDamagableBetweenPoints(List<Vector3> points)
		{
			//IL_000f: 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)
			//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)
			//IL_0044: 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_0058: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0083: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			HashSet<Damagable> hashSet = new HashSet<Damagable>();
			Vector2 val5 = default(Vector2);
			for (int i = 0; i < points.Count - 1; i++)
			{
				Vector2 val = Vector2.op_Implicit(points[i]);
				Vector2 val2 = Vector2.op_Implicit(points[i + 1]);
				float num = BaseThickness * (ScaleThickness ? ((Component)this).transform.localScale.x : 1f) * 0.5f;
				Vector2 val3 = val2 - val;
				float magnitude = ((Vector2)(ref val3)).magnitude;
				if (magnitude <= 0.0001f)
				{
					continue;
				}
				Vector2 val4 = (val + val2) * 0.5f;
				float num2 = Mathf.Atan2(val3.y, val3.x) * 57.29578f;
				((Vector2)(ref val5))..ctor(magnitude, num * 2f);
				Collider2D[] array = Physics2D.OverlapCapsuleAll(val4, val5, (CapsuleDirection2D)1, num2);
				for (int j = 0; j < array.Length; j++)
				{
					Damagable componentInParent = ((Component)array[j]).GetComponentInParent<Damagable>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						hashSet.Add(componentInParent);
					}
				}
			}
			return hashSet.ToArray();
		}

		private void DoDamage(Damagable damagable)
		{
			//IL_0046: 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_0094: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			float value;
			float num = (LastDamageMap.TryGetValue(damagable, out value) ? value : 0f);
			if (!(Time.time > num + DamageDelay))
			{
				return;
			}
			float num2 = BaseDamage * (ScaleDamage ? ((Component)this).transform.localScale.x : 1f);
			float num3 = Silence * (ScaleSilence ? ((Component)this).transform.localScale.x : 1f);
			float num4 = Slow * (ScaleSlow ? ((Component)this).transform.localScale.x : 1f);
			CharacterData componentInParent = ((Component)damagable).gameObject.GetComponentInParent<CharacterData>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				if (num3 > 0f)
				{
					componentInParent.view.RPC("RPCA_AddSilence", (RpcTarget)0, new object[1] { num3 });
				}
				if (num4 > 0f)
				{
					componentInParent.view.RPC("RPCA_AddSlow", (RpcTarget)0, new object[2] { num4, FastSlow });
				}
			}
			damagable.CallTakeDamage(Vector2.up * num2, Vector2.op_Implicit(((Component)damagable).transform.position), (GameObject)null, Player, true);
			LastDamageMap[damagable] = Time.time;
		}

		public void Update(Vector3[] positions)
		{
			Positions = positions.ToList();
		}

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//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)
			Player = PlayerManager.instance.players.First((Player p) => p.playerID == (int)info.photonView.InstantiationData[1]);
			if (DamageFromTrail != 0f)
			{
				BaseDamage = (float)info.photonView.InstantiationData[2] * DamageFromTrail;
			}
		}
	}
	public class ProjectileEffectChanceMono : MonoBehaviour
	{
		[Header("Sync Time")]
		public string RPCSyncName = "TrailBulletApply";

		[Header("Projectile Chance")]
		public float ProjectileEffectChance = 0.2f;

		public bool DependentOnSPS;

		[Header("Projectile")]
		public Color ProjectileColor = Color.black;

		public ObjectsToSpawn ObjectsToSpawn;

		private Player player;

		private Gun applyGun;

		private ChildRPC childRPC;

		private bool TrailBulletApply;

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			PlayerGunActions.AddShootAction(((Component)this).GetComponentInParent<Player>(), OnShootProjectileAction);
			childRPC.childRPCs.Add(RPCSyncName, SyncTrailBullet);
		}

		private void OnDestroy()
		{
			PlayerGunActions.RemoveShootAction(((Component)this).GetComponentInParent<Player>(), OnShootProjectileAction);
			childRPC.childRPCs.Remove(RPCSyncName);
		}

		public void OnShootProjectileAction(Gun gun, GameObject obj)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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)
			if (TrailBulletApply && (Object)(object)applyGun != (Object)null)
			{
				applyGun.objectsToSpawn = applyGun.objectsToSpawn.Except((IEnumerable<ObjectsToSpawn>)(object)new ObjectsToSpawn[1] { ObjectsToSpawn }).ToArray();
				TrailBulletApply = false;
				applyGun = null;
				if (ProjectileColor != Color.black)
				{
					float num = Mathf.Pow((ProjectileColor.r * ProjectileColor.r + ProjectileColor.r * ProjectileColor.r) / 2f, 0.5f);
					float num2 = Mathf.Pow((ProjectileColor.g * ProjectileColor.g + ProjectileColor.g * ProjectileColor.g) / 2f, 0.5f);
					float num3 = Mathf.Pow((ProjectileColor.b * ProjectileColor.b + ProjectileColor.b * ProjectileColor.b) / 2f, 0.5f);
					float num4 = default(float);
					float num5 = default(float);
					float num6 = default(float);
					Color.RGBToHSV(new Color(num, num2, num3, 1f), ref num4, ref num5, ref num6);
					obj.GetComponent<SpawnedAttack>().SetColor(Color.HSVToRGB(num4, 1f, 1f));
				}
			}
			float num7 = Mathf.Max(DependentOnSPS ? PlayerExtensions.GetSPS(player) : 1f, 0.01f);
			if (player.data.view.IsMine && Random.value < ProjectileEffectChance / num7)
			{
				childRPC.CallFunction(RPCSyncName);
			}
		}

		public void SyncTrailBullet()
		{
			applyGun = player.data.weaponHandler.gun;
			applyGun.objectsToSpawn = applyGun.objectsToSpawn.Concat((IEnumerable<ObjectsToSpawn>)(object)new ObjectsToSpawn[1] { ObjectsToSpawn }).ToArray();
			TrailBulletApply = true;
		}
	}
	public class QuickDashHandler : MonoBehaviour
	{
		public const string QUICK_DASH_KEY = "quick_dash";

		[Header("Sounds")]
		public SoundEvent DashSound;

		public ParticleSystem DashParticleSystem;

		[Header("Other Settings")]
		public float DoubleKeyPressMaxTiming = 0.3f;

		public float DashForce = 5000f;

		public float DashCooldown = 0.25f;

		private PlayerVelocity playerVelocity;

		private CharacterData characterData;

		private GeneralInput input;

		private ChildRPC childRPC;

		private Vector3 LastDirectionInput = Vector3.zero;

		private bool isKeyDown;

		private float keyPressResetTime;

		private float dashCooldownTime;

		private int inputKeyPressAmount;

		private int quickDashesLeft;

		private void Start()
		{
			playerVelocity = ((Component)this).GetComponentInParent<PlayerVelocity>();
			characterData = ((Component)this).GetComponentInParent<CharacterData>();
			input = ((Component)this).GetComponentInParent<GeneralInput>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			DashSound.variables.audioMixerGroup = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX")[0];
			childRPC.childRPCsVector2.Add("quick_dash", RPCA_Dash);
		}

		private void OnDestroy()
		{
			childRPC.childRPCsVector2.Remove("quick_dash");
		}

		private void Update()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			if (!characterData.view.IsMine)
			{
				return;
			}
			if (Time.time > keyPressResetTime)
			{
				inputKeyPressAmount = 0;
			}
			if (characterData.isGrounded)
			{
				quickDashesLeft = CharacterDataExtensions.GetCustomStatsRegistry(characterData).GetOrCreate<StandardStats>().QuickDashes;
			}
			if (isKeyDown && input.direction.x == 0f)
			{
				isKeyDown = false;
			}
			else if (isKeyDown && input.direction.x != 0f)
			{
				return;
			}
			if (input.direction.x != 0f && quickDashesLeft != 0)
			{
				if (LastDirectionInput != input.direction)
				{
					LastDirectionInput = input.direction;
					inputKeyPressAmount = 0;
				}
				keyPressResetTime = Time.time + DoubleKeyPressMaxTiming;
				inputKeyPressAmount++;
				isKeyDown = true;
				if (inputKeyPressAmount >= 2 && Time.time > dashCooldownTime)
				{
					childRPC.CallFunction("quick_dash", Vector2.op_Implicit(input.direction));
					dashCooldownTime = Time.time + DashCooldown;
					quickDashesLeft--;
				}
			}
		}

		private void RPCA_Dash(Vector2 dir)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			ExtensionMethods.SetFieldValue((object)playerVelocity, "velocity", (object)new Vector2(((Vector2)ExtensionMethods.GetFieldValue((object)playerVelocity, "velocity")).x, 0f));
			ExtensionMethods.InvokeMethod((object)playerVelocity, "AddForce", new Type[1] { typeof(Vector2) }, new object[1] { (object)new Vector2(dir.x * DashForce * (float)ExtensionMethods.GetFieldValue((object)playerVelocity, "mass"), 0f) });
			characterData.sinceGrounded = 0f;
			characterData.sinceWallGrab = 0f;
			SoundManager.Instance.Play(DashSound, ((Component)characterData).transform);
			DashParticleSystem.Play();
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, 0.25f, (Action)delegate
			{
				DashParticleSystem.Stop();
			});
		}
	}
}
namespace AALUND13Cards.Standard.Handler
{
	public class PlayerGunActions
	{
		public static Dictionary<Player, Action<Gun, GameObject>> OnGunShootAction = new Dictionary<Player, Action<Gun, GameObject>>();

		public static void AddShootAction(Player player, Action<Gun, GameObject> action)
		{
			if (!OnGunShootAction.ContainsKey(player))
			{
				OnGunShootAction.Add(player, action);
				return;
			}
			Dictionary<Player, Action<Gun, GameObject>> onGunShootAction = OnGunShootAction;
			onGunShootAction[player] = (Action<Gun, GameObject>)Delegate.Combine(onGunShootAction[player], action);
		}

		public static void RemoveShootAction(Player player, Action<Gun, GameObject> action)
		{
			if (OnGunShootAction.ContainsKey(player))
			{
				Dictionary<Player, Action<Gun, GameObject>> onGunShootAction = OnGunShootAction;
				onGunShootAction[player] = (Action<Gun, GameObject>)Delegate.Remove(onGunShootAction[player], action);
			}
		}

		internal static void InvokeShootAction(Player player, Gun gun, GameObject projectile)
		{
			if (!OnGunShootAction.ContainsKey(player))
			{
				OnGunShootAction.Add(player, null);
			}
			OnGunShootAction[player]?.Invoke(gun, projectile);
		}
	}
}
namespace AALUND13Cards.Standard.Cards
{
	public class StandardStats : ICustomStats
	{
		public float secondToDealDamage;

		public bool dealDamage = true;

		public int BlocksWhenRecharge;

		public float StunBlockTime;

		public Rarity MaxRarityForCurse;

		public float DamageReduction;

		public float BleedingDamage;

		public int QuickDashes;

		public float FrozenTime;

		public float OldFrozenTime;

		public float GravityDamageMultiplier;

		public void ResetStats()
		{
			secondToDealDamage = 0f;
			dealDamage = true;
			BlocksWhenRecharge = 0;
			StunBlockTime = 0f;
			MaxRarityForCurse = null;
			DamageReduction = 0f;
			BleedingDamage = 0f;
			QuickDashes = 0;
			FrozenTime = 0f;
			OldFrozenTime = 0f;
			GravityDamageMultiplier = 0f;
		}
	}
}
namespace AALUND13Cards.Standard.Cards.StatModifers
{
	public class StandardStatModifers : CustomStatModifers
	{
		[Header("Curses Stats")]
		public bool SetMaxRarityForCurse;

		public CardRarity MaxRarityForCurse;

		[Header("Blocks Stats")]
		public int BlocksWhenRecharge;

		public float StunBlockTime;

		[Header("Uncategorized Stats")]
		public float SecondToDealDamage;

		public float BleedingDamage;

		public float FreezeDamage;

		public int QuickDashes;

		[Header("Bullets Damage Multiplier")]
		public float BulletsDamageMultiplier;

		public override void Apply(Player player)
		{
			//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)
			StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>();
			if (SecondToDealDamage > 0f)
			{
				orCreate.dealDamage = false;
			}
			orCreate.secondToDealDamage += SecondToDealDamage;
			orCreate.BleedingDamage += BleedingDamage;
			orCreate.QuickDashes += QuickDashes;
			if (SetMaxRarityForCurse)
			{
				Rarity rarity = RarityUtils.GetRarity(((object)(CardRarity)(ref MaxRarityForCurse)).ToString());
				orCreate.MaxRarityForCurse = RarityUtils.GetRarityData(rarity);
			}
			orCreate.BlocksWhenRecharge += BlocksWhenRecharge;
			orCreate.StunBlockTime += StunBlockTime;
			orCreate.GravityDamageMultiplier += BulletsDamageMultiplier;
		}
	}
}