Decompiled source of AALUND13 Cards v1.5.1

plugins/AALUND13_Cards.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Card;
using AALUND13Card.Armors;
using AALUND13Card.Cards;
using AALUND13Card.Extensions;
using AALUND13Card.Handlers;
using AALUND13Card.Handlers.ExtraPickHandlers;
using AALUND13Card.MonoBehaviours;
using AALUND13Card.MonoBehaviours.Soulstreak;
using AALUND13_Card.Utils;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ClassesManagerReborn;
using HarmonyLib;
using JARL.Armor;
using JARL.Armor.Bases;
using JARL.Armor.Utlis;
using JARL.Bases;
using JARL.Utils;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using SoundImplementation;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
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: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AALUND13_Card.Utils
{
	public static class NegativeStatCardGenerator
	{
		public static readonly Dictionary<int, (Func<int, CardInfoStat>, Action<float, Gun, CharacterStatModifiers, Block>)> StatGenerators = new Dictionary<int, (Func<int, CardInfoStat>, Action<float, Gun, CharacterStatModifiers, Block>)>
		{
			{
				0,
				((int random) => GenerateCardStat("Damage", GetNegativeRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					gun.damage *= 1f + value;
				})
			},
			{
				1,
				((int random) => GenerateCardStat("Reload Time", GetPositiveRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					gun.reloadTime *= 1f + value;
				})
			},
			{
				2,
				((int random) => GenerateCardStat("Attack Speed", GetPositiveRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					gun.attackSpeed *= 1f + value;
				})
			},
			{
				3,
				((int random) => GenerateCardStat("Movement Speed", GetNegativeRandomValue(random, 25)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					stats.movementSpeed *= 1f + value;
				})
			},
			{
				4,
				((int random) => GenerateCardStat("Health", GetNegativeRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					stats.health *= 1f + value;
				})
			},
			{
				5,
				((int random) => GenerateCardStat("Block Cooldown", GetPositiveRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					block.cdMultiplier *= 1f + value;
				})
			},
			{
				6,
				((int random) => GenerateCardStat("Bullet Speed", GetNegativeRandomValue(random, 50)), delegate(float value, Gun gun, CharacterStatModifiers stats, Block block)
				{
					gun.projectileSpeed *= 1f + value;
				})
			}
		};

		private static CardInfoStat GenerateCardStat(string statName, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			return new CardInfoStat
			{
				stat = statName,
				amount = string.Format("{0}{1}%", (value > 0f) ? "+" : "", value),
				positive = false
			};
		}

		private static float GetPositiveRandomValue(int random, int max)
		{
			return 1f + (float)(random % max);
		}

		private static float GetNegativeRandomValue(int random, int max)
		{
			return -1f * (float)(1 + random % max);
		}

		internal static void Setup()
		{
			RandomSyncSeed.RegisterSyncedRandom("RegisterNegativeStatCard", delegate(SyncedRandomContext SyncedRandomContext)
			{
				Player player = PlayerManager.instance.players.Find((Player p) => p.playerID == (int)SyncedRandomContext.Parameters[0]);
				GameObject val = Object.Instantiate<GameObject>(AALUND13_Cards.BlankCardPrefab);
				Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(0)).gameObject);
				Object.DontDestroyOnLoad((Object)(object)val);
				CardInfo component = val.GetComponent<CardInfo>();
				BuildNegativeStatCard buildNegativeStatCard = val.AddComponent<BuildNegativeStatCard>();
				component.cardName = $"Defective Card ({SyncedRandomContext.Random.Next(int.MaxValue)})";
				component.cardDestription = "A defective card";
				Gun component2 = val.GetComponent<Gun>();
				CharacterStatModifiers component3 = val.GetComponent<CharacterStatModifiers>();
				Block component4 = val.GetComponent<Block>();
				int num = SyncedRandomContext.Random.Next(1, 4);
				List<(CardInfoStat, int)> list = new List<(CardInfoStat, int)>();
				HashSet<int> hashSet = new HashSet<int>();
				LoggerUtils.LogInfo($"Generating {num} stats...");
				while (hashSet.Count < num)
				{
					int num2 = SyncedRandomContext.Random.Next(StatGenerators.Count);
					if (hashSet.Add(num2))
					{
						(Func<int, CardInfoStat>, Action<float, Gun, CharacterStatModifiers, Block>) tuple = StatGenerators[num2];
						CardInfoStat val2 = tuple.Item1(SyncedRandomContext.Random.Next());
						float arg = float.Parse(val2.amount.Replace("%", "")) / 100f;
						tuple.Item2(arg, component2, component3, component4);
						list.Add((val2, num2));
					}
				}
				component.cardStats = list.Select(((CardInfoStat, int) stat) => stat.Item1).ToArray();
				LoggerUtils.LogInfo("Building card...");
				((CustomCard)buildNegativeStatCard).BuildUnityCard((Action<CardInfo>)delegate(CardInfo cardInfo)
				{
					Cards.instance.AddHiddenCard(cardInfo);
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)AALUND13_Cards.Instance, 0.2f, (Action)delegate
					{
						Cards.instance.AddCardToPlayer(player, cardInfo, false, "", 2f, 2f, true);
					});
					LoggerUtils.LogInfo("Card built!");
				});
			});
		}

		public static void AddDefectiveCard(Player player)
		{
			RandomSyncSeed.SyncSeed("RegisterNegativeStatCard", player.playerID);
		}
	}
	public static class RandomSyncSeed
	{
		private static readonly Random Random = new Random();

		public static Dictionary<string, Action<SyncedRandomContext>> SyncedSeeds = new Dictionary<string, Action<SyncedRandomContext>>();

		public static void SyncSeed(string target, params object[] additionalParams)
		{
			NetworkingManager.RPC(typeof(RandomSyncSeed), "RPCA_SyncSeed", new object[3]
			{
				Random.Next(),
				target,
				additionalParams
			});
		}

		[UnboundRPC]
		private static void RPCA_SyncSeed(int seed, string target, object[] additionalParams)
		{
			if (SyncedSeeds.ContainsKey(target))
			{
				SyncedSeeds[target](new SyncedRandomContext(seed, additionalParams));
			}
		}

		public static void RegisterSyncedRandom(string target, Action<SyncedRandomContext> action)
		{
			SyncedSeeds.Add(target, action);
		}
	}
	public class SyncedRandomContext
	{
		public Random Random { get; private set; }

		public object[] Parameters { get; private set; }

		public SyncedRandomContext(int seed, object[] parameters)
		{
			Random = new Random(seed);
			Parameters = parameters;
		}
	}
}
namespace AALUND13_Card.MonoBehaviours
{
	public class CardFactoryMono : MonoBehaviour, IPickEndHookHandler
	{
		public Player Player;

		public Gun Gun;

		public GunAmmo GunAmmo;

		public CharacterData Data;

		public HealthHandler Health;

		public Gravity Gravity;

		public Block Block;

		public CharacterStatModifiers CharacterStats;

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

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

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

		private bool condition(CardInfo card, Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			return true;
		}
	}
}
namespace AALUND13Card
{
	[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.5.1")]
	[BepInProcess("Rounds.exe")]
	public class AALUND13_Cards : BaseUnityPlugin
	{
		internal const string ModInitials = "AAC";

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

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

		internal const string ModName = "AALUND13 Cards";

		internal const string Version = "1.5.1";

		internal static List<BaseUnityPlugin> Plugins;

		internal static ManualLogSource ModLogger;

		public static AssetBundle Assets;

		public static GameObject BlankCardPrefab;

		public static CardCategory SoulstreakClassCards;

		public static Material PixelateEffectMaterial;

		public static Material ScanEffectMaterial;

		public static AALUND13_Cards Instance { get; private set; }

		public void Awake()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			Instance = this;
			ModLogger = ((BaseUnityPlugin)this).Logger;
			ConfigHandler.RegesterMenu(((BaseUnityPlugin)this).Config);
			Assets = AssetUtils.LoadAssetBundleFromResources("aalund13_cards_assets", typeof(AALUND13_Cards).Assembly);
			BlankCardPrefab = Assets.LoadAsset<GameObject>("__AAC__Blank");
			PixelateEffectMaterial = Assets.LoadAsset<Material>("PixelateEffectMaterial");
			ScanEffectMaterial = Assets.LoadAsset<Material>("ScanEffectMaterial");
			Assets.LoadAsset<GameObject>("ModCards").GetComponent<CardResgester>().RegisterCards();
			NegativeStatCardGenerator.Setup();
			Harmony val = new Harmony("com.aalund13.rounds.aalund13_cards");
			val.PatchAll();
		}

		public void Start()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			Plugins = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			DeathHandler.OnPlayerDeath += new DeathHandlerDelegate(OnPlayerDeath);
			ArmorFramework.RegisterArmorType((ArmorBase)(object)new SoulArmor());
			ArmorFramework.RegisterArmorType((ArmorBase)(object)new BattleforgedArmor());
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => ExtraCardPickHandler.HandleExtraPicks()));
			if (Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			((Component)this).gameObject.AddComponent<DelayDamageHandler>();
		}

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

		public List<GameObject> HiddenCards;

		public static Dictionary<string, CardInfo> ModCards = new Dictionary<string, CardInfo>();

		internal void RegisterCards()
		{
			foreach (GameObject card in Cards)
			{
				CardInfo component = card.GetComponent<CardInfo>();
				CustomCard.RegisterUnityCard(card, ((CustomCard)card.GetComponent<AACustomCard>()).GetModName() ?? "AAC", component.cardName, true, (Action<CardInfo>)null);
				ModCards.Add(component.cardName, component);
				card.GetComponent<AACustomCard>()?.OnRegister(component);
				AALUND13_Cards.ModLogger.LogInfo((object)("Registered Card: " + component.cardName));
			}
			foreach (GameObject hiddenCard in HiddenCards)
			{
				CardInfo component2 = hiddenCard.GetComponent<CardInfo>();
				CustomCard.RegisterUnityCard(hiddenCard, ((CustomCard)hiddenCard.GetComponent<AACustomCard>()).GetModName() ?? "AAC", component2.cardName, false, (Action<CardInfo>)null);
				ModCards.Add(component2.cardName, component2);
				Cards.instance.AddHiddenCard(component2);
				hiddenCard.GetComponent<AACustomCard>()?.OnRegister(component2);
				AALUND13_Cards.ModLogger.LogInfo((object)("Registered Hidden Card: " + component2.cardName));
			}
		}
	}
	public class DamageDealSecond
	{
		public float TimeToDealDamage;

		public Vector2 Damage;

		public Vector2 Position;

		public Color BlinkColor;

		public GameObject DamagingWeapon;

		public Player DamagingPlayer;

		public bool HealthRemoval;

		public bool Lethal;

		public bool IgnoreBlock;

		public DamageDealSecond(float timeToDealDamage, Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			TimeToDealDamage = timeToDealDamage;
			Damage = damage;
			Position = position;
			BlinkColor = blinkColor;
			DamagingWeapon = damagingWeapon;
			DamagingPlayer = damagingPlayer;
			HealthRemoval = healthRemoval;
			Lethal = lethal;
			IgnoreBlock = ignoreBlock;
		}
	}
	public class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory val = TabInfoManager.RegisterCategory("Soulstreak Stats", 7);
			TabInfoManager.RegisterStat(val, "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(val, "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(val, "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(val, "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(val, "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(val, "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(val, "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(val, "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(val, "Soul Drain Multiply", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulDrainMultiply != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulDrainMultiply * 100f:0}%"));
			TabInfoManager.RegisterStat(val, "Souls", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().Souls != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().Souls}"));
		}
	}
	public static class CardRemover
	{
		public static void RemoveCardFromPlayer(Player player, CardInfo cardInfo, int frameDelay)
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AALUND13_Cards.Instance, frameDelay, (Action)delegate
			{
				int num = player.data.currentCards.FindIndex((CardInfo c) => (Object)(object)c == (Object)(object)cardInfo);
				if (num != -1)
				{
					NetworkingManager.RPC(typeof(CardRemover), "RPCA_RemoveCardFromPlayer", new object[2] { player.playerID, num });
				}
			});
		}

		[UnboundRPC]
		private static void RPCA_RemoveCardFromPlayer(int playerID, int cardId)
		{
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerID);
			CardInfo cardInfo = val.data.currentCards[cardId];
			val.data.currentCards.RemoveAt(cardId);
			CardBarButton[] componentsInChildren = ((Component)CardBarUtils.instance.PlayersCardBar(val)).GetComponentsInChildren<CardBarButton>();
			componentsInChildren.ToList().ForEach(delegate(CardBarButton cardBarButton)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				CardInfo val2 = (CardInfo)ExtensionMethods.GetFieldValue((object)cardBarButton, "card");
				if ((Object)(object)val2 == (Object)(object)cardInfo)
				{
					Object.Destroy((Object)(object)((Component)cardBarButton).gameObject);
				}
			});
		}
	}
	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)
		{
			if (logging)
			{
				AALUND13_Cards.ModLogger.LogWarning((object)message);
			}
		}

		public static void LogError(string message)
		{
			if (logging)
			{
				AALUND13_Cards.ModLogger.LogError((object)message);
			}
		}
	}
}
namespace AALUND13Card.Patches
{
	[HarmonyPatch(typeof(Cards), "PlayerIsAllowedCard")]
	public class AllowedCardPatch
	{
		private static void Postfix(Player player, CardInfo card, ref bool __result, Cards __instance)
		{
			if (!((Object)(object)player == (Object)null) && !((Object)(object)card == (Object)null) && (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;
			}
		}
	}
	[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(CardChoice), "IDoEndPick")]
	public class CardChoiceIDoEndPickPatch
	{
		private static void Postfix(GameObject pickedCard, int theInt, int pickId)
		{
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, pickId);
			if (!((Object)(object)playerWithID == (Object)null) && (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>());
			}
		}
	}
	[HarmonyPatch(typeof(CharacterStatModifiers))]
	public class CharacterStatModifiersPatch
	{
		[HarmonyPatch("ResetStats")]
		[HarmonyPrefix]
		public static void ResetStats(CharacterStatModifiers __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			val.GetAdditionalData().Reset();
			if (ExtraCardPickHandler.extraPicks.ContainsKey(val.player))
			{
				ExtraCardPickHandler.extraPicks[val.player].Clear();
			}
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null)
			{
				Effect[] components = ((Component)main).GetComponents<Effect>();
				foreach (Effect effect in components)
				{
					Object.Destroy((Object)(object)effect);
				}
			}
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	public class HealthHandlerPatch
	{
		[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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			CharacterData block = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			AALUND13CardCharacterDataAdditionalData additionalData = block.GetAdditionalData();
			if (additionalData.secondToDealDamage > 0f && !additionalData.dealDamage)
			{
				Vector2 damage2 = default(Vector2);
				((Vector2)(ref damage2))..ctor(damage.x, damage.y);
				ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(damage2, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
				damage = Vector2.zero;
			}
			else if (additionalData.dealDamage)
			{
				additionalData.dealDamage = false;
			}
		}
	}
}
namespace AALUND13Card.MonoBehaviours
{
	[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);
		}
	}
	public class SoulstreakDrain : MonoBehaviour
	{
		private SoulStreakStats soulstreakStats;

		private DealDamageToPlayer dealDamageToPlayer;

		private Player player;

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

		public void Update()
		{
			if (soulstreakStats != null)
			{
				dealDamageToPlayer.damage = player.data.weaponHandler.gun.damage * 55f * soulstreakStats.SoulDrainMultiply;
			}
		}

		public void Heal()
		{
			player.data.healthHandler.Heal(player.data.weaponHandler.gun.damage * 55f * soulstreakStats.SoulDrainMultiply * 0.25f);
		}
	}
	[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 SoulDrainMultiply = 0f;

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

		private ArmorHandler armorHandler;

		public bool CanResetKills = true;

		public bool AbilityActive;

		public float AbilityCooldown;

		public GameObject SoulsCounter;

		public GameObject SoulsCounterGUI;

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

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

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

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

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

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

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

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

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

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

		public void OnPointEnd()
		{
			CanResetKills = false;
			armorHandler.GetArmorByType<SoulArmor>().MaxArmorValue = 0f;
		}
	}
}
namespace AALUND13Card.MonoBehaviours.Soulstreak
{
	public class SoulstreakEffect : ReversibleEffect, IPickStartHookHandler, IGameStartHookHandler
	{
		public override void OnStart()
		{
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
			((ReversibleEffect)this).SetLivesToEffect(int.MaxValue);
			base.applyImmediately = false;
			ApplyStats();
		}

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

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

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

		public override void OnOnDestroy()
		{
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}
	}
}
namespace AALUND13Card.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 class DelayDamageHandler : MonoBehaviour, IBattleStartHookHandler
	{
		public Player player;

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

		public void DelayDamage(Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, player.data.GetAdditionalData().secondToDealDamage, (Action)delegate
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				player.data.GetAdditionalData().dealDamage = true;
				player.data.healthHandler.DoDamage(damage, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
			});
		}

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

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

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

		public static Player currentPlayer;

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

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

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

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

		private static IEnumerator HandleExtraPickForPlayer(Player player)
		{
			currentPlayer = player;
			yield return GameModeManager.TriggerHook("PlayerPickStart");
			CardChoiceVisuals.instance.Show((from i in Enumerable.Range(0, PlayerManager.instance.players.Count)
				where PlayerManager.instance.players[i].playerID == player.playerID
				select i).First(), true);
			yield return CardChoice.instance.DoPick(1, player.playerID, (PickerType)1);
			yield return (object)new WaitForSecondsRealtime(0.1f);
			extraPicks[player].RemoveAt(0);
			yield return GameModeManager.TriggerHook("PlayerPickEnd");
		}
	}
}
namespace AALUND13Card.Handlers.ExtraPickHandlers
{
	public class SteelPickHandler : ExtraPickHandler
	{
		public override bool OnExtraPickStart(Player player, CardInfo card)
		{
			List<CardInfo> list = new List<CardInfo>();
			foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(player))
			{
				if ((Object)(object)enemyPlayer != (Object)(object)player)
				{
					list.AddRange(enemyPlayer.data.currentCards);
				}
			}
			return list.Contains(card);
		}

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

		public bool dealDamage = true;

		public SoulStreakStats SoulStreakStats = new SoulStreakStats();

		public uint Souls = 0u;

		public int RandomCardsAtStart = 0;

		public void Reset()
		{
			secondToDealDamage = 0f;
			dealDamage = true;
			SoulStreakStats = new SoulStreakStats();
			Souls = 0u;
			RandomCardsAtStart = 0;
		}
	}
	public static class CharacterDataExtensions
	{
		public static readonly ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData> data = new ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData>();

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

		public static void AddData(this CharacterData block, AALUND13CardCharacterDataAdditionalData value)
		{
			try
			{
				data.Add(block, value);
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace AALUND13Card.Classes
{
	internal class SoulstreakClass : ClassHandler
	{
		public override IEnumerator Init()
		{
			ClassesRegistry.Register(CardResgester.ModCards["Soulstreak"], (CardType)1, 0);
			ClassesRegistry.Register(CardResgester.ModCards["Eternal Resilience"], (CardType)16, CardResgester.ModCards["Soulstreak"], 2);
			ClassesRegistry.Register(CardResgester.ModCards["Soulstealer Embrace"], (CardType)16, CardResgester.ModCards["Soulstreak"], 0);
			ClassesRegistry.Register(CardResgester.ModCards["Soul Barrier"], (CardType)2, CardResgester.ModCards["Soulstreak"], 0);
			ClassesRegistry.Register(CardResgester.ModCards["Soul Barrier Enhancement"], (CardType)16, CardResgester.ModCards["Soul Barrier"], 2);
			ClassesRegistry.Register(CardResgester.ModCards["Soul Drain"], (CardType)2, CardResgester.ModCards["Soulstreak"], 0);
			ClassesRegistry.Register(CardResgester.ModCards["Soul Drain Enhancement"], (CardType)16, CardResgester.ModCards["Soul Drain"], 2);
			yield break;
		}
	}
}
namespace AALUND13Card.Cards
{
	public class AACustomCard : CustomCardUnity
	{
		public virtual void OnRegister(CardInfo cardInfo)
		{
		}

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

		public float PlayerSize = 0f;

		public float MovementSpeed = 0f;

		public float AttackSpeed = 0f;

		public float Damage = 0f;

		public float BulletSpeed = 0f;

		public float SoulArmorPercentage = 0f;

		public float SoulArmorPercentageRegenRate = 0f;

		public float SoulDrainMultiply = 0f;

		public AbilityType AbilityType;

		[Header("Uncategorized Stats")]
		public int RandomCardsAtStart = 0;

		public float SecondToDealDamage = 0f;

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

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

		public ExtraPicksType ExtraPicksType;

		public void Apply(Player player)
		{
			CharacterData data = player.data;
			AALUND13CardCharacterDataAdditionalData additionalData = data.GetAdditionalData();
			additionalData.SoulStreakStats.MaxHealth += MaxHealth;
			additionalData.SoulStreakStats.PlayerSize += PlayerSize;
			additionalData.SoulStreakStats.MovementSpeed += MovementSpeed;
			additionalData.SoulStreakStats.AttackSpeed += AttackSpeed;
			additionalData.SoulStreakStats.Damage += Damage;
			additionalData.SoulStreakStats.BulletSpeed += BulletSpeed;
			additionalData.SoulStreakStats.SoulArmorPercentage += SoulArmorPercentage;
			additionalData.SoulStreakStats.SoulArmorPercentageRegenRate += SoulArmorPercentageRegenRate;
			additionalData.SoulStreakStats.SoulDrainMultiply += SoulDrainMultiply;
			additionalData.SoulStreakStats.AbilityType |= AbilityType;
			additionalData.RandomCardsAtStart += RandomCardsAtStart;
			additionalData.secondToDealDamage += SecondToDealDamage;
			if (BattleforgedArmor > 0f)
			{
				ArmorFramework.ArmorHandlers[player].AddArmor(typeof(BattleforgedArmor), BattleforgedArmor, 0f, 0f, (ArmorReactivateType)0, 0.5f);
			}
			ExtraPickHandler extraPickHandler = GetExtraPickHandler(ExtraPicksType);
			if (extraPickHandler != null && ExtraPicks > 0 && player.data.view.IsMine)
			{
				ExtraCardPickHandler.AddExtraPick(extraPickHandler, player, ExtraPicks);
			}
		}

		public ExtraPickHandler GetExtraPickHandler(ExtraPicksType type)
		{
			return type switch
			{
				ExtraPicksType.Normal => new ExtraPickHandler(), 
				ExtraPicksType.Steel => new SteelPickHandler(), 
				_ => null, 
			};
		}
	}
	public class CursesEffectCard : AACustomCard
	{
		public List<Material> PostProcessingEffects = new List<Material>();

		public override void OnRegister(CardInfo cardInfo)
		{
			CurseManager.instance.RegisterCurse(cardInfo);
		}

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

		public override string GetModName()
		{
			return "AAC (Curse)";
		}
	}
	public class BuildNegativeStatCard : AACustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			TextMeshProUGUI[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
			if (componentsInChildren.Length != 0)
			{
				((TMP_Text)((Component)componentsInChildren.Where((TextMeshProUGUI obj) => ((Object)((Component)obj).gameObject).name == "Text_Name").FirstOrDefault()).GetComponent<TextMeshProUGUI>()).text = "Defective Card";
			}
		}

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

		public override bool GetEnabled()
		{
			return false;
		}
	}
	public class RandomPickerCard : AACustomCard
	{
		public List<GameObject> randomCardsToChoseFrom = new List<GameObject>();

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient)
			{
				CardInfo component = ExtensionMethods.GetRandom<GameObject>((IList)randomCardsToChoseFrom).GetComponent<CardInfo>();
				Cards.instance.AddCardToPlayer(player, component, true, "", 2f, 2f, true);
				CardBarUtils.instance.ShowAtEndOfPhase(player, component);
			}
		}
	}
}
namespace AALUND13Card.Armors
{
	public class BattleforgedArmor : ArmorBase
	{
		public override BarColor GetBarColor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.yellow * 0.6f, Color.yellow * 0.45f);
		}

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

		public BattleforgedArmor()
		{
			base.ArmorTags.Add("CanArmorPierce");
			base.ArmorRegenCooldownSeconds = 5f;
		}
	}
	public class SoulArmor : ArmorBase
	{
		public override BarColor GetBarColor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.magenta * 0.6f, Color.magenta * 0.45f);
		}

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

		public SoulArmor()
		{
			base.ArmorRegenCooldownSeconds = 5f;
		}
	}
}