Decompiled source of AALUND13 Cards v1.3.1

plugins/AALUND13_Cards.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Card.Armors;
using AALUND13Card.Extensions;
using AALUND13Card.MonoBehaviours;
using AALUND13Card.MonoBehaviours.Soulstreak;
using AALUND13Card.Scripts.Handlers;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ClassesManagerReborn;
using HarmonyLib;
using JARL.Armor;
using JARL.Armor.Bases;
using JARL.Bases;
using JARL.Utils;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using Photon.Pun;
using SoundImplementation;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AALUND13Card
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.aalund13.rounds.aalund13_cards", "AALUND13 Cards", "1.3.1")]
	[BepInProcess("Rounds.exe")]
	public class AALUND13_Cards : BaseUnityPlugin
	{
		internal const string modInitials = "AAC";

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

		internal const string ModName = "AALUND13 Cards";

		internal const string Version = "1.3.1";

		internal static List<BaseUnityPlugin> plugins;

		public static AssetBundle assets = AssetUtils.LoadAssetBundleFromResources("aalund13_cards_assets", typeof(AALUND13_Cards).Assembly);

		public static CardCategory SoulstreakClassCards;

		public static AALUND13_Cards Instance { get; private set; }

		public void Awake()
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			ConfigHandler.RegesterMenu(((BaseUnityPlugin)this).Config);
			assets.LoadAsset<GameObject>("ModCards").GetComponent<CardResgester>().RegisterCards();
			ClassesRegistry.Register(CardManager.cards["__AAC__Soulstreak"].cardInfo, (CardType)1, 0);
			ClassesRegistry.Register(CardManager.cards["__AAC__Eternal Resilience"].cardInfo, (CardType)16, CardManager.cards["__AAC__Soulstreak"].cardInfo, 2);
			ClassesRegistry.Register(CardManager.cards["__AAC__Soulstealer Embrace"].cardInfo, (CardType)16, CardManager.cards["__AAC__Soulstreak"].cardInfo, 0);
			ClassesRegistry.Register(CardManager.cards["__AAC__Soul Barrier"].cardInfo, (CardType)2, CardManager.cards["__AAC__Soulstreak"].cardInfo, 0);
			ClassesRegistry.Register(CardManager.cards["__AAC__Soul Barrier Enhancement"].cardInfo, (CardType)16, CardManager.cards["__AAC__Soul Barrier"].cardInfo, 2);
			ClassesRegistry.Register(CardManager.cards["__AAC__Soul Drain"].cardInfo, (CardType)2, CardManager.cards["__AAC__Soulstreak"].cardInfo, 0);
			ClassesRegistry.Register(CardManager.cards["__AAC__Soul Drain Enhancement"].cardInfo, (CardType)16, CardManager.cards["__AAC__Soul Drain"].cardInfo, 2);
			new Harmony("com.aalund13.rounds.aalund13_cards").PatchAll();
		}

		public void Start()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			plugins = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			DeathHandler.OnPlayerDeath += new DeathHandlerDelegate(OnPlayerDeath);
			ArmorFramework.RegisterArmorType((ArmorBase)(object)new SoulArmor());
			if (plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			new GameObject("DamageHandler").AddComponent<DelayDamageHandler>();
		}

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

		public List<GameObject> HiddenCards;

		internal void RegisterCards()
		{
			foreach (GameObject card in Cards)
			{
				CustomCard.RegisterUnityCard(card, "AAC", card.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
			}
			foreach (GameObject hiddenCard in HiddenCards)
			{
				CustomCard.RegisterUnityCard(hiddenCard, "AAC", hiddenCard.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(hiddenCard.GetComponent<CardInfo>());
			}
		}
	}
	public class DamageDealSecond
	{
		public float TimeToDealDamage;

		public Vector2 Damage;

		public Vector2 Position;

		public Color BlinkColor;

		public GameObject DamagingWeapon;

		public Player DamagingPlayer;

		public bool HealthRemoval;

		public bool Lethal;

		public bool IgnoreBlock;

		public DamageDealSecond(float timeToDealDamage, Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			TimeToDealDamage = timeToDealDamage;
			Damage = damage;
			Position = position;
			BlinkColor = blinkColor;
			DamagingWeapon = damagingWeapon;
			DamagingPlayer = damagingPlayer;
			HealthRemoval = healthRemoval;
			Lethal = lethal;
			IgnoreBlock = ignoreBlock;
		}
	}
	internal class ConfigHandler
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__2_0;

			internal void <RegesterMenu>b__2_0()
			{
			}
		}

		public static ConfigEntry<bool> DetailsMode;

		public static ConfigEntry<bool> DebugMode;

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

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

		public static void NewGui(GameObject menu)
		{
			MenuHandler.CreateToggle(DebugMode.Value, "<#c41010> Debug Mode", menu, (UnityAction<bool>)DebugModeChanged, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			static void DebugModeChanged(bool val)
			{
				DebugMode.Value = val;
			}
		}
	}
	public class TabinfoInterface
	{
		public static void Setup()
		{
			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 && p.data.GetAdditionalData().SoulStreakStats.MaxHealth != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.MaxHealth * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Player Size Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.PlayerSize != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.PlayerSize * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Movement Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.MovementSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.MovementSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Attack Speed Pre Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.AttackSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.AttackSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Damage Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.Damage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.Damage * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Bullet Speed Per Kill", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.BulletSpeed != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.BulletSpeed * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Armor Percentage", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentage != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentage * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Armor Percentage Regen Rate", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentageRegenRate != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulArmorPercentageRegenRate * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Soul Drain Multiply", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().SoulStreakStats.SoulDrainMultiply != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().SoulStreakStats.SoulDrainMultiply * 100f:0}%"));
			TabInfoManager.RegisterStat(obj, "Souls", (Func<Player, bool>)((Player p) => (Object)(object)((Component)p).GetComponentInChildren<SoulstreakMono>() != (Object)null && p.data.GetAdditionalData().Souls != 0), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().Souls}"));
		}
	}
	public static class Utils
	{
		public static bool logging = ConfigHandler.DebugMode.Value;

		public static void LogInfo(string message)
		{
			if (logging)
			{
				Debug.Log((object)message);
			}
		}

		public static void LogWarn(string message)
		{
			if (logging)
			{
				Debug.LogWarning((object)message);
			}
		}

		public static void LogError(string message)
		{
			if (logging)
			{
				Debug.LogError((object)message);
			}
		}

		public static int CountOfAliveEnemyPlayers(Player player)
		{
			return PlayerStatus.GetEnemyPlayers(player).FindAll((Player __player) => !__player.data.dead).Count;
		}
	}
}
namespace AALUND13Card.Patches
{
	[HarmonyPatch(typeof(CharacterStatModifiers))]
	public class CharacterStatModifiersPatch
	{
		[HarmonyPatch("ResetStats")]
		[HarmonyPrefix]
		public static void ResetStats(CharacterStatModifiers __instance)
		{
			//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_0020: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_004b: Expected O, but got Unknown
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			CharacterDataExtensions.GetAdditionalData(val).secondToDealDamage = 0f;
			CharacterDataExtensions.GetAdditionalData(val).dealDamage = true;
			CharacterDataExtensions.GetAdditionalData(val).SoulStreakStats = new SoulStreakStats();
			CharacterDataExtensions.GetAdditionalData(val).Souls = 0u;
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	public class HealthHandlerPatch
	{
		[HarmonyPatch("DoDamage")]
		[HarmonyPrefix]
		public static void DoDamage(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0059: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			CharacterData block = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			if (block.GetAdditionalData().secondToDealDamage > 0f && !block.GetAdditionalData().dealDamage)
			{
				Vector2 damage2 = default(Vector2);
				((Vector2)(ref damage2))..ctor(damage.x, damage.y);
				ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(damage2, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
				damage = Vector2.zero;
			}
			else if (block.GetAdditionalData().dealDamage)
			{
				block.GetAdditionalData().dealDamage = false;
			}
		}
	}
}
namespace AALUND13Card.MonoBehaviours
{
	public class SoulstreakDrain : MonoBehaviour
	{
		private SoulStreakStats soulstreakStats;

		private DealDamageToPlayer dealDamageToPlayer;

		private Player player;

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

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

		public void Heal()
		{
			player.data.healthHandler.Heal(player.data.weaponHandler.gun.damage * 55f * soulstreakStats.SoulDrainMultiply * 0.25f);
		}
	}
	[Flags]
	public enum AbilityType
	{
		Armor = 1
	}
	[Serializable]
	public class SoulStreakStats
	{
		public float MaxHealth = 1f;

		public float PlayerSize = 1f;

		public float MovementSpeed = 1f;

		public float AttackSpeed = 1f;

		public float Damage = 1f;

		public float BulletSpeed = 1f;

		public float SoulArmorPercentage;

		public float SoulArmorPercentageRegenRate;

		public float SoulDrainMultiply;

		public AbilityType AbilityType;

		public void AddStats(SoulStreakStats soulStreakStats)
		{
			MaxHealth += soulStreakStats.MaxHealth;
			PlayerSize += soulStreakStats.PlayerSize;
			MovementSpeed += soulStreakStats.MovementSpeed;
			AttackSpeed += soulStreakStats.AttackSpeed;
			Damage += soulStreakStats.Damage;
			BulletSpeed += soulStreakStats.BulletSpeed;
			SoulArmorPercentage += soulStreakStats.SoulArmorPercentage;
			SoulArmorPercentageRegenRate += soulStreakStats.SoulArmorPercentageRegenRate;
			SoulDrainMultiply += soulStreakStats.SoulDrainMultiply;
			AbilityType |= soulStreakStats.AbilityType;
		}
	}
	public class SoulstreakMono : MonoBehaviour, IBattleStartHookHandler, IPointEndHookHandler
	{
		private Player player;

		private ArmorHandler armorHandler;

		public bool CanResetKills = true;

		public bool AbilityActive;

		public float AbilityCooldown;

		public GameObject SoulsCounter;

		public GameObject SoulsCounterGUI;

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

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

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

		private void Start()
		{
			//IL_00c7: 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)
			player = ((Component)((Component)this).gameObject.transform.parent).GetComponent<Player>();
			armorHandler = ((Component)player).GetComponent<ArmorHandler>();
			SoulsCounter = Object.Instantiate<GameObject>(SoulsCounter);
			if (player.data.view.IsMine && !((Behaviour)((Component)player).GetComponent<PlayerAPI>()).enabled)
			{
				SoulsCounterGUI = Object.Instantiate<GameObject>(SoulsCounterGUI);
				SoulsCounterGUI.transform.SetParent(((Component)player).transform.parent);
			}
			player.data.SetWobbleObjectChild(SoulsCounter.transform);
			SoulsCounter.transform.localPosition = Vector2.op_Implicit(new Vector2(0f, 0.3f));
			InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
		}

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

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

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

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

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

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

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

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

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

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

		public override void OnOnDestroy()
		{
			InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
		}
	}
}
namespace AALUND13Card.Scripts.Handlers
{
	public class DelayDamageHandler : MonoBehaviour, IBattleStartHookHandler
	{
		public Player player;

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

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

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

		public void OnBattleStart()
		{
			((MonoBehaviour)this).StopAllCoroutines();
		}
	}
}
namespace AALUND13Card.Extensions
{
	public class AALUND13CardCharacterDataAdditionalData
	{
		public float secondToDealDamage;

		public bool dealDamage = true;

		public SoulStreakStats SoulStreakStats = new SoulStreakStats();

		public uint Souls;
	}
	public static class CharacterDataExtensions
	{
		public static readonly ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData> data = new ConditionalWeakTable<CharacterData, AALUND13CardCharacterDataAdditionalData>();

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

		public static void AddData(this CharacterData block, AALUND13CardCharacterDataAdditionalData value)
		{
			try
			{
				data.Add(block, value);
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace AALUND13Card.CustomCards
{
	public class CustomCardAACard : CustomCardUnity
	{
		public override string GetModName()
		{
			return "AAC";
		}
	}
	public class CustomCardNumb : CustomCardAACard
	{
		public float secondToDealDamage = 5f;

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			player.data.GetAdditionalData().dealDamage = false;
			player.data.GetAdditionalData().secondToDealDamage += secondToDealDamage;
		}
	}
	public class CustomCardRandomPicker : CustomCardAACard
	{
		public List<GameObject> randomCardsToChoseFrom = new List<GameObject>();

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient)
			{
				CardInfo component = ExtensionMethods.GetRandom<GameObject>((IList)randomCardsToChoseFrom).GetComponent<CardInfo>();
				Cards.instance.AddCardToPlayer(player, component, true, "", 2f, 2f, true);
				CardBarUtils.instance.ShowAtEndOfPhase(player, component);
			}
		}
	}
	public class CustomCardSoulstreakStats : CustomCardAACard
	{
		[Header("Stats")]
		public float MaxHealth;

		[Header("Stats")]
		public float PlayerSize;

		[Header("Stats")]
		public float MovementSpeed;

		[Header("Stats")]
		public float AttackSpeed;

		[Header("Stats")]
		public float Damage;

		[Header("Stats")]
		public float BulletSpeed;

		[Header("Soul Armor")]
		public float SoulArmorPercentage;

		public float SoulArmorPercentageRegenRate;

		[Header("Ability")]
		public AbilityType AbilityType;

		public float SoulDrainMultiply;

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)AALUND13_Cards.Instance, 2, (Action)delegate
			{
				SoulStreakStats soulStreakStats = new SoulStreakStats
				{
					AttackSpeed = AttackSpeed,
					MovementSpeed = MovementSpeed,
					Damage = Damage,
					PlayerSize = PlayerSize,
					MaxHealth = MaxHealth,
					BulletSpeed = BulletSpeed,
					SoulArmorPercentage = SoulArmorPercentage,
					SoulArmorPercentageRegenRate = SoulArmorPercentageRegenRate,
					SoulDrainMultiply = SoulDrainMultiply
				};
				soulStreakStats.AbilityType |= AbilityType;
				data.GetAdditionalData().SoulStreakStats.AddStats(soulStreakStats);
			});
		}
	}
}
namespace AALUND13Card.Armors
{
	public class SoulArmor : 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.magenta * 0.6f, Color.magenta * 0.45f);
		}

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

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