Decompiled source of MADGEIOS Custom Cards v1.0.5

MADGEIOSCustomCards.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnboundLib;
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("MADGEIOSCustomCards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MADGEIOSCustomCards")]
[assembly: AssemblyTitle("MADGEIOSCustomCards")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 MadgeiosDemonicCardsPack
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.madgeios.customcards", "MADGEIOS Custom Cards", "1.0.5")]
	[BepInProcess("Rounds.exe")]
	public class MyMod : BaseUnityPlugin
	{
		private const string ModId = "com.madgeios.customcards";

		private const string ModName = "MADGEIOS Custom Cards";

		private const string Version = "1.0.5";

		private void Awake()
		{
		}

		private void Start()
		{
			CustomCard.BuildCard<HeavyLeadCard>();
			CustomCard.BuildCard<BloodRitualCard>();
			CustomCard.BuildCard<BoundCard>();
			CustomCard.BuildCard<GravityWellCard>();
		}
	}
	public class HeavyLeadCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.ammo--;
			block.cdMultiplier *= 0.85f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			HeavyLeadBlockModifier orAddComponent = ExtensionMethods.GetOrAddComponent<HeavyLeadBlockModifier>(((Component)player).gameObject, false);
			orAddComponent.player = player;
			orAddComponent.block = block;
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			HeavyLeadBlockModifier component = ((Component)player).gameObject.GetComponent<HeavyLeadBlockModifier>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}

		protected override string GetTitle()
		{
			return "Heavy Lead";
		}

		protected override string GetDescription()
		{
			return "Blocking forces ALL active bullets to fall straight downward.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)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 = false,
					stat = "Ammo",
					amount = "-1",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Block Cooldown",
					amount = "-15%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		public override void Callback()
		{
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}
	}
	public class HeavyLeadBlockModifier : MonoBehaviour
	{
		public Player player;

		public Block block;

		private void Start()
		{
			if ((Object)(object)block != (Object)null)
			{
				Block obj = block;
				obj.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}

		private void OnBlock(BlockTriggerType trigger)
		{
			//IL_0052: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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)
			GameObject[] array = GameObject.FindGameObjectsWithTag("Bullet");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				MoveTransform component = val.GetComponent<MoveTransform>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				SpriteRenderer[] componentsInChildren = val.GetComponentsInChildren<SpriteRenderer>();
				SpriteRenderer[] array3 = componentsInChildren;
				foreach (SpriteRenderer val2 in array3)
				{
					val2.color = Color.red;
				}
				Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>();
				Renderer[] array4 = componentsInChildren2;
				foreach (Renderer val3 in array4)
				{
					if ((Object)(object)val3.material != (Object)null)
					{
						val3.material.color = Color.red;
					}
				}
				TrailRenderer[] componentsInChildren3 = val.GetComponentsInChildren<TrailRenderer>();
				TrailRenderer[] array5 = componentsInChildren3;
				foreach (TrailRenderer val4 in array5)
				{
					val4.startColor = Color.red;
					val4.endColor = Color.red;
				}
				component.velocity = Vector2.op_Implicit(Vector2.down * ((Vector3)(ref component.velocity)).magnitude);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)block != (Object)null)
			{
				Block obj = block;
				obj.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
			}
		}
	}
	public class BloodRitualCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			statModifiers.health *= 0.9f;
			statModifiers.movementSpeed *= 1.2f;
		}

		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 "Ritual";
		}

		protected override string GetDescription()
		{
			return "Blood for speed.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)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 = false,
					stat = "Max HP",
					amount = "-10%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Movement Speed",
					amount = "+20%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		public override void Callback()
		{
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}
	}
	public class BoundCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
			statModifiers.movementSpeed *= 0.75f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<BoundModifier>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BoundModifier component = ((Component)player).gameObject.GetComponent<BoundModifier>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}

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

		protected override string GetDescription()
		{
			return "Your bound slows you.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)5;
		}

		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 = false,
					stat = "Movement Speed",
					amount = "-25%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Regeneration",
					amount = "4% Max HP/s",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		public override void Callback()
		{
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}
	}
	public class BoundModifier : MonoBehaviour
	{
		private HealthHandler health;

		private CharacterData data;

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

		private void Update()
		{
			if (!((Object)(object)health == (Object)null) && !((Object)(object)data == (Object)null))
			{
				health.Heal(data.maxHealth * 0.04f * TimeHandler.deltaTime);
			}
		}
	}
	public class GravityWellCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
		{
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<GravityWellModifier>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			GravityWellModifier component = ((Component)player).gameObject.GetComponent<GravityWellModifier>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}

		protected override string GetTitle()
		{
			return "Gravity Well";
		}

		protected override string GetDescription()
		{
			return "Bullets entering your field only retaining 70% of their original speed.*Effect does not stack* ";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)4;
		}

		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 = false,
					stat = "Block Cooldown",
					amount = "+30%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

		public override void Callback()
		{
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}
	}
	public class GravityWellModifier : MonoBehaviour
	{
		private float radius = 4f;

		private float slowMultiplier = 0.3f;

		private GameObject radiusVisual;

		private HashSet<GameObject> slowedBullets = new HashSet<GameObject>();

		private void Start()
		{
			CreateRadiusVisual();
		}

		private void Update()
		{
			//IL_0021: 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_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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//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_00b5: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = GameObject.FindGameObjectsWithTag("Bullet");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				float num = Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(val.transform.position));
				if (num <= radius && !slowedBullets.Contains(val))
				{
					MoveTransform component = val.GetComponent<MoveTransform>();
					if (!((Object)(object)component == (Object)null))
					{
						Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref component.velocity)).normalized);
						float magnitude = ((Vector3)(ref component.velocity)).magnitude;
						component.velocity = Vector2.op_Implicit(val2 * (magnitude * slowMultiplier));
						slowedBullets.Add(val);
					}
				}
			}
			slowedBullets.RemoveWhere((GameObject b) => (Object)(object)b == (Object)null);
		}

		private void CreateRadiusVisual()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0033: 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_0084: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			radiusVisual = new GameObject("Gravity Well Radius");
			radiusVisual.transform.SetParent(((Component)this).transform);
			radiusVisual.transform.localPosition = Vector3.zero;
			LineRenderer val = radiusVisual.AddComponent<LineRenderer>();
			val.positionCount = 100;
			val.loop = true;
			val.useWorldSpace = false;
			val.widthMultiplier = 0.05f;
			((Renderer)val).material = new Material(Shader.Find("Sprites/Default"));
			for (int i = 0; i < 100; i++)
			{
				float num = (float)i * MathF.PI * 2f / 100f;
				val.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, Mathf.Sin(num) * radius, 0f));
			}
			val.startColor = new Color(0.55f, 0f, 1f, 0.25f);
			val.endColor = new Color(0.55f, 0f, 1f, 0.25f);
		}

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