Decompiled source of RoundsTBH v1.0.5

RoundsTBH.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Photon.Pun;
using RoundsTBH.Cards;
using RoundsTBH.MonoBehaviors;
using RoundsTBH.Patches;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RoundsTBH")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RoundsTBH")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fd2f46f9-5c1c-4ebb-bd53-18e7bb0a7cc4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RoundsTBH
{
	public class Utils
	{
		public static MethodInfo FindMethodByName(string clazz, string method, bool enumerator = false)
		{
			Type type = AccessTools.TypeByName(clazz);
			if (type != null)
			{
				MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null);
				if (enumerator && methodInfo != null)
				{
					return AccessTools.EnumeratorMoveNext((MethodBase)methodInfo);
				}
				return methodInfo;
			}
			TehBroHouse.LOGGER.LogWarning((object)("Couldn't find " + clazz + ":" + method + " (mod not loaded?)"));
			return null;
		}
	}
	[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.tbh.rounds", "TBH", "1.0.5")]
	[BepInProcess("Rounds.exe")]
	public class TehBroHouse : BaseUnityPlugin
	{
		public const string ModId = "com.tbh.rounds";

		public const string ModName = "TBH";

		public const string Version = "1.0.5";

		public static TehBroHouse Instance;

		public static ManualLogSource LOGGER;

		public static AssetBundle ArtAssets { get; private set; }

		public static ConfigEntry<bool> ConfPickTimerCurrentSelection { get; private set; }

		public static ConfigEntry<bool> ConfAIIgnoreTeammates { get; private set; }

		private void Awake()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			Instance = this;
			LOGGER = ((BaseUnityPlugin)this).Logger;
			ConfPickTimerCurrentSelection = ((BaseUnityPlugin)this).Config.Bind<bool>("TBH", "PickTimer CurrentSelection", true, "If set, pick the currently selected card when the pick timer runs out");
			ConfAIIgnoreTeammates = ((BaseUnityPlugin)this).Config.Bind<bool>("TBH", "AI IgnoreTeammates", true, "If set, AI bullets will ignore teammates");
			Harmony harmony = new Harmony("com.tbh.rounds");
			ApplyOptionalPatches(harmony, Assembly.GetExecutingAssembly());
		}

		private void Start()
		{
			ArtAssets = AssetUtils.LoadAssetBundleFromResources("tbh", typeof(TehBroHouse).Assembly);
			if ((Object)(object)ArtAssets == (Object)null)
			{
				LOGGER.LogError((object)"Failed to load tbh art asset bundle!");
			}
			CustomCard.BuildCard<LeckEierCard>();
			CustomCard.BuildCard<BoomerangButNiceCard>();
			CustomCard.BuildCard<JetpackCard>();
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
			FixOtherCards();
		}

		private void FixOtherCards()
		{
			CardInfo val = CustomCard.cards.Find((CardInfo ci) => ci.cardName.Equals("Star"));
			if ((Object)(object)val != (Object)null)
			{
				val.allowMultiple = false;
			}
		}

		public void ApplyOptionalPatches(Harmony harmony, Assembly assembly)
		{
			List<Type> list = new List<Type>();
			Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(assembly);
			foreach (Type type in typesFromAssembly)
			{
				OptionalPatchAttribute customAttribute = type.GetCustomAttribute<OptionalPatchAttribute>();
				if (customAttribute != null)
				{
					if (Chainloader.PluginInfos.ContainsKey(customAttribute.PluginGUID))
					{
						list.Add(type);
						continue;
					}
					LOGGER.LogInfo((object)("Soft dependency " + customAttribute.PluginGUID + " not found. Skipping " + type.Name + "."));
				}
				else if (((MemberInfo)type).GetCustomAttribute<HarmonyPatch>() != null)
				{
					list.Add(type);
				}
			}
			foreach (Type item in list)
			{
				List<MethodInfo> list2 = harmony.CreateClassProcessor(item).Patch();
				if (list2 != null && list2.Count > 0)
				{
					LOGGER.LogDebug((object)$"Applied {item}");
				}
				else
				{
					LOGGER.LogWarning((object)$"Couldn't apply patch {item}");
				}
			}
		}

		private IEnumerator OnGameStart(IGameModeHandler gm)
		{
			if (!PhotonNetwork.OfflineMode && PhotonNetwork.IsMasterClient)
			{
				NetworkingManager.RPC(typeof(TehBroHouse), "SyncSettings", new object[2] { ConfPickTimerCurrentSelection.Value, ConfAIIgnoreTeammates.Value });
			}
			yield break;
		}

		[UnboundRPC]
		public static void SyncSettings(bool pickTimerCurrentSelection, bool aiIgnoreTeammates)
		{
			LOGGER.LogDebug((object)$"SyncSettings {pickTimerCurrentSelection},{aiIgnoreTeammates}");
			ConfPickTimerCurrentSelection.Value = pickTimerCurrentSelection;
			ConfAIIgnoreTeammates.Value = aiIgnoreTeammates;
		}
	}
}
namespace RoundsTBH.Patches
{
	internal static class AITargetPatch
	{
		internal static Player Mono_GetClosestPlayerInOtherTeam(MonoBehaviour mono, PlayerManager playermngr, Vector3 refPos, bool needVision)
		{
			//IL_011b: 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)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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)
			if (TehBroHouse.ConfAIIgnoreTeammates.Value)
			{
				SpawnedAttack componentInParent = ((Component)mono).GetComponentInParent<SpawnedAttack>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					int num = (((Object)(object)componentInParent.spawner != (Object)null) ? componentInParent.spawner.teamID : int.MinValue);
					float num2 = float.MaxValue;
					Player result = null;
					for (int i = 0; i < playermngr.players.Count; i++)
					{
						if (!playermngr.players[i].data.dead && (playermngr.players[i].teamID != num || (Object)(object)playermngr.players[i] == (Object)(object)componentInParent.spawner))
						{
							float num3 = Vector2.Distance(Vector2.op_Implicit(refPos), playermngr.players[i].data.playerVel.position);
							if ((!needVision || playermngr.CanSeePlayer(Vector2.op_Implicit(refPos), playermngr.players[i]).canSee) && num3 < num2)
							{
								num2 = num3;
								result = playermngr.players[i];
							}
						}
					}
					return result;
				}
			}
			return playermngr.GetClosestPlayer(Vector2.op_Implicit(refPos), needVision);
		}

		internal static List<CodeInstruction> PatchCall_GetClosestPlayer(string origin, List<CodeInstruction> code)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerManager), "instance");
			MethodInfo methodInfo = AccessTools.Method(typeof(PlayerManager), "GetClosestPlayer", new Type[2]
			{
				typeof(Vector2),
				typeof(bool)
			}, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(AITargetPatch), "Mono_GetClosestPlayerInOtherTeam", (Type[])null, (Type[])null);
			bool flag = false;
			for (int i = 6; i < code.Count; i++)
			{
				if (CodeInstructionExtensions.Calls(code[i], methodInfo) && CodeInstructionExtensions.Is(code[i - 6], OpCodes.Ldsfld, (MemberInfo)fieldInfo))
				{
					code[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2);
					code.Insert(i - 6, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					i++;
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				TehBroHouse.LOGGER.LogWarning((object)("Couldn't patch GetClosestPlayer of " + origin));
			}
			return code;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(Homing), "Update")]
	internal class HomingTargetPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> code = new List<CodeInstruction>(instructions);
			return AITargetPatch.PatchCall_GetClosestPlayer("Homing", code);
		}
	}
	[Serializable]
	[HarmonyPatch]
	[OptionalPatch("com.XAngelMoonX.rounds.CosmicRounds")]
	internal class SquidTargetPatch
	{
		private static MethodBase TargetMethod()
		{
			return Utils.FindMethodByName("CR.MonoBehaviors.SquidMono", "Update");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> code = new List<CodeInstruction>(instructions);
			return AITargetPatch.PatchCall_GetClosestPlayer("Squid", code);
		}
	}
	[Serializable]
	[HarmonyPatch]
	[OptionalPatch("com.XAngelMoonX.rounds.CosmicRounds")]
	internal class DroneTargetPatch
	{
		private static MethodBase TargetMethod()
		{
			return Utils.FindMethodByName("CR.MonoBehaviors.DroneMono", "Update");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> code = new List<CodeInstruction>(instructions);
			code = AITargetPatch.PatchCall_GetClosestPlayer("Drone1", code);
			return AITargetPatch.PatchCall_GetClosestPlayer("Drone2", code);
		}
	}
	[Serializable]
	[HarmonyPatch]
	[OptionalPatch("com.XAngelMoonX.rounds.CosmicRounds")]
	internal class BeeTargetPatch
	{
		private static MethodBase TargetMethod()
		{
			return Utils.FindMethodByName("CR.MonoBehaviors.BeeMono", "Update");
		}

		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> code = new List<CodeInstruction>(instructions);
			code = AITargetPatch.PatchCall_GetClosestPlayer("Bee1", code);
			return AITargetPatch.PatchCall_GetClosestPlayer("Bee2", code);
		}
	}
	[HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")]
	[HarmonyPriority(200)]
	internal class IgonreMyBouncesPatch
	{
		private static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID, int colliderID, ref bool wasBlocked)
		{
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<BoomerangButNiceMono>()) && (Object)(object)__instance.ownPlayer != (Object)null)
			{
				Transform val = null;
				if (viewID != -1)
				{
					val = ((Component)PhotonNetwork.GetPhotonView(viewID)).transform;
				}
				if ((Object)(object)val != (Object)null)
				{
					Player component = ((Component)val).GetComponent<Player>();
					if ((Object)(object)component != (Object)null && component.playerID == __instance.ownPlayer.playerID)
					{
						return false;
					}
				}
			}
			return true;
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
	public class OptionalPatchAttribute : Attribute
	{
		public string PluginGUID { get; }

		public OptionalPatchAttribute(string pluginGUID)
		{
			PluginGUID = pluginGUID;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[OptionalPatch("ot.dan.rounds.picktimer")]
	internal class PickTimerCardChoicePatch
	{
		private static MethodBase TargetMethod()
		{
			return Utils.FindMethodByName("PickTimer.Util.PickTimerController", "StartPickTimer", enumerator: true);
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo methodInfo = AccessTools.Method(typeof(CardChoice), "Pick", new Type[2]
			{
				typeof(GameObject),
				typeof(bool)
			}, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(PickTimerCardChoicePatch), "PickCard_CurrentlySelected", (Type[])null, (Type[])null);
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.Calls(list[i], methodInfo))
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2);
					break;
				}
			}
			return list;
		}

		public static void PickCard_CurrentlySelected(CardChoice instance, GameObject card, bool clear)
		{
			Traverse obj = Traverse.Create((object)instance);
			List<GameObject> list = (List<GameObject>)obj.Field("spawnedCards").GetValue();
			int num = (int)obj.Field("currentlySelectedCard").GetValue();
			if (list != null && list.Count > 0 && num >= 0 && num < list.Count)
			{
				card = list[num];
			}
			instance.Pick(card, clear);
		}
	}
}
namespace RoundsTBH.MonoBehaviors
{
	internal class BobTheBuilderMono : MonoBehaviour
	{
		private Player player;

		private Block block;

		private void Start()
		{
			CharacterData componentInParent = ((Component)this).GetComponentInParent<CharacterData>();
			player = componentInParent.player;
			block = componentInParent.block;
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}

		private void OnBlock(BlockTriggerType blockTrigger)
		{
		}

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

		public void Destroy()
		{
			Object.Destroy((Object)(object)this);
		}
	}
	internal class BoomerangButNiceMono : MonoBehaviour
	{
		private void Start()
		{
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)this);
		}
	}
	internal class JetpackMono : MonoBehaviour
	{
		public float thrustForce = 1260f;

		public float thrustMultiplier = 1f;

		public float jetpackDuration;

		private float timeHoldingJetpack;

		private CharacterData data;

		private static GameObject MasterThrusters;

		private GameObject jet;

		private void Start()
		{
			//IL_0056: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0034: Expected O, but got Unknown
			Player component = ((Component)this).GetComponent<Player>();
			data = component.data;
			if ((Object)(object)MasterThrusters == (Object)null)
			{
				MasterThrusters = (GameObject)Resources.Load("0 cards/Thruster");
			}
			GameObject effect = MasterThrusters.GetComponent<Gun>().objectsToSpawn[0].effect;
			Vector3 position = ((Component)component).gameObject.transform.position;
			position.x += 0.12f;
			jet = Object.Instantiate<GameObject>(effect, ((Component)component).gameObject.transform.position, Quaternion.Euler(-90f, 0f, 0f), ((Component)component).gameObject.transform);
			position.y -= 1.4f;
			DelayEvent component2 = jet.GetComponent<DelayEvent>();
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component2);
			}
			RemoveAfterSeconds component3 = jet.GetComponent<RemoveAfterSeconds>();
			if ((Object)(object)component3 != (Object)null)
			{
				Object.Destroy((Object)(object)component3);
			}
			Thruster component4 = jet.GetComponent<Thruster>();
			if ((Object)(object)component4 != (Object)null)
			{
				Object.Destroy((Object)(object)component4);
			}
			jet.GetComponentInChildren<ParticleSystem>().loop = true;
			((Object)jet).name = "JetThruster";
			jet.SetActive(false);
		}

		public void OnDestroy()
		{
			if ((Object)(object)jet != (Object)null)
			{
				Object.Destroy((Object)(object)jet);
				jet = null;
			}
		}

		private void FixedUpdate()
		{
			//IL_004e: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			bool active = false;
			if (data.isPlaying)
			{
				if (((OneAxisInputControl)data.playerActions.Jump).IsPressed || ((OneAxisInputControl)data.playerActions.Jump).WasPressed)
				{
					if (timeHoldingJetpack < jetpackDuration)
					{
						Vector2 val = Vector2.up * thrustForce * thrustMultiplier;
						data.healthHandler.TakeForce(val, (ForceMode2D)0, true, true, 0f);
						timeHoldingJetpack += Time.fixedDeltaTime;
						active = true;
					}
				}
				else if (data.isGrounded)
				{
					timeHoldingJetpack = 0f;
				}
			}
			if ((Object)(object)jet != (Object)null)
			{
				jet.SetActive(active);
			}
		}
	}
	internal class LeckEierMono : MonoBehaviour
	{
		private Player player;

		private static GameObject Asset;

		public float startTime;

		private float activateTime;

		private readonly float cooldown = 3f;

		private readonly float updateDelay = 0.1f;

		private const float pushForce = 1150f;

		private const float maxDistance = 8.8f;

		private const bool pushIgnoreBlock = true;

		public void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)Asset == (Object)null)
			{
				Asset = TehBroHouse.ArtAssets.LoadAsset<GameObject>("A_LeckEier");
			}
		}

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

		public void Update()
		{
			if (Time.time >= startTime + cooldown + updateDelay)
			{
				List<Player> enemyPlayersInRange = GetEnemyPlayersInRange(player, 8.8f);
				if (enemyPlayersInRange != null && enemyPlayersInRange.Count > 0)
				{
					activateTime = Time.time + 0.28f;
					ResetTimer();
				}
			}
			else if (activateTime > 0.1f && Time.time >= activateTime)
			{
				activateTime = 0f;
				ExecAbility();
			}
		}

		private bool ExecAbility()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//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_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			List<Player> enemyPlayersInRange = GetEnemyPlayersInRange(player, 8.8f);
			if (enemyPlayersInRange != null && enemyPlayersInRange.Count > 0)
			{
				Vector2 val = Vector2.op_Implicit(((Component)player).transform.position);
				foreach (Player item in enemyPlayersInRange)
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)item).transform.position) - val;
					Vector2 val3 = ((Vector2)(ref val2)).normalized * 1150f;
					if (PhotonNetwork.OfflineMode)
					{
						item.data.healthHandler.TakeForce(val3 * 1150f, (ForceMode2D)0, false, true, 0f);
					}
					else if (((Component)player).GetComponent<PhotonView>().IsMine)
					{
						flag = true;
					}
				}
				if (flag)
				{
					int[] array = enemyPlayersInRange.Select((Player p) => p.playerID).ToArray();
					NetworkingManager.RPC(typeof(LeckEierMono), "SyncPush", new object[2] { player.playerID, array });
				}
				else
				{
					SpawnEffect(player);
				}
				return true;
			}
			return false;
		}

		[UnboundRPC]
		public static void SyncPush(int invokerId, int[] targetIds)
		{
			//IL_003b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == invokerId);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			Vector2 val2 = Vector2.op_Implicit(((Component)val).transform.position);
			foreach (int targetId in targetIds)
			{
				Player val3 = PlayerManager.instance.players.Find((Player p) => p.playerID == targetId);
				if ((Object)(object)val3 != (Object)null)
				{
					Vector2 val4 = Vector2.op_Implicit(((Component)val3).transform.position) - val2;
					Vector2 val5 = ((Vector2)(ref val4)).normalized * 1150f;
					val3.data.healthHandler.TakeForce(val5 * 1150f, (ForceMode2D)0, false, true, 0f);
				}
			}
			SpawnEffect(val);
		}

		private static void SpawnEffect(Player player)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Asset == (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(Asset);
				if (!((Object)(object)val == (Object)null))
				{
					Object.Destroy((Object)(object)val, 0.35f);
					val.transform.position = ((Component)player).transform.position;
				}
			}
		}

		private void ResetTimer()
		{
			startTime = Time.time;
		}

		private static List<Player> GetEnemyPlayersInRange(Player localplayer, float range)
		{
			//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_0012: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = null;
			Vector2 val = Vector2.op_Implicit(((Component)localplayer).transform.position);
			for (int i = 0; i < PlayerManager.instance.players.Count; i++)
			{
				if (!PlayerManager.instance.players[i].data.dead && PlayerManager.instance.players[i].teamID != localplayer.teamID && PlayerManager.instance.CanSeePlayer(val, PlayerManager.instance.players[i]).canSee && Vector2.Distance(val, PlayerManager.instance.players[i].data.playerVel.position) <= range)
				{
					if (list == null)
					{
						list = new List<Player>();
					}
					list.Add(PlayerManager.instance.players[i]);
				}
			}
			return list;
		}
	}
}
namespace RoundsTBH.Cards
{
	internal class JetpackCard : 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)
		{
			characterStats.movementSpeed *= 0.85f;
			ExtensionMethods.GetOrAddComponent<JetpackMono>(((Component)player).gameObject, false).jetpackDuration += 3.1f;
		}

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

		protected override string GetDescription()
		{
			return "They'll never know what hit them (hold Jump to activate)";
		}

		protected override GameObject GetCardArt()
		{
			return TehBroHouse.ArtAssets.LoadAsset<GameObject>("C_Jetpack");
		}

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

		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 = false,
					stat = "Movement Speed",
					amount = "-25%",
					simepleAmount = (SimpleAmount)6
				}
			};
		}

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

		public override string GetModName()
		{
			return "TBH";
		}
	}
	internal class BoomerangButNiceCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
		}

		protected override string GetTitle()
		{
			return "Boomerang, but nice";
		}

		protected override string GetDescription()
		{
			return "Your bullets know their master and pass through you.";
		}

		protected override GameObject GetCardArt()
		{
			return TehBroHouse.ArtAssets.LoadAsset<GameObject>("C_BoomerangButNice");
		}

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

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[0];
		}

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

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

		private void OnShoot(GameObject projectile)
		{
			projectile.AddComponent<BoomerangButNiceMono>();
		}
	}
	internal class LeckEierCard : CustomCard
	{
		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			block.cdAdd -= 0.25f;
			if ((Object)(object)((Component)player).gameObject.GetComponent<LeckEierMono>() == (Object)null)
			{
				((Component)player).gameObject.AddComponent<LeckEierMono>();
			}
		}

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

		protected override string GetTitle()
		{
			return "Leck Eier";
		}

		protected override string GetDescription()
		{
			return "Every couple of seconds pushes nearby enemies away.";
		}

		protected override GameObject GetCardArt()
		{
			return TehBroHouse.ArtAssets.LoadAsset<GameObject>("C_LeckEier");
		}

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

		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 = "Block Cooldown",
					amount = "-0.25s",
					simepleAmount = (SimpleAmount)0
				}
			};
		}

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

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