Decompiled source of CoryCards v1.7.0

CoryPack.dll

Decompiled 2 days 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 BepInEx;
using CoryCardPack.Cards;
using CoryCardPack.MonoBehaviours;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CoryPack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CoryPack")]
[assembly: AssemblyTitle("CoryPack")]
[assembly: AssemblyVersion("1.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 CoryCardPack
{
	[BepInPlugin("cory.rounds.cardpack", "CoryCards", "1.7.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Rounds.exe")]
	public class CoryCardPackPlugin : BaseUnityPlugin
	{
		private const string ModId = "cory.rounds.cardpack";

		private const string ModName = "CoryCards";

		private const string Version = "1.7.0";

		public static CoryCardPackPlugin instance { get; private set; }

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			new Harmony("cory.rounds.cardpack").PatchAll();
		}

		private void Start()
		{
			Debug.Log((object)"[CoryCards] Loading Cory's Card Pack");
			Unbound.RegisterCredits("CoryCards", new string[1] { "Cory" }, new string[1] { "GitHub" }, new string[1] { "https://github.com/cory" });
			Debug.Log((object)"[CoryCards] Building StunResistance card...");
			CustomCard.BuildCard<StunResistance>();
			Debug.Log((object)"[CoryCards] Building VampireHeart card...");
			CustomCard.BuildCard<VampireHeart>();
			Debug.Log((object)"[CoryCards] Card registration complete!");
		}
	}
}
namespace CoryCardPack.MonoBehaviours
{
	public class VampireHeartRoundEffect : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <OnRoundStart>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public VampireHeartRoundEffect <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				VampireHeartRoundEffect vampireHeartRoundEffect = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				if ((Object)(object)vampireHeartRoundEffect.player != (Object)null && (Object)(object)vampireHeartRoundEffect.player.data != (Object)null)
				{
					vampireHeartRoundEffect.roundsApplied++;
					_ = vampireHeartRoundEffect.healthPerRound;
					_ = vampireHeartRoundEffect.roundsApplied;
					CharacterData data = vampireHeartRoundEffect.player.data;
					data.maxHealth *= 1f + vampireHeartRoundEffect.healthPerRound;
					vampireHeartRoundEffect.player.data.health = vampireHeartRoundEffect.player.data.maxHealth;
					Debug.Log((object)$"[VampireHeart] Round {vampireHeartRoundEffect.roundsApplied}: Applied {vampireHeartRoundEffect.healthPerRound * 100f}% health boost to player {vampireHeartRoundEffect.player.playerID}");
				}
				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();
			}
		}

		private Player player;

		private int roundsApplied;

		private float healthPerRound = 0.1f;

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnRoundStart);
		}

		private void OnDestroy()
		{
			GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnRoundStart);
		}

		[IteratorStateMachine(typeof(<OnRoundStart>d__5))]
		private IEnumerator OnRoundStart(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnRoundStart>d__5(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace CoryCardPack.Cards
{
	public class StunResistance : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.slow = 0.5f;
			block.cdMultiplier = 0.8f;
		}

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

		public override void OnRemoveCard()
		{
		}

		protected override string GetTitle()
		{
			return "Lightning Rod";
		}

		protected override string GetDescription()
		{
			return "Reduces stun effects by 50%";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

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

		protected override CardInfoStat[] GetStats()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[1]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Stun Resistance",
					amount = "+50%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

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

		public override string GetModName()
		{
			return "Made By\n[c0ry]";
		}
	}
	public class VampireHeart : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			statModifiers.lifeSteal = 0.25f;
			cardInfo.allowMultiple = false;
		}

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

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

		protected override string GetTitle()
		{
			return "Vampire Heart";
		}

		protected override string GetDescription()
		{
			return "Gain 25% life steal and 10% more health each round";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

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

		protected override CardInfoStat[] GetStats()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_004b: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				new CardInfoStat
				{
					positive = true,
					stat = "Life Steal",
					amount = "+25%",
					simepleAmount = (SimpleAmount)0
				},
				new CardInfoStat
				{
					positive = true,
					stat = "Health per round",
					amount = "+10%",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

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

		public override string GetModName()
		{
			return "Made By\n[c0ry]";
		}
	}
}