Decompiled source of AALUND13 Cards v1.12.3

plugins/AALUND13_Cards.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AALUND13Cards.Armors;
using AALUND13Cards.Armors.Processor;
using AALUND13Cards.Cards;
using AALUND13Cards.Cards.Conditions;
using AALUND13Cards.Cards.Effects;
using AALUND13Cards.Extensions;
using AALUND13Cards.Handlers;
using AALUND13Cards.Handlers.ExtraPickHandlers;
using AALUND13Cards.MonoBehaviours;
using AALUND13Cards.MonoBehaviours.CardsEffects;
using AALUND13Cards.MonoBehaviours.CardsEffects.Soulstreak;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CorruptedCardsManager;
using HarmonyLib;
using JARL;
using JARL.Armor;
using JARL.Armor.Bases;
using JARL.Armor.Processors;
using JARL.Armor.Utlis;
using JARL.Bases;
using JARL.Extensions;
using JARL.Utils;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RandomCardsGenerators;
using RandomCardsGenerators.Cards;
using RandomCardsGenerators.StatsGroup;
using RarityLib.Utils;
using Sonigon;
using SoundImplementation;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using WillsWackyManagers.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[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
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.aalund13.rounds.aalund13_cards", "AALUND13 Cards", "1.12.3")]
	[BepInProcess("Rounds.exe")]
	public class AALUND13_Cards : BaseUnityPlugin
	{
		internal const string ModInitials = "AAC";

		internal const string CurseInitials = "AAC (Curse)";

		internal const string ModId = "com.aalund13.rounds.aalund13_cards";

		internal const string ModName = "AALUND13 Cards";

		internal const string Version = "1.12.3";

		internal static List<BaseUnityPlugin> Plugins;

		internal static ManualLogSource ModLogger;

		internal static AssetBundle Assets;

		public static GameObject BlankCardPrefab;

		public static CardResgester CardResgester;

		public static CardCategory SoulstreakClassCards;

		public static Material PixelateEffectMaterial;

		public static Material ScanEffectMaterial;

		public static AALUND13_Cards Instance { get; private set; }

		public void Awake()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			Instance = this;
			ModLogger = ((BaseUnityPlugin)this).Logger;
			ConfigHandler.RegesterMenu(((BaseUnityPlugin)this).Config);
			Assets = AssetUtils.LoadAssetBundleFromResources("aacardassets", typeof(AALUND13_Cards).Assembly);
			if ((Object)(object)Assets == (Object)null)
			{
				throw new Exception("Failed to load asset bundle");
			}
			BlankCardPrefab = Assets.LoadAsset<GameObject>("__AAC__Blank");
			PixelateEffectMaterial = Assets.LoadAsset<Material>("PixelateEffectMaterial");
			ScanEffectMaterial = Assets.LoadAsset<Material>("ScanEffectMaterial");
			AACardsGenerators.RegisterGenerators();
			Harmony val = new Harmony("com.aalund13.rounds.aalund13_cards");
			val.PatchAll();
		}

		public void Start()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			Plugins = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			CardResgester = Assets.LoadAsset<GameObject>("ModCards").GetComponent<CardResgester>();
			CardResgester.RegisterCards<AALUND13_Cards>("AAC");
			GameObject val = Object.Instantiate<GameObject>(Assets.LoadAsset<GameObject>("FlashlightMaskHandler"));
			Object.DontDestroyOnLoad((Object)(object)val);
			DeathHandler.OnPlayerDeath += new DeathHandlerDelegate(OnPlayerDeath);
			ArmorFramework.RegisterArmorType<SoulArmor>();
			ArmorFramework.RegisterArmorType<BattleforgedArmor>();
			ArmorFramework.RegisterArmorProcessor<DamageAgainstArmorPercentagePeocessor>();
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => ExtraCardPickHandler.HandleExtraPicks()));
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)OnPickStart);
			if (Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			((Component)this).gameObject.AddComponent<DelayDamageHandler>();
			((Component)this).gameObject.AddComponent<PickCardTracker>();
		}

		private IEnumerator OnGameStart(IGameModeHandler gameModeHandler)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					player.data.GetAdditionalData().Souls = 0u;
				}
			}
			yield break;
		}

		private IEnumerator OnPickStart(IGameModeHandler gameModeHandler)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					bool isWinner = gameModeHandler.GetRoundWinners().Contains(player.teamID);
					if (player.data.GetAdditionalData().ExtraCardPicks > 0 && !isWinner)
					{
						ExtraCardPickHandler.AddExtraPick<ExtraPickHandler>(player, player.data.GetAdditionalData().ExtraCardPicks);
					}
				}
			}
			yield break;
		}

		private void OnPlayerDeath(Player player, Dictionary<Player, DamageInfo> playerDamageInfos)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)player).GetComponent<DelayDamageHandler>() != (Object)null)
			{
				((MonoBehaviour)((Component)player).GetComponent<DelayDamageHandler>()).StopAllCoroutines();
			}
			foreach (KeyValuePair<Player, DamageInfo> playerDamageInfo in playerDamageInfos)
			{
				if (playerDamageInfo.Value.TimeSinceLastDamage <= 5f && (Object)(object)((Component)playerDamageInfo.Key).GetComponentInChildren<SoulstreakMono>() != (Object)null && !playerDamageInfo.Key.data.dead)
				{
					((Component)playerDamageInfo.Key).GetComponentInChildren<SoulstreakMono>().AddSouls();
					if ((Object)(object)((Component)player).GetComponentInChildren<SoulstreakMono>() != (Object)null)
					{
						((Component)playerDamageInfo.Key).GetComponentInChildren<SoulstreakMono>().AddSouls((uint)((float)player.data.GetAdditionalData().Souls * 0.5f));
					}
				}
			}
			((Component)player).GetComponentInChildren<SoulstreakMono>()?.ResetSouls();
			if ((Object)(object)((Component)player).GetComponentInChildren<SoulstreakMono>() == (Object)null)
			{
				player.data.GetAdditionalData().Souls = 0u;
			}
		}
	}
	public class PickCardTracker : MonoBehaviour, IPickStartHookHandler
	{
		public static PickCardTracker instance;

		private readonly List<CardInfo> cardPickedInPickPhase = new List<CardInfo>();

		public IReadOnlyList<CardInfo> CardPickedInPickPhase => cardPickedInPickPhase.AsReadOnly();

		public bool AlreadyPickedInPickPhase(CardInfo card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return false;
			}
			return cardPickedInPickPhase.Contains(card);
		}

		public void OnPickStart()
		{
			cardPickedInPickPhase.Clear();
		}

		internal void AddCardPickedInPickPhase(CardInfo card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				if ((Object)(object)card.sourceCard != (Object)null)
				{
					card = card.sourceCard;
				}
				if (!cardPickedInPickPhase.Contains(card))
				{
					cardPickedInPickPhase.Add(card);
				}
			}
		}

		private void Awake()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Debug.LogWarning((object)"PickCardTracker instance already exists! Destroying the new one.");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				instance = this;
				InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
			}
		}
	}
	public enum AACardsGeneratorType
	{
		CardFactoryGenerator
	}
	internal class AACardsGenerators
	{
		public static ModRandomCardsGenerators<AACardsGeneratorType> Generators;

		public static void RegisterGenerators()
		{
			Dictionary<AACardsGeneratorType, RandomCardsGenerator> dictionary = new Dictionary<AACardsGeneratorType, RandomCardsGenerator> { 
			{
				AACardsGeneratorType.CardFactoryGenerator,
				CreateCardFactoryGenerator()
			} };
			Generators = new ModRandomCardsGenerators<AACardsGeneratorType>(dictionary);
		}

		private static RandomCardsGenerator CreateCardFactoryGenerator()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			RandomCardOption val = default(RandomCardOption);
			((RandomCardOption)(ref val))..ctor("Defective Card", "AAC", "This card that come out the factory is defective, it has some negative stats.", "Dc", 1, 4, (Rarity)0, (CardThemeColorType)0);
			return new RandomCardsGenerator("DefectiveCardGenerators", val, new List<RandomStatGenerator>
			{
				(RandomStatGenerator)new DamageStatGenerator(-0.5f, 0f, 0.05f),
				(RandomStatGenerator)new ReloadTimeStatGenerator(0f, 0.5f, 0.05f),
				(RandomStatGenerator)new AttackSpeedStatGenerator(0f, 0.5f, 0.05f),
				(RandomStatGenerator)new MovementSpeedStatGenerator(-0.5f, 0f, 0.05f),
				(RandomStatGenerator)new HealthStatGenerator(-0.5f, 0f, 0.05f),
				(RandomStatGenerator)new BlockCooldownStatGenerator(0f, 0.5f, 0.025f),
				(RandomStatGenerator)new BulletSpeedStatGenerator(-0.5f, 0f, 0.05f)
			});
		}
	}
	public class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory val = TabInfoManager.RegisterCategory("AA Stats", 6);
			TabInfoManager.RegisterStat(val, "Delay Damage", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().secondToDealDamage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().secondToDealDamage} seconds"));
			TabInfoManager.RegisterStat(val, "Random Cards At Start", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RandomCardsAtStart != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RandomCardsAtStart}"));
			TabInfoManager.RegisterStat(val, "Extra Card Picks", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().ExtraCardPicks != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().ExtraCardPicks}"));
			TabInfoManager.RegisterStat(val, "Damage Against Armor Percentage", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().DamageAgainstArmorPercentage != 1f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().DamageAgainstArmorPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(val, "Blocks When Recharge", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().BlocksWhenRecharge != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().BlocksWhenRecharge}"));
			TabInfoManager.RegisterStat(val, "Block Pierce Percent", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().BlockPircePercent != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().BlockPircePercent * 100f:0}%"));
			TabInfoManager.RegisterStat(val, "Current HP Regen Percentage", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().CurrentHPRegenPercentage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().CurrentHPRegenPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(val, "DPS", (Func<Player, bool>)((Player _) => true), (Func<Player, string>)((Player p) => $"{p.GetDPS()}"));
			TabInfoManager.RegisterStat(val, "Is Bind", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().isBind), (Func<Player, string>)((Player p) => p.data.GetAdditionalData().isBind ? "Yes" : "No"));
			StatCategory val2 = TabInfoManager.RegisterCategory("Soulstreak Stats", 7);
			TabInfoManager.RegisterStat(val2, "Max Health Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.MaxHealth != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.MaxHealth * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "player Size Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.PlayerSize != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.PlayerSize * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Movement Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.MovementSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.MovementSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Attack Speed Pre Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.AttackSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.AttackSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Damage Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.Damage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.Damage * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Bullet Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.BulletSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.BulletSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Soul Armor Percentage", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Soul Armor Percentage Regen Rate", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentageRegenRate != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentageRegenRate * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Soul Drain DPS Factor", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulDrainDPSFactor != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulDrainDPSFactor * 100f:0}%"));
			TabInfoManager.RegisterStat(val2, "Souls", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().Souls != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().Souls}"));
			StatCategory val3 = TabInfoManager.RegisterCategory("Railgun Stats", 8);
			TabInfoManager.RegisterStat(val3, "Charge", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RailgunStats.IsEnabled && p.data.GetAdditionalData().RailgunStats.MaximumCharge != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RailgunStats.CurrentCharge:0.00}/{p.data.GetAdditionalData().RailgunStats.MaximumCharge:0.00}"));
			TabInfoManager.RegisterStat(val3, "Charge Rate", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RailgunStats.IsEnabled && p.data.GetAdditionalData().RailgunStats.ChargeRate != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RailgunStats.ChargeRate:0.00}/s"));
			TabInfoManager.RegisterStat(val3, "Railgun Damage Multiplier", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RailgunStats.IsEnabled && p.data.GetAdditionalData().RailgunStats.RailgunDamageMultiplier != 1f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RailgunStats.RailgunDamageMultiplier * 100f:0}%"));
			TabInfoManager.RegisterStat(val3, "Railgun Bullet Speed Multiplier", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RailgunStats.IsEnabled && p.data.GetAdditionalData().RailgunStats.RailgunBulletSpeedMultiplier != 1f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RailgunStats.RailgunBulletSpeedMultiplier * 100f:0}%"));
			TabInfoManager.RegisterStat(val3, "Railgun Full Charge Threshold", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().RailgunStats.IsEnabled && p.data.GetAdditionalData().RailgunStats.FullChargeThreshold != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().RailgunStats.FullChargeThreshold:0.00}"));
		}
	}
	public static class LoggerUtils
	{
		public static bool logging = ConfigHandler.DebugMode.Value;

		public static void LogInfo(string message)
		{
			if (logging)
			{
				AALUND13_Cards.ModLogger.LogInfo((object)message);
			}
		}

		public static void LogWarn(string message)
		{
			AALUND13_Cards.ModLogger.LogWarning((object)message);
		}

		public static void LogError(string message)
		{
			AALUND13_Cards.ModLogger.LogError((object)message);
		}
	}
}
namespace AALUND13Cards.VisualEffect
{
	public class AddAComponentToRandomObjects : MonoBehaviour
	{
		public int NumberOfObjectsToAdd = 1;

		public MonoBehaviour ComponentToAdd;

		public List<GameObject> TargetObjects;

		private void Start()
		{
			if (TargetObjects == null || TargetObjects.Count == 0)
			{
				Debug.LogWarning("No TargetObjects specified to add the component to.");
				return;
			}
			for (int i = 0; i < NumberOfObjectsToAdd; i++)
			{
				AddComponentToRandomObject();
			}
		}

		private void AddComponentToRandomObject()
		{
			if (TargetObjects == null || TargetObjects.Count == 0)
			{
				Debug.LogWarning("No TargetObjects specified to add the component to.");
				return;
			}
			int index = Random.Range(0, TargetObjects.Count);
			GameObject val = TargetObjects[index];
			if ((Object)(object)val.GetComponent(((object)ComponentToAdd).GetType()) != (Object)null)
			{
				Debug.LogWarning("Component " + ((object)ComponentToAdd).GetType().Name + " already exists on " + ((Object)val).name);
				return;
			}
			val.AddComponent(((object)ComponentToAdd).GetType());
			TargetObjects.RemoveAt(index);
		}
	}
	public class CorruptedCardVisualEffect : MonoBehaviour
	{
		private const float ROTATE_CARD_CHANCE = 5f;

		private const float ROTATE_CARD_ANGLE_LIMIT = 180f;

		private float oldRotationZ;

		private void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = ((Component)this).transform.rotation;
			oldRotationZ = ((Quaternion)(ref rotation)).eulerAngles.z;
		}

		private void Update()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_006c: 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)
			if (Random.Range(0f, 100f) < 5f)
			{
				((Component)this).transform.Rotate(0f, 0f, Random.Range(-180f, 180f));
				return;
			}
			Quaternion rotation = ((Component)this).transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z = oldRotationZ;
			((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0028: 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)
			Quaternion rotation = ((Component)this).transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z = oldRotationZ;
			((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0028: 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)
			Quaternion rotation = ((Component)this).transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z = oldRotationZ;
			((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
		}
	}
	public class StartWithRandomRotationOffset : MonoBehaviour
	{
		[Tooltip("The maximum rotation offset in degrees that will be applied to the object at start.")]
		public float rotationOffset = 25f;

		private void Start()
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f - rotationOffset, rotationOffset);
			Quaternion rotation = ((Component)this).transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z += num;
			((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
		}
	}
	[DisallowMultipleComponent]
	public class StartWithRandomSize : MonoBehaviour
	{
		public Vector2 sizeRange = new Vector2(0.75f, 1.25f);

		private void Start()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(sizeRange.x, sizeRange.y);
			((Component)this).transform.localScale = new Vector3(num, num, 1f);
		}
	}
}
namespace AALUND13Cards.Utils
{
	public class RandomCardRarity : MonoBehaviour
	{
		public Image[] edges;

		public void OnEnable()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!Application.isEditor)
			{
				Rarity randomRarity = GetRandomRarity();
				Image[] array = edges;
				foreach (Image val in array)
				{
					((Graphic)val).color = randomRarity.color;
				}
			}
			else
			{
				Debug.Log((object)"RandomCardRarity is running in the editor");
			}
		}

		public static Rarity GetRandomRarity()
		{
			float num = RarityUtils.Rarities.Sum((KeyValuePair<int, Rarity> r) => r.Value.calculatedRarity);
			float num2 = Random.Range(0f, num);
			Rarity result = null;
			foreach (KeyValuePair<int, Rarity> rarity in RarityUtils.Rarities)
			{
				num2 -= rarity.Value.calculatedRarity;
				if (num2 <= 0f)
				{
					result = rarity.Value;
					break;
				}
			}
			return result;
		}
	}
}
namespace AALUND13Cards.Patches
{
	[HarmonyPatch(typeof(Cards), "PlayerIsAllowedCard")]
	public class AllowedCardPatch
	{
		private static void Postfix(Player player, CardInfo card, ref bool __result)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || (Object)(object)card == (Object)null)
			{
				return;
			}
			if ((Object)(object)ExtraCardPickHandler.currentPlayer != (Object)null && ExtraCardPickHandler.extraPicks.ContainsKey(player) && ExtraCardPickHandler.extraPicks[player].Count > 0)
			{
				ExtraPickHandler extraPickHandler = ExtraCardPickHandler.extraPicks[player][0];
				bool flag = extraPickHandler.OnExtraPickStart(player, card);
				__result &= flag;
			}
			CardCondition[] components = ((Component)card).GetComponents<CardCondition>();
			if (components != null && components.Length != 0)
			{
				CardCondition[] array = components;
				foreach (CardCondition cardCondition in array)
				{
					if (!((Object)(object)cardCondition == (Object)null) && !cardCondition.IsPlayerAllowedCard(player))
					{
						__result = false;
						break;
					}
				}
			}
			if (card.categories.Contains(CustomCardCategories.instance.CardCategory("Curse")) && player.data.GetAdditionalData().MaxRarityForCurse != null)
			{
				Rarity rarityData = RarityUtils.GetRarityData(card.rarity);
				Rarity maxRarityForCurse = player.data.GetAdditionalData().MaxRarityForCurse;
				if (rarityData.relativeRarity < maxRarityForCurse.relativeRarity)
				{
					__result = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ApplyCardStats), "ApplyStats")]
	public class ApplyCardStatsPatch
	{
		public static void Postfix(ApplyCardStats __instance, Player ___playerToUpgrade)
		{
			AAStatModifers component = ((Component)__instance).gameObject.GetComponent<AAStatModifers>();
			if ((Object)(object)component != (Object)null)
			{
				component.Apply(___playerToUpgrade);
			}
		}
	}
	[HarmonyPatch(typeof(Block))]
	public 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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			if (!(!firstBlock || dontSetCD) && (int)triggerType <= 0)
			{
				BlockRechargeAlreadyTriggered[__instance] = false;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPostfix(Block __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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 < data.GetAdditionalData().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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0055: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			HealthHandler val = (HealthHandler)ExtensionMethods.GetFieldValue((object)__instance, "health");
			float blockPircePercent = component.ownPlayer.data.GetAdditionalData().BlockPircePercent;
			if (blockPircePercent > 0f)
			{
				Vector2 val2 = Vector2.op_Implicit((component.bulletCanDealDeamage ? component.damage : 1f) * blockPircePercent * ((Vector3)(ref forward)).normalized);
				((Damagable)val).TakeDamage(val2, Vector2.op_Implicit(hitPos), component.projectileColor, component.ownWeapon, component.ownPlayer, true, true);
				Object.Destroy((Object)(object)projectile);
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice))]
	public class CardChoicePatch
	{
		[HarmonyPatch("IDoEndPick")]
		private static void Postfix(GameObject pickedCard, int theInt, int pickId)
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, pickId);
			if ((Object)(object)playerWithID == (Object)null)
			{
				return;
			}
			PickCardTracker.instance.AddCardPickedInPickPhase(pickedCard.GetComponent<CardInfo>());
			if ((Object)(object)ExtraCardPickHandler.currentPlayer != (Object)null && ExtraCardPickHandler.extraPicks.ContainsKey(playerWithID) && ExtraCardPickHandler.extraPicks[playerWithID].Count > 0)
			{
				ExtraPickHandler extraPickHandler = ExtraCardPickHandler.extraPicks[playerWithID][0];
				extraPickHandler.OnExtraPick(playerWithID, pickedCard.GetComponent<CardInfo>());
			}
			if (playerWithID.data.GetAdditionalData().DuplicatesAsCorrupted == 0 || (!((Object)(object)pickedCard.GetComponent<RandomCard>() == (Object)null) && pickedCard.GetComponent<RandomCard>().StatGenName.StartsWith("CCM_CorruptedCardsGenerator")) || (!PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode))
			{
				return;
			}
			Rarity rarity = pickedCard.GetComponent<CardInfo>().rarity;
			if (Enum.IsDefined(typeof(CorruptedCardRarity), ((object)(Rarity)(ref rarity)).ToString()))
			{
				CorruptedCardRarity val = (CorruptedCardRarity)Enum.Parse(typeof(CorruptedCardRarity), ((object)(Rarity)(ref rarity)).ToString());
				for (int i = 0; i < playerWithID.data.GetAdditionalData().DuplicatesAsCorrupted; i++)
				{
					CorruptedCardsManager.CorruptedCardsGenerators.CreateRandomCard(val, playerWithID);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterStatModifiers))]
	public class CharacterStatModifiersPatch
	{
		[HarmonyPatch("ResetStats")]
		[HarmonyPrefix]
		public static void ResetStats(CharacterStatModifiers __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			val.GetAdditionalData().Reset();
			if (ExtraCardPickHandler.extraPicks.ContainsKey(val.player))
			{
				ExtraCardPickHandler.extraPicks[val.player].Clear();
			}
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null)
			{
				Effect[] components = ((Component)main).GetComponents<Effect>();
				foreach (Effect effect in components)
				{
					Object.Destroy((Object)(object)effect);
				}
			}
		}
	}
	[HarmonyPatch(typeof(DamageOverTime))]
	public class DamageOverTimePatch
	{
		[HarmonyPatch("TakeDamageOverTime")]
		[HarmonyPrefix]
		public static void TakeDamageOverTimePrefix(DamageOverTime __instance, Vector2 damage)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			if (!HealthHandlerPatch.TakeDamageRunning)
			{
				DamageEventHandler.TriggerDamageEvent(DamageEventHandler.DamageEventType.OnTakeDamageOvertime, val.player, damage);
			}
		}
	}
	[HarmonyPatch(typeof(Gun))]
	public class GunPatch
	{
		[HarmonyPatch("ApplyProjectileStats")]
		public static void Prefix(Gun __instance, GameObject obj)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			RailgunStats railgunStats = __instance.player.data.GetAdditionalData().RailgunStats;
			if (railgunStats.IsEnabled)
			{
				ProjectileHit component = obj.GetComponent<ProjectileHit>();
				MoveTransform component2 = obj.GetComponent<MoveTransform>();
				RailgunStats.RailgunChargeStats chargeStats = railgunStats.GetChargeStats(railgunStats.CurrentCharge);
				component2.localForce *= chargeStats.ChargeBulletSpeedMultiplier;
				component.damage *= chargeStats.ChargeDamageMultiplier;
			}
		}

		[HarmonyPatch("DoAttack")]
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction code in instructions)
			{
				if (code.opcode == OpCodes.Ret)
				{
					yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(GunPatch), "InjectUseCharge", (Type[])null, (Type[])null));
				}
				yield return code;
			}
		}

		public static void InjectUseCharge(Gun gun)
		{
			RailgunStats railgunStats = gun.player.data.GetAdditionalData().RailgunStats;
			if (railgunStats.IsEnabled && railgunStats.CurrentCharge > 0f)
			{
				railgunStats.UseCharge(railgunStats);
			}
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	public class HealthHandlerPatch
	{
		public static bool TakeDamageRunning;

		[HarmonyPatch("TakeDamage", new Type[]
		{
			typeof(Vector2),
			typeof(Vector2),
			typeof(Color),
			typeof(GameObject),
			typeof(Player),
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPrefix]
		public static void TakeDamagePrefix(HealthHandler __instance, Vector2 damage)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			TakeDamageRunning = true;
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			DamageEventHandler.TriggerDamageEvent(DamageEventHandler.DamageEventType.OnTakeDamage, val.player, damage);
		}

		[HarmonyPatch("TakeDamage", new Type[]
		{
			typeof(Vector2),
			typeof(Vector2),
			typeof(Color),
			typeof(GameObject),
			typeof(Player),
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPostfix]
		public static void TakeDamagePostfix(HealthHandler __instance, Vector2 damage)
		{
			TakeDamageRunning = false;
		}

		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamage(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			AALUND13CardCharacterDataAdditionalData additionalData = val.GetAdditionalData();
			Vector2 damage2 = damage;
			DamageEventHandler.TriggerDamageEvent(DamageEventHandler.DamageEventType.OnDoDamage, val.player, damage2);
			if (additionalData.secondToDealDamage > 0f && !additionalData.dealDamage)
			{
				Vector2 damage3 = default(Vector2);
				((Vector2)(ref damage3))..ctor(damage.x, damage.y);
				ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(damage3, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
				damage = Vector2.zero;
			}
			else if (additionalData.dealDamage)
			{
				additionalData.dealDamage = false;
			}
		}
	}
	[HarmonyPatch(typeof(ResetBlock), "Go")]
	public class ResetBlockPatch
	{
		public static void Postfix(Block __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterData characterData = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
			if (!(BlockPatch.BlockRechargeAlreadyTriggered.TryGetValue(__instance, out var value) && value))
			{
				for (int i = 0; i < characterData.GetAdditionalData().BlocksWhenRecharge; i++)
				{
					float num = (float)ExtensionMethods.GetFieldValue((object)__instance, "timeBetweenBlocks");
					float num2 = (float)i * num;
					((MonoBehaviour)__instance).StartCoroutine("DelayBlock", (object)num2);
				}
				BlockPatch.BlockRechargeAlreadyTriggered[__instance] = false;
			}
		}
	}
}
namespace AALUND13Cards.MonoBehaviours
{
	public class DamageSpawnedAttack : SpawnedAttack
	{
		public Vector2 Damage;
	}
	[RequireComponent(typeof(DamageSpawnObjects))]
	public class DamageSpawnObjects : SpawnObjects, IOnDoDamageEvent, IOnTakeDamageEvent, IOnTakeDamageOvertimeEvent
	{
		public float DamageThreshold = 0.5f;

		public bool TriggerOnDamage = false;

		public bool TriggerOnTakeDamage = true;

		public bool TriggerOnOvertimeDamage = true;

		private Player player;

		public void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			DamageEventHandler.RegisterDamageEvent(this, player);
		}

		public void OnDestroy()
		{
			DamageEventHandler.UnregisterDamageEvent(this, player);
		}

		public void OnDamage(Vector2 damage)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (TriggerOnDamage && ((Vector2)(ref damage)).magnitude >= DamageThreshold)
			{
				SpawnDamage(damage);
			}
		}

		public void OnTakeDamage(Vector2 damage)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (TriggerOnTakeDamage && ((Vector2)(ref damage)).magnitude >= DamageThreshold)
			{
				SpawnDamage(damage);
			}
		}

		public void OnTakeDamageOvertime(Vector2 damage)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (TriggerOnOvertimeDamage && ((Vector2)(ref damage)).magnitude >= DamageThreshold)
			{
				SpawnDamage(damage);
			}
		}

		public void SpawnDamage(Vector2 damage)
		{
			//IL_0028: 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)
			GameObject[] objectToSpawn = base.objectToSpawn;
			foreach (GameObject val in objectToSpawn)
			{
				DamageSpawnedAttack component = val.GetComponent<DamageSpawnedAttack>();
				if ((Object)(object)component != (Object)null)
				{
					component.Damage = damage;
				}
			}
			((SpawnObjects)this).Spawn();
		}
	}
	[ExecuteInEditMode]
	[RequireComponent(typeof(Camera))]
	public class Effect : MonoBehaviour
	{
		public Material Material;

		private void OnRenderImage(RenderTexture src, RenderTexture dest)
		{
			if ((Object)(object)Material == (Object)null)
			{
				Graphics.Blit((Texture)(object)src, dest);
				return;
			}
			RenderTexture temporary = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height);
			Graphics.Blit((Texture)(object)src, temporary, Material, 0);
			Graphics.Blit((Texture)(object)temporary, dest);
			RenderTexture.ReleaseTemporary(temporary);
		}
	}
}
namespace AALUND13Cards.MonoBehaviours.CardsEffects
{
	public class CardFactoryMono : MonoBehaviour, IPickEndHookHandler
	{
		public Player Player;

		public Gun Gun;

		public GunAmmo GunAmmo;

		public CharacterData Data;

		public HealthHandler Health;

		public Gravity Gravity;

		public Block Block;

		public CharacterStatModifiers CharacterStats;

		public void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			Player = ((Component)this).GetComponentInParent<Player>();
			Gun = Player.data.weaponHandler.gun;
			GunAmmo = (GunAmmo)ExtensionMethods.GetFieldValue((object)Gun, "gunAmmo");
			Data = Player.data;
			Health = Player.data.healthHandler;
			Gravity = ((Component)Player).GetComponent<Gravity>();
			Block = Player.data.block;
			CharacterStats = Player.data.stats;
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
		}

		public void OnDestroy()
		{
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}

		public void OnPickEnd()
		{
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			for (int i = 0; i < Player.data.GetAdditionalData().RandomCardsAtStart; i++)
			{
				float num = Random.Range(0f, 1f);
				if (num < 0.7f)
				{
					CardInfo val = Cards.instance.NORARITY_GetRandomCardWithCondition(Player, Gun, GunAmmo, Data, Health, Gravity, Block, CharacterStats, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)condition, 1000);
					Cards.instance.AddCardToPlayer(Player, val, false, "", 0f, 0f, true);
				}
				else
				{
					AACardsGenerators.Generators.CreateRandomCard(AACardsGeneratorType.CardFactoryGenerator, Player);
				}
			}
		}

		private bool condition(CardInfo card, Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			return true;
		}
	}
	public class CurrentHPRegenMono : MonoBehaviour
	{
		public float activatePercentage = 0.75f;

		private CharacterData data;

		private float oldRegen;

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

		public void Update()
		{
			float currentHPRegenPercentage = data.GetAdditionalData().CurrentHPRegenPercentage;
			if (currentHPRegenPercentage != 0f)
			{
				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 RailgunStats
	{
		public struct RailgunChargeStats
		{
			public float ChargeDamageMultiplier;

			public float ChargeBulletSpeedMultiplier;

			public RailgunChargeStats(float chargeDamageMultiplier, float chargeBulletSpeedMultiplier)
			{
				ChargeDamageMultiplier = chargeDamageMultiplier;
				ChargeBulletSpeedMultiplier = chargeBulletSpeedMultiplier;
			}
		}

		public bool IsEnabled = false;

		public float MaximumCharge = 0f;

		public float CurrentCharge = 0f;

		public float ChargeRate = 0f;

		public float FullChargeThreshold = 20f;

		public float RailgunDamageMultiplier = 1f;

		public float RailgunBulletSpeedMultiplier = 1f;

		public float RailgunMinimumChargeDamageMultiplier = 0.25f;

		public float RailgunMinimumChargeBulletSpeedMultiplier = 0.5f;

		public RailgunChargeStats GetChargeStats(float charge)
		{
			float num = Mathf.Min(charge, FullChargeThreshold);
			float num2 = num / FullChargeThreshold;
			float chargeDamageMultiplier = Mathf.Lerp(RailgunMinimumChargeDamageMultiplier, RailgunDamageMultiplier, num2);
			float chargeBulletSpeedMultiplier = Mathf.Lerp(RailgunMinimumChargeBulletSpeedMultiplier, RailgunBulletSpeedMultiplier, num2);
			return new RailgunChargeStats(chargeDamageMultiplier, chargeBulletSpeedMultiplier);
		}

		public void UseCharge(RailgunStats stats)
		{
			CurrentCharge = Mathf.Max(CurrentCharge - FullChargeThreshold, 0f);
		}
	}
	public class RailgunMono : MonoBehaviour
	{
		private CustomHealthBar RailgunChargeBar;

		private Player player;

		public RailgunStats RailgunStats => player.data.GetAdditionalData().RailgunStats;

		private void Start()
		{
			player = ((Component)this).gameObject.GetComponentInParent<Player>();
			RailgunStats.IsEnabled = true;
			RailgunChargeBar = CreateChargeBar();
			HealthHandler componentInParent = ((Component)this).GetComponentInParent<HealthHandler>();
			componentInParent.reviveAction = (Action)Delegate.Combine(componentInParent.reviveAction, new Action(OnRevive));
		}

		public void OnDestroy()
		{
			if ((Object)(object)RailgunChargeBar != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)RailgunChargeBar).gameObject);
			}
			RailgunStats.IsEnabled = false;
			HealthHandler componentInParent = ((Component)this).GetComponentInParent<HealthHandler>();
			componentInParent.reviveAction = (Action)Delegate.Remove(componentInParent.reviveAction, new Action(OnRevive));
		}

		public void Update()
		{
			if (RailgunStats.IsEnabled)
			{
				RailgunStats.CurrentCharge = Mathf.Min(RailgunStats.CurrentCharge + RailgunStats.ChargeRate * Time.deltaTime, RailgunStats.MaximumCharge);
			}
			RailgunChargeBar.SetValues(RailgunStats.CurrentCharge, RailgunStats.MaximumCharge);
		}

		public void OnRevive()
		{
			RailgunStats.CurrentCharge = RailgunStats.MaximumCharge;
		}

		private CustomHealthBar CreateChargeBar()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Railgun Charge Bar");
			CustomHealthBar val2 = val.AddComponent<CustomHealthBar>();
			val2.SetColor(Color.cyan * 0.8f);
			ExtensionMethods.AddStatusIndicator(player, val, 0f, true);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Healthbar(Clone)/Canvas/Image/White")).gameObject);
			return val2;
		}
	}
	public class RayHitExecution : RayHitEffect
	{
		[Range(0f, 1f)]
		public float executionPercentage = 0.3f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_006f: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)hit.transform))
			{
				return (HasToReturn)1;
			}
			CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
			if ((Object)(object)component == (Object)null || component.dead)
			{
				return (HasToReturn)1;
			}
			float num = (component.health + CharacterDataExtensions.GetAdditionalData(component).totalArmor) / component.maxHealth;
			if (num > executionPercentage)
			{
				return (HasToReturn)1;
			}
			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;
		}
	}
	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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			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_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)
			if ((Object)(object)saveTeleportPosition != (Object)null)
			{
				saveTeleportPosition.SetActive(false);
			}
			DoTeleport = false;
			SavePosition = Vector2.zero;
		}
	}
	[RequireComponent(typeof(DamageSpawnedAttack), typeof(Explosion))]
	public class SetExplosionDamageOffTakennDamage : MonoBehaviour
	{
		public float ExplosionDamageMultiplier = 1f;

		private DamageSpawnedAttack damageSpawnedAttack;

		private Explosion explosion;

		private void Awake()
		{
			damageSpawnedAttack = ((Component)this).GetComponent<DamageSpawnedAttack>();
			explosion = ((Component)this).GetComponent<Explosion>();
		}

		private void Start()
		{
			explosion.damage = ((Vector2)(ref damageSpawnedAttack.Damage)).magnitude * ExplosionDamageMultiplier;
		}
	}
}
namespace AALUND13Cards.MonoBehaviours.CardsEffects.Soulstreak
{
	public class SoulstreakDrain : MonoBehaviour
	{
		[Header("Sounds")]
		public SoundEvent SoundDamage;

		private SoulStreakStats soulstreakStats;

		private PlayerInRangeTrigger playerInRangeTrigger;

		private Player player;

		public void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			soulstreakStats = player.data.GetAdditionalData().SoulStreakStats;
			SoundDamage.variables.audioMixerGroup = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX")[0];
			playerInRangeTrigger = ((Component)this).GetComponent<PlayerInRangeTrigger>();
		}

		public void TriggerDamage()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (soulstreakStats != null)
			{
				Player closestEnemy = GetClosestEnemy();
				if (!((Object)(object)closestEnemy == (Object)null))
				{
					float dPS = player.GetDPS();
					float num = dPS * soulstreakStats.SoulDrainDPSFactor * playerInRangeTrigger.cooldown;
					float num2 = Mathf.Min(num, closestEnemy.data.health);
					float num3 = Mathf.Max(0f, num2 * soulstreakStats.SoulDrainLifestealMultiply);
					((Damagable)closestEnemy.data.healthHandler).TakeDamage(num * Vector2.up, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, player, true, true);
					player.data.healthHandler.Heal(num3);
					SoundManager.Instance.Play(SoundDamage, ((Component)closestEnemy).transform);
					LoggerUtils.LogInfo($"DPS: {dPS}, Damage: {num}, Lifesteal: {num3}");
				}
			}
		}

		private Player GetClosestEnemy()
		{
			//IL_0053: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Player result = null;
			float num = float.MaxValue;
			foreach (Player player in PlayerManager.instance.players)
			{
				if ((Object)(object)player != (Object)(object)this.player && player.data.isPlaying)
				{
					float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)this.player).transform.position), Vector2.op_Implicit(((Component)player).transform.position));
					if (num2 < num)
					{
						num = num2;
						result = player;
					}
				}
			}
			return result;
		}
	}
	public class SoulstreakEffect : ReversibleEffect, IPickStartHookHandler, IGameStartHookHandler
	{
		public override void OnStart()
		{
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
			((ReversibleEffect)this).SetLivesToEffect(int.MaxValue);
			base.applyImmediately = false;
			ApplyStats();
		}

		public void ApplyStats()
		{
			SoulStreakStats soulStreakStats = base.data.GetAdditionalData().SoulStreakStats;
			uint souls = base.data.GetAdditionalData().Souls;
			((ReversibleEffect)this).ClearModifiers(true);
			base.characterDataModifier.maxHealth_mult = 1f + (soulStreakStats.MaxHealth - 1f) * (float)souls;
			base.characterStatModifiersModifier.sizeMultiplier_mult = 1f + (soulStreakStats.PlayerSize - 1f) * (float)souls;
			base.characterStatModifiersModifier.movementSpeed_mult = 1f + (soulStreakStats.MovementSpeed - 1f) * (float)souls;
			base.gunStatModifier.attackSpeed_mult = 1f + (soulStreakStats.AttackSpeed - 1f) * (float)souls;
			base.gunStatModifier.damage_mult = 1f + (soulStreakStats.Damage - 1f) * (float)souls;
			base.gunStatModifier.projectileSpeed_mult = 1f + (soulStreakStats.BulletSpeed - 1f) * (float)souls;
			((ReversibleEffect)this).ApplyModifiers();
		}

		public void OnGameStart()
		{
			Object.Destroy((Object)(object)this);
		}

		public void OnPickStart()
		{
			Object.Destroy((Object)(object)this);
		}

		public override void OnOnDestroy()
		{
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}
	}
	[Flags]
	public enum AbilityType
	{
		Armor = 1
	}
	[Serializable]
	public class SoulStreakStats
	{
		public float MaxHealth = 1f;

		public float PlayerSize = 1f;

		public float MovementSpeed = 1f;

		public float AttackSpeed = 1f;

		public float Damage = 1f;

		public float BulletSpeed = 1f;

		public float SoulArmorPercentage = 0f;

		public float SoulArmorPercentageRegenRate = 0f;

		public float SoulDrainDPSFactor = 0f;

		public float SoulDrainLifestealMultiply = 0f;

		public AbilityType AbilityType;
	}
	public class SoulstreakMono : MonoBehaviour, IBattleStartHookHandler, IPointEndHookHandler
	{
		private Player player;

		private ArmorHandler armorHandler;

		public bool CanResetKills = true;

		public bool AbilityActive;

		public float AbilityCooldown;

		public GameObject SoulsCounter;

		public GameObject SoulsCounterGUI;

		private SoulStreakStats SoulstreakStats => player.data.GetAdditionalData().SoulStreakStats;

		private string SoulsString => string.Format("{0}: {1}", (Souls > 1) ? "Souls" : "Soul", Souls);

		private uint Souls
		{
			get
			{
				return player.data.GetAdditionalData().Souls;
			}
			set
			{
				player.data.GetAdditionalData().Souls = value;
			}
		}

		private void Start()
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)((Component)this).gameObject.transform.parent).GetComponent<Player>();
			armorHandler = ((Component)player).GetComponent<ArmorHandler>();
			SoulsCounter = Object.Instantiate<GameObject>(SoulsCounter);
			if (player.data.view.IsMine && !((Behaviour)((Component)player).GetComponent<PlayerAPI>()).enabled)
			{
				SoulsCounterGUI = Object.Instantiate<GameObject>(SoulsCounterGUI);
				SoulsCounterGUI.transform.SetParent(((Component)player).transform.parent);
			}
			player.data.SetWobbleObjectChild(SoulsCounter.transform);
			SoulsCounter.transform.localPosition = Vector2.op_Implicit(new Vector2(0f, 0.3f));
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
		}

		private void OnDestroy()
		{
			if (player.data.view.IsMine && !((Behaviour)((Component)player).GetComponent<PlayerAPI>()).enabled)
			{
				Object.Destroy((Object)(object)SoulsCounterGUI);
			}
			Object.Destroy((Object)(object)SoulsCounter);
			if ((Object)(object)((Component)player).gameObject.GetComponent<SoulstreakEffect>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)player).gameObject.GetComponent<SoulstreakEffect>());
			}
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}

		private void Update()
		{
			if (player.data.isPlaying)
			{
				AbilityCooldown = Mathf.Max(AbilityCooldown - Time.deltaTime, 0f);
				if (armorHandler.GetArmorByType<SoulArmor>().CurrentArmorValue <= 0f && armorHandler.GetArmorByType<SoulArmor>().MaxArmorValue > 0f)
				{
					armorHandler.GetArmorByType<SoulArmor>().MaxArmorValue = 0f;
					AbilityCooldown = 10f;
					AbilityActive = false;
				}
			}
			((TMP_Text)SoulsCounter.GetComponent<TextMeshPro>()).text = SoulsString;
			if (player.data.view.IsMine && !((Behaviour)((Component)player).GetComponent<PlayerAPI>()).enabled)
			{
				((TMP_Text)SoulsCounterGUI.GetComponentInChildren<TextMeshProUGUI>()).text = SoulsString;
			}
		}

		public void BlockAbility()
		{
			if (SoulstreakStats.AbilityType == AbilityType.Armor && !AbilityActive && AbilityCooldown == 0f)
			{
				ArmorBase armorByType = armorHandler.GetArmorByType<SoulArmor>();
				armorByType.MaxArmorValue = player.data.maxHealth * SoulstreakStats.SoulArmorPercentage * (float)(Souls + 1);
				armorByType.ArmorRegenerationRate = armorByType.MaxArmorValue * SoulstreakStats.SoulArmorPercentageRegenRate;
				armorByType.CurrentArmorValue = armorByType.MaxArmorValue;
				AbilityActive = true;
			}
		}

		public void ResetSouls()
		{
			if (CanResetKills)
			{
				LoggerUtils.LogInfo($"Resetting kill streak of player with ID {player.playerID}");
				if ((Object)(object)((Component)player).gameObject.GetComponent<SoulstreakEffect>() != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)player).gameObject.GetComponent<SoulstreakEffect>());
				}
				Souls = 0u;
				if (player.data.view.IsMine)
				{
					((TMP_Text)SoulsCounterGUI.GetComponentInChildren<TextMeshProUGUI>()).text = SoulsString;
				}
			}
		}

		public void AddSouls(uint kills = 1u)
		{
			if (CanResetKills)
			{
				LoggerUtils.LogInfo($"Adding {kills} kills for player with ID {player.playerID}");
				Souls += kills;
				ExtensionMethods.GetOrAddComponent<SoulstreakEffect>(((Component)player).gameObject, false).ApplyStats();
			}
		}

		public void OnBattleStart()
		{
			CanResetKills = true;
			ExtensionMethods.GetOrAddComponent<SoulstreakEffect>(((Component)player).gameObject, false).ApplyStats();
		}

		public void OnPointEnd()
		{
			CanResetKills = false;
			armorHandler.GetArmorByType<SoulArmor>().MaxArmorValue = 0f;
		}
	}
}
namespace AALUND13Cards.Handlers
{
	internal class ConfigHandler
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__2_0;

			internal void <RegesterMenu>b__2_0()
			{
			}
		}

		public static ConfigEntry<bool> DetailsMode;

		public static ConfigEntry<bool> DebugMode;

		public static void RegesterMenu(ConfigFile config)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("AALUND13 Cards", (UnityAction)obj, (Action<GameObject>)NewGui, (GameObject)null, false);
			DebugMode = config.Bind<bool>("AALUND13 Cards", "DebugMode", false, "Enabled or disabled Debug Mode");
		}

		public static void addBlank(GameObject menu)
		{
			TextMeshProUGUI val = default(TextMeshProUGUI);
			MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		}

		public static void NewGui(GameObject menu)
		{
			MenuHandler.CreateToggle(DebugMode.Value, "<#c41010> Debug Mode", menu, (UnityAction<bool>)DebugModeChanged, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			static void DebugModeChanged(bool val)
			{
				DebugMode.Value = val;
			}
		}
	}
	public interface IOnDoDamageEvent
	{
		void OnDamage(Vector2 damage);
	}
	public interface IOnTakeDamageEvent
	{
		void OnTakeDamage(Vector2 damage);
	}
	public interface IOnTakeDamageOvertimeEvent
	{
		void OnTakeDamageOvertime(Vector2 damage);
	}
	public class DamageEventHandler
	{
		public enum DamageEventType
		{
			OnDoDamage,
			OnTakeDamage,
			OnTakeDamageOvertime
		}

		internal static Dictionary<Player, List<IOnDoDamageEvent>> OnDoDamageEvents = new Dictionary<Player, List<IOnDoDamageEvent>>();

		internal static Dictionary<Player, List<IOnTakeDamageEvent>> OnTakeDamageEvents = new Dictionary<Player, List<IOnTakeDamageEvent>>();

		internal static Dictionary<Player, List<IOnTakeDamageOvertimeEvent>> OnTakeDamageOvertimeEvents = new Dictionary<Player, List<IOnTakeDamageOvertimeEvent>>();

		public static void RegisterDamageEvent(object obj, Player player)
		{
			if (obj is IOnDoDamageEvent item)
			{
				if (!OnDoDamageEvents.ContainsKey(player))
				{
					OnDoDamageEvents[player] = new List<IOnDoDamageEvent>();
				}
				OnDoDamageEvents[player].Add(item);
			}
			if (obj is IOnTakeDamageEvent item2)
			{
				if (!OnTakeDamageEvents.ContainsKey(player))
				{
					OnTakeDamageEvents[player] = new List<IOnTakeDamageEvent>();
				}
				OnTakeDamageEvents[player].Add(item2);
			}
			if (obj is IOnTakeDamageOvertimeEvent item3)
			{
				if (!OnTakeDamageOvertimeEvents.ContainsKey(player))
				{
					OnTakeDamageOvertimeEvents[player] = new List<IOnTakeDamageOvertimeEvent>();
				}
				OnTakeDamageOvertimeEvents[player].Add(item3);
			}
		}

		public static void UnregisterDamageEvent(object obj, Player player)
		{
			if (obj is IOnDoDamageEvent item && OnDoDamageEvents.ContainsKey(player))
			{
				OnDoDamageEvents[player].Remove(item);
			}
			if (obj is IOnTakeDamageEvent item2 && OnTakeDamageEvents.ContainsKey(player))
			{
				OnTakeDamageEvents[player].Remove(item2);
			}
			if (obj is IOnTakeDamageOvertimeEvent item3 && OnTakeDamageOvertimeEvents.ContainsKey(player))
			{
				OnTakeDamageOvertimeEvents[player].Remove(item3);
			}
		}

		internal static void TriggerDamageEvent(DamageEventType eventType, Player player, Vector2 damage)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			switch (eventType)
			{
			case DamageEventType.OnDoDamage:
				if (!OnDoDamageEvents.ContainsKey(player))
				{
					break;
				}
				{
					foreach (IOnDoDamageEvent item in OnDoDamageEvents[player])
					{
						item.OnDamage(damage);
					}
					break;
				}
			case DamageEventType.OnTakeDamage:
				if (!OnTakeDamageEvents.ContainsKey(player))
				{
					break;
				}
				{
					foreach (IOnTakeDamageEvent item2 in OnTakeDamageEvents[player])
					{
						item2.OnTakeDamage(damage);
					}
					break;
				}
			case DamageEventType.OnTakeDamageOvertime:
				if (!OnTakeDamageOvertimeEvents.ContainsKey(player))
				{
					break;
				}
				{
					foreach (IOnTakeDamageOvertimeEvent item3 in OnTakeDamageOvertimeEvents[player])
					{
						item3.OnTakeDamageOvertime(damage);
					}
					break;
				}
			}
		}
	}
	public class DelayDamageHandler : MonoBehaviour, IBattleStartHookHandler
	{
		public Player player;

		public void Awake()
		{
			player = ((Component)this).GetComponent<Player>();
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
		}

		public void DelayDamage(Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//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_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, player.data.GetAdditionalData().secondToDealDamage, (Action)delegate
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				player.data.GetAdditionalData().dealDamage = true;
				player.data.healthHandler.DoDamage(damage, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
			});
		}

		public void OnDestroy()
		{
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}

		public void OnBattleStart()
		{
			((MonoBehaviour)this).StopAllCoroutines();
		}
	}
	public class ExtraPickHandler
	{
		public virtual bool OnExtraPickStart(Player player, CardInfo card)
		{
			return true;
		}

		public virtual void OnExtraPick(Player player, CardInfo card)
		{
		}
	}
	public static class ExtraCardPickHandler
	{
		internal static Dictionary<Player, List<ExtraPickHandler>> extraPicks = new Dictionary<Player, List<ExtraPickHandler>>();

		public static Player currentPlayer;

		public static void AddExtraPick(ExtraPickHandler extraPickHandler, Player player, int picks)
		{
			NetworkingManager.RPC(typeof(ExtraCardPickHandler), "RPCA_AddExtraPick", new object[3]
			{
				player.playerID,
				extraPickHandler.GetType().AssemblyQualifiedName,
				picks
			});
		}

		public static void AddExtraPick<T>(Player player, int picks) where T : ExtraPickHandler
		{
			NetworkingManager.RPC(typeof(ExtraCardPickHandler), "RPCA_AddExtraPick", new object[3]
			{
				player.playerID,
				typeof(T).AssemblyQualifiedName,
				picks
			});
		}

		public static void RemoveExtraPick(ExtraPickHandler extraPickHandler, Player player, int picks)
		{
			NetworkingManager.RPC(typeof(ExtraCardPickHandler), "RPCA_RemoveExtraPick", new object[3]
			{
				player.playerID,
				extraPickHandler.GetType().AssemblyQualifiedName,
				picks
			});
		}

		public static void RemoveExtraPick<T>(Player player, int picks) where T : ExtraPickHandler
		{
			NetworkingManager.RPC(typeof(ExtraCardPickHandler), "RPCA_RemoveExtraPick", new object[3]
			{
				player.playerID,
				typeof(T).AssemblyQualifiedName,
				picks
			});
		}

		[UnboundRPC]
		private static void RPCA_AddExtraPick(int playerId, string handlerType, int picks)
		{
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Type type = Type.GetType(handlerType);
			if (!(type == null))
			{
				ExtraPickHandler item = (ExtraPickHandler)Activator.CreateInstance(type);
				if (!extraPicks.ContainsKey(val))
				{
					extraPicks.Add(val, new List<ExtraPickHandler>());
				}
				for (int i = 0; i < picks; i++)
				{
					extraPicks[val].Add(item);
				}
			}
		}

		[UnboundRPC]
		public static void RPCA_RemoveExtraPick(int playerId, string handlerType, int picks)
		{
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Type type = Type.GetType(handlerType);
			if (type == null)
			{
				return;
			}
			ExtraPickHandler item = (ExtraPickHandler)Activator.CreateInstance(type);
			if (extraPicks.ContainsKey(val))
			{
				for (int i = 0; i < picks; i++)
				{
					extraPicks[val].Remove(item);
				}
			}
		}

		internal static IEnumerator HandleExtraPicks()
		{
			Player[] array = PlayerManager.instance.players.ToArray();
			foreach (Player player in array)
			{
				if (extraPicks.ContainsKey(player) && extraPicks[player].Count > 0)
				{
					yield return HandleExtraPickForPlayer(player);
				}
			}
			currentPlayer = null;
		}

		private static IEnumerator HandleExtraPickForPlayer(Player player)
		{
			currentPlayer = player;
			yield return GameModeManager.TriggerHook("PlayerPickStart");
			CardChoiceVisuals.instance.Show((from i in Enumerable.Range(0, PlayerManager.instance.players.Count)
				where PlayerManager.instance.players[i].playerID == player.playerID
				select i).First(), true);
			yield return CardChoice.instance.DoPick(1, player.playerID, (PickerType)1);
			yield return (object)new WaitForSecondsRealtime(0.1f);
			if (extraPicks.ContainsKey(player) && extraPicks[player].Count > 0)
			{
				extraPicks[player].RemoveAt(0);
			}
			yield return GameModeManager.TriggerHook("PlayerPickEnd");
		}
	}
	public class FlashlightMaskHandler : MonoBehaviour
	{
		public Material mat;

		public float RadiusFadeInMultiplier = 0.2f;

		public float RadiusFadeOutMultiplier = 1f;

		public float FadeDuration = 2f;

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

		private Coroutine fadeCoroutine = null;

		private float globalFade = 0f;

		private bool isBattleActive = false;

		private bool oldIsBattleActive = false;

		public static FlashlightMaskHandler Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			globalFade = 0f;
			mat.SetFloat("_GlobalFade", globalFade);
		}

		private void OnDestroy()
		{
			if (fadeCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
			}
			Instance = null;
		}

		private void Update()
		{
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = PlayerManager.instance.players.Where((Player p) => p.data.view.IsMine && !p.data.dead).ToList();
			int num = Mathf.Clamp(list.Count, 0, 32);
			isBattleActive = GameManager.instance.battleOngoing && list.Any((Player p) => p.data.GetAdditionalData().isBind) && num > 0;
			if (isBattleActive != oldIsBattleActive)
			{
				oldIsBattleActive = isBattleActive;
				if (isBattleActive)
				{
					OnBattleStart();
				}
				else
				{
					OnBattleEnd();
				}
			}
			Vector4[] array = (Vector4[])(object)new Vector4[32];
			float[] array2 = new float[32];
			Camera main = Camera.main;
			for (int i = 0; i < num; i++)
			{
				Player val = list[i];
				if (!((Object)(object)val == (Object)null) && Object.op_Implicit((Object)(object)((Component)val).transform))
				{
					Vector3 val2 = main.WorldToViewportPoint(((Component)val).transform.position);
					array[i] = new Vector4(val2.x, val2.y, 0f, 0f);
					float num2 = CalculateRadius(val);
					if (!currentRadii.ContainsKey(val))
					{
						currentRadii[val] = num2;
					}
					float num3 = currentRadii[val];
					num3 = Mathf.MoveTowards(num3, num2, Time.deltaTime);
					currentRadii[val] = num3;
					array2[i] = num3;
				}
			}
			for (int j = num; j < 32; j++)
			{
				array[j] = Vector4.zero;
				array2[j] = 0f;
			}
			mat.SetVectorArray("_LightPosArray", array);
			mat.SetFloatArray("_RadiusArray", array2);
			mat.SetInt("_LightCount", num);
			List<Player> list2 = currentRadii.Keys.Except(list).ToList();
			foreach (Player item in list2)
			{
				currentRadii.Remove(item);
			}
		}

		private float CalculateRadius(Player player)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null || !Object.op_Implicit((Object)(object)((Component)player).transform))
			{
				return 0f;
			}
			float orthographicSize = Camera.main.orthographicSize;
			float num = Mathf.Max(((Component)player).transform.localScale.x, 2f);
			float num2 = 1f / Mathf.Max(orthographicSize, 0.01f);
			float num3 = (isBattleActive ? RadiusFadeInMultiplier : RadiusFadeOutMultiplier);
			return Mathf.Max(num * num2 * num3, 0.01f);
		}

		private IEnumerator FadeCoroutine(float from, float to, float duration)
		{
			float elapsed = 0f;
			while (elapsed < duration)
			{
				elapsed += Time.deltaTime;
				globalFade = Mathf.Lerp(from, to, Mathf.Clamp01(elapsed / duration));
				mat.SetFloat("_GlobalFade", globalFade);
				yield return null;
			}
			globalFade = to;
			mat.SetFloat("_GlobalFade", globalFade);
			fadeCoroutine = null;
		}

		public void OnBattleStart()
		{
			isBattleActive = true;
			if (fadeCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
			}
			fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeCoroutine(globalFade, 1f, FadeDuration));
		}

		public void OnBattleEnd()
		{
			isBattleActive = false;
			if (fadeCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
			}
			fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeCoroutine(globalFade, 0f, FadeDuration));
		}
	}
}
namespace AALUND13Cards.Handlers.ExtraPickHandlers
{
	public class SteelPickHandler : ExtraPickHandler
	{
		public override bool OnExtraPickStart(Player player, CardInfo card)
		{
			List<CardInfo> list = new List<CardInfo>();
			foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(player))
			{
				if ((Object)(object)enemyPlayer != (Object)(object)player)
				{
					list.AddRange(enemyPlayer.data.currentCards);
				}
			}
			return list.Contains(card);
		}

		public override void OnExtraPick(Player player, CardInfo card)
		{
			if (!PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient)
			{
				return;
			}
			List<Player> list = new List<Player>();
			foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(player))
			{
				if (enemyPlayer.data.currentCards.Contains(CardChoice.instance.GetSourceCard(card)))
				{
					list.Add(enemyPlayer);
				}
			}
			if (list.Count != 0)
			{
				Player random = ExtensionMethods.GetRandom<Player>((IList)list);
				Cards.instance.RemoveCardFromPlayer(random, CardChoice.instance.GetSourceCard(card), (SelectionType)2);
			}
		}
	}
}
namespace AALUND13Cards.Extensions
{
	public class AALUND13CardCharacterDataAdditionalData
	{
		public float secondToDealDamage = 0f;

		public bool dealDamage = true;

		public SoulStreakStats SoulStreakStats = new SoulStreakStats();

		public uint Souls = 0u;

		public int RandomCardsAtStart = 0;

		public int ExtraCardPicks = 0;

		public int DuplicatesAsCorrupted = 0;

		public float DamageAgainstArmorPercentage = 1f;

		public int BlocksWhenRecharge = 0;

		public float BlockPircePercent = 0f;

		public Rarity MaxRarityForCurse = null;

		public bool isBind = false;

		public float CurrentHPRegenPercentage = 0f;

		public RailgunStats RailgunStats = new RailgunStats();

		public void Reset()
		{
			secondToDealDamage = 0f;
			dealDamage = true;
			SoulStreakStats = new SoulStreakStats();
			RandomCardsAtStart = 0;
			ExtraCardPicks = 0;
			DuplicatesAsCorrupted = 0;
			DamageAgainstArmorPercentage = 1f;
			BlocksWhenRecharge = 0;
			BlockPircePercent = 0f;
			MaxRarityForCurse = null;
			isBind = false;
			CurrentHPRegenPercentage = 0f;
			RailgunStats = new RailgunStats();
		}
	}
	public static class CharacterDataExtensions
	{
		public static readonly ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData> data = new ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData>();

		public static AALUND13CardCharacterDataAdditionalData GetAdditionalData(this CharacterData characterData)
		{
			return data.GetOrCreateValue(characterData);
		}

		public static void AddData(this CharacterData characterData, AALUND13CardCharacterDataAdditionalData value)
		{
			try
			{
				data.Add(characterData, value);
			}
			catch (Exception)
			{
			}
		}
	}
	public static class PlayerExtensions
	{
		public static float GetDPS(this Player player)
		{
			float num = player.data.weaponHandler.gun.damage * player.data.weaponHandler.gun.bulletDamageMultiplier * player.data.weaponHandler.gun.projectiles[0].objectToSpawn.GetComponent<ProjectileHit>().damage;
			GunAmmo componentInChildren = ((Component)player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>();
			int maxAmmo = componentInChildren.maxAmmo;
			int numberOfProjectiles = player.data.weaponHandler.gun.numberOfProjectiles;
			int num2 = Mathf.Max(player.data.weaponHandler.gun.bursts, 1);
			float timeBetweenBullets = player.data.weaponHandler.gun.timeBetweenBullets;
			float num3 = (float)ExtensionMethods.InvokeMethod((object)componentInChildren, "ReloadTime", Array.Empty<object>());
			float num4 = Mathf.Max(player.data.weaponHandler.gun.attackSpeed, 0.01f);
			int num5 = num2 * numberOfProjectiles;
			int num6 = Mathf.Max(maxAmmo / num5, 1);
			float num7 = (float)(num2 - 1) * timeBetweenBullets;
			float num8 = (num4 + num7) * (float)(num6 - 1) + Mathf.Max(num3, num4 + num7);
			float num9 = 1f / num8;
			return num * (float)num6 * (float)num5 * num9 / 1.33333f;
		}
	}
	public static class RandomExtension
	{
		public static float NextFloat(this Random random, float minValue, float maxValue)
		{
			return (float)random.NextDouble() * (maxValue - minValue) + minValue;
		}
	}
}
namespace AALUND13Cards.Cards
{
	public class AACustomCard : CustomUnityCard
	{
		public bool IsCursed = false;

		public override void OnRegister(CardInfo cardInfo)
		{
			if (IsCursed)
			{
				CurseManager.instance.RegisterCurse(cardInfo);
				List<CardCategory> list = new List<CardCategory>(cardInfo.categories) { CustomCardCategories.instance.CardCategory("Curse") };
				cardInfo.categories = list.ToArray();
			}
		}

		public override void OnReassignCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			AAStatModifers component = ((Component)this).GetComponent<AAStatModifers>();
			if ((Object)(object)component != (Object)null)
			{
				component.OnReassign(player);
			}
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			OnAddedEffect[] components = ((Component)this).GetComponents<OnAddedEffect>();
			OnAddedEffect[] array = components;
			foreach (OnAddedEffect onAddedEffect in array)
			{
				onAddedEffect.OnAdded(player, gun, gunAmmo, data, health, gravity, block, characterStats);
			}
		}

		public override string GetModName()
		{
			if (IsCursed)
			{
				return "AAC (Curse)";
			}
			return "AAC";
		}
	}
	public enum ExtraPicksType
	{
		None,
		Normal,
		Steel
	}
	public class AAStatModifers : MonoBehaviour
	{
		[Header("Soulstreak Stats")]
		public float MaxHealth = 0f;

		public float PlayerSize = 0f;

		public float MovementSpeed = 0f;

		public float AttackSpeed = 0f;

		public float Damage = 0f;

		public float BulletSpeed = 0f;

		public float SoulArmorPercentage = 0f;

		public float SoulArmorPercentageRegenRate = 0f;

		public float SoulDrainDamageMultiply = 0f;

		public float SoulDrainLifestealMultiply = 0f;

		public AbilityType AbilityType;

		[Header("Railgun Stats Add")]
		public float MaximumCharge = 0f;

		public float ChargeRate = 0f;

		public float FullChargeThreshold = 0f;

		[Header("Railgun Stats Multiplier")]
		public float MaximumChargeMultiplier = 1f;

		public float ChargeRateMultiplier = 1f;

		public float RailgunDamageMultiplier = 1f;

		public float RailgunBulletSpeedMultiplier = 1f;

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

		public float CurrentHPRegenPercentage = 0f;

		[Header("Curses Stats")]
		public bool SetMaxRarityForCurse = false;

		public CardRarity MaxRarityForCurse;

		public bool IsBind = false;

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

		public float BlockPircePercent = 0f;

		[Header("Armors Stats")]
		public float BattleforgedArmor = 0f;

		public float ArmorPiercePercent = 0f;

		public float DamageAgainstArmorPercentage = 1f;

		[Header("Extra Picks")]
		public int ExtraPicks = 0;

		public ExtraPicksType ExtraPicksType;

		public int ExtraPicksForEnemies = 0;

		public ExtraPicksType ExtraPicksTypeForEnemies;

		[Header("Extra Cards")]
		public int RandomCardsAtStart = 0;

		public int ExtraCardPicks = 0;

		public int DuplicatesAsCorrupted = 0;

		public void Apply(Player player)
		{
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			CharacterData data = player.data;
			AALUND13CardCharacterDataAdditionalData additionalData = data.GetAdditionalData();
			JARLCharacterDataAdditionalData additionalData2 = CharacterDataExtensions.GetAdditionalData(data);
			additionalData.SoulStreakStats.MaxHealth += MaxHealth;
			additionalData.SoulStreakStats.PlayerSize += PlayerSize;
			additionalData.SoulStreakStats.MovementSpeed += MovementSpeed;
			additionalData.SoulStreakStats.AttackSpeed += AttackSpeed;
			additionalData.SoulStreakStats.Damage += Damage;
			additionalData.SoulStreakStats.BulletSpeed += BulletSpeed;
			additionalData.SoulStreakStats.SoulArmorPercentage += SoulArmorPercentage;
			additionalData.SoulStreakStats.SoulArmorPercentageRegenRate += SoulArmorPercentageRegenRate;
			additionalData.SoulStreakStats.SoulDrainDPSFactor += SoulDrainDamageMultiply;
			additionalData.SoulStreakStats.SoulDrainLifestealMultiply += SoulDrainLifestealMultiply;
			additionalData.SoulStreakStats.AbilityType |= AbilityType;
			additionalData.RailgunStats.MaximumCharge = Mathf.Max(additionalData.RailgunStats.MaximumCharge + MaximumCharge, 0f);
			additionalData.RailgunStats.ChargeRate = Mathf.Max(additionalData.RailgunStats.ChargeRate + ChargeRate, 0f);
			additionalData.RailgunStats.FullChargeThreshold = Mathf.Max(additionalData.RailgunStats.FullChargeThreshold + FullChargeThreshold, 0f);
			additionalData.RailgunStats.MaximumCharge *= MaximumChargeMultiplier;
			additionalData.RailgunStats.ChargeRate *= ChargeRateMultiplier;
			additionalData.RailgunStats.RailgunDamageMultiplier += RailgunDamageMultiplier - 1f;
			additionalData.RailgunStats.RailgunBulletSpeedMultiplier += RailgunBulletSpeedMultiplier - 1f;
			if (SecondToDealDamage > 0f)
			{
				additionalData.dealDamage = false;
			}
			additionalData.secondToDealDamage += SecondToDealDamage;
			additionalData.CurrentHPRegenPercentage += CurrentHPRegenPercentage;
			if (SetMaxRarityForCurse)
			{
				Rarity rarity = RarityUtils.GetRarity(((object)(CardRarity)(ref MaxRarityForCurse)).ToString());
				additionalData.MaxRarityForCurse = RarityUtils.GetRarityData(rarity);
			}
			if (IsBind)
			{
				additionalData.isBind = true;
			}
			additionalData.BlocksWhenRecharge += BlocksWhenRecharge;
			additionalData.BlockPircePercent = Mathf.Clamp(additionalData.BlockPircePercent + BlockPircePercent, 0f, 1f);
			additionalData.RandomCardsAtStart += RandomCardsAtStart;
			additionalData.ExtraCardPicks += ExtraCardPicks;
			if (BattleforgedArmor > 0f)
			{
				ArmorFramework.ArmorHandlers[player].AddArmor<BattleforgedArmor>(BattleforgedArmor, 0f, 0f, (ArmorReactivateType)0, 0.5f);
			}
			additionalData2.ArmorPiercePercent = Mathf.Clamp(additionalData2.ArmorPiercePercent + ArmorPiercePercent, 0f, 1f);
			additionalData.DamageAgainstArmorPercentage += DamageAgainstArmorPercentage - 1f;
			ExtraPickHandler extraPickHandler = GetExtraPickHandler(ExtraPicksType);
			if (extraPickHandler != null && ExtraPicks > 0 && player.data.view.IsMine)
			{
				ExtraCardPickHandler.AddExtraPick(extraPickHandler, player, ExtraPicks);
			}
			ExtraPickHandler extraPickHandler2 = GetExtraPickHandler(ExtraPicksTypeForEnemies);
			if (extraPickHandler != null && ExtraPicksForEnemies > 0 && player.data.view.IsMine)
			{
				List<Player> enemyPlayers = PlayerStatus.GetEnemyPlayers(player);
				foreach (Player item in enemyPlayers)
				{
					ExtraCardPickHandler.AddExtraPick(extraPickHandler2, item, ExtraPicksForEnemies);
				}
			}
			if (DuplicatesAsCorrupted > 0)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AALUND13_Cards.Instance, 1, (Action)delegate
				{
					additionalData.DuplicatesAsCorrupted += DuplicatesAsCorrupted;
				});
			}
		}

		public void OnReassign(Player player)
		{
			CharacterData data = player.data;
			AALUND13CardCharacterDataAdditionalData additionalData = data.GetAdditionalData();
			additionalData.ExtraCardPicks += ExtraCardPicks;
		}

		public ExtraPickHandler GetExtraPickHandler(ExtraPicksType type)
		{
			return type switch
			{
				ExtraPicksType.Normal => new ExtraPickHandler(), 
				ExtraPicksType.Steel => new SteelPickHandler(), 
				_ => null, 
			};
		}
	}
}
namespace AALUND13Cards.Cards.Effects
{
	public class AddPostProcessingEffect : OnAddedEffect
	{
		public List<Material> PostProcessingEffects = new List<Material>();

		public override void OnAdded(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (!player.data.view.IsMine)
			{
				return;
			}
			Camera main = Camera.main;
			if (!((Object)(object)main != (Object)null))
			{
				return;
			}
			foreach (Material postProcessingEffect in PostProcessingEffects)
			{
				((Component)main).gameObject.AddComponent<Effect>().Material = postProcessingEffect;
			}
		}
	}
	public abstract class OnAddedEffect : MonoBehaviour
	{
		public abstract void OnAdded(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats);
	}
	public class PickCardFromListEffect : OnAddedEffect
	{
		public List<GameObject> randomCardsToChoseFrom = new List<GameObject>();

		public int cardCount = 1;

		public override void OnAdded(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (!PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient)
			{
				return;
			}
			for (int i = 0; i < cardCount; i++)
			{
				if (randomCardsToChoseFrom.Count == 0)
				{
					LoggerUtils.LogWarn("No cards to choose from. Please add cards to the list.");
					break;
				}
				CardInfo component = ExtensionMethods.GetRandom<GameObject>((IList)randomCardsToChoseFrom).GetComponent<CardInfo>();
				Cards.instance.AddCardToPlayer(player, component, true, "", 2f, 2f, true);
				CardBarUtils.instance.ShowAtEndOfPhase(player, component);
			}
		}
	}
}
namespace AALUND13Cards.Cards.Conditions
{
	public abstract class CardCondition : MonoBehaviour
	{
		public CardInfo CardInfo => ((Component)this).GetComponent<CardInfo>();

		public abstract bool IsPlayerAllowedCard(Player player);
	}
	public class CardLimitCondition : CardCondition
	{
		public int AllowedAmount = 1;

		public override bool IsPlayerAllowedCard(Player player)
		{
			CardInfo[] source = PlayerManager.instance.players.SelectMany((Player p) => p.data.currentCards).ToArray();
			int num = source.Count((CardInfo c) => (Object)(object)c == (Object)(object)base.CardInfo);
			if (num >= AllowedAmount)
			{
				return false;
			}
			return true;
		}
	}
	internal class MinEnemyPlayersCondition : CardCondition
	{
		public int MinEnemyPlayers = 2;

		public override bool IsPlayerAllowedCard(Player player)
		{
			return PlayerStatus.GetEnemyPlayers(player).Count >= MinEnemyPlayers;
		}
	}
	public class PickPhaseLimitCondition : CardCondition
	{
		public int AllowedPickCount = 1;

		public override bool IsPlayerAllowedCard(Player player)
		{
			int num = PickCardTracker.instance.CardPickedInPickPhase.Count((CardInfo c) => (Object)(object)c == (Object)(object)base.CardInfo);
			if (num >= AllowedPickCount)
			{
				return false;
			}
			return true;
		}
	}
}
namespace AALUND13Cards.Armors
{
	public class BattleforgedArmor : ArmorBase
	{
		public override BarColor GetBarColor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.yellow * 0.6f, Color.yellow * 0.45f);
		}

		public override DamageArmorInfo OnDamage(float damage, Player DamagingPlayer, ArmorDamagePatchType? armorDamagePatchType)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			DamageArmorInfo val = ArmorUtils.ApplyDamage(base.CurrentArmorValue, damage);
			float num = base.CurrentArmorValue - val.Armor;
			base.MaxArmorValue += num * 0.1f;
			return val;
		}

		public BattleforgedArmor()
		{
			base.ArmorTags.Add("CanArmorPierce");
			base.ArmorRegenCooldownSeconds = 5f;
		}
	}
	public class SoulArmor : ArmorBase
	{
		public override BarColor GetBarColor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.magenta * 0.6f, Color.magenta * 0.45f);
		}

		public override void OnRespawn()
		{
			SoulstreakMono componentInChildren = ((Component)((ArmorBase)this).ArmorHandler).GetComponentInChildren<SoulstreakMono>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				base.MaxArmorValue = 0f;
				base.CurrentArmorValue = 0f;
				componentInChildren.AbilityCooldown = 0f;
				componentInChildren.AbilityActive = false;
			}
		}

		public SoulArmor()
		{
			base.ArmorRegenCooldownSeconds = 5f;
		}
	}
}
namespace AALUND13Cards.Armors.Processor
{
	internal class DamageAgainstArmorPercentagePeocessor : ArmorProcessor
	{
		public override float AfterArmorProcess(float remaindingDamage, float originalDamage, float takenArmorDamage)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			if (((ArmorProcessor)this).Armor.ArmorTags.Contains("CanArmorPierce"))
			{
				if ((Object)(object)((ArmorProcessor)this).DamagingPlayer == (Object)null || ((ArmorProcessor)this).DamagingPlayer.data.GetAdditionalData().DamageAgainstArmorPercentage == 1f || takenArmorDamage <= 0f)
				{
					return remaindingDamage;
				}
				object[] obj = new object[5] { remaindingDamage, originalDamage, takenArmorDamage, null, null };
				Player damagingPlayer = ((ArmorProcessor)this).DamagingPlayer;
				obj[3] = ((damagingPlayer != null) ? ((Object)damagingPlayer).name : null);
				obj[4] = ((object)((ArmorProcessor)this).Armor)?.ToString();
				Debug.Log((object)string.Format("DamageAgainstArmorPercentagePeocessor: remaindingDamage={0}, originalDamage={1}, takenArmorDamage={2}, DamagingPlayer={3}, Armor={4}", obj));
				DamageArmorInfo val = ((ArmorProcessor)this).Armor.OnDamage(takenArmorDamage * (((ArmorProcessor)this).DamagingPlayer.data.GetAdditionalData().DamageAgainstArmorPercentage - 1f), ((ArmorProcessor)this).DamagingPlayer, (ArmorDamagePatchType?)((ArmorProcessor)this).ArmorDamagePatchType);
				((ArmorProcessor)this).Armor.CurrentArmorValue = val.Armor;
			}
			return remaindingDamage;
		}
	}
}