Decompiled source of AALUND13 Cards Beta v2.2.5

plugins/AALUND13_Armors_Cards.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Cards.Armors.Armors;
using AALUND13Cards.Armors.Armors.Processors;
using AALUND13Cards.Armors.Cards;
using AALUND13Cards.Armors.Utils;
using AALUND13Cards.Core;
using AALUND13Cards.Core.Cards;
using AALUND13Cards.Core.Cards.Conditions;
using AALUND13Cards.Core.Extensions;
using AALUND13Cards.Core.Utils;
using BepInEx;
using HarmonyLib;
using JARL.Armor;
using JARL.Armor.Bases;
using JARL.Armor.Builtin;
using JARL.Armor.Processors;
using JARL.Armor.Utlis;
using JARL.Extensions;
using Microsoft.CodeAnalysis;
using TabInfo.Utils;
using UnboundLib;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AALUND13Cards.Armors
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("AALUND13.Cards.Armors", "AALUND13 Armors Cards", "1.1.0")]
	[BepInProcess("Rounds.exe")]
	internal class AAC_Armors : BaseUnityPlugin
	{
		internal const string ModId = "AALUND13.Cards.Armors";

		internal const string ModName = "AALUND13 Armors Cards";

		internal const string Version = "1.1.0";

		private static AssetBundle assets;

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

		private void Start()
		{
			if ((Object)(object)assets == (Object)null)
			{
				Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Armors Cards\" assets failled to load, All the cards will be disable in this mod");
				throw new NullReferenceException("Failled to load \"AALUND13 Armors Cards\" assets");
			}
			ArmorTypeGetterUtils.RegiterArmorType<TitaniumArmor>("Titanium");
			ArmorTypeGetterUtils.RegiterArmorType<BattleforgedArmor>("Battleforged");
			ArmorFramework.RegisterArmorProcessor<DamageAgainstArmorPercentageProcessor>();
			ArmorFramework.RegisterArmorProcessor<ArmorDamageReductionProcessor>();
			CardResgester cardResgester = assets.LoadAsset<GameObject>("ArmorsModCards").GetComponent<CardResgester>();
			cardResgester.RegisterCards();
			AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
			{
				AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Armors Cards", "1.1.0", cardResgester);
			});
			if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
		}
	}
	internal class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
			TabInfoManager.RegisterStat(orCreateCategory, "Damage Against Armor Percentage", (Func<Player, bool>)((Player p) => GetArmorStatsFromPlayer(p).DamageAgainstArmorPercentage != 1f), (Func<Player, string>)((Player p) => $"{GetArmorStatsFromPlayer(p).DamageAgainstArmorPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(orCreateCategory, "Armor Damage Reduction", (Func<Player, bool>)((Player p) => GetArmorStatsFromPlayer(p).ArmorDamageReduction != 0f), (Func<Player, string>)((Player p) => $"{GetArmorStatsFromPlayer(p).ArmorDamageReduction * 100f:0}%"));
		}

		private static ArmorStats GetArmorStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ArmorStats>();
		}
	}
}
namespace AALUND13Cards.Armors.Utils
{
	public class ArmorTypeGetterUtils
	{
		private static Dictionary<string, Type> registerArmorType = new Dictionary<string, Type>();

		public static ReadOnlyDictionary<string, Type> RegisterArmorType => new ReadOnlyDictionary<string, Type>(RegisterArmorType);

		public static void RegiterArmorType<T>(string armorId) where T : ArmorBase, new()
		{
			if (registerArmorType.ContainsKey(armorId))
			{
				throw new ArgumentException("Armor with the type '" + armorId + "' already register");
			}
			ArmorFramework.RegisterArmorType<T>();
			registerArmorType.Add(armorId, typeof(T));
		}

		public static Type GetArmorType(string armorId)
		{
			return registerArmorType[armorId];
		}
	}
}
namespace AALUND13Cards.Armors.Patches
{
	[HarmonyPatch(typeof(HealthHandler), "Heal")]
	public class HealthHandlerHealPatch
	{
		public static Dictionary<Player, float> OldHealth = new Dictionary<Player, float>();

		public static void Prefix(HealthHandler __instance)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Player val = (Player)ExtensionMethods.GetFieldValue((object)__instance, "player");
			if (!OldHealth.ContainsKey(val))
			{
				OldHealth.Add(val, 0f);
			}
			OldHealth[val] = val.data.health;
		}

		public static void Postfix(HealthHandler __instance, float healAmount)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			if (healAmount == 0f)
			{
				return;
			}
			Player val = (Player)ExtensionMethods.GetFieldValue((object)__instance, "player");
			float num = val.data.health - OldHealth[val];
			float num2 = Mathf.Max(healAmount - num, 0f);
			if (num2 <= 0f)
			{
				return;
			}
			float num3 = num2;
			if (!(num3 > 0f))
			{
				return;
			}
			foreach (ArmorBase activeArmor in ArmorFramework.ArmorHandlers[val].ActiveArmors)
			{
				if (!activeArmor.HasArmorTag("NoRestorationRegen") && !(Time.time < activeArmor.LastStateChangeTime + 5f) && !activeArmor.Disable)
				{
					float num4 = activeArmor.HealArmor(num3);
					num3 -= num4;
					if (num3 <= 0f)
					{
						break;
					}
				}
			}
		}
	}
}
namespace AALUND13Cards.Armors.MonoBehaviours.CardsEffects
{
	public class HealthToArmorConversion : MonoBehaviour
	{
		public float HealthToArmorConversions = 0.5f;

		private Dictionary<ArmorBase, float> armorAdded = new Dictionary<ArmorBase, float>();

		private CharacterData characterData;

		private ArmorHandler armorHandler;

		private float oldHealth;

		private int oldArmorCount;

		private void Start()
		{
			characterData = ((Component)this).GetComponentInParent<CharacterData>();
			armorHandler = ((Component)this).GetComponentInParent<ArmorHandler>();
			CharacterData obj = characterData;
			obj.maxHealth *= HealthToArmorConversions;
			CharacterData obj2 = characterData;
			obj2.health *= HealthToArmorConversions;
			oldHealth = characterData.maxHealth;
			oldArmorCount = Mathf.Max(armorHandler.ActiveArmors.Count, 1);
			UpdateArmorStats();
		}

		private void Update()
		{
			if (characterData.maxHealth != oldHealth || armorHandler.ActiveArmors.Count != oldArmorCount)
			{
				oldHealth = characterData.maxHealth;
				oldArmorCount = Mathf.Max(armorHandler.ActiveArmors.Count, 1);
				UpdateArmorStats();
			}
		}

		private void OnDestroy()
		{
			foreach (KeyValuePair<ArmorBase, float> item in armorAdded)
			{
				ArmorBase key = item.Key;
				key.MaxArmorValue -= item.Value;
				ArmorBase key2 = item.Key;
				key2.CurrentArmorValue -= item.Value;
			}
		}

		private void UpdateArmorStats()
		{
			Dictionary<ArmorBase, float> dictionary = new Dictionary<ArmorBase, float>(armorAdded);
			foreach (KeyValuePair<ArmorBase, float> item in armorAdded)
			{
				ArmorBase key = item.Key;
				key.MaxArmorValue -= item.Value;
			}
			armorAdded.Clear();
			if (armorHandler.ActiveArmors.Count == 0)
			{
				float num = characterData.maxHealth * HealthToArmorConversions * 2f;
				ArmorBase armorByType = armorHandler.GetArmorByType<DefaultArmor>();
				float num2 = num;
				if (dictionary.ContainsKey(armorByType))
				{
					num2 = num - dictionary[armorByType];
				}
				armorByType.MaxArmorValue += num;
				armorByType.CurrentArmorValue += num2;
				armorAdded[armorByType] = num;
			}
			else
			{
				float num3 = characterData.maxHealth * HealthToArmorConversions * 2f / (float)armorHandler.ActiveArmors.Count;
				foreach (ArmorBase activeArmor in armorHandler.ActiveArmors)
				{
					float num4 = num3;
					if (dictionary.ContainsKey(activeArmor))
					{
						num4 = num3 - dictionary[activeArmor];
					}
					activeArmor.MaxArmorValue += num3;
					activeArmor.CurrentArmorValue += num4;
					armorAdded[activeArmor] = num3;
				}
			}
			LoggerUtils.LogInfo($"Added armors to player with a id of {characterData.player.playerID}", false);
		}
	}
}
namespace AALUND13Cards.Armors.Cards
{
	public class ArmorStats : ICustomStats
	{
		public float DamageAgainstArmorPercentage = 1f;

		public float HealToArmorHealPercentage;

		public float ArmorDamageReduction;

		public void ResetStats()
		{
			DamageAgainstArmorPercentage = 1f;
			HealToArmorHealPercentage = 0f;
			ArmorDamageReduction = 0f;
		}
	}
}
namespace AALUND13Cards.Armors.Cards.StatModifers
{
	public class ArmorStatModifers : CustomStatModifers
	{
		[Header("Armors Stats")]
		public float ArmorDamageReduction;

		public float HealToArmorHealPercentage;

		[Space(10f)]
		public string ArmorTypeId = "";

		public float ArmorHealth;

		public float ArmorHealthMultiplier = 1f;

		public float ArmorRegenRate;

		public float ArmorRegenCooldown;

		public bool RemoveArmorPirceTag;

		[Space(10f)]
		public bool OverrideArmorDamagePatchType;

		public bool PatchDoDamage;

		public bool PatchTakeDamage;

		public bool PatchTakeDamageOverTime;

		[Space(10f)]
		public ArmorReactivateType ArmorReactivateType;

		public float ArmorReactivateValue;

		[Header("Armor Pierce Stats")]
		public float ArmorPiercePercent;

		public float DamageAgainstArmorPercentage = 1f;

		public override void Apply(Player player)
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			ArmorStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ArmorStats>();
			JARLCharacterDataAdditionalData additionalData = CharacterDataExtensions.GetAdditionalData(player.data);
			orCreate.ArmorDamageReduction = Mathf.Min(orCreate.ArmorDamageReduction + ArmorDamageReduction, 0.8f);
			orCreate.HealToArmorHealPercentage += HealToArmorHealPercentage;
			if (!Utility.IsNullOrWhiteSpace(ArmorTypeId))
			{
				ArmorBase val = ArmorFramework.ArmorHandlers[player].Armors.First((ArmorBase x) => ((object)x).GetType() == ArmorTypeGetterUtils.GetArmorType(ArmorTypeId));
				if (val != null)
				{
					val.MaxArmorValue += ArmorHealth;
					if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "Systems.R00t.AdditiveStats"))
					{
						val.MaxArmorValue += 100f * (ArmorHealthMultiplier - 1f);
					}
					else
					{
						val.MaxArmorValue *= ArmorHealthMultiplier;
					}
					val.ArmorRegenerationRate += ArmorRegenRate;
					val.ArmorRegenCooldownSeconds += ArmorRegenCooldown;
					if (ArmorReactivateValue > 0f)
					{
						val.reactivateArmorType = ArmorReactivateType;
						val.reactivateArmorValue = ArmorReactivateValue;
					}
					if (RemoveArmorPirceTag && val.HasArmorTag("CanArmorPierce"))
					{
						val.ArmorTags.Remove("CanArmorPierce");
					}
					if (OverrideArmorDamagePatchType)
					{
						val.ArmorDamagePatch = (ArmorDamagePatchType)0;
						if (PatchDoDamage)
						{
							val.ArmorDamagePatch = (ArmorDamagePatchType)(val.ArmorDamagePatch | 1);
						}
						if (PatchTakeDamage)
						{
							val.ArmorDamagePatch = (ArmorDamagePatchType)(val.ArmorDamagePatch | 2);
						}
						if (PatchTakeDamageOverTime)
						{
							val.ArmorDamagePatch = (ArmorDamagePatchType)(val.ArmorDamagePatch | 4);
						}
					}
				}
			}
			additionalData.ArmorPiercePercent = Mathf.Clamp(additionalData.ArmorPiercePercent + ArmorPiercePercent, 0f, 1f);
			orCreate.DamageAgainstArmorPercentage += DamageAgainstArmorPercentage - 1f;
		}
	}
}
namespace AALUND13Cards.Armors.Cards.Conditions
{
	public class PlayerHaveArmorCondition : CardCondition
	{
		public List<string> BlacklistedArmorTag = new List<string>();

		public override bool IsPlayerAllowedCard(Player player)
		{
			return ArmorFramework.ArmorHandlers[player].ActiveArmors.Any((ArmorBase armor) => !BlacklistedArmorTag.Any((string tag) => armor.ArmorTags.Contains(tag)));
		}
	}
}
namespace AALUND13Cards.Armors.Armors
{
	public class BattleforgedArmor : ArmorBase
	{
		public override BarColor GetBarColor()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.yellow * 0.6f, Color.yellow * 0.45f);
		}

		public override DamageArmorInfo OnDamage(float damage, Player DamagingPlayer, ArmorDamagePatchType? armorDamagePatchType)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			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 TitaniumArmor : ArmorBase
	{
		public int SegmentsCount = 4;

		public float RegenThresholdPercent = 1.5f;

		private float segmentThresholdHealth;

		private Image segmentThresholdBar;

		public TitaniumArmor()
		{
			base.ArmorTags.Add("CanArmorPierce");
			base.ArmorRegenCooldownSeconds = 5f;
		}

		public override BarColor GetBarColor()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return new BarColor(Color.magenta * 0.6f, Color.magenta * 0.45f);
		}

		public override void OnUpdate()
		{
			TryCreateArmorMinBar();
			float num = base.MaxArmorValue / (float)SegmentsCount;
			while (base.CurrentArmorValue >= segmentThresholdHealth + num * RegenThresholdPercent)
			{
				segmentThresholdHealth += num;
			}
			if ((Object)(object)segmentThresholdBar != (Object)null)
			{
				segmentThresholdBar.fillAmount = segmentThresholdHealth / base.MaxArmorValue;
			}
		}

		public override void OnRespawn()
		{
			segmentThresholdHealth = base.MaxArmorValue - base.MaxArmorValue / (float)SegmentsCount;
		}

		public override DamageArmorInfo OnDamage(float damage, Player DamagingPlayer, ArmorDamagePatchType? armorDamagePatchType)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			DamageArmorInfo val = ((ArmorBase)this).OnDamage(damage, DamagingPlayer, armorDamagePatchType);
			if (Mathf.Max(val.Armor, segmentThresholdHealth) <= segmentThresholdHealth + 0.1f && segmentThresholdHealth > 0f)
			{
				((DamageArmorInfo)(ref val))..ctor(0f, segmentThresholdHealth);
				segmentThresholdHealth = Mathf.Max(segmentThresholdHealth - base.MaxArmorValue / (float)SegmentsCount, 0f);
			}
			return val;
		}

		private void TryCreateArmorMinBar()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)segmentThresholdBar != (Object)null)
			{
				return;
			}
			Dictionary<ArmorBase, GameObject> dictionary = (Dictionary<ArmorBase, GameObject>)ExtensionMethods.GetFieldValue((object)((ArmorBase)this).ArmorHandler, "armorHealthBars");
			if (dictionary == null || !dictionary.ContainsKey((ArmorBase)(object)this))
			{
				return;
			}
			GameObject gameObject = ((Component)dictionary[(ArmorBase)(object)this].transform.Find("Healthbar(Clone)/Canvas/Image")).gameObject;
			if ((Object)(object)gameObject.transform.Find("MinArmorBar") == (Object)null)
			{
				gameObject.AddComponent<Mask>();
				GameObject obj = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Health")).gameObject, gameObject.transform);
				((Object)obj).name = "MinArmorBar";
				obj.transform.SetAsLastSibling();
				Image component = obj.GetComponent<Image>();
				((Graphic)component).color = new Color(0.45f, 0f, 0.45f, 1f);
				component.fillAmount = segmentThresholdHealth / base.MaxArmorValue;
				segmentThresholdBar = component;
				GameObject gameObject2 = ((Component)gameObject.transform.Find("Grid")).gameObject;
				gameObject2.transform.SetAsLastSibling();
				((HorizontalOrVerticalLayoutGroup)gameObject2.GetComponent<HorizontalLayoutGroup>()).spacing = -10f;
				GameObject[] array = (GameObject[])(object)new GameObject[gameObject2.transform.childCount];
				for (int i = 0; i < gameObject2.transform.childCount; i++)
				{
					array[i] = ((Component)gameObject2.transform.GetChild(i)).gameObject;
				}
				int num = 8 - SegmentsCount;
				for (int j = 0; j < num; j++)
				{
					array[j].SetActive(false);
				}
				gameObject2.SetActive(true);
			}
			else
			{
				segmentThresholdBar = ((Component)gameObject.transform.Find("MinArmorBar")).GetComponent<Image>();
				segmentThresholdBar.fillAmount = segmentThresholdHealth / base.MaxArmorValue;
			}
		}
	}
}
namespace AALUND13Cards.Armors.Armors.Processors
{
	public class ArmorDamageReductionProcessor : ArmorProcessor
	{
		public override float BeforeArmorProcess(float remaindingDamage, float originalDamage)
		{
			if (!((ArmorProcessor)this).Armor.HasArmorTag("NoDamageReduction"))
			{
				if (CharacterDataExtensions.GetCustomStatsRegistry(((ArmorProcessor)this).HurtPlayer.data).GetOrCreate<ArmorStats>().ArmorDamageReduction == 0f)
				{
					return remaindingDamage;
				}
				return remaindingDamage * (1f - CharacterDataExtensions.GetCustomStatsRegistry(((ArmorProcessor)this).HurtPlayer.data).GetOrCreate<ArmorStats>().ArmorDamageReduction);
			}
			return remaindingDamage;
		}
	}
	internal class DamageAgainstArmorPercentageProcessor : ArmorProcessor
	{
		public override float AfterArmorProcess(float remaindingDamage, float originalDamage, float takenArmorDamage)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (((ArmorProcessor)this).Armor.HasArmorTag("CanArmorPierce"))
			{
				if ((Object)(object)((ArmorProcessor)this).DamagingPlayer == (Object)null || CharacterDataExtensions.GetCustomStatsRegistry(((ArmorProcessor)this).DamagingPlayer.data).GetOrCreate<ArmorStats>().DamageAgainstArmorPercentage == 1f || takenArmorDamage <= 0f)
				{
					return remaindingDamage;
				}
				DamageArmorInfo val = ((ArmorProcessor)this).Armor.OnDamage(takenArmorDamage * (CharacterDataExtensions.GetCustomStatsRegistry(((ArmorProcessor)this).DamagingPlayer.data).GetOrCreate<ArmorStats>().DamageAgainstArmorPercentage - 1f), ((ArmorProcessor)this).DamagingPlayer, (ArmorDamagePatchType?)((ArmorProcessor)this).ArmorDamagePatchType);
				((ArmorProcessor)this).Armor.CurrentArmorValue = val.Armor;
			}
			return remaindingDamage;
		}
	}
}

plugins/AALUND13_Classes_Cards.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Cards.Armors.Utils;
using AALUND13Cards.Classes.Armors;
using AALUND13Cards.Classes.Cards;
using AALUND13Cards.Classes.MonoBehaviours;
using AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Reaper;
using AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Soulstreak;
using AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Soulstreak.Abilities;
using AALUND13Cards.Classes.UI;
using AALUND13Cards.Classes.Utils;
using AALUND13Cards.Core;
using AALUND13Cards.Core.Cards;
using AALUND13Cards.Core.Cards.Conditions;
using AALUND13Cards.Core.Extensions;
using AALUND13Cards.Core.Handlers;
using AALUND13Cards.Core.MonoBehaviours;
using AALUND13Cards.Core.Utils;
using Assets.Mods._AALUND13_Card.Classes.Scripts.Patches;
using BepInEx;
using HarmonyLib;
using JARL.Armor;
using JARL.Armor.Bases;
using JARL.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using Sonigon;
using SoundImplementation;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Assets.Mods._AALUND13_Card.Classes.Scripts.Patches
{
	internal class ExoArmorProjectileHitPatch
	{
		public static void Patch(Harmony harmony)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(ProjectileHit), "Hit", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ExoArmorProjectileHitPatch), "Prefix", (Type[])null, (Type[])null);
			harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static bool Prefix(ProjectileHit __instance, HitInfo hit, bool forceCall)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			HealthHandler val = null;
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				val = ((Component)hit.transform).GetComponent<HealthHandler>();
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				Player component = ((Component)val).GetComponent<Player>();
				ExoArmor exoArmor = (ExoArmor)(object)ArmorFramework.ArmorHandlers[component].GetArmorByType<ExoArmor>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (((ArmorBase)exoArmor).IsActive && exoArmor.Reflect(GetBulletDamage(((Component)__instance).GetComponent<ProjectileHit>(), component)))
				{
					((Component)__instance).GetComponent<ProjectileHit>().RemoveOwnPlayerFromPlayersHit();
					((Component)__instance).GetComponent<ProjectileHit>().AddPlayerToHeld(val);
					MoveTransform component2 = ((Component)__instance).GetComponent<MoveTransform>();
					component2.velocity *= -1f;
					Transform transform = ((Component)__instance).transform;
					transform.position += ((Component)__instance).GetComponent<MoveTransform>().velocity * TimeHandler.deltaTime;
					((Component)__instance).GetComponent<RayCastTrail>().WasBlocked();
					if (__instance.destroyOnBlock)
					{
						ExtensionMethods.InvokeMethod((object)__instance, "DestroyMe", Array.Empty<object>());
					}
					__instance.sinceReflect = 0f;
					return false;
				}
			}
			return true;
		}

		private static float GetBulletDamage(ProjectileHit projectileHit, Player targetPlayer)
		{
			float damage = projectileHit.damage;
			float percentageDamage = projectileHit.percentageDamage;
			return damage + targetPlayer.data.maxHealth * percentageDamage;
		}
	}
}
namespace AALUND13Cards.Classes
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("AALUND13.Cards.Classes", "AALUND13 Classes Cards", "1.3.0")]
	[BepInProcess("Rounds.exe")]
	internal class AAC_Classes : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <OnGameStart>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				foreach (Player player in PlayerManager.instance.players)
				{
					CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<SoulStreakStats>().Souls = 0u;
				}
				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 ModId = "AALUND13.Cards.Classes";

		internal const string ModName = "AALUND13 Classes Cards";

		internal const string Version = "1.3.0";

		private static AssetBundle assets;

		private static Harmony harmony;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			assets = AssetsUtils.LoadAssetBundle("aac_classes_assets", typeof(AAC_Classes).Assembly);
			if ((Object)(object)assets != (Object)null)
			{
				harmony = new Harmony("AALUND13.Cards.Classes");
				harmony.PatchAll();
			}
		}

		private void Start()
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			if ((Object)(object)assets == (Object)null)
			{
				Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Classes Cards\" assets failled to load, All the cards will be disable in this mod");
				throw new NullReferenceException("Failled to load \"AALUND13 Classes Cards\" assets");
			}
			if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "AALUND13.Cards.Armors"))
			{
				ArmorInterface.RegisterArmors();
				ExoArmorProjectileHitPatch.Patch(harmony);
			}
			CardResgester cardResgester = assets.LoadAsset<GameObject>("ClassesModCards").GetComponent<CardResgester>();
			cardResgester.RegisterCards();
			AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
			{
				AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Classes Cards", "1.3.0", cardResgester);
			});
			DeathHandler.OnPlayerDeath += new DeathHandlerDelegate(OnPlayerDeath);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
		}

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

		private void OnPlayerDeath(Player player, Dictionary<Player, DamageInfo> playerDamageInfos)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			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)CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<SoulStreakStats>().Souls * 0.25f));
					}
				}
			}
			((Component)player).GetComponentInChildren<SoulstreakMono>()?.ResetSouls();
		}
	}
	public class ArmorInterface
	{
		public static void RegisterArmors()
		{
			ArmorFramework.RegisterArmorType<SoulArmor>();
			ArmorTypeGetterUtils.RegiterArmorType<ExoArmor>("Exo-Armor");
		}
	}
	internal class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
			TabInfoManager.RegisterStat(orCreateCategory, "Scaling Percentage Damage", (Func<Player, bool>)((Player p) => GetReaperStatsFromPlayer(p).ScalingPercentageDamage != 0f), (Func<Player, string>)((Player p) => $"{(Mathf.Min(GetReaperStatsFromPlayer(p).ScalingPercentageDamage, Mathf.Min(GetReaperStatsFromPlayer(p).ScalingPercentageDamageCap, 0.8f)) + GetReaperStatsFromPlayer(p).ScalingPercentageDamageUnCap) * 100f:0}%"));
			TabInfoManager.RegisterStat(orCreateCategory, "Effective Percentage Damage", (Func<Player, bool>)((Player p) => GetReaperStatsFromPlayer(p).ScalingPercentageDamage != 0f), (Func<Player, string>)((Player p) => $"{(MathUtils.GetEffectivePercentCap(PlayerExtensions.GetSPS(p), GetReaperStatsFromPlayer(p).ScalingPercentageDamage, GetReaperStatsFromPlayer(p).ScalingPercentageDamageCap) + MathUtils.GetEffectivePercent(PlayerExtensions.GetSPS(p), GetReaperStatsFromPlayer(p).ScalingPercentageDamageUnCap)) * 100f:0}%"));
			TabInfoManager.RegisterStat(orCreateCategory, "Percentage Bleed Damage", (Func<Player, bool>)((Player p) => GetReaperStatsFromPlayer(p).PercentageDamageBleedingPercentage != 0f), (Func<Player, string>)((Player p) => $"{GetReaperStatsFromPlayer(p).PercentageDamageBleedingPercentage * 100f:0}%"));
			StatCategory obj = TabInfoManager.RegisterCategory("Soulstreak Stats", 7);
			TabInfoManager.RegisterStat(obj, "Max Health Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).MaxHealth != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).MaxHealth * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "player Size Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).PlayerSize != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).PlayerSize * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Movement Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).MovementSpeed != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).MovementSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Attack Speed Pre Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).AttackSpeed != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).AttackSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Damage Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).Damage != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).Damage * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Bullet Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).BulletSpeed != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).BulletSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Armor Percentage", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).SoulArmorPercentage != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).SoulArmorPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Armor Percentage Regen Rate", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).SoulArmorPercentageRegenRate != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).SoulArmorPercentageRegenRate * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Drain DPS Factor", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).SoulDrainDPSFactor != 0f), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).SoulDrainDPSFactor * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Souls", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && GetSoulstreakStatsFromPlayer(p).Souls != 0), (Func<Player, string>)((Player p) => $"{GetSoulstreakStatsFromPlayer(p).Souls}"));
			StatCategory obj2 = TabInfoManager.RegisterCategory("Railgun Stats", 8);
			TabInfoManager.RegisterStat(obj2, "Charge", (Func<Player, bool>)((Player p) => GetRailgunStatsFromPlayer(p).IsEnabled && GetRailgunStatsFromPlayer(p).MaximumCharge != 0f), (Func<Player, string>)((Player p) => $"{GetRailgunStatsFromPlayer(p).CurrentCharge:0.00}/{GetRailgunStatsFromPlayer(p).MaximumCharge:0.00}"));
			TabInfoManager.RegisterStat(obj2, "Charge Rate", (Func<Player, bool>)((Player p) => GetRailgunStatsFromPlayer(p).IsEnabled && GetRailgunStatsFromPlayer(p).ChargeRate != 0f), (Func<Player, string>)((Player p) => $"{GetRailgunStatsFromPlayer(p).ChargeRate:0.00}/s"));
			TabInfoManager.RegisterStat(obj2, "Railgun Damage Multiplier", (Func<Player, bool>)((Player p) => GetRailgunStatsFromPlayer(p).IsEnabled && GetRailgunStatsFromPlayer(p).RailgunDamageMultiplier != 1f), (Func<Player, string>)((Player p) => $"{GetRailgunStatsFromPlayer(p).RailgunDamageMultiplier * 100f:0}%"));
			TabInfoManager.RegisterStat(obj2, "Railgun Bullet Speed Multiplier", (Func<Player, bool>)((Player p) => GetRailgunStatsFromPlayer(p).IsEnabled && GetRailgunStatsFromPlayer(p).RailgunBulletSpeedMultiplier != 1f), (Func<Player, string>)((Player p) => $"{GetRailgunStatsFromPlayer(p).RailgunBulletSpeedMultiplier * 100f:0}%"));
			TabInfoManager.RegisterStat(obj2, "Railgun Full Charge Threshold", (Func<Player, bool>)((Player p) => GetRailgunStatsFromPlayer(p).IsEnabled && GetRailgunStatsFromPlayer(p).FullChargeThreshold != 0f), (Func<Player, string>)((Player p) => $"{GetRailgunStatsFromPlayer(p).FullChargeThreshold:0.00}"));
		}

		private static RailgunStats GetRailgunStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<RailgunStats>();
		}

		private static SoulStreakStats GetSoulstreakStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<SoulStreakStats>();
		}

		private static ReaperStats GetReaperStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<ReaperStats>();
		}
	}
}
namespace AALUND13Cards.Classes.Utils
{
	public static class MathUtils
	{
		public const float PERCENT_CAP = 0.8f;

		public const float EXPONENT = 0.75f;

		public static float GetEffectivePercentCap(float sps, float basePercent, float percentCap = 0.8f)
		{
			float num = Mathf.Max(0.0001f, sps);
			float num2 = Mathf.Min(percentCap, 0.8f);
			return Mathf.Min(basePercent * Mathf.Pow(1f / num, 0.75f), num2);
		}

		public static float GetEffectivePercent(float sps, float basePercent)
		{
			float num = Mathf.Max(0.0001f, sps);
			return basePercent * Mathf.Pow(1f / num, 0.75f);
		}
	}
	public class ReflectionUtils
	{
		public static FieldInfo FindNestedField(MethodInfo method, string fieldName)
		{
			if (method == null)
			{
				throw new ArgumentNullException("method");
			}
			Type declaringType = method.DeclaringType;
			if (declaringType == null)
			{
				return null;
			}
			Type[] nestedTypes = declaringType.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
			foreach (Type type in nestedTypes)
			{
				if (type.GetCustomAttribute<CompilerGeneratedAttribute>() != null && type.Name.Contains(method.Name))
				{
					FieldInfo fieldInfo = FindNestedFieldRecursive(type, fieldName);
					if (fieldInfo != null)
					{
						return fieldInfo;
					}
				}
			}
			return null;
		}

		private static FieldInfo FindNestedFieldRecursive(Type type, string fieldName)
		{
			FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				return field;
			}
			Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
			for (int i = 0; i < nestedTypes.Length; i++)
			{
				FieldInfo fieldInfo = FindNestedFieldRecursive(nestedTypes[i], fieldName);
				if (fieldInfo != null)
				{
					return fieldInfo;
				}
			}
			return null;
		}
	}
}
namespace AALUND13Cards.Classes.UI
{
	public class SoulstreakSoulsCounter : MonoBehaviour
	{
		[Header("Souls Text")]
		public TMP_Text SoulstreakSoulsText;

		public bool UseFullText = true;

		[Header("Single Bar")]
		public GameObject SingleBarObject;

		public Image SinglePercentage;

		[Header("Double Bar")]
		public GameObject DoubleBarObject;

		public Image DoubleBarPercentageFirst;

		public Image DoubleBarPercentageSecond;

		[Header("Color")]
		public Color BarNonActiveColor;

		public Color BarActiveColor;

		[Header("Animation")]
		[SerializeField]
		private float fillSmoothTime = 0.15f;

		private float firstCurrentFillVelocity;

		private float firstTargetFillAmount;

		private float secondCurrentFillVelocity;

		private float secondTargetFillAmount;

		[HideInInspector]
		public SoulstreakMono soulstreakMono;

		private void Update()
		{
			if (!((Object)(object)soulstreakMono == (Object)null))
			{
				UpdateSoulsText();
				UpdateArmorUI();
			}
		}

		private void LateUpdate()
		{
			if (!((Object)(object)SingleBarObject == (Object)null) && !((Object)(object)DoubleBarObject == (Object)null))
			{
				SinglePercentage.fillAmount = Mathf.SmoothDamp(SinglePercentage.fillAmount, firstTargetFillAmount, ref firstCurrentFillVelocity, fillSmoothTime);
				DoubleBarPercentageFirst.fillAmount = Mathf.SmoothDamp(DoubleBarPercentageFirst.fillAmount, firstTargetFillAmount, ref firstCurrentFillVelocity, fillSmoothTime);
				DoubleBarPercentageSecond.fillAmount = Mathf.SmoothDamp(DoubleBarPercentageSecond.fillAmount, secondTargetFillAmount, ref secondCurrentFillVelocity, fillSmoothTime);
			}
		}

		private void UpdateSoulsText()
		{
			if (!((Object)(object)SoulstreakSoulsText == (Object)null))
			{
				uint souls = soulstreakMono.SoulstreakStats.Souls;
				if (UseFullText)
				{
					string arg = ((souls == 1) ? "Soul" : "Souls");
					SoulstreakSoulsText.text = $"{arg}: {souls}";
				}
				else
				{
					SoulstreakSoulsText.text = souls.ToString();
				}
			}
		}

		private void UpdateArmorUI()
		{
			if (!((Object)(object)SingleBarObject == (Object)null) && !((Object)(object)DoubleBarObject == (Object)null))
			{
				RenderBars(soulstreakMono.SoulstreakStats.Abilities.ToArray());
			}
		}

		private void RenderBars(ISoulstreakAbility[] soulstreakAbilities)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: 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)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			List<AbilityBarInfo> list = new List<AbilityBarInfo>();
			for (int i = 0; i < soulstreakAbilities.Length; i++)
			{
				AbilityBarInfo barInfo = soulstreakAbilities[i].GetBarInfo();
				if (barInfo.ShowBar)
				{
					list.Add(barInfo);
					num++;
				}
			}
			if (num > 2)
			{
				throw new Exception("More then 2 abilities requested bars, but counter only support TWO bars");
			}
			switch (num)
			{
			case 1:
				SingleBarObject.SetActive(true);
				DoubleBarObject.SetActive(false);
				((Graphic)SinglePercentage).color = (list[0].IsActive ? BarActiveColor : BarNonActiveColor);
				firstTargetFillAmount = 0.5f + Mathf.Clamp01(list[0].CurrentValue / list[0].MaxValue * 0.5f);
				break;
			case 2:
				SingleBarObject.SetActive(false);
				DoubleBarObject.SetActive(true);
				((Graphic)DoubleBarPercentageFirst).color = (list[0].IsActive ? BarActiveColor : BarNonActiveColor);
				firstTargetFillAmount = 0.5f + Mathf.Clamp01(list[0].CurrentValue / list[0].MaxValue * 0.25f);
				((Graphic)DoubleBarPercentageSecond).color = (list[1].IsActive ? BarActiveColor : BarNonActiveColor);
				secondTargetFillAmount = 0.5f + Mathf.Clamp01(list[1].CurrentValue / list[1].MaxValue * 0.25f);
				break;
			default:
				SingleBarObject.SetActive(true);
				DoubleBarObject.SetActive(false);
				((Graphic)SinglePercentage).color = BarNonActiveColor;
				SinglePercentage.fillAmount = 0.5f;
				break;
			}
		}
	}
	public class UILoopingMover : MonoBehaviour
	{
		[Header("UI Elements")]
		[SerializeField]
		private List<RectTransform> uiElements;

		[Header("Movement")]
		[SerializeField]
		private RectTransform moveTarget;

		[SerializeField]
		private float moveSpeed = 200f;

		[SerializeField]
		private float reachThreshold = 5f;

		[Header("Teleport")]
		[SerializeField]
		private RectTransform teleportTarget;

		[SerializeField]
		private Vector2 teleportOffsetMin;

		[SerializeField]
		private Vector2 teleportOffsetMax;

		private void Update()
		{
			foreach (RectTransform uiElement in uiElements)
			{
				MoveElement(uiElement);
			}
		}

		private void MoveElement(RectTransform element)
		{
			//IL_0002: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			element.anchoredPosition = Vector2.MoveTowards(element.anchoredPosition, moveTarget.anchoredPosition, moveSpeed * Time.deltaTime);
			if (Vector2.Distance(element.anchoredPosition, moveTarget.anchoredPosition) <= reachThreshold)
			{
				TeleportElement(element);
			}
		}

		private void TeleportElement(RectTransform element)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(Random.Range(teleportOffsetMin.x, teleportOffsetMax.x), Random.Range(teleportOffsetMin.y, teleportOffsetMax.y));
			element.anchoredPosition = teleportTarget.anchoredPosition + val;
		}

		private void OnDrawGizmos()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)teleportTarget == (Object)null))
			{
				Gizmos.color = Color.cyan;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(teleportOffsetMin.x, teleportOffsetMin.y, 0f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(teleportOffsetMax.x, teleportOffsetMax.y, 0f);
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(teleportOffsetMin.x, teleportOffsetMax.y, 0f);
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(teleportOffsetMax.x, teleportOffsetMin.y, 0f);
				Vector3 val5 = ((Transform)teleportTarget).TransformPoint(val);
				Vector3 val6 = ((Transform)teleportTarget).TransformPoint(val3);
				Vector3 val7 = ((Transform)teleportTarget).TransformPoint(val2);
				Vector3 val8 = ((Transform)teleportTarget).TransformPoint(val4);
				Gizmos.DrawLine(val5, val6);
				Gizmos.DrawLine(val6, val7);
				Gizmos.DrawLine(val7, val8);
				Gizmos.DrawLine(val8, val5);
			}
		}
	}
}
namespace AALUND13Cards.Classes.Patches
{
	[HarmonyPatch(typeof(DamageOverTime))]
	public class DamageOverTimePatch
	{
		[HarmonyPatch("TakeDamageOverTime")]
		[HarmonyPrefix]
		public static void TakeDamageOverTimePrefix(DamageOverTime __instance, Vector2 damage, Vector2 position, float time, float interval, Color color, SoundEvent soundDamageOverTime, GameObject damagingWeapon, Player damagingPlayer, bool lethal)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (CharacterDataExtensions.GetCustomStatsRegistry((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).GetOrCreate<ClassesStats>().Invulnerable)
			{
				damage = Vector2.zero;
			}
		}
	}
	[HarmonyPatch(typeof(DeathEffect))]
	public class DeathEffectPatch
	{
		[HarmonyPatch("PlayDeath")]
		[HarmonyPostfix]
		public static void PlayDeathPostfix(DeathEffect __instance, int playerIDToRevive)
		{
			ICustomDeathEffect[] components = ((Component)__instance).GetComponents<ICustomDeathEffect>();
			for (int i = 0; i < components.Length; i++)
			{
				components[i].OnDeath(__instance, PlayerManager.instance.players.First((Player p) => p.playerID == playerIDToRevive));
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> RespawnPlayerTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			LoggerUtils.LogInfo("Begin patching the \"RespawnPlayer\" method in the \"DeathEffect\" class", false);
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo method = AccessTools.Method(typeof(DeathEffect), "RespawnPlayer", (Type[])null, (Type[])null);
			MethodInfo methodInfo = AccessTools.Method(typeof(DeathEffectPatch), "OnRespawn", (Type[])null, (Type[])null);
			FieldInfo fieldInfo = ReflectionUtils.FindNestedField(method, "playerIDToRevive");
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_I4_0 && list[i + 1].opcode == OpCodes.Ret && list[i - 1].opcode == OpCodes.Callvirt)
				{
					CodeInstruction[] array = (CodeInstruction[])(object)new CodeInstruction[4]
					{
						new CodeInstruction(OpCodes.Ldloc_1, (object)null),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
						new CodeInstruction(OpCodes.Callvirt, (object)methodInfo)
					};
					list.InsertRange(i, array);
					LoggerUtils.LogInfo("Patched the \"RespawnPlayer\" method to trigger the our \"OnRespawn\" method", false);
					i += array.Length;
				}
			}
			return list;
		}

		private static void OnRespawn(DeathEffect __instance, int playerIDToRevive)
		{
			ICustomDeathRespawnEffect[] components = ((Component)__instance).GetComponents<ICustomDeathRespawnEffect>();
			for (int i = 0; i < components.Length; i++)
			{
				components[i].OnRespawn(__instance, PlayerManager.instance.players.First((Player p) => p.playerID == playerIDToRevive));
			}
		}
	}
	[HarmonyPatch(typeof(Gun))]
	public class GunPatch
	{
		[HarmonyPatch("ApplyProjectileStats")]
		[HarmonyPrefix]
		public static void ApplyRailgunStats(Gun __instance, GameObject obj)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			RailgunStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<RailgunStats>();
			if (orCreate.IsEnabled)
			{
				ProjectileHit component = obj.GetComponent<ProjectileHit>();
				MoveTransform component2 = obj.GetComponent<MoveTransform>();
				RailgunStats.RailgunChargeStats chargeStats = orCreate.GetChargeStats(orCreate.CurrentCharge);
				component2.localForce *= chargeStats.ChargeBulletSpeedMultiplier;
				component.damage *= chargeStats.ChargeDamageMultiplier;
			}
		}

		[HarmonyPatch("DoAttack")]
		[HarmonyPostfix]
		public static void UseRailgunCharge(Gun __instance)
		{
			RailgunStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<RailgunStats>();
			if (orCreate.IsEnabled && orCreate.CurrentCharge > 0f)
			{
				orCreate.UseCharge(orCreate);
			}
		}

		[HarmonyPatch("ApplyProjectileStats")]
		[HarmonyPostfix]
		public static void ApplyReaperStats(Gun __instance, GameObject obj)
		{
			ProjectileHit component = obj.GetComponent<ProjectileHit>();
			component.percentageDamage += MathUtils.GetEffectivePercentCap(PlayerExtensions.GetSPS(__instance.player), CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<ReaperStats>().ScalingPercentageDamage, CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<ReaperStats>().ScalingPercentageDamageCap);
			component.percentageDamage += MathUtils.GetEffectivePercent(PlayerExtensions.GetSPS(__instance.player), CharacterDataExtensions.GetCustomStatsRegistry(__instance.player.data).GetOrCreate<ReaperStats>().ScalingPercentageDamageUnCap);
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	public class HealthHandlerPatch
	{
		[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, ref Vector2 damage)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//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)
			if (CharacterDataExtensions.GetCustomStatsRegistry((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).GetOrCreate<ClassesStats>().Invulnerable)
			{
				damage = Vector2.zero;
			}
		}

		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamage(HealthHandler __instance, ref Vector2 damage)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			if (CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<ClassesStats>().DamageResistance > 0f)
			{
				damage *= Mathf.Clamp01(1f - CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<ClassesStats>().DamageResistance);
			}
			if (CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<ClassesStats>().Invulnerable)
			{
				damage = Vector2.zero;
			}
		}
	}
	[HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")]
	internal class ProjectileHitPatch
	{
		private static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, int viewID = -1, int colliderID = -1, bool wasBlocked = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			HitInfo val = new HitInfo();
			val.point = hitPoint;
			val.normal = hitNormal;
			val.collider = null;
			if (viewID != -1)
			{
				PhotonView photonView = PhotonNetwork.GetPhotonView(viewID);
				val.collider = ((Component)photonView).GetComponentInChildren<Collider2D>();
				val.transform = ((Component)photonView).transform;
			}
			else if (colliderID != -1)
			{
				val.collider = ((Component)MapManager.instance.currentMap.Map).GetComponentsInChildren<Collider2D>()[colliderID];
				val.transform = ((Component)val.collider).transform;
			}
			HealthHandler val2 = null;
			if (Object.op_Implicit((Object)(object)val.transform))
			{
				val2 = ((Component)val.transform).GetComponent<HealthHandler>();
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				Player component = ((Component)val2).GetComponent<Player>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if (CharacterDataExtensions.GetCustomStatsRegistry(__instance.ownPlayer.data).GetOrCreate<ReaperStats>().PercentageDamageBleedingPercentage > 0f)
				{
					float bulletDamage = GetBulletDamage(__instance, component);
					component.data.healthHandler.TakeDamageOverTime(Vector2.op_Implicit(((Component)__instance).transform.forward * bulletDamage * CharacterDataExtensions.GetCustomStatsRegistry(__instance.ownPlayer.data).GetOrCreate<ReaperStats>().PercentageDamageBleedingPercentage), hitPoint, 5f, 1f, Color.red * 0.8f, __instance.ownWeapon, __instance.ownPlayer, true);
				}
			}
			return true;
		}

		private static float GetBulletDamage(ProjectileHit projectileHit, Player targetPlayer)
		{
			float damage = projectileHit.damage;
			float percentageDamage = projectileHit.percentageDamage;
			return damage + targetPlayer.data.maxHealth * percentageDamage;
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours
{
	public interface ICustomDeathEffect
	{
		void OnDeath(DeathEffect effect, Player player);
	}
	public interface ICustomDeathRespawnEffect
	{
		void OnRespawn(DeathEffect effect, Player player);
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.ProjectilesEffects
{
	public class RayHitPercentDamageOverTime : RayHitEffect
	{
		[Header("Sounds")]
		public SoundEvent soundEventDamageOverTime;

		[Header("Settings")]
		public float PrecntageDamage = 0.15f;

		public Color Color = new Color(0.8867924f, 0.598302f, 0f);

		[Header("Damage Over Time")]
		public float Time = 5f;

		public float Interval = 0.5f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
				if (!((Object)(object)component == (Object)null) && !component.dead)
				{
					float effectivePercentCap = MathUtils.GetEffectivePercentCap(PlayerExtensions.GetSPS(((Component)this).GetComponentInParent<ProjectileHit>().ownPlayer), PrecntageDamage);
					float num = component.maxHealth * effectivePercentCap;
					((Component)hit.transform).GetComponent<DamageOverTime>().TakeDamageOverTime(Vector2.op_Implicit(num * ((Component)this).transform.forward), Vector2.op_Implicit(((Component)this).transform.position), Time, Interval, Color, soundEventDamageOverTime, ((Component)this).GetComponentInParent<ProjectileHit>().ownWeapon, ((Component)this).GetComponentInParent<ProjectileHit>().ownPlayer, true);
					return (HasToReturn)1;
				}
				return (HasToReturn)1;
			}
			return (HasToReturn)1;
		}
	}
	public class RayHitWithering : RayHitEffect
	{
		public float PercentageDamagePerSecond = 0.005f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
				if (!((Object)(object)component == (Object)null) && !component.dead)
				{
					float effectivePercentCap = MathUtils.GetEffectivePercentCap(PlayerExtensions.GetSPS(((Component)this).GetComponentInParent<ProjectileHit>().ownPlayer), PercentageDamagePerSecond);
					ConstantDamageHandler.Instance.AddConstantPrecentageDamage(component.player, ((Component)this).GetComponentInParent<ProjectileHit>().ownPlayer, Color.black, effectivePercentCap);
					return (HasToReturn)1;
				}
				return (HasToReturn)1;
			}
			return (HasToReturn)1;
		}
	}
	public class SetProjectileDamage : MonoBehaviour
	{
		public float damage;

		private void Start()
		{
			((Component)this).GetComponentInParent<ProjectileHit>().damage = damage;
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.DeathEffects
{
	public class GrimFateDeathRespawnEffect : MonoBehaviour, ICustomDeathRespawnEffect
	{
		public PercentDamageExplosion PercentDamageExplosion;

		public GameObject ActivateObjectWhenRespawn;

		public void OnRespawn(DeathEffect effect, Player player)
		{
			if (player.data.view.IsMine)
			{
				PercentDamageExplosion.Trigger(player);
			}
			ActivateObjectWhenRespawn.SetActive(true);
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.CardsEffects
{
	public class CooldownTrigger : MonoBehaviour
	{
		public UnityEvent Trigger;

		public float Cooldown = 5f;

		private float lastTriggerTime;

		public void TriggerCooldown()
		{
			if (Time.time > lastTriggerTime + Cooldown)
			{
				lastTriggerTime = Time.time;
				UnityEvent trigger = Trigger;
				if (trigger != null)
				{
					trigger.Invoke();
				}
			}
		}
	}
	public class RailgunMono : MonoBehaviour
	{
		[HideInInspector]
		public RailgunStats RailgunStats;

		private CustomHealthBar RailgunChargeBar;

		private Player player;

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			RailgunStats = CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<RailgunStats>();
			RailgunStats.IsEnabled = true;
			RailgunChargeBar = CreateChargeBar();
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		public void OnDestroy()
		{
			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_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0012: 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)
			GameObject val = new GameObject("Railgun Charge Bar");
			CustomHealthBar obj = val.AddComponent<CustomHealthBar>();
			obj.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 obj;
		}
	}
	public class RailgunOvercharge : MonoBehaviour
	{
		[SerializeField]
		private SoundEvent soundEmpowerSpawn;

		private CharacterData data;

		private ParticleSystem[] parts;

		private Transform particleTransform;

		private RailgunMono railgun;

		private bool isOn;

		private void Start()
		{
			parts = ((Component)this).GetComponentsInChildren<ParticleSystem>();
			particleTransform = ((Component)this).transform.GetChild(0);
			railgun = ((Component)((Component)this).transform.parent).GetComponentInChildren<RailgunMono>();
			data = ((Component)this).GetComponentInParent<CharacterData>();
			Block block = data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(Block));
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(ResetOvercharge));
			soundEmpowerSpawn.variables.audioMixerGroup = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX")[0];
		}

		private void OnDestroy()
		{
			Block block = data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(Block));
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(ResetOvercharge));
			railgun.RailgunStats.AllowOvercharge = false;
		}

		public void Block(BlockTriggerType trigger)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			if ((int)trigger != 3 && (int)trigger != 4 && (int)trigger != 2)
			{
				railgun.RailgunStats.AllowOvercharge = true;
			}
		}

		private void ResetOvercharge()
		{
			railgun.RailgunStats.AllowOvercharge = false;
		}

		private void Update()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] array = parts;
			foreach (ParticleSystem val in array)
			{
				if (railgun.RailgunStats.AllowOvercharge)
				{
					((Component)particleTransform).transform.position = ((Component)data.weaponHandler.gun).transform.position;
					((Component)particleTransform).transform.rotation = ((Component)data.weaponHandler.gun).transform.rotation;
					if (!isOn)
					{
						SoundManager.Instance.PlayAtPosition(soundEmpowerSpawn, SoundManager.Instance.GetTransform(), ((Component)this).transform);
						val.Play();
						isOn = true;
					}
				}
				else if (!railgun.RailgunStats.AllowOvercharge && isOn)
				{
					val.Stop();
					isOn = false;
				}
			}
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Soulstreak
{
	public class DreadfulBurstEffect : MonoBehaviour, ISoulstreakAbility
	{
		private float storedDamage;

		private int ticks;

		private Player player;

		private DamageSpawnObjects damageSpawnObjects;

		private const int MINIMUM_DRAIN_TICKS = 20;

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			damageSpawnObjects = ((Component)this).GetComponent<DamageSpawnObjects>();
			DamageEventHandler.Instance.RegisterDamageEvent((object)this, player);
			CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<SoulStreakStats>().AddAbilityRaw(this);
			SoulstreakDrain soulstreakDrain = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<SoulStreakStats>().GetAbility<SoulDrainAbility>()
				.soulstreakDrain;
			soulstreakDrain.OnPlayerDamage = (Action<Player, float>)Delegate.Combine(soulstreakDrain.OnPlayerDamage, new Action<Player, float>(OnSoulDrainTick));
		}

		public void OnSoulDrainTick(Player target, float damage)
		{
			if (!(CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<SoulStreakStats>().DamageStorage <= (float)ticks))
			{
				storedDamage += damage;
				ticks++;
			}
		}

		public void OnBlock()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (20 <= ticks)
			{
				damageSpawnObjects.SpawnDamage(Vector2.up * storedDamage);
				storedDamage = 0f;
				ticks = 0;
			}
		}

		public AbilityBarInfo GetBarInfo()
		{
			return new AbilityBarInfo(showBar: true, 20 <= ticks, ticks, CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<SoulStreakStats>().DamageStorage);
		}

		public void OnUpdate()
		{
		}

		public void OnSoulsAdded(uint addedSouls)
		{
		}

		public void OnSoulsReset(uint remainingSouls)
		{
		}

		public void OnRevive()
		{
		}

		public void OnRemove()
		{
		}
	}
	public class SoulDrainAbility : SoulstreakAbility<SoulDrainAbility>
	{
		public SoulstreakDrain soulstreakDrain;

		public SoulDrainAbility(SoulstreakDrain soulstreakDrain)
		{
			this.soulstreakDrain = soulstreakDrain;
		}
	}
	public class SoulstreakDrain : MonoBehaviour
	{
		public const string SOUL_DRAIN_DAMAGE_TRIGGER_KEY = "Soul_Drain_Damage_Trigger";

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

		[Header("Effects")]
		public GameObject soulDrainEffect;

		public UnityEvent DamagePlayerTrigger;

		[Header("Settings")]
		public float Range = 5f;

		public float Cooldown = 0.5f;

		public Action<Player, float> OnPlayerDamage;

		private SoulStreakStats soulstreakStats;

		private ChildRPC childRPC;

		private Player player;

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

		private readonly Dictionary<Player, GameObject> playerEffects = new Dictionary<Player, GameObject>();

		private readonly Queue<GameObject> unusedEffects = new Queue<GameObject>();

		private void Awake()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			soulstreakStats = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<SoulStreakStats>();
			childRPC.childRPCsInt.Add("Soul_Drain_Damage_Trigger", TriggerDamageForPlayer);
			soulstreakStats.AddAbility(new SoulDrainAbility(this));
		}

		private void OnDestroy()
		{
			childRPC.childRPCsInt.Remove("Soul_Drain_Damage_Trigger");
		}

		private void Start()
		{
			AudioMixerGroup[] array = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX");
			if (array.Length != 0)
			{
				SoundDamage.variables.audioMixerGroup = array[0];
			}
			soulDrainEffect.SetActive(true);
			unusedEffects.Enqueue(soulDrainEffect);
		}

		private void Update()
		{
			List<Player> enemiesInRange = GetEnemiesInRange();
			List<Player> list = playerEffects.Keys.ToList();
			foreach (Player item in enemiesInRange)
			{
				if ((!timeSinceHits.TryGetValue(item, out var value) || Time.time > value + Cooldown) && player.data.view.IsMine)
				{
					childRPC.CallFunction("Soul_Drain_Damage_Trigger", item.playerID);
					timeSinceHits[item] = Time.time;
				}
				list.Remove(item);
				ShowEffectForPlayer(item);
			}
			foreach (Player item2 in list)
			{
				HideEffectForPlayer(item2);
			}
		}

		private GameObject GetEffectForPlayer(Player target)
		{
			if (playerEffects.TryGetValue(target, out var value))
			{
				return value;
			}
			value = ((unusedEffects.Count <= 0) ? Object.Instantiate<GameObject>(soulDrainEffect, ((Component)this).transform) : unusedEffects.Dequeue());
			value.GetComponentInChildren<ParticleSystem>().Play();
			playerEffects[target] = value;
			return value;
		}

		private void ShowEffectForPlayer(Player target)
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			GameObject effectForPlayer = GetEffectForPlayer(target);
			effectForPlayer.transform.position = ((Component)target).transform.position + new Vector3(0f, 0f, 6f);
			Vector3 val = ((Component)target).transform.position - ((Component)player).transform.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			if (normalized != Vector3.zero)
			{
				effectForPlayer.transform.rotation = Quaternion.LookRotation(normalized);
			}
		}

		private void HideEffectForPlayer(Player target)
		{
			if (playerEffects.TryGetValue(target, out var value))
			{
				value.GetComponentInChildren<ParticleSystem>().Stop();
				unusedEffects.Enqueue(value);
				playerEffects.Remove(target);
			}
		}

		public void TriggerDamageForPlayer(int playerID)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (soulstreakStats != null)
			{
				Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, playerID);
				float num = GetDamage(playerWithID) + GetPercentageDamage(playerWithID);
				float num2 = Mathf.Min(num, playerWithID.data.health);
				Vector3 val = ((Component)playerWithID).transform.position - ((Component)this).transform.position;
				Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref val)).normalized);
				float num3 = Mathf.Max(0f, num2 * soulstreakStats.SoulDrainLifestealMultiply);
				((Damagable)playerWithID.data.healthHandler).TakeDamage(val2 * num, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, player, true, true);
				player.data.healthHandler.Heal(num3);
				SoundManager.Instance.Play(SoundDamage, ((Component)playerWithID).transform);
				OnPlayerDamage?.Invoke(playerWithID, num);
			}
		}

		private float GetDamage(Player target)
		{
			return PlayerExtensions.GetDPS(player) * soulstreakStats.SoulDrainDPSFactor * Cooldown;
		}

		private float GetPercentageDamage(Player target)
		{
			float num = soulstreakStats.SoulDrainPercentageDPSFactor * Cooldown;
			return target.data.maxHealth * num;
		}

		private List<Player> GetEnemiesInRange()
		{
			//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)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = new List<Player>();
			if (!GameManager.instance.battleOngoing)
			{
				return list;
			}
			foreach (Player player in PlayerManager.instance.players)
			{
				if (player.teamID != this.player.teamID && player.data.isPlaying && !player.data.dead && PlayerManager.instance.CanSeePlayer(Vector2.op_Implicit(((Component)this.player).transform.position), player).canSee && !(Vector2.Distance(Vector2.op_Implicit(((Component)this.player).transform.position), Vector2.op_Implicit(((Component)player).transform.position)) >= Range * ((Component)this).transform.root.localScale.x))
				{
					list.Add(player);
				}
			}
			return list;
		}
	}
	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 orCreate = CharacterDataExtensions.GetCustomStatsRegistry(base.data).GetOrCreate<SoulStreakStats>();
			uint souls = orCreate.Souls;
			((ReversibleEffect)this).ClearModifiers(true);
			base.characterDataModifier.maxHealth_mult = 1f + (orCreate.MaxHealth - 1f) * (float)souls;
			base.characterStatModifiersModifier.sizeMultiplier_mult = 1f + (orCreate.PlayerSize - 1f) * (float)souls;
			base.characterStatModifiersModifier.movementSpeed_mult = 1f + (orCreate.MovementSpeed - 1f) * (float)souls;
			base.gunStatModifier.attackSpeed_mult = 1f + (orCreate.AttackSpeed - 1f) * (float)souls;
			base.gunStatModifier.damage_mult = 1f + (orCreate.Damage - 1f) * (float)souls;
			base.gunStatModifier.projectileSpeed_mult = 1f + (orCreate.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);
		}
	}
	public class SoulstreakMono : MonoBehaviour, IBattleStartHookHandler
	{
		public GameObject SoulsCounter;

		public GameObject SoulsCounterGUI;

		public SoulStreakStats SoulstreakStats;

		private CharacterData data;

		public CharacterData Data => data;

		public void BlockAbility()
		{
			foreach (ISoulstreakAbility ability in SoulstreakStats.Abilities)
			{
				ability.OnBlock();
			}
		}

		public void ResetSouls(float precentage = 0.5f)
		{
			if (!GameManager.instance.battleOngoing)
			{
				return;
			}
			LoggerUtils.LogInfo($"Resetting kill streak of player with ID {data.player.playerID}", false);
			if ((Object)(object)((Component)data).gameObject.GetComponent<SoulstreakEffect>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)data).gameObject.GetComponent<SoulstreakEffect>());
			}
			uint souls = (uint)Mathf.RoundToInt((float)SoulstreakStats.Souls / 2f);
			foreach (ISoulstreakAbility ability in SoulstreakStats.Abilities)
			{
				ability.OnSoulsReset(SoulstreakStats.Souls);
			}
			SoulstreakStats.Souls = souls;
		}

		public void AddSouls(uint kills = 1u)
		{
			if (!GameManager.instance.battleOngoing)
			{
				return;
			}
			LoggerUtils.LogInfo($"Adding {kills} kills for player with ID {data.player.playerID}", false);
			SoulstreakStats.Souls += kills;
			ExtensionMethods.GetOrAddComponent<SoulstreakEffect>(((Component)data).gameObject, false).ApplyStats();
			foreach (ISoulstreakAbility ability in SoulstreakStats.Abilities)
			{
				ability.OnSoulsAdded(kills);
			}
		}

		public void OnBattleStart()
		{
			ExtensionMethods.GetOrAddComponent<SoulstreakEffect>(((Component)data).gameObject, false).ApplyStats();
		}

		private void OnRevive()
		{
			foreach (ISoulstreakAbility ability in SoulstreakStats.Abilities)
			{
				ability.OnRevive();
			}
		}

		private void Start()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			data = ((Component)this).GetComponentInParent<Player>().data;
			SoulstreakStats = CharacterDataExtensions.GetAdditionalData(data).CustomStatsRegistry.GetOrCreate<SoulStreakStats>();
			SoulsCounter = Object.Instantiate<GameObject>(SoulsCounter);
			SoulsCounter.GetComponent<SoulstreakSoulsCounter>().soulstreakMono = this;
			if (data.view.IsMine && !((Behaviour)((Component)data).GetComponent<PlayerAPI>()).enabled)
			{
				SoulsCounterGUI = Object.Instantiate<GameObject>(SoulsCounterGUI);
				SoulsCounterGUI.transform.SetParent(((Component)data).transform.parent);
				SoulsCounterGUI.GetComponent<SoulstreakSoulsCounter>().soulstreakMono = this;
			}
			data.SetWobbleObjectChild(SoulsCounter.transform);
			SoulsCounter.transform.localPosition = Vector2.op_Implicit(new Vector2(0f, 0.3f));
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		private void OnDestroy()
		{
			if (data.view.IsMine && !((Behaviour)((Component)data).GetComponent<PlayerAPI>()).enabled)
			{
				Object.Destroy((Object)(object)SoulsCounterGUI);
			}
			Object.Destroy((Object)(object)SoulsCounter);
			if ((Object)(object)((Component)data).gameObject.GetComponent<SoulstreakEffect>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)data).gameObject.GetComponent<SoulstreakEffect>());
			}
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
		}

		private void Update()
		{
			if (!data.isPlaying)
			{
				return;
			}
			foreach (ISoulstreakAbility ability in SoulstreakStats.Abilities)
			{
				ability.OnUpdate();
			}
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Soulstreak.Abilities
{
	public class ArmorAbility : SoulstreakAbility<ArmorAbility>
	{
		public float AbilityCooldownTime;

		private bool abilityActive;

		private ArmorHandler armorHandler;

		private Player player;

		public float AbilityCooldown { get; private set; }

		public ArmorAbility(Player player, float abilityCooldownTime)
		{
			AbilityCooldownTime = abilityCooldownTime;
			AbilityCooldown = 0f;
			abilityActive = false;
			armorHandler = ArmorFramework.ArmorHandlers[player];
			this.player = player;
		}

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

		public override void OnRevive()
		{
			abilityActive = false;
			AbilityCooldown = 0f;
			ArmorBase armorByType = armorHandler.GetArmorByType<SoulArmor>();
			armorByType.MaxArmorValue = 0f;
			armorByType.CurrentArmorValue = 0f;
		}

		public override void OnUpdate()
		{
			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;
			}
		}

		public override AbilityBarInfo GetBarInfo()
		{
			SoulArmor soulArmor = (SoulArmor)(object)armorHandler.GetArmorByType<SoulArmor>();
			float currentValue = 0f;
			if (!((ArmorBase)soulArmor).IsActive && ((ArmorBase)soulArmor).MaxArmorValue <= 0f && AbilityCooldownTime > 0f)
			{
				currentValue = Mathf.Clamp01((AbilityCooldownTime - AbilityCooldown) / AbilityCooldownTime);
			}
			else if (((ArmorBase)soulArmor).IsActive && ((ArmorBase)soulArmor).MaxArmorValue > 0f && ((ArmorBase)soulArmor).MaxArmorValue > 0f)
			{
				currentValue = Mathf.Clamp01(((ArmorBase)soulArmor).CurrentArmorValue / ((ArmorBase)soulArmor).MaxArmorValue);
			}
			return new AbilityBarInfo(showBar: true, ((ArmorBase)soulArmor).IsActive, currentValue, 1f);
		}
	}
	public struct AbilityBarInfo
	{
		public bool ShowBar;

		public bool IsActive;

		public float CurrentValue;

		public float MaxValue;

		public AbilityBarInfo(bool showBar, bool isActive, float currentValue, float maxValue)
		{
			ShowBar = showBar;
			IsActive = isActive;
			CurrentValue = currentValue;
			MaxValue = maxValue;
		}
	}
	public interface ISoulstreakAbility
	{
		void OnBlock();

		void OnRevive();

		void OnUpdate();

		void OnSoulsAdded(uint addedSouls);

		void OnSoulsReset(uint remainingSouls);

		void OnRemove();

		AbilityBarInfo GetBarInfo();
	}
	public class SoulstealerResistanceAbiilty : SoulstreakAbility<SoulstealerResistanceAbiilty>
	{
		private Player player;

		private float addedDamageResistance;

		public SoulstealerResistanceAbiilty(Player player)
		{
			this.player = player;
		}

		public override void OnSoulsAdded(uint addedSouls)
		{
			float damageResistance = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().DamageResistance;
			float num = base.SoulstreakStats.DamageResistancePerKill * (float)addedSouls;
			float num2 = Mathf.Min(damageResistance + num, 0.75f);
			float num3 = num2 - damageResistance;
			addedDamageResistance += num3;
			CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().DamageResistance = num2;
		}

		public override void OnSoulsReset(uint remainingSouls)
		{
			CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().DamageResistance -= addedDamageResistance;
			addedDamageResistance = 0f;
			OnSoulsAdded(remainingSouls);
		}
	}
	public abstract class SoulstreakAbility<TAbility> : ISoulstreakAbility where TAbility : SoulstreakAbility<TAbility>
	{
		public SoulStreakStats SoulstreakStats { get; internal set; }

		public virtual void OnBlock()
		{
		}

		public virtual void OnRevive()
		{
		}

		public virtual void OnUpdate()
		{
		}

		public virtual void OnSoulsAdded(uint addedSouls)
		{
		}

		public virtual void OnSoulsReset(uint removedSouls)
		{
		}

		public virtual void OnRemove()
		{
		}

		public virtual AbilityBarInfo GetBarInfo()
		{
			return new AbilityBarInfo(showBar: false, isActive: false, 0f, 0f);
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.CardsEffects.Reaper
{
	public class BloodlustBehaviour : MonoBehaviour, IOnDoDamageEvent
	{
		public const float DEFAULT_MAX_BLOOD = 100f;

		private CharacterData data;

		private CustomHealthBar bloodBar;

		private float decayingPrecentageDamage;

		private float appliedScaling;

		public ReaperStats ReaperStats => CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<ReaperStats>();

		public BloodlustStats BloodlustStats => CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<BloodlustStats>();

		public void OnDamage(DamageInfo damage)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)data.player != (Object)(object)damage.DamagingPlayer) && !BloodlustStats.DisableDamageGain)
			{
				float num = Mathf.Min(((Vector2)(ref damage.Damage)).magnitude, damage.HurtPlayer.data.maxHealth) / damage.HurtPlayer.data.maxHealth;
				float num2 = 100f * num * BloodlustStats.BloodFillPerDamage;
				float num3 = num * BloodlustStats.DamageMultiplierFromDamage;
				decayingPrecentageDamage += num3;
				ReaperStats.ScalingPercentageDamageUnCap += num3;
				appliedScaling += num3;
				if (BloodlustStats.Blood < 0f)
				{
					BloodlustStats.Blood = 0f;
				}
				BloodlustStats.Blood = Mathf.Min(BloodlustStats.MaxBlood, BloodlustStats.Blood + num2);
				LoggerUtils.LogInfo($"Gained {num2} blood from damage, now at {BloodlustStats.Blood}/{BloodlustStats.MaxBlood}", false);
			}
		}

		private void OnRevive()
		{
			BloodlustStats.Blood = BloodlustStats.StartingBlood;
			ReaperStats.ScalingPercentageDamageUnCap -= appliedScaling;
			appliedScaling = 0f;
			decayingPrecentageDamage = 0f;
			LoggerUtils.LogInfo($"Reset \"blood\" value to {BloodlustStats.Blood}, and \"decayingPrecentageDamage\" to {decayingPrecentageDamage}", false);
		}

		private CustomHealthBar CreateStoredDamageBar()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Blood Bar");
			CustomHealthBar obj = val.AddComponent<CustomHealthBar>();
			obj.SetColor(new Color(0.66156864f, 0.043137256f, 0.043137256f, 1f) * 0.8f);
			ExtensionMethods.AddStatusIndicator(data.player, val, 0f, true);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Healthbar(Clone)/Canvas/Image/White")).gameObject);
			LoggerUtils.LogInfo("Created a blood bar", false);
			return obj;
		}

		private float DecayValue(float value)
		{
			return Mathf.Max(0f, value / (1f + 2f * value * Time.deltaTime));
		}

		private void UpdateBloodState()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (BloodlustStats.Blood <= 0f)
			{
				float num = data.maxHealth * ((0f - BloodlustStats.Blood) * BloodlustStats.DamageFromNoBlood);
				data.healthHandler.DoDamage(Vector2.down * num * Time.deltaTime, Vector2.zero, Color.red * 0.6f, (GameObject)null, (Player)null, false, true, true);
			}
			else if (BloodlustStats.Blood > 0f && data.health < data.maxHealth)
			{
				float num2 = data.maxHealth * BloodlustStats.BloodHealthRegenRate;
				data.healthHandler.Heal(num2 * Time.deltaTime);
			}
		}

		private void Update()
		{
			if ((bool)ExtensionMethods.GetFieldValue((object)data.playerVel, "simulated"))
			{
				float num = decayingPrecentageDamage;
				decayingPrecentageDamage = DecayValue(decayingPrecentageDamage);
				float num2 = decayingPrecentageDamage - num;
				ReaperStats.ScalingPercentageDamageUnCap += num2;
				appliedScaling += num2;
				if (data.health < data.maxHealth)
				{
					BloodlustStats.ToggleBloodDrain("Regen", toggle: true);
				}
				else
				{
					BloodlustStats.ToggleBloodDrain("Regen", toggle: false);
				}
				BloodlustStats.Blood -= BloodlustStats.GetBloodDrain() * Time.deltaTime;
				UpdateBloodState();
			}
			bloodBar.SetValues(BloodlustStats.Blood, BloodlustStats.MaxBlood);
		}

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
			bloodBar = CreateStoredDamageBar();
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
			DamageEventHandler.Instance.RegisterDamageEventForOtherPlayers((object)this, data.player);
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)((Component)bloodBar).gameObject);
			CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<ReaperStats>().ScalingPercentageDamageUnCap -= appliedScaling;
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
			DamageEventHandler.Instance.UnregisterDamageEvent((object)this, data.player);
		}
	}
	public class BloodTranscendenceBehaviour : MonoBehaviour
	{
		public const string BLOOD_TRANSCENDENCE_KEY = "BloodTranscendence";

		public const string BLOOD_TRANSCENDENCE_ACTIVATE_KEY = "BloodTranscendenceActivate";

		public const string BLOOD_TRANSCENDENCE_DEACTIVATE_KEY = "BloodTranscendenceDeactivate";

		[Header("Effect Objects")]
		public ParticleSystem Effect;

		[Header("Settings")]
		public float SecondsOfInvincibilityAtFullBlood = 5f;

		public float PrecentageBloodInvincibilityStop = 0.1f;

		public float CooldownTime = 10f;

		private CharacterData data;

		private ChildRPC rpc;

		private bool hasTrigger;

		private float lastTriggerTime;

		public BloodlustStats BloodlustStats => CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<BloodlustStats>();

		public void Trigger()
		{
			float num = 100f * PrecentageBloodInvincibilityStop;
			if (data.view.IsMine && BloodlustStats.Blood > num && !hasTrigger && Time.time > lastTriggerTime + CooldownTime)
			{
				rpc.CallFunction("BloodTranscendenceActivate");
			}
		}

		private void RPCA_Activate()
		{
			if (!hasTrigger)
			{
				float amount = 100f * (1f - PrecentageBloodInvincibilityStop) / SecondsOfInvincibilityAtFullBlood;
				BloodlustStats.AddBloodDrain("BloodTranscendence", amount);
				BloodlustStats.DisableDamageGain = true;
				ClassesStats.MakeInvulnerable(data.player);
				Effect.Play();
				hasTrigger = true;
				LoggerUtils.LogInfo("\"BloodTranscendence\" has been activated", false);
			}
		}

		private void RPCA_Deactivate()
		{
			if (hasTrigger)
			{
				_ = 100f * PrecentageBloodInvincibilityStop / SecondsOfInvincibilityAtFullBlood;
				BloodlustStats.RemoveBloodDrain("BloodTranscendence");
				BloodlustStats.DisableDamageGain = false;
				ClassesStats.MakeVulnerable(data.player);
				Effect.Stop();
				hasTrigger = false;
				LoggerUtils.LogInfo("\"BloodTranscendence\" has been deactivated", false);
			}
		}

		private void OnRevive()
		{
			if (hasTrigger)
			{
				RPCA_Deactivate();
			}
		}

		private void Update()
		{
			float num = 100f * PrecentageBloodInvincibilityStop;
			if (data.view.IsMine && BloodlustStats.Blood < num && hasTrigger)
			{
				rpc.CallFunction("BloodTranscendenceDeactivate");
			}
		}

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
			rpc = ((Component)this).GetComponentInParent<ChildRPC>();
			rpc.childRPCs.Add("BloodTranscendenceActivate", RPCA_Activate);
			rpc.childRPCs.Add("BloodTranscendenceDeactivate", RPCA_Deactivate);
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
		}

		private void OnDestroy()
		{
			rpc.childRPCs.Remove("BloodTranscendenceActivate");
			rpc.childRPCs.Remove("BloodTranscendenceDeactivate");
			HealthHandler healthHandler = data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
		}
	}
	[RequireComponent(typeof(AttackLevel))]
	public class BloodTransfusionBehaviour : MonoBehaviour, IOnDoDamageEvent
	{
		[Header("Particles")]
		public ParticleSystem ParticleSystem;

		public int ParticlesEmitCount;

		[Header("Parameters")]
		public float HealFromDamageMultiplier = 0.25f;

		public float Radius = 10f;

		private CharacterData data;

		private AttackLevel attackLevel;

		public float CalculateScaledValue(float value, float maxValue, float scalingRange)
		{
			float num = value / scalingRange;
			return Mathf.Clamp((num * (0f - num) * num + 1f) * maxValue, 0f, maxValue);
		}

		public void OnDamage(DamageInfo damage)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			float scalingRange = Radius * ((Component)this).transform.localScale.x;
			float num = ((Vector2)(ref damage.Damage)).magnitude * (HealFromDamageMultiplier * (float)attackLevel.attackLevel);
			float value = Vector3.Distance(((Component)data).transform.position, ((Component)damage.HurtPlayer).transform.position);
			float num2 = CalculateScaledValue(value, num, scalingRange);
			float num3 = num2 / num;
			int num4 = (int)((float)ParticlesEmitCount * num3);
			data.healthHandler.Heal(num2);
			ParticleSystem.Emit(num4);
		}

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
			attackLevel = ((Component)this).GetComponent<AttackLevel>();
			DamageEventHandler.Instance.RegisterDamageEventForOtherPlayers((object)this, data.player);
		}

		private void OnDestroy()
		{
			DamageEventHandler.Instance.UnregisterDamageEvent((object)this, data.player);
		}
	}
	public class GrimFateBehaviour : MonoBehaviour, IBattleStartHookHandler
	{
		public GameObject GrimFateDeathEffect;

		private CharacterData data;

		private bool alreadyTrigger;

		private void OnDeath()
		{
			if (!alreadyTrigger)
			{
				GameObject oldDeathEffect = data.healthHandler.deathEffectPhoenix;
				data.healthHandler.deathEffectPhoenix = GrimFateDeathEffect;
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AAC_Core.Instance, 1, (Action)delegate
				{
					data.healthHandler.deathEffectPhoenix = oldDeathEffect;
				});
				alreadyTrigger = true;
			}
		}

		public void OnBattleStart()
		{
			alreadyTrigger = false;
		}

		private void Start()
		{
			data = ((Component)this).GetComponentInParent<CharacterData>();
			DeathActionHandler.Instance.RegisterReviveAction(data.player, (Action)OnDeath);
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
		}

		private void OnDestroy()
		{
			DeathActionHandler.Instance.DeregisterReviveAction(data.player, (Action)OnDeath);
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}
	}
	public class PercentDamageExplosion : MonoBehaviour
	{
		[Header("Settings")]
		public float PercentDamage = 0.45f;

		public float Ranage = 10f;

		[Header("Scales")]
		public bool ScaleWithLevel;

		[Header("Trigger")]
		public bool TriggerOnAwake;

		public GameObject PlayerDamageEffect;

		private AttackLevel attackLevel;

		private SpawnedAttack spawnedAttack;

		public float CalculateScaledValue(float value, float maxValue, float scalingRange)
		{
			float num = value / scalingRange;
			return Mathf.Clamp((num * (0f - num) * num + 1f) * maxValue, 0f, maxValue);
		}

		public void Trigger(Player player)
		{
			//IL_000c: 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)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			float scalingRange = Ranage * ((Component)this).transform.localScale.x;
			float num = PercentDamage;
			if (ScaleWithLevel && (Object)(object)attackLevel != (Object)null)
			{
				num *= (float)attackLevel.attackLevel;
			}
			foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(player))
			{
				if (PlayerManager.instance.CanSeePlayer(Vector2.op_Implicit(((Component)this).transform.position), enemyPlayer).canSee)
				{
					float value = Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)enemyPlayer).transform.position));
					float maxValue = enemyPlayer.data.maxHealth * num;
					float num2 = CalculateScaledValue(value, maxValue, scalingRange);
					if (num2 > 0f)
					{
						Vector3 val = ((Component)enemyPlayer).transform.position - ((Component)this).transform.position;
						Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref val)).normalized) * num2;
						((Damagable)enemyPlayer.data.healthHandler).CallTakeDamage(val2, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, player, true);
						SpawnPlayerDamageEffect(enemyPlayer);
					}
				}
			}
		}

		public void Trigger()
		{
			if ((Object)(object)spawnedAttack != (Object)null && spawnedAttack.IsMine())
			{
				Trigger(spawnedAttack.spawner);
			}
		}

		private void SpawnPlayerDamageEffect(Player player)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0062: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PlayerDamageEffect == (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(PlayerDamageEffect, ((Component)this).transform);
				val.transform.position = ((Component)player).transform.position;
				val.SetActive(true);
				Vector3 val2 = ((Component)player).transform.position - ((Component)this).transform.position;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				if (normalized != Vector3.zero)
				{
					val.transform.rotation = Quaternion.LookRotation(normalized);
				}
			}
		}

		private void Start()
		{
			spawnedAttack = ((Component)this).GetComponent<SpawnedAttack>();
			attackLevel = ((Component)this).GetComponent<AttackLevel>();
			if ((Object)(object)PlayerDamageEffect != (Object)null)
			{
				PlayerDamageEffect.SetActive(false);
			}
		}

		private void Awake()
		{
			if (TriggerOnAwake)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
				{
					Trigger();
				});
			}
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0000: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.color = Color.red;
			Gizmos.DrawWireSphere(((Component)this).transform.position, Ranage * ((Component)this).transform.localScale.x);
		}
	}
}
namespace AALUND13Cards.Classes.MonoBehaviours.CardsEffects.ExoArmor
{
	public class ExoArmorDamageReductionAdder : MonoBehaviour
	{
		public float DamageReduction;

		private ArmorHandler armorHandler;

		private float addedArmorDamageReduction;

		private void Awake()
		{
			armorHandler = ((Component)this).GetComponentInParent<ArmorHandler>();
			float armorDamageReduction = ((AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>()).ArmorDamageReduction;
			if (addedArmorDamageReduction > 0f)
			{
				addedArmorDamageReduction = Mathf.Max(Mathf.Min(armorDamageReduction + DamageReduction, 0.8f) - armorDamageReduction, 0f);
			}
			else
			{
				addedArmorDamageReduction = DamageReduction;
			}
			((AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>()).ArmorDamageReduction += addedArmorDamageReduction;
		}

		private void OnDestroy()
		{
			((AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>()).ArmorDamageReduction -= addedArmorDamageReduction;
		}
	}
	public class ExoArmorReflectChanceAdder : MonoBehaviour
	{
		public float ReflectChance;

		private ArmorHandler armorHandler;

		private float addedArmorReflectChance;

		private void Awake()
		{
			armorHandler = ((Component)this).GetComponentInParent<ArmorHandler>();
			AALUND13Cards.Classes.Armors.ExoArmor exoArmor = (AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>();
			addedArmorReflectChance = Mathf.Max(Mathf.Min(exoArmor.ReflectChance + ReflectChance, 0.8f) - exoArmor.ReflectChance, 0f);
			exoArmor.ReflectChance += addedArmorReflectChance;
		}

		private void OnDestroy()
		{
			((AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>()).ReflectChance -= addedArmorReflectChance;
		}
	}
	public class ExoArmorSpawnDamageEffect : MonoBehaviour
	{
		private DamageSpawnObjects damageSpawnObjects;

		private ArmorHandler armorHandler;

		private void Awake()
		{
			damageSpawnObjects = ((Component)this).GetComponent<DamageSpawnObjects>();
			armorHandler = ((Component)this).GetComponentInParent<ArmorHandler>();
			AALUND13Cards.Classes.Armors.ExoArmor obj = (AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>();
			obj.OnArmorDamaged = (Action<float>)Delegate.Combine(obj.OnArmorDamaged, new Action<float>(OnArmorDamaged));
		}

		private void OnDestroy()
		{
			AALUND13Cards.Classes.Armors.ExoArmor obj = (AALUND13Cards.Classes.Armors.ExoArmor)(object)armorHandler.GetArmorByType<AALUND13Cards.Classes.Armors.ExoArmor>();
			obj.OnArmorDamaged = (Action<float>)Delegate.Remove(obj.OnArmorDamaged, new Action<float>(OnArmorDamaged));
		}

		private void OnArmorDamaged(float damage)
		{
			//IL_0006: 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)
			damageSpawnObjects.SpawnDamage(Vector2.up * damage);
		}
	}
}
namespace AALUND13Cards.Classes.Cards
{
	public class BloodlustStats : ICustomStats
	{
		private struct BloodDrain
		{
			public float Drain;

			public bool Enable;

			public BloodDrain(float drain)
				: this(drain, toggle: true)
			{
			}

			public BloodDrain(float drain, bool toggle)
			{
				Drain = drain;
				Enable = toggle;
			}

			public BloodDrain ToggleDrain(bool toggle)
			{
				Enable = toggle;
				return this;
			}

			public static BloodDrain operator +(BloodDrain left, float right)
			{
				return new BloodDrain(left.Drain + right, left.Enable);
			}

			public static BloodDrain operator -(BloodDrain left, float right)
			{
				return new BloodDrain(left.Drain - right, left.Enable);
			}
		}

		public float MaxBlood;

		public float StartingBlood;

		public float Blood;

		public float BloodDrainRate;

		public float BloodHealthRegenRate;

		private Dictionary<string, BloodDrain> drainRate = new Dictionary<string, BloodDrain>();

		public float BloodFillPerDamage;

		public float DamageMultiplierFromDamage;

		public float DamageFromNoBlood;

		public bool DisableDamageGain;

		public void ResetStats()
		{
			MaxBlood = 0f;
			StartingBlood = 0f;
			Blood = 0f;
			BloodDrainRate = 0f;
			BloodHealthRegenRate = 0f;
			drainRate.Clear();
			BloodFillPerDamage = 0f;
			DamageMultiplierFromDamage = 0f;
			DamageFromNoBlood = 0f;
			DisableDamageGain = false;
		}

		public float GetBloodDrain(string key)
		{
			if (drainRate.ContainsKey(key))
			{
				return drainRate[key].Drain;
			}
			return 0f;
		}

		public float GetBloodDrain()
		{
			float num = BloodDrainRate;
			foreach (BloodDrain item in drainRate.Values.Where((BloodDrain d) => d.Enable))
			{
				num += item.Drain;
			}
			return num;
		}

		public void RemoveBloodDrain(string key)
		{
			if (drainRate.ContainsKey(key))
			{
				drainRate.Remove(key);
			}
		}

		public void RemoveBloodDrain(string key, float amount)
		{
			if (drainRate.ContainsKey(key))
			{
				drainRate[key] -= amount;
				if (drainRate[key].Drain <= 0f)
				{
					drainRate.Remove(key);
				}
			}
		}

		public void AddBloodDrain(string key, float amount)
		{
			if (!drainRate.ContainsKey(key))
			{
				drainRate.Add(key, new BloodDrain(amount));
			}
			else
			{
				drainRate[key] += amount;
			}
		}

		public void ToggleBloodDrain(string key, bool toggle)
		{
			if (drainRate.ContainsKey(key))
			{
				drainRate[key] = drainRate[key].ToggleDrain(toggle);
			}
		}
	}
	public class ClassesStats : ICustomStats
	{
		private static readonly Color DarkenColor = new Color(0.75f, 0.75f, 0.75f, 1f);

		public float DamageResistance;

		private bool invulnerable;

		public bool Invulnerable => invulnerable;

		public static void MakeInvulnerable(Player player)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			if (!((Object)(object)player == (Object)null) && !CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().invulnerable)
			{
				CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().invulnerable = true;
				Image val = ((Component)player).GetComponentInChildren<HealthBar>()?.hp;
				((Graphic)val).color = new Color(((Graphic)val).color.r * DarkenColor.r, ((Graphic)val).color.g * DarkenColor.g, ((Graphic)val).color.b * DarkenColor.b, ((Graphic)val).color.a);
			}
		}

		public static void MakeVulnerable(Player player)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			if (!((Object)(object)player == (Object)null) && CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().invulnerable)
			{
				CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ClassesStats>().invulnerable = false;
				Image val = ((Component)player).GetComponentInChildren<HealthBar>()?.hp;
				((Graphic)val).color = new Color(((Graphic)val).color.r / DarkenColor.r, ((Graphic)val).color.g / DarkenColor.g, ((Graphic)val).color.b / DarkenColor.b, ((Graphic)val).color.a);
			}
		}

		public void ResetStats()
		{
			DamageResistance = 0f;
			if (!invulnerable)
			{
				return;
			}
			foreach (CharacterData item in PlayerManager.instance.players.Select((Player p) => p.data))
			{
				if (CharacterDataExtensions.GetCustomStatsRegistry(item).Get<ClassesStats>() == this)
				{
					MakeVulnerable(item.player);
				}
			}
		}
	}
	public class RailgunStats : ICustomStats
	{
		public struct RailgunChargeStats
		{
			public float ChargeDamageMultiplier;

			public float ChargeBulletSpeedMultiplier;

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

		public bool IsEnabled;

		public bool AllowOvercharge;

		public float MaximumCharge;

		public float CurrentCharge;

		public float ChargeRate;

		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 = charge;
			num = (AllowOvercharge ? (num / 2f) : Mathf.Min(num, FullChargeThreshold));
			float num2 = num / FullChargeThreshold;
			float chargeDamageMultiplier = RailgunMinimumChargeDamageMultiplier + (RailgunDamageMultiplier - RailgunMinimumChargeDamageMultiplier) * num2;
			float chargeBulletSpeedMultiplier = RailgunMinimumChargeBulletSpeedMultiplier + (RailgunBulletSpeedMultiplier - RailgunMinimumChargeBulletSpeedMultiplier) * num2;
			return new RailgunChargeStats(chargeDamageMultiplier, chargeBulletSpeedMultiplier);
		}

		public void UseCharge(RailgunStats stats)
		{
			if (AllowOvercharge)
			{
				CurrentCharge = 0f;
			}
			else
			{
				CurrentCharge = Mathf.Max(CurrentCharge - FullChargeThreshold, 0f);
			}
			AllowOvercharge = false;
		}

		public void ResetStats()
		{
			IsEnabled = false;
			AllowOvercharge = false;
			MaximumCharge = 0f;
			CurrentCharge = 0f;
			ChargeRate = 0f;
			FullChargeThreshold = 20f;
			RailgunDamageMultiplier = 1f;
			RailgunBulletSpeedMultiplier = 1f;
			RailgunMinimumChargeDamageMultiplier = 0.25f;
			RailgunMinimumChargeBulletSpeedMultiplier = 0.5f;
		}
	}
	public class ReaperStats : ICustomStats
	{
		public float ScalingPercentageDamage;

		public float ScalingPercentageDamageUnCap;

		public float ScalingPercentageDamageCap;

		public float PercentageDamageBleedingPercentage;

		public void ResetStats()
		{
			ScalingPercentageDamage = 0f;
			ScalingPercentageDamageUnCap = 0f;
			ScalingPercentageDamageCap = 0f;
			PercentageDamageBleedingPercentage = 0f;
		}
	}
	public class SoulStreakStats : ICustomStats
	{
		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;

		public float SoulArmorPercentageRegenRate;

		public float SoulDrainDPSFactor;

		public float SoulDrainPercentageDPSFactor;

		public float SoulDrainLifestealMultiply;

		public float BurstDamageMultiplier;

		public float DamageStorage;

		public float DamageResistancePerKill;

		public Dictionary<Type, ISoulstreakAbility> AbilitiesMap = new Dictionary<Type, ISoulstreakAbility>();

		public uint Souls;

		public ReadOnlyCollection<ISoulstreakAbility> Abilities => AbilitiesMap.Values.ToList().AsReadOnly();

		public TAbility AddAbility<TAbility>(TAbility soulstreakAbility) where TAbility : SoulstreakAbility<TAbility>
		{
			AddAbilityRaw(soulstreakAbility);
			soulstreakAbility.SoulstreakStats = this;
			return soulstreakAbility;
		}

		public TAbility AddAbilityRaw<TAbility>(TAbility soulstreakAbility) where TAbility : ISoulstreakAbility
		{
			if (AbilitiesMap.TryGetValue(soulstreakAbility.GetType(), out var value) && value is TAbility)
			{
				return (TAbility)value;
			}
			AbilitiesMap.Add(soulstreakAbility.GetType(), soulstreakAbility);
			return soulstreakAbility;
		}

		public TAbility GetAbility<TAbility>() where TAbility : SoulstreakAbility<TAbility>
		{
			if (AbilitiesMap.TryGetValue(typeof(TAbility), out var value))
			{
				return (TAbility)value;
			}
			return null;
		}

		public void ResetStats()
		{
			MaxHealth = 1f;
			PlayerSize = 1f;
			MovementSpeed = 1f;
			AttackSpeed = 1f;
			Damage = 1f;
			BulletSpeed = 1f;
			SoulArmorPercentage = 0f;
			SoulArmorPercentageRegenRate = 0f;
			SoulDrainDPSFactor = 0f;
			SoulDrainPercentageDPSFactor = 0f;
			SoulDrainLifestealMultiply = 0f;
			DamageResistancePerKill = 0f;
			AbilitiesMap.Clear();
		}
	}
}
namespace AALUND13Cards.Classes.Cards.StatModifers
{
	public class BloodlustStatModifers : CustomStatModifers
	{
		[Header("Blood Values")]
		public float MaxBlood;

		public float StartingBlood;

		[Header("Blood Healing/Draining")]
		public float BloodDrainRate;

		public float BloodDrainRateWhenRegen;

		public float BloodHealthRegenRate;

		[Header("Blood Damage")]
		public float DamageFromNoBlood;

		public float BloodFillPerDamage;

		public float DamageMultiplierFromDamage;

		public override void Apply(Player player)
		{
			BloodlustStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<BloodlustStats>();
			orCreate.MaxBlood = Mathf.Max(orCreate.MaxBlood + MaxBlood, 0f);
			orCreate.StartingBlood = Mathf.Max(orCreate.StartingBlood + StartingBlood, 0f);
			orCreate.BloodDrainRate = Mathf.Max(orCreate.BloodDrainRate + BloodDrainRate, 0f);
			orCreate.BloodHealthRegenRate = Mathf.Max(orCreate.BloodHealthRegenRate + BloodHealthRegenRate, 0f);
			if (BloodDrainRateWhenRegen > 0f)
			{
				orCreate.AddBloodDrain("Regen", BloodDrainRateWhenRegen);
			}
			else if (BloodDrainRateWhenRegen < 0f)
			{
				orCreate.RemoveBloodDrain("Regen", BloodDrainRateWhenRegen);
			}
			orCreate.DamageFromNoBlood = Mathf.Max(orCreate.DamageFromNoBlood + DamageFromNoBlood, 0f);
			orCreate.BloodFillPerDamage = Mathf.Max(orCreate.BloodFillPerDamage + BloodFillPerDamage, 0f);
			orCreate.DamageMultiplierFromDamage = Mathf.Max(orCreate.DamageMultiplierFromDamage + DamageMultiplierFromDamage, 0f);
		}
	}
	public class RailgunStatModifers : CustomStatModifers
	{
		[Header("Railgun Stats Add")]
		public float MaximumCharge;

		public float ChargeRate;

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

		public float ChargeRateMultiplier = 1f;

		public float RailgunDamageMultiplier = 1f;

		public float RailgunBulletSpeedMultiplier = 1f;

		public override void Apply(Player player)
		{
			RailgunStats orCreate = CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<RailgunStats>();
			orCreate.MaximumCharge = Mathf.Max(orCreate.MaximumCharge + MaximumCharge, 0f);
			orCreate.ChargeRate = Mathf.Max(orCreate.ChargeRate + ChargeRate, 0f);
			orCreate.MaximumCharge *= MaximumChargeMultiplier;
			orCreate.ChargeRate *= ChargeRateMultiplier;
			orCreate.RailgunDamageMultiplier += RailgunDamageMultiplier - 1f;
			orCreate.RailgunBulletSpeedMultiplier += RailgunBulletSpeedMultiplier - 1f;
		}
	}
	public class ReaperStatModifers : CustomStatModifers
	{
		[Header("Percentage Damage")]
		public float ScalingPercentageDamage;

		public float ScalingPercentageDamageCap;

		public float PercentageDamageBleedingPercentage;

		public override void Apply(Player player)
		{
			ReaperStats orCreate = CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<ReaperStats>();
			orCreate.ScalingPercentageDamageCap += ScalingPercentageDamageCap;
			orCreate.ScalingPercentageDamage += ScalingPercentageDamage;
			orCreate.PercentageDamageBleedingPercentage += PercentageDamageBleedingPercentage;
		}
	}
	[Flags]
	public enum AbilityType
	{
		Armor = 1
	}
	publi

plugins/AALUND13_Extra_Picks_Cards.dll

Decompiled 2 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 AALUND13Cards.Core;
using AALUND13Cards.Core.Cards;
using AALUND13Cards.Core.Cards.Effects;
using AALUND13Cards.Core.Extensions;
using AALUND13Cards.Core.Handlers;
using AALUND13Cards.Core.Utils;
using AALUND13Cards.ExtraCards;
using AALUND13Cards.ExtraCards.Cards;
using AALUND13Cards.ExtraCards.Handlers.ExtraPickHandlers;
using BepInEx;
using CorruptedCardsManager;
using DrawNCards;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RandomCardsGenerators;
using RandomCardsGenerators.Cards;
using RandomCardsGenerators.StatsGroup;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using WillsWackyManagers.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AALUND13Cards.Core.VisualEffect
{
	public class CorruptedCardVisualEffect : MonoBehaviour
	{
		private const float ROTATE_CARD_CHANCE = 5f;

		private const float ROTATE_CARD_ANGLE_LIMIT = 180f;

		private float oldRotationZ;

		private bool init;

		private void Awake()
		{
			//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)
			Quaternion rotation = ((Component)this).transform.rotation;
			oldRotationZ = ((Quaternion)(ref rotation)).eulerAngles.z;
			init = true;
		}

		private void Update()
		{
			//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_0017: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation;
			if (!init)
			{
				rotation = ((Component)this).transform.rotation;
				oldRotationZ = ((Quaternion)(ref rotation)).eulerAngles.z;
				init = true;
			}
			if (Random.Range(0f, 100f) < 5f)
			{
				((Component)this).transform.Rotate(0f, 0f, Random.Range(-180f, 180f));
				return;
			}
			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_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_0017: 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_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)
			if (init)
			{
				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_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_0017: 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_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)
			if (init)
			{
				Quaternion rotation = ((Component)this).transform.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
				eulerAngles.z = oldRotationZ;
				((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
			}
		}
	}
}
namespace AALUND13Cards.Core.Patches
{
	[HarmonyPatch(typeof(CardChoice))]
	public class CardChoicePatch
	{
		[HarmonyPatch("IDoEndPick")]
		[HarmonyPostfix]
		private static void IDoEndPickPostfix(GameObject pickedCard, int theInt, int pickId)
		{
			//IL_006b: 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)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, pickId);
			if ((Object)(object)playerWithID == (Object)null)
			{
				return;
			}
			ExtraCardsStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(playerWithID.data).GetOrCreate<ExtraCardsStats>();
			if (orCreate.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 < orCreate.DuplicatesAsCorrupted; i++)
				{
					CorruptedCardsManager.CorruptedCardsGenerators.CreateRandomCard(val, playerWithID);
				}
			}
		}

		[HarmonyPatch("Spawn")]
		[HarmonyPostfix]
		private static void SpawnPostfix(CardChoice __instance, GameObject __result)
		{
			List<GameObject> list = (List<GameObject>)ExtensionMethods.GetFieldValue((object)CardChoice.instance, "spawnedCards");
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, __instance.pickrID);
			if (!((Object)(object)playerWithID == (Object)null) && list.Count >= Math.Max(DrawNCards.GetPickerDraws(__instance.pickrID) - CharacterDataExtensions.GetCustomStatsRegistry(playerWithID.data).GetOrCreate<ExtraCardsStats>().CurseCardDraws, 0))
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AAC_Core.Instance, 5, (Action)delegate
				{
					NetworkingManager.RPC(typeof(CardChoicePatch), "SpawnCurseDraw", new object[1] { __result.GetComponent<PhotonView>().ViewID });
				});
			}
		}

		[HarmonyPatch("RPCA_DoEndPick")]
		[HarmonyPostfix]
		private static void RPCA_DoEndPickpOSTFIX(CardChoice __instance, int targetCardID, int theInt, int pickId)
		{
			_ = (List<GameObject>)ExtensionMethods.GetFieldValue((object)CardChoice.instance, "spawnedCards");
			Player playerWithID = ExtensionMethods.GetPlayerWithID(PlayerManager.instance, pickId);
			if (theInt >= Math.Max(DrawNCards.GetPickerDraws(pickId) - CharacterDataExtensions.GetCustomStatsRegistry(playerWithID.data).GetOrCreate<ExtraCardsStats>().CurseCardDraws, 0))
			{
				CurseManager.instance.CursePlayer(playerWithID);
			}
		}

		[UnboundRPC]
		private static void SpawnCurseDraw(int viewId)
		{
			try
			{
				PhotonView photonView = PhotonNetwork.GetPhotonView(viewId);
				Object.Instantiate<GameObject>(AAC_ExtraCards.CurseDrawObject, ((Component)((Component)((Component)photonView).transform).GetComponentInChildren<CardVisuals>()).transform.GetChild(0)).transform.SetAsFirstSibling();
			}
			catch (Exception ex)
			{
				LoggerUtils.LogError(ex.Message);
			}
		}
	}
}
namespace AALUND13Cards.ExtraCards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("AALUND13.Cards.Extra_Cards", "AALUND13 Extra Picks Cards", "1.1.2")]
	[BepInProcess("Rounds.exe")]
	internal class AAC_ExtraCards : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <OnPickStart>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gameModeHandler;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				foreach (Player player in PlayerManager.instance.players)
				{
					if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
					{
						bool flag = gameModeHandler.GetRoundWinners().Contains(player.teamID);
						if (CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<ExtraCardsStats>().ExtraCardPicksPerPickPhase > 0 && !flag)
						{
							ExtraCardPickHandler.AddExtraPick<ExtraPickHandler>(player, CharacterDataExtensions.GetAdditionalData(player.data).CustomStatsRegistry.GetOrCreate<ExtraCardsStats>().ExtraCardPicksPerPickPhase, (ExtraPickPhaseTrigger)0);
						}
					}
				}
				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 ModId = "AALUND13.Cards.Extra_Cards";

		internal const string ModName = "AALUND13 Extra Picks Cards";

		internal const string Version = "1.1.2";

		public static GameObject CurseDrawObject;

		private static AssetBundle assets;

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

		private void Start()
		{
			if ((Object)(object)assets == (Object)null)
			{
				Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Extra Picks Cards\" assets failled to load, All the cards will be disable in this mod");
				throw new NullReferenceException("Failled to load \"AALUND13 Extra Picks Cards\" assets");
			}
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)OnPickStart);
			if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			CardResgester cardResgester = assets.LoadAsset<GameObject>("ExtraPicksModCards").GetComponent<CardResgester>();
			cardResgester.RegisterCards();
			CurseDrawObject = assets.LoadAsset<GameObject>("CurseCardDraw");
			AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
			{
				AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Extra Picks Cards", "1.1.2", cardResgester);
			});
		}

		[IteratorStateMachine(typeof(<OnPickStart>d__7))]
		private IEnumerator OnPickStart(IGameModeHandler gameModeHandler)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnPickStart>d__7(0)
			{
				gameModeHandler = gameModeHandler
			};
		}
	}
	internal class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
			TabInfoManager.RegisterStat(orCreateCategory, "Extra Card Picks", (Func<Player, bool>)((Player p) => GetExtraCaedStatsFromPlayer(p).ExtraCardPicksPerPickPhase != 0), (Func<Player, string>)((Player p) => $"{GetExtraCaedStatsFromPlayer(p).ExtraCardPicksPerPickPhase}"));
			TabInfoManager.RegisterStat(orCreateCategory, "Duplicates As Corrupted", (Func<Player, bool>)((Player p) => GetExtraCaedStatsFromPlayer(p).DuplicatesAsCorrupted != 0), (Func<Player, string>)((Player p) => $"{GetExtraCaedStatsFromPlayer(p).DuplicatesAsCorrupted}"));
			TabInfoManager.RegisterStat(orCreateCategory, "Cursed Draws", (Func<Player, bool>)((Player p) => GetExtraCaedStatsFromPlayer(p).CurseCardDraws != 0), (Func<Player, string>)((Player p) => $"{GetExtraCaedStatsFromPlayer(p).CurseCardDraws}"));
		}

		private static ExtraCardsStats GetExtraCaedStatsFromPlayer(Player player)
		{
			return CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<ExtraCardsStats>();
		}
	}
}
namespace AALUND13Cards.ExtraCards.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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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++)
			{
				if (Random.Range(0f, 1f) < 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
				{
					CardsGenerators.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(AAC_Core.NoLotteryCategories).Any();
		}
	}
}
namespace AALUND13Cards.ExtraCards.Handlers.ExtraPickHandlers
{
	public class SteelPickHandler : ExtraPickHandler
	{
		public override bool PickConditions(Player player, CardInfo card)
		{
			if (card.categories.Intersect(AAC_Core.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 OnPickEnd(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.ExtraCards.Cards
{
	public enum AACardsGeneratorType
	{
		CardFactoryGenerator
	}
	internal class CardsGenerators
	{
		public static ModRandomCardsGenerators<AACardsGeneratorType> Generators;

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

		private static RandomCardsGenerator CreateCardFactoryGenerator()
		{
			//IL_0024: 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_0044: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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 ExtraCardsStats : ICustomStats
	{
		public int DuplicatesAsCorrupted;

		public int ExtraCardPicksPerPickPhase;

		public int CurseCardDraws;

		public void ResetStats()
		{
			DuplicatesAsCorrupted = 0;
			ExtraCardPicksPerPickPhase = 0;
			CurseCardDraws = 0;
		}
	}
}
namespace AALUND13Cards.ExtraCards.Cards.StatModifers
{
	public enum ExtraPicksType
	{
		None,
		Normal,
		Steel
	}
	public class ExtraCardsStatsModifers : CustomStatModifers
	{
		[Header("Extra Picks")]
		public int ExtraPicks;

		public ExtraPicksType ExtraPicksType;

		public int ExtraPicksForEnemies;

		public ExtraPicksType ExtraPicksTypeForEnemies;

		public ExtraPickPhaseTrigger ExtraPickPhaseTrigger;

		[Header("Extra Cards")]
		public int ExtraCardPicks;

		public int DuplicatesAsCorrupted;

		[Header("Curse Card Draws")]
		public int CurseCardDraws;

		public override void Apply(Player player)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			CharacterData data = player.data;
			ExtraCardsStats additionalData = CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<ExtraCardsStats>();
			additionalData.ExtraCardPicksPerPickPhase += ExtraCardPicks;
			ExtraPickHandler extraPickHandler = GetExtraPickHandler(ExtraPicksType);
			if (extraPickHandler != null && ExtraPicks > 0 && player.data.view.IsMine)
			{
				ExtraCardPickHandler.AddExtraPick(extraPickHandler, player, ExtraPicks, ExtraPickPhaseTrigger);
			}
			ExtraPickHandler extraPickHandler2 = GetExtraPickHandler(ExtraPicksTypeForEnemies);
			if (extraPickHandler != null && ExtraPicksForEnemies > 0 && player.data.view.IsMine)
			{
				foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(player))
				{
					ExtraCardPickHandler.AddExtraPick(extraPickHandler2, enemyPlayer, ExtraPicksForEnemies, ExtraPickPhaseTrigger);
				}
			}
			if (DuplicatesAsCorrupted > 0)
			{
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AAC_Core.Instance, 1, (Action)delegate
				{
					additionalData.DuplicatesAsCorrupted += DuplicatesAsCorrupted;
				});
			}
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AAC_Core.Instance, 10, (Action)delegate
			{
				if (CurseCardDraws > 0)
				{
					additionalData.CurseCardDraws += CurseCardDraws;
					DrawNCards.SetPickerDraws(player.playerID, DrawNCards.GetPickerDraws(player.playerID) + CurseCardDraws);
				}
			});
		}

		public override void OnReassign(Player player)
		{
			CharacterData data = player.data;
			ExtraCardsStats additionalData = CharacterDataExtensions.GetAdditionalData(data).CustomStatsRegistry.GetOrCreate<ExtraCardsStats>();
			additionalData.ExtraCardPicksPerPickPhase += ExtraCardPicks;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AAC_Core.Instance, 10, (Action)delegate
			{
				if (CurseCardDraws > 0)
				{
					additionalData.CurseCardDraws += CurseCardDraws;
					DrawNCards.SetPickerDraws(player.playerID, DrawNCards.GetPickerDraws(player.playerID) + CurseCardDraws);
				}
			});
		}

		public ExtraPickHandler GetExtraPickHandler(ExtraPicksType type)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			return (ExtraPickHandler)(type switch
			{
				ExtraPicksType.Normal => (object)new ExtraPickHandler(), 
				ExtraPicksType.Steel => new SteelPickHandler(), 
				_ => null, 
			});
		}
	}
}
namespace AALUND13Cards.ExtraCards.Cards.Effects
{
	public class PickCardFromListEffect : OnAddedEffect
	{
		public List<GameObject> randomCardsToChoseFrom = new List<GameObject>();

		public int cardCount = 1;

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

plugins/AALUND13_Standard_Cards.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AALUND13Cards.Core.Patches
{
	[HarmonyPatch(typeof(Cards), "PlayerIsAllowedCard")]
	internal class AllowedCardPatch
	{
		private static void Postfix(Player player, CardInfo card, ref bool __result)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !((Object)(object)card == (Object)null) && card.categories.Contains(CustomCardCategories.instance.CardCategory("Curse")) && CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse != null)
			{
				Rarity rarityData = RarityUtils.GetRarityData(card.rarity);
				Rarity maxRarityForCurse = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse;
				if (rarityData.relativeRarity < maxRarityForCurse.relativeRarity)
				{
					__result = false;
				}
			}
		}
	}
}
namespace AALUND13Cards.Core.MonoBehaviours.ProjectilesEffects
{
	public class ConnectingBullets : MonoBehaviour
	{
		private static Dictionary<Player, GameObject> PlayerLastBullet = new Dictionary<Player, GameObject>();

		public float DamageInterval = 0.5f;

		public float DamageMultiplier = 0.75f;

		public float MaxDistance = 20f;

		public GameObject ConnectingBulletPrefab;

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

		private GameObject connectingBulletInstance;

		private GameObject connectedBullet;

		private ChildRPC childRPC;

		private ProjectileHit ProjectileHit;

		private ProjectileHit OtherProjectileHit;

		private void Start()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			ProjectileHit = ((Component)this).GetComponentInParent<ProjectileHit>();
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			if (PlayerLastBullet.ContainsKey(ProjectileHit.ownPlayer) && (Object)(object)PlayerLastBullet[ProjectileHit.ownPlayer] != (Object)null && Vector2.Distance(Vector2.op_Implicit(PlayerLastBullet[ProjectileHit.ownPlayer].transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position)) < MaxDistance)
			{
				connectingBulletInstance = Object.Instantiate<GameObject>(ConnectingBulletPrefab, Vector2.op_Implicit(Vector2.zero), Quaternion.identity);
				LineEffect component = connectingBulletInstance.GetComponent<LineEffect>();
				connectedBullet = PlayerLastBullet[ProjectileHit.ownPlayer];
				OtherProjectileHit = connectedBullet.GetComponent<ProjectileHit>();
				component.fromPos = connectedBullet.transform;
				component.toPos = ((Component)this).gameObject.transform;
				LineRenderer component2 = connectingBulletInstance.GetComponent<LineRenderer>();
				component2.startColor = GetProjectileColor(OtherProjectileHit);
				component2.endColor = GetProjectileColor(ProjectileHit);
				component2.SetPositions((Vector3[])(object)new Vector3[2]
				{
					connectedBullet.transform.position,
					((Component)this).gameObject.transform.position
				});
			}
			PlayerLastBullet[ProjectileHit.ownPlayer] = ((Component)((Component)this).transform.parent).gameObject;
		}

		private Color GetProjectileColor(ProjectileHit projectileHit)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (projectileHit.projectileColor == Color.black)
			{
				return new Color(0.75f, 0.28530002f, 0.0882f);
			}
			return projectileHit.projectileColor * 0.75f;
		}

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

		private void FixedUpdate()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)connectingBulletInstance != (Object)null && (Object)(object)connectedBullet != (Object)null)
			{
				DamageBetweenPoints(Vector2.op_Implicit(connectedBullet.transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position));
			}
		}

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

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

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

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

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

		public float CurrentHPRegenPercentage = 0.15f;

		private CharacterData data;

		private float oldRegen;

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

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

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

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

		public ParticleSystem[] remainParts;

		private GameObject saveTeleportPosition;

		private CharacterData data;

		private Vector2 SavePosition;

		private bool DoTeleport;

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

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

		private void OnDisable()
		{
			ResetTeleport();
		}

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

		public void ResetTeleport()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)saveTeleportPosition != (Object)null)
			{
				saveTeleportPosition.SetActive(false);
			}
			DoTeleport = false;
			SavePosition = Vector2.zero;
		}
	}
	public class StoreDamageEffect : MonoBehaviour, IOnDoDamageEvent
	{
		public float DamageToStorePercentage = 0.5f;

		public float MaxStoredDamageMultiplier = 5f;

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

		private float maxStoredDamage = 100f;

		private float storedDamage;

		private float cooldownTimer;

		private bool damageReductionApplied;

		private Player player;

		private DamageSpawnObjects damageSpawnObjects;

		private CustomHealthBar storedDamageBar;

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

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

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

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

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

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

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

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

		internal const string ModName = "AALUND13 Standard Cards";

		internal const string Version = "1.1.0";

		private static AssetBundle assets;

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

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

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

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

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

		[HarmonyPatch("blocked")]
		[HarmonyPrefix]
		public static void BlockedPrefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			ProjectileHit component = projectile.GetComponent<ProjectileHit>();
			_ = (HealthHandler)ExtensionMethods.GetFieldValue((object)__instance, "health");
			CharacterData data = component.ownPlayer.data;
			CharacterData val = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
			bool flag = false;
			if ((Object)(object)data != (Object)null && CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime > 0f)
			{
				((MonoBehaviour)val.block).StopAllCoroutines();
				val.block.sinceBlock = float.PositiveInfinity;
				val.stunHandler.AddStun(val.stunTime + CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime);
				flag = true;
			}
			if (flag)
			{
				Object.Destroy((Object)(object)projectile);
			}
		}
	}
	[HarmonyPatch(typeof(Gun), "BulletInit")]
	public class GunPatch
	{
		public static void Postfix(Gun __instance, GameObject bullet)
		{
			PlayerGunActions.InvokeShootAction(__instance.player, __instance, bullet);
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	internal class HealthHandlerPatch
	{
		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamagePrefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			StandardStats characterAdditionalData = CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<StandardStats>();
			if (characterAdditionalData.DamageReduction != 0f)
			{
				damage = new Vector2(damage.x * (1f - characterAdditionalData.DamageReduction), damage.y * (1f - characterAdditionalData.DamageReduction));
			}
			if (characterAdditionalData.secondToDealDamage > 0f && !characterAdditionalData.dealDamage)
			{
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(damage.x, damage.y);
				ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(new DelayDamageInfo(val2, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock), characterAdditionalData.secondToDealDamage, (Action)delegate
				{
					characterAdditionalData.dealDamage = true;
				}, (Action)null);
				damage = Vector2.zero;
			}
			else if (characterAdditionalData.dealDamage)
			{
				characterAdditionalData.dealDamage = false;
			}
		}

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

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

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

		private void Start()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = new Vector3(Mathf.Min(((Component)this).transform.localScale.x, MaxScale), Mathf.Min(((Component)this).transform.localScale.y, MaxScale), Mathf.Min(((Component)this).transform.localScale.z, MaxScale));
		}
	}
}
namespace AALUND13Cards.Standard.MonoBehaviours.ProjectilesEffects
{
	public class RayHitApplyFrozenTime : RayHitEffect
	{
		[Range(0f, 10f)]
		public float FrozenTime = 0.3f;

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

		public float ActvateRange = 5f;

		public GameObject TrailPrefab;

		private PhotonView view;

		private ProjectileHit bullet;

		private PhotonView trailView;

		private GameObject trailObject;

		private float lastSyncTime;

		private bool active;

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

		private void Update()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (view.IsMine)
			{
				Vector3 val = ((Component)this).transform.position;
				if (!active && Vector3.Distance(((Component)this).transform.position, ((Component)bullet.ownPlayer).transform.position) >= ActvateRange)
				{
					Vector3 val2 = ((Component)this).transform.position - ((Component)bullet.ownPlayer).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					val = ((Component)bullet.ownPlayer).transform.position + normalized * ActvateRange;
					active = true;
				}
				if (active && Time.time > lastSyncTime + SyncInterval)
				{
					trailView.RPC("RPCA_AddPosition", (RpcTarget)0, new object[1] { val });
					lastSyncTime = Time.time;
				}
			}
		}

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

		public Vector3 End;

		public Vector3 Current;

		public float Lifetime;

		public float ExpireTime;

		public TrailObject(Vector3 start, Vector3 end, float lifetime, float expireTime)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Start = start;
			End = end;
			Lifetime = lifetime;
			ExpireTime = expireTime;
			Current = start;
		}

		public void UpdatePosition(float now)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			float num = ExpireTime - now;
			float num2 = 1f - num / Lifetime;
			Current = Vector3.Lerp(Start, End, num2);
		}
	}
	public interface ITrailUpdatable
	{
		void Update(Vector3[] positions);
	}
	public class TrailEffect : MonoBehaviour, IPunInstantiateMagicCallback
	{
		public GameObject EffectObject;

		public float Lifetime = 1f;

		private PhotonView view;

		private ParticleSystem effectParticles;

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

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

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

		private Vector3 lastPosition;

		private bool active;

		private bool sourceFinished;

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

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

		[PunRPC]
		public void RPCA_AddPosition(Vector3 position)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			float num = Time.time;
			if (!active)
			{
				active = true;
				lastPosition = position;
				EffectObject.transform.position = position;
				effectParticles.Play();
			}
			else
			{
				trail.Enqueue(new TrailObject(lastPosition, position, Lifetime, num + Lifetime));
				lastPosition = position;
				EffectObject.transform.position = position;
			}
		}

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

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = (Vector3)info.photonView.InstantiationData[0];
		}
	}
}
namespace AALUND13Cards.Standard.MonoBehaviours.CardsEffects
{
	public class LineHurtbox : MonoBehaviour, ITrailUpdatable, IPunInstantiateMagicCallback
	{
		[Header("Sounds")]
		public SoundEvent SoundDamage;

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

		public Player Player;

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

		public float BaseDamage = 100f;

		public float DamageFromTrail = 0.075f;

		public float BaseThickness = 1f;

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

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

		public float Slow;

		public bool FastSlow;

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

		public bool ScaleSlow;

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

		public bool ScaleThickness;

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

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

		private Damagable[] GetDamagableBetweenPoints(List<Vector3> points)
		{
			//IL_0015: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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)
			List<Collider2D> list = new List<Collider2D>();
			List<Damagable> list2 = new List<Damagable>();
			Vector2 val5 = default(Vector2);
			for (int i = 0; i < points.Count - 1; i++)
			{
				Vector2 val = Vector2.op_Implicit(points[i]);
				Vector2 val2 = Vector2.op_Implicit(points[i + 1]);
				float num = BaseThickness * (ScaleThickness ? ((Component)this).transform.localScale.x : 1f) * 0.5f;
				Vector2 val3 = val2 - val;
				float magnitude = ((Vector2)(ref val3)).magnitude;
				if (magnitude <= 0.0001f)
				{
					continue;
				}
				Vector2 val4 = (val + val2) * 0.5f;
				float num2 = Mathf.Atan2(val3.y, val3.x) * 57.29578f;
				((Vector2)(ref val5))..ctor(magnitude + num * 2f, num * 2f);
				Collider2D[] array = Physics2D.OverlapCapsuleAll(val4, val5, (CapsuleDirection2D)1, num2);
				foreach (Collider2D val6 in array)
				{
					if (!list.Contains(val6))
					{
						Damagable componentInParent = ((Component)val6).GetComponentInParent<Damagable>();
						if ((Object)(object)componentInParent != (Object)null)
						{
							list.Add(val6);
							list2.Add(componentInParent);
						}
					}
				}
			}
			return list2.ToArray();
		}

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

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

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Player = PlayerManager.instance.players.First((Player p) => p.playerID == (int)info.photonView.InstantiationData[1]);
			if (DamageFromTrail != 0f)
			{
				BaseDamage = (float)info.photonView.InstantiationData[2] * DamageFromTrail;
			}
		}
	}
	public class ProjectileEffectChanceMono : MonoBehaviour
	{
		[Header("Sync Time")]
		public string RPCSyncName = "TrailBulletApply";

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

		public bool DependentOnSPS;

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

		public ObjectsToSpawn ObjectsToSpawn;

		private Player player;

		private Gun applyGun;

		private ChildRPC childRPC;

		private bool TrailBulletApply;

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

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

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

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

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

		public ParticleSystem DashParticleSystem;

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

		public float DashForce = 5000f;

		public float DashCooldown = 0.25f;

		private PlayerVelocity playerVelocity;

		private CharacterData characterData;

		private GeneralInput input;

		private ChildRPC childRPC;

		private Vector3 LastDirectionInput = Vector3.zero;

		private bool isKeyDown;

		private float keyPressResetTime;

		private float dashCooldownTime;

		private int inputKeyPressAmount;

		private int quickDashesLeft;

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

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

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

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

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

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

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

		public bool dealDamage = true;

		public int BlocksWhenRecharge;

		public float StunBlockTime;

		public Rarity MaxRarityForCurse;

		public float DamageReduction;

		public float BleedingDamage;

		public int QuickDashes;

		public float FrozenTime;

		public float OldFrozenTime;

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

		public CardRarity MaxRarityForCurse;

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

		public float StunBlockTime;

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

		public float BleedingDamage;

		public float FreezeDamage;

		public int QuickDashes;

		public override void Apply(Player player)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>();
			if (SecondToDealDamage > 0f)
			{
				orCreate.dealDamage = false;
			}
			orCreate.secondToDealDamage += SecondToDealDamage;
			orCreate.BleedingDamage += BleedingDamage;
			orCreate.QuickDashes += QuickDashes;
			if (SetMaxRarityForCurse)
			{
				Rarity rarity = RarityUtils.GetRarity(((object)(CardRarity)(ref MaxRarityForCurse)).ToString());
				orCreate.MaxRarityForCurse = RarityUtils.GetRarityData(rarity);
			}
			orCreate.BlocksWhenRecharge += BlocksWhenRecharge;
			orCreate.StunBlockTime += StunBlockTime;
		}
	}
}