Decompiled source of InsaneCards v1.0.0

InsaneCards.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using InsaneCards.Cards;
using InsaneCards.Monos;
using Microsoft.CodeAnalysis;
using UnboundLib.Cards;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("InsaneCards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InsaneCards")]
[assembly: AssemblyTitle("InsaneCards")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace InsaneCards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.My.Mod.Id", "InsaneCards", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class InsaneCards : BaseUnityPlugin
	{
		private const string ModId = "com.My.Mod.Id";

		private const string ModName = "InsaneCards";

		public const string Version = "1.0.0";

		public const string ModInitials = "IC";

		public static InsaneCards instance { get; private set; }

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.My.Mod.Id");
			val.PatchAll();
		}

		private void Start()
		{
			instance = this;
			CustomCard.BuildCard<ATrain>();
			CustomCard.BuildCard<SnipersGambit>();
		}
	}
}
namespace InsaneCards.Monos
{
	internal class ATrainMono : MonoBehaviour
	{
		public static readonly float abilityCooldown = 1E-06f;

		public static readonly float abilityDuration = 2f;

		public static readonly float heal = 300f;

		public static readonly float abilitySpeedTimes = 5f;

		private static readonly int bitesCount = 5;

		private float abilityUseTime;

		private Player player;

		private CharacterStatModifiers stats;

		private HealthHandler healthHandler;

		private bool abilityActive = false;

		private void Start()
		{
			abilityUseTime = Time.time;
			player = ((Component)this).GetComponentInParent<Player>();
			Block block = player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
			stats = player.data.stats;
			healthHandler = player.data.healthHandler;
		}

		private void OnDestroy()
		{
			Block block = player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}

		private void OnDisable()
		{
			if (abilityActive)
			{
				((MonoBehaviour)this).StopAllCoroutines();
				abilityActive = false;
				abilityUseTime = Time.time;
				DisableEffect();
			}
		}

		public void OnBlock(BlockTriggerType triggerType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)triggerType == 0 && !(Time.time < abilityUseTime))
			{
				abilityUseTime = Time.time + abilityCooldown;
				((MonoBehaviour)this).StartCoroutine(useAbility());
			}
		}

		private IEnumerator useAbility()
		{
			if (!abilityActive)
			{
				abilityActive = true;
				EnableEffect();
				for (int i = 0; i < bitesCount; i++)
				{
					yield return (object)new WaitForSeconds(abilityDuration / (float)bitesCount);
				}
				DisableEffect();
				abilityActive = false;
			}
		}

		private void EnableEffect()
		{
			CharacterStatModifiers obj = stats;
			obj.movementSpeed *= abilitySpeedTimes;
		}

		private void DisableEffect()
		{
			CharacterStatModifiers obj = stats;
			obj.movementSpeed /= abilitySpeedTimes;
		}
	}
}
namespace InsaneCards.Cards
{
	internal class ATrain : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			Debug.Log((object)("[IC][Card] " + ((CustomCard)this).GetTitle() + " has been setup."));
			cardInfo.allowMultiple = false;
			block.cdAdd = 0.3f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Debug.Log((object)string.Format("[{0}][Card] {1} has been added to player {2}.", "IC", ((CustomCard)this).GetTitle(), player.playerID));
			GameObject val = new GameObject("A_SANYA_Sandwich");
			val.transform.SetParent(((Component)player).transform);
			val.AddComponent<ATrainMono>();
			characterStats.objectsAddedToPlayer.Add(val);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			Debug.Log((object)string.Format("[{0}][Card] {1} has been removed from player {2}.", "IC", ((CustomCard)this).GetTitle(), player.playerID));
		}

		protected override string GetTitle()
		{
			return "A-Train";
		}

		protected override string GetDescription()
		{
			return $"Blocking inceases speed by {ATrainMono.abilitySpeedTimes * 100f}%.";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: 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_0015: 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_0044: 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_004c: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0070: 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_0078: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Movement speed after blocking",
					amount = (int)(100f * ATrainMono.abilitySpeedTimes) + "%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Block cooldown",
					amount = "+0.25s",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)7;
		}

		public override string GetModName()
		{
			return "IC";
		}
	}
	internal class BlockTest : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			block.forceToAdd = -10f;
			statModifiers.health = 1.2f;
			block.cdAdd = 0.25f;
		}

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

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

		protected override string GetTitle()
		{
			return "BlockTest";
		}

		protected override string GetDescription()
		{
			return "Jump backwards when you block.";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: 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_0015: 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_002b: 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
			//IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_005f: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Health",
					amount = "+20%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Block Cooldown",
					amount = "+0.25s",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)7;
		}

		public override string GetModName()
		{
			return "InsaneCards";
		}
	}
	internal class SnipersGambit : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.projectileSpeed = 1.5f;
			gun.damage = 1.2f;
			gun.unblockable = true;
			gun.ammo = -2;
			gun.projectileSize = -1.8f;
			gun.reloadTimeAdd = 1.7f;
		}

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

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

		protected override string GetTitle()
		{
			return "Sniper's Gambit";
		}

		protected override string GetDescription()
		{
			return "Trade precision for power.";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: 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_0015: 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_002b: 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
			//IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_005f: Expected O, but got Unknown
			//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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_008b: Expected O, but got Unknown
			//IL_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[6]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Attack Speed",
					amount = "50%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Damage",
					amount = "20%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Unblockable",
					amount = "",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Ammo",
					amount = "-2",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Bullet Size",
					amount = "-80%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = false,
					stat = "Reload Time",
					amount = "70%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)0;
		}

		public override string GetModName()
		{
			return "InsaneCards";
		}
	}
	internal class Template : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
		}

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

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

		protected override string GetTitle()
		{
			return "CardName";
		}

		protected override string GetDescription()
		{
			return "CardDescription";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			//IL_0009: 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_0015: 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_002b: 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
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Effect",
					amount = "No",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)7;
		}

		public override string GetModName()
		{
			return "InsaneCards";
		}
	}
}