Decompiled source of RSCards v1.5.1

RSCards.dll

Decompiled 3 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 BepInEx;
using BepInEx.Bootstrap;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.Utils;
using Photon.Pun;
using RSCards.Cards;
using RSCards.Utilities;
using RarityLib.Utils;
using Sonigon;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
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(".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 RSCards
{
	public class CardHolder : MonoBehaviour
	{
		public List<GameObject> Cards;

		public List<GameObject> HiddenCards;

		public static Dictionary<string, CardInfo> cards = new Dictionary<string, CardInfo>();

		internal void RegisterCards()
		{
			foreach (GameObject card in Cards)
			{
				card.AddComponent<Template>();
				if ((!RSCards.RSClasses || !(((Object)card).name == "Twin Scythe")) && (DateTools.WeekOf(new DateTime(DateTime.UtcNow.Year, 4, 1)) || !(((Object)card).name == "Repentence")) && (!DateTools.WeekOf(new DateTime(DateTime.UtcNow.Year, 4, 1)) || !(((Object)card).name == "Repentance")))
				{
					CustomCard.RegisterUnityCard(card, "RSC", card.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
					CustomCardCategories.instance.UpdateAndPullCategoriesFromCard(card.GetComponent<CardInfo>());
					cards.Add(card.GetComponent<CardInfo>().cardName, card.GetComponent<CardInfo>());
				}
			}
			foreach (GameObject hiddenCard in HiddenCards)
			{
				hiddenCard.AddComponent<Template>();
				if (DateTools.WeekOf(new DateTime(DateTime.UtcNow.Year, 4, 1)) || !(((Object)hiddenCard).name == "Repen10ce"))
				{
					CustomCard.RegisterUnityCard(hiddenCard, "RSC", hiddenCard.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
					CustomCardCategories.instance.UpdateAndPullCategoriesFromCard(hiddenCard.GetComponent<CardInfo>());
					Cards.instance.AddHiddenCard(hiddenCard.GetComponent<CardInfo>());
					cards.Add(hiddenCard.GetComponent<CardInfo>().cardName, hiddenCard.GetComponent<CardInfo>());
				}
			}
		}
	}
	[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.rsmind.rounds.RSCards", "RSCards", "1.5.1")]
	[BepInProcess("Rounds.exe")]
	public class RSCards : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <PlayerPickStart>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gm;

			public RSCards <>4__this;

			private List<Player>.Enumerator <>s__1;

			private Player <player>5__2;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>s__1 = PlayerManager.instance.players.GetEnumerator();
				try
				{
					while (<>s__1.MoveNext())
					{
						<player>5__2 = <>s__1.Current;
						if (((Component)((Component)<player>5__2.data).GetComponent<Holding>().holdable).GetComponent<Gun>().reflects >= 2)
						{
							CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Remove(RSCardCategories.BounceAbsorptionCategory);
						}
						else
						{
							CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(RSCardCategories.BounceAbsorptionCategory);
						}
						if (((Component)<player>5__2).GetComponent<CharacterStatModifiers>().lifeSteal >= 0.5f)
						{
							CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Remove(RSCardCategories.RepentanceCategory);
						}
						else
						{
							CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(RSCardCategories.RepentanceCategory);
						}
						<player>5__2 = null;
					}
				}
				finally
				{
					((IDisposable)<>s__1).Dispose();
				}
				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 const string ModId = "com.rsmind.rounds.RSCards";

		private const string ModName = "RSCards";

		public const string Version = "1.5.1";

		public const string ModInitials = "RSC";

		internal static bool RSClasses;

		public static bool Debug;

		internal static AssetBundle assets;

		public static RSCards 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.rsmind.rounds.RSCards");
			val.PatchAll();
		}

		private void Start()
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				if (pluginInfo.Value.Metadata.GUID == "com.rsmind.rounds.RSClasses")
				{
					RSClasses = true;
					break;
				}
			}
			instance = this;
			assets = AssetUtils.LoadAssetBundleFromResources("rscardart", typeof(RSCards).Assembly);
			if ((Object)(object)assets == (Object)null)
			{
				Debug.Log((object)"Failed to load RSCards asset bundle");
			}
			assets.LoadAsset<GameObject>("CardHolder").GetComponent<CardHolder>().RegisterCards();
			GameModeManager.AddHook("PlayerPickStart", (Func<IGameModeHandler, IEnumerator>)PlayerPickStart);
		}

		[IteratorStateMachine(typeof(<PlayerPickStart>d__10))]
		private IEnumerator PlayerPickStart(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayerPickStart>d__10(0)
			{
				<>4__this = this,
				gm = gm
			};
		}
	}
	internal static class RSCardCategories
	{
		public static CardCategory BounceAbsorptionCategory = CustomCardCategories.instance.CardCategory("BounceAbsorptionCategory");

		public static CardCategory RepentanceCategory = CustomCardCategories.instance.CardCategory("RepentanceCategory");
	}
}
namespace RSCards.Utilities
{
	internal static class DateTools
	{
		public static bool DayOf(DateTime holiday)
		{
			double num = DateTime.UtcNow.ToOADate();
			double num2 = holiday.AddHours(-12.0).ToOADate();
			double num3 = holiday.AddHours(36.0).ToOADate();
			return num > num2 && num < num3;
		}

		public static bool DayOf(DateTime[] holidays)
		{
			for (int i = 0; i < holidays.Length; i++)
			{
				if (DayOf(holidays[i]))
				{
					return true;
				}
			}
			return false;
		}

		public static bool WeekOf(DateTime holiday)
		{
			double num = DateTime.UtcNow.ToOADate();
			double num2 = holiday.AddDays(-6.0).AddHours(-12.0).ToOADate();
			double num3 = holiday.AddDays(6.0).AddHours(36.0).ToOADate();
			return num > num2 && num < num3;
		}

		public static bool WeekOf(DateTime[] holidays)
		{
			for (int i = 0; i < holidays.Length; i++)
			{
				if (WeekOf(holidays[i]))
				{
					return true;
				}
			}
			return false;
		}

		public static void DateTest(DateTime testDate)
		{
			if (DayOf(testDate))
			{
				Debug.Log((object)$"It's {testDate.Month}/{testDate.Day} somewhere");
			}
			else if (WeekOf(testDate))
			{
				Debug.Log((object)$"It's the week of {testDate.Month}/{testDate.Day} somewhere");
			}
			else
			{
				Debug.Log((object)$"It's not {testDate.Month}/{testDate.Day} anywhere");
			}
		}
	}
	internal class RarityAdder : MonoBehaviour
	{
		public enum Rarity
		{
			Trinket,
			Common,
			Scarce,
			Uncommon,
			Exotic,
			Rare,
			Epic,
			Legendary,
			Mythical,
			Divine,
			Unique
		}

		private string[] rarityNames = new string[11]
		{
			"Trinket", "Common", "Scarce", "Uncommon", "Exotic", "Rare", "Epic", "Legendary", "Mythical", "Divine",
			"Unique"
		};

		public Rarity rarity = Rarity.Common;

		public void Start()
		{
			//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)
			((Component)this).GetComponent<CardInfo>().rarity = RarityUtils.GetRarity(rarityNames[(int)rarity]);
		}
	}
}
namespace RSCards.Cards
{
	internal class Template : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			if (RSCards.Debug)
			{
				Debug.Log((object)("[RSC][Card] " + ((CustomCard)this).GetTitle() + " has been setup."));
			}
		}

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

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

		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 "RSC";
		}
	}
}
namespace RSCards.MonoBehaviors
{
	public class Hitscan_Bullet_Mono : MonoBehaviour
	{
		private GameObject trail;

		private void OnDestroy()
		{
			//IL_0012: 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)
			trail.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation);
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)RSCards.instance, 2f, (Action)delegate
			{
				Object.Destroy((Object)(object)trail);
			});
		}

		private void Start()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0035: 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)
			trail = new GameObject("Hitscan_Trail", new Type[1] { typeof(TrailRenderer) });
			trail.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation);
			trail.GetComponent<TrailRenderer>().startWidth = 0.1f;
			trail.GetComponent<TrailRenderer>().endWidth = 0.1f;
			trail.GetComponent<TrailRenderer>().time = 1f;
			((Renderer)trail.GetComponent<TrailRenderer>()).sharedMaterial = RSCards.assets.LoadAsset<Material>("Material");
			RayHitReflect componentInParent = ((Component)this).GetComponentInParent<RayHitReflect>();
			if (componentInParent != null)
			{
				componentInParent.reflects = 0;
			}
		}

		private void Update()
		{
			//IL_0012: 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)
			trail.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation);
		}
	}
	public class Mortar_Mono : MonoBehaviour
	{
		public bool snap;

		public bool trigger;

		public float rotateSpeed = 1000f;

		private SpawnedAttack spawned;

		private MoveTransform move;

		private float startVelocity;

		private bool isOn;

		private ProjectileHit hit;

		private float c;

		private PhotonView view;

		private ChildRPC childRPC;

		private void OnDestroy()
		{
		}

		private void Start()
		{
			childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
			view = ((Component)this).GetComponentInParent<PhotonView>();
			hit = ((Component)this).GetComponentInParent<ProjectileHit>();
			move = ((Component)this).GetComponentInParent<MoveTransform>();
			spawned = ((Component)this).GetComponentInParent<SpawnedAttack>();
			startVelocity = ((Vector3)(ref move.velocity)).magnitude;
			((Component)this).GetComponentInParent<SyncProjectile>().active = true;
		}

		private void Update()
		{
			//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_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_007b: 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_0085: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			//IL_00e3: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!view.IsMine)
				{
					return;
				}
				Vector3 val = Vector3.zero;
				if (((PlayerActionSet)spawned.spawner.data.playerActions).Device != null)
				{
					val = spawned.spawner.data.input.aimDirection;
				}
				else
				{
					val = MainCam.instance.cam.ScreenToWorldPoint(Input.mousePosition) - ((Component)this).transform.position;
					val.z = 0f;
					((Vector3)(ref val)).Normalize();
				}
				trigger = spawned.spawner.data.weaponHandler.gun.ReadyAmount() < 0.01f;
				val += Vector3.Cross(Vector3.forward, val) * move.selectedSpread;
				c += TimeHandler.deltaTime;
				if (!trigger)
				{
					return;
				}
				if (snap)
				{
					if (spawned.spawner.data.block.blockedThisFrame)
					{
						move.velocity *= -1f;
						((Behaviour)this).enabled = false;
					}
				}
				else if (((Vector3)(ref val)).magnitude > 0.2f && hit.sinceReflect > 2f)
				{
					move.velocity = Vector3.RotateTowards(move.velocity, ((Vector3)(ref val)).normalized * startVelocity, rotateSpeed * TimeHandler.deltaTime, rotateSpeed * TimeHandler.deltaTime * 10f);
					if (c > 0.1f)
					{
						c = 0f;
					}
					if (!isOn)
					{
						MoveTransform obj = move;
						obj.simulateGravity++;
					}
					isOn = true;
				}
				else
				{
					if (isOn)
					{
						MoveTransform obj2 = move;
						obj2.simulateGravity--;
					}
					isOn = false;
				}
			}
			catch
			{
			}
		}
	}
	public class Repentence_Mono : MonoBehaviour
	{
		private void Start()
		{
			Player componentInParent = ((Component)this).GetComponentInParent<Player>();
			int num = 0;
			foreach (CardInfo currentCard in componentInParent.data.currentCards)
			{
				if (currentCard.cardName == "Repentence")
				{
					num++;
				}
			}
			if (num == 9)
			{
				Cards.instance.AddCardToPlayer(componentInParent, Cards.instance.GetCardWithName("Repen10ce"), false, "", 0f, 0f);
			}
		}
	}
	internal class Scythe : MonoBehaviour
	{
		public bool ableToHit = true;

		public bool active = true;

		public float damage = 35f;

		private Player player;

		private Dictionary<int, float> recent = new Dictionary<int, float>();

		private GameObject scythe;

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)scythe);
		}

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			scythe = Object.Instantiate<GameObject>(RSCards.assets.LoadAsset<GameObject>("Scythe"), ((Component)player).transform);
			scythe.SetActive(true);
		}

		public void DoHit()
		{
			//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_003f: 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_00ab: Expected O, but got Unknown
			//IL_00d3: 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_00e8: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if (!player.data.view.IsMine)
			{
				return;
			}
			float y = ((Component)this).transform.localScale.y;
			Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(scythe.transform.position), y);
			Collider2D[] array2 = array;
			foreach (Collider2D val in array2)
			{
				ProjectileHit componentInParent = ((Component)val).gameObject.GetComponentInParent<ProjectileHit>();
				Damagable component = ((Component)val).gameObject.GetComponent<Damagable>();
				HealthHandler component2 = ((Component)val).gameObject.GetComponent<HealthHandler>();
				Vector2 val3;
				if (Object.op_Implicit((Object)(object)component2))
				{
					Player val2 = (Player)ExtensionMethods.GetFieldValue((object)component2, "player");
					SoundManager.Instance.PlayAtPosition(component2.soundBounce, ((Component)this).transform, ((Component)component).transform);
					val3 = Vector2.op_Implicit(((Component)val2).transform.position) - Vector2.op_Implicit(scythe.transform.position);
					component2.CallTakeForce(((Vector2)(ref val3)).normalized * 2500f, (ForceMode2D)1, true, false, 0f);
					ableToHit = false;
					if (((Component)(Player)ExtensionMethods.GetFieldValue((object)component2, "player")).GetComponent<Block>().blockedThisFrame)
					{
						continue;
					}
				}
				if (Object.op_Implicit((Object)(object)component))
				{
					val3 = Vector2.op_Implicit(((Component)component).transform.position) - Vector2.op_Implicit(((Component)this).transform.position);
					component.CallTakeDamage(((Vector2)(ref val3)).normalized * damage, Vector2.op_Implicit(((Component)this).transform.position), ((Component)this).gameObject, player, true);
				}
				if (Object.op_Implicit((Object)(object)componentInParent))
				{
					componentInParent.deathEvent.Invoke();
					Object.Destroy((Object)(object)((Component)componentInParent).gameObject);
				}
			}
		}

		public void UpdatePos(double angle, float rotation, float radius)
		{
			//IL_0039: 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_0062: 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)
			double num = angle * Math.PI / 180.0;
			Vector3 localPosition = default(Vector3);
			((Vector3)(ref localPosition))..ctor((float)((double)radius * Math.Sin(num)), (float)((double)radius * Math.Cos(num)), 0f);
			Quaternion rotation2 = default(Quaternion);
			((Quaternion)(ref rotation2)).eulerAngles = new Vector3(0f, 0f, rotation);
			scythe.transform.localPosition = localPosition;
			scythe.transform.rotation = rotation2;
		}

		public void SetColor(Color color)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			scythe.GetComponent<SpriteRenderer>().color = color;
		}
	}
	public class TwinScythe_Mono : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <PointEnd>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gm;

			public TwinScythe_Mono <>4__this;

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

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

			[DebuggerHidden]
			public <PointEnd>d__11(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;
				<>4__this.active = false;
				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();
			}
		}

		[CompilerGenerated]
		private sealed class <PointStart>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IGameModeHandler gm;

			public TwinScythe_Mono <>4__this;

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

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

			[DebuggerHidden]
			public <PointStart>d__10(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;
				<>4__this.active = true;
				<>4__this.rotation = 0f;
				<>4__this.angle = 0.0;
				<>4__this.UpdateStats();
				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 double angle = 0.0;

		private float rotation = 0f;

		private bool active = false;

		private Color color = new Color(0.5f, 0.5f, 0.5f);

		private List<Scythe> scythes = new List<Scythe>();

		private Player player;

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			TwinScythe_Mono[] componentsInChildren = ((Component)player).GetComponentsInChildren<TwinScythe_Mono>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (!((Object)(object)componentsInChildren[i] == (Object)(object)this))
				{
					Object.Destroy((Object)(object)this);
				}
			}
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
		}

		private void FixedUpdate()
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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)
			angle += 200f * TimeHandler.fixedDeltaTime;
			if (angle > 360.0)
			{
				foreach (Scythe scythe in scythes)
				{
					scythe.ableToHit = true;
				}
				angle -= 360.0;
			}
			rotation = (rotation - 1200f * TimeHandler.fixedDeltaTime) % 360f;
			int num = 0;
			foreach (Scythe scythe2 in scythes)
			{
				double num2 = angle + (double)(360f / (float)scythes.Count() * (float)num);
				scythe2.UpdatePos(num2, rotation, 2f);
				if (active && scythe2.ableToHit)
				{
					scythe2.DoHit();
				}
				if (scythe2.ableToHit)
				{
					Color val = color;
					val.a = 1f;
					scythe2.SetColor(val);
				}
				else
				{
					Color val2 = color;
					val2.a = 0.5f;
					scythe2.SetColor(val2);
				}
				num++;
			}
		}

		public void UpdateStats()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_009b: Expected O, but got Unknown
			color = player.GetTeamColors().color;
			int num = 0;
			foreach (CardInfo currentCard in player.data.currentCards)
			{
				if ((Object)(object)currentCard == (Object)(object)CardHolder.cards["Twin Scythe"])
				{
					num++;
				}
			}
			num = Math.Min(num, 4);
			while (scythes.Count() < num)
			{
				GameObject val = new GameObject("Scythe", new Type[1] { typeof(Scythe) });
				val.transform.SetParent(((Component)player).transform);
				scythes.Add(val.GetComponent<Scythe>());
			}
			while (scythes.Count() > Math.Max(num, 0))
			{
				Object.Destroy((Object)(object)scythes[0]);
				scythes.Remove(scythes[0]);
			}
		}

		private void OnDestroy()
		{
			GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
			while (scythes.Count() > 0)
			{
				Object.Destroy((Object)(object)scythes[0]);
				scythes.Remove(scythes[0]);
			}
		}

		[IteratorStateMachine(typeof(<PointStart>d__10))]
		private IEnumerator PointStart(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PointStart>d__10(0)
			{
				<>4__this = this,
				gm = gm
			};
		}

		[IteratorStateMachine(typeof(<PointEnd>d__11))]
		private IEnumerator PointEnd(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PointEnd>d__11(0)
			{
				<>4__this = this,
				gm = gm
			};
		}
	}
}