Decompiled source of AALUND13 Cards v1.13.6

plugins/AALUND13_Cards.dll

Decompiled 2 weeks 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.Processors;
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.13.6")]
	[BepInProcess("Rounds.exe")]
	public class AALUND13_Cards : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <OnGameStart>d__18 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gameModeHandler;

			public AALUND13_Cards <>4__this;

			private List<Player>.Enumerator <>s__1;

			private Player <player>5__2;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>s__1 = PlayerManager.instance.players.GetEnumerator();
				try
				{
					while (<>s__1.MoveNext())
					{
						<player>5__2 = <>s__1.Current;
						if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
						{
							<player>5__2.data.GetAdditionalData().SoulStreakStats.Souls = 0u;
						}
						<player>5__2 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__1).Dispose();
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <OnPickStart>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gameModeHandler;

			public AALUND13_Cards <>4__this;

			private List<Player>.Enumerator <>s__1;

			private Player <player>5__2;

			private bool <isWinner>5__3;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>s__1 = PlayerManager.instance.players.GetEnumerator();
				try
				{
					while (<>s__1.MoveNext())
					{
						<player>5__2 = <>s__1.Current;
						if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
						{
							<isWinner>5__3 = gameModeHandler.GetRoundWinners().Contains(<player>5__2.teamID);
							if (<player>5__2.data.GetAdditionalData().ExtraCardPicks > 0 && !<isWinner>5__3)
							{
								ExtraCardPickHandler.AddExtraPick<ExtraPickHandler>(<player>5__2, <player>5__2.data.GetAdditionalData().ExtraCardPicks);
							}
						}
						<player>5__2 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__1).Dispose();
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		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.13.6";

		internal static List<BaseUnityPlugin> Plugins;

		internal static ManualLogSource ModLogger;

		internal static AssetBundle Assets;

		public static CardResgester CardResgester;

		public static CardCategory SoulstreakClassCards;

		public static CardCategory[] NoLotteryCategories;

		public static CardCategory[] NoSteelCategories;

		public static AALUND13_Cards Instance { get; private set; }

		public void Awake()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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");
			}
			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<TitaniumArmor>();
			ArmorFramework.RegisterArmorType<BattleforgedArmor>();
			ArmorFramework.RegisterArmorProcessor<DamageAgainstArmorPercentageProcessor>();
			ArmorFramework.RegisterArmorProcessor<ArmorDamageReductionProcessor>();
			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>();
			NoLotteryCategories = (CardCategory[])(object)new CardCategory[2]
			{
				CustomCardCategories.instance.CardCategory("CardManipulation"),
				CustomCardCategories.instance.CardCategory("NoRandom")
			};
			NoSteelCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("NoRemove") };
		}

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

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

		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().SoulStreakStats.Souls * 0.5f));
					}
				}
			}
			((Component)player).GetComponentInChildren<SoulstreakMono>()?.ResetSouls();
			if ((Object)(object)((Component)player).GetComponentInChildren<SoulstreakMono>() == (Object)null)
			{
				player.data.GetAdditionalData().SoulStreakStats.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, "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, "Duplicates As Corrupted", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().DuplicatesAsCorrupted != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().DuplicatesAsCorrupted}"));
			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, "Armor Damage Reduction", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().ArmorDamageReduction != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().ArmorDamageReduction * 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, "Max Rarity For Curse", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().MaxRarityForCurse != null), (Func<Player, string>)((Player p) => p.data.GetAdditionalData().MaxRarityForCurse.name));
			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"));
			TabInfoManager.RegisterStat(val, "Damage Reduction", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().DamageReduction != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().DamageReduction * 100f:0}%"));
			TabInfoManager.RegisterStat(val, "DPS", (Func<Player, bool>)((Player _) => true), (Func<Player, string>)((Player p) => $"{p.GetDPS()}"));
			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().SoulStreakStats.Souls != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.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 Awake()
		{
			//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();
			}
			if (!val.view.IsMine)
			{
				return;
			}
			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, Player damagingPlayer, Vector2 damage)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0031: 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, damagingPlayer, damage);
			}
		}
	}
	[HarmonyPatch(typeof(Gun))]
	public class GunPatch
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private IEnumerator<CodeInstruction> <>s__1;

			private CodeInstruction <code>5__2;

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

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

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 2u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = null;
				<code>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Expected O, but got Unknown
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>s__1 = instructions.GetEnumerator();
						<>1__state = -3;
						goto IL_0112;
					case 1:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(GunPatch), "InjectUseCharge", (Type[])null, (Type[])null));
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						goto IL_00eb;
					case 3:
						{
							<>1__state = -3;
							<code>5__2 = null;
							goto IL_0112;
						}
						IL_0112:
						if (<>s__1.MoveNext())
						{
							<code>5__2 = <>s__1.Current;
							if (<code>5__2.opcode == OpCodes.Ret)
							{
								<>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
								<>1__state = 1;
								return true;
							}
							goto IL_00eb;
						}
						<>m__Finally1();
						<>s__1 = null;
						return false;
						IL_00eb:
						<>2__current = <code>5__2;
						<>1__state = 3;
						return true;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__1 != null)
				{
					<>s__1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

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

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		[HarmonyPatch("DoAttack")]
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}

		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, Player damagingPlayer, Vector2 damage)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002a: 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, damagingPlayer, 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			AALUND13CardCharacterDataAdditionalData additionalData = val.GetAdditionalData();
			if (additionalData.DamageReduction > 0f)
			{
				damage = new Vector2(damage.x * (1f - additionalData.DamageReduction), damage.y * (1f - additionalData.DamageReduction));
			}
			Vector2 damage2 = damage;
			DamageEventHandler.TriggerDamageEvent(DamageEventHandler.DamageEventType.OnDoDamage, val.player, damagingPlayer, 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, Player damagingPlayer)
		{
			//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, Player damagingPlayer)
		{
			//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, Player damagingPlayer)
		{
			//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 int RandomCardsAtStart = 1;

		public float DefectiveCardChance = 0.7f;

		private Player Player;

		private Gun Gun;

		private GunAmmo GunAmmo;

		private CharacterData Data;

		private HealthHandler Health;

		private Gravity Gravity;

		private Block Block;

		private 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 < RandomCardsAtStart; i++)
			{
				float num = Random.Range(0f, 1f);
				if (num < DefectiveCardChance)
				{
					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 !card.categories.Intersect(AALUND13_Cards.NoLotteryCategories).Any();
		}
	}
	public class CurrentHPRegenMono : MonoBehaviour
	{
		[Tooltip("Percentage of current health to activate the regeneration. If the character's health is above this percentage, regeneration will not be applied.")]
		public float activatePercentage = 0.75f;

		public float CurrentHPRegenPercentage = 0.15f;

		private CharacterData data;

		private float oldRegen;

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

		public void Update()
		{
			if (oldRegen != 0f && data.health / data.maxHealth > activatePercentage)
			{
				HealthHandler healthHandler = data.healthHandler;
				healthHandler.regeneration -= oldRegen;
				oldRegen = 0f;
			}
			else if (data.health / data.maxHealth <= activatePercentage)
			{
				float num = data.health * CurrentHPRegenPercentage;
				HealthHandler healthHandler2 = data.healthHandler;
				healthHandler2.regeneration -= oldRegen;
				HealthHandler healthHandler3 = data.healthHandler;
				healthHandler3.regeneration += num;
				oldRegen = num;
			}
		}
	}
	public class HealingRadiance : MonoBehaviour
	{
		public float healingAmount = 10f;

		private CharacterData data;

		private bool effectActive = false;

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

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!(data.input.direction == Vector3.zero) && !(data.input.direction == Vector3.down))
			{
				return;
			}
			List<Player> enemyPlayers = PlayerStatus.GetEnemyPlayers(data.player);
			foreach (Player item in enemyPlayers)
			{
				item.data.healthHandler.Heal(healingAmount * TimeHandler.deltaTime);
			}
		}
	}
	public class ReverseLifeSteelEffect : MonoBehaviour, IOnDoDamageEvent
	{
		public float ReverseLifeSteelPercentage = 0.2f;

		private Player player;

		public void OnDamage(Vector2 damage, Player damagingPlayer)
		{
			damagingPlayer.data.healthHandler.Heal(((Vector2)(ref damage)).magnitude * ReverseLifeSteelPercentage);
		}

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
		}
	}
	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).GetComponentInParent<Player>();
			RailgunStats.IsEnabled = true;
			RailgunChargeBar = CreateChargeBar();
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		public void OnDestroy()
		{
			if ((Object)(object)RailgunChargeBar != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)RailgunChargeBar).gameObject);
			}
			RailgunStats.IsEnabled = false;
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
		}

		public void Update()
		{
			if (RailgunStats.IsEnabled)
			{
				RailgunStats.CurrentCharge = Mathf.Min(RailgunStats.CurrentCharge + RailgunStats.ChargeRate * TimeHandler.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;
		}
	}
	public class StoreDamageEffect : MonoBehaviour, IOnDoDamageEvent
	{
		public float DamageToStorePercentage = 0.5f;

		public float MaxStoredDamageMultiplier = 5f;

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

		private float maxStoredDamage = 100f;

		private float storedDamage = 0f;

		private float cooldownTimer = 0f;

		private bool damageReductionApplied = false;

		private Player player;

		private DamageSpawnObjects damageSpawnObjects;

		private CustomHealthBar storedDamageBar;

		public void ReleaseStoredDamage()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (storedDamage > 0f)
			{
				damageSpawnObjects.SpawnDamage(Vector2.up * storedDamage);
				ResetStoredDamage();
				cooldownTimer = CoolddownTime;
			}
		}

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

		public void ResetStoredDamage()
		{
			storedDamage = 0f;
			storedDamageBar.CurrentHealth = storedDamage;
			if (!damageReductionApplied)
			{
				player.data.GetAdditionalData().DamageReduction += DamageToStorePercentage;
				damageReductionApplied = true;
			}
		}

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

		private void OnDestroy()
		{
			DamageEventHandler.UnregisterDamageEvent(this, player);
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
		}

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

		private CustomHealthBar CreateStoredDamageBar()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Railgun Charge Bar");
			CustomHealthBar val2 = val.AddComponent<CustomHealthBar>();
			val2.SetColor(new Color(1f, 0.64705884f, 0f, 1f) * 0.8f);
			ExtensionMethods.AddStatusIndicator(player, val, 0f, true);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Healthbar(Clone)/Canvas/Image/White")).gameObject);
			return val2;
		}

		private void OnRevive()
		{
			ResetStoredDamage();
			cooldownTimer = 0f;
		}
	}
}
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 = soulStreakStats.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 uint Souls = 0u;

		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 SoulstreakStats.Souls;
			}
			set
			{
				SoulstreakStats.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 - TimeHandler.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, Player player);
	}
	public interface IOnTakeDamageEvent
	{
		void OnTakeDamage(Vector2 damage, Player player);
	}
	public interface IOnTakeDamageOvertimeEvent
	{
		void OnTakeDamageOvertime(Vector2 damage, Player player);
	}
	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 hurtPlayer, Player damagingPlayer, Vector2 damage)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			switch (eventType)
			{
			case DamageEventType.OnDoDamage:
				if (!OnDoDamageEvents.ContainsKey(hurtPlayer))
				{
					break;
				}
				{
					foreach (IOnDoDamageEvent item in OnDoDamageEvents[hurtPlayer])
					{
						item.OnDamage(damage, damagingPlayer);
					}
					break;
				}
			case DamageEventType.OnTakeDamage:
				if (!OnTakeDamageEvents.ContainsKey(hurtPlayer))
				{
					break;
				}
				{
					foreach (IOnTakeDamageEvent item2 in OnTakeDamageEvents[hurtPlayer])
					{
						item2.OnTakeDamage(damage, damagingPlayer);
					}
					break;
				}
			case DamageEventType.OnTakeDamageOvertime:
				if (!OnTakeDamageOvertimeEvents.ContainsKey(hurtPlayer))
				{
					break;
				}
				{
					foreach (IOnTakeDamageOvertimeEvent item3 in OnTakeDamageOvertimeEvents[hurtPlayer])
					{
						item3.OnTakeDamageOvertime(damage, damagingPlayer);
					}
					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
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public Player player;

			internal bool <HandleExtraPickForPlayer>b__0(int i)
			{
				return PlayerManager.instance.players[i].playerID == player.playerID;
			}
		}

		[CompilerGenerated]
		private sealed class <HandleExtraPickForPlayer>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Player player;

			private <>c__DisplayClass9_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass9_0();
					<>8__1.player = player;
					currentPlayer = <>8__1.player;
					<>2__current = GameModeManager.TriggerHook("PlayerPickStart");
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					CardChoiceVisuals.instance.Show((from i in Enumerable.Range(0, PlayerManager.instance.players.Count)
						where PlayerManager.instance.players[i].playerID == <>8__1.player.playerID
						select i).First(), true);
					<>2__current = CardChoice.instance.DoPick(1, <>8__1.player.playerID, (PickerType)1);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(0.1f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					if (extraPicks.ContainsKey(<>8__1.player) && extraPicks[<>8__1.player].Count > 0)
					{
						extraPicks[<>8__1.player].RemoveAt(0);
					}
					<>2__current = GameModeManager.TriggerHook("PlayerPickEnd");
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HandleExtraPicks>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Player[] <>s__1;

			private int <>s__2;

			private Player <player>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<player>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_00aa;
				}
				<>1__state = -1;
				<>s__1 = PlayerManager.instance.players.ToArray();
				<>s__2 = 0;
				goto IL_00c0;
				IL_00aa:
				<player>5__3 = null;
				<>s__2++;
				goto IL_00c0;
				IL_00c0:
				if (<>s__2 < <>s__1.Length)
				{
					<player>5__3 = <>s__1[<>s__2];
					if (extraPicks.ContainsKey(<player>5__3) && extraPicks[<player>5__3].Count > 0)
					{
						<>2__current = HandleExtraPickForPlayer(<player>5__3);
						<>1__state = 1;
						return true;
					}
					goto IL_00aa;
				}
				<>s__1 = null;
				currentPlayer = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

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

		[IteratorStateMachine(typeof(<HandleExtraPicks>d__8))]
		internal static IEnumerator HandleExtraPicks()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HandleExtraPicks>d__8(0);
		}

		[IteratorStateMachine(typeof(<HandleExtraPickForPlayer>d__9))]
		private static IEnumerator HandleExtraPickForPlayer(Player player)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HandleExtraPickForPlayer>d__9(0)
			{
				player = player
			};
		}
	}
	public class FlashlightMaskHandler : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <FadeCoroutine>d__17 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float from;

			public float to;

			public float duration;

			public FlashlightMaskHandler <>4__this;

			private float <elapsed>5__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__1 < duration)
				{
					<elapsed>5__1 += Time.deltaTime;
					<>4__this.globalFade = Mathf.Lerp(from, to, Mathf.Clamp01(<elapsed>5__1 / duration));
					<>4__this.mat.SetFloat("_GlobalFade", <>4__this.globalFade);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<>4__this.globalFade = to;
				<>4__this.mat.SetFloat("_GlobalFade", <>4__this.globalFade);
				<>4__this.fadeCoroutine = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

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

		[IteratorStateMachine(typeof(<FadeCoroutine>d__17))]
		private IEnumerator FadeCoroutine(float from, float to, float duration)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeCoroutine>d__17(0)
			{
				<>4__this = this,
				from = from,
				to = to,
				duration = duration
			};
		}

		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)
		{
			if (card.categories.Intersect(AALUND13_Cards.NoSteelCategories).Any())
			{
				return false;
			}
			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
	{
		pub