Decompiled source of YaBetterRun v0.5.0

yabetterrun.dll

Decompiled 15 hours 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using UnityEngine;
using UnityEngine.Networking;

[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("yabetterrun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("yabetterrun")]
[assembly: AssemblyTitle("yabetterrun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 yabetterrun
{
	[BepInPlugin("com.yourbetterrun.mod", "You Better Run", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class YouBetterRun : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <OnStageStart>d__43 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public orig_Start orig;

			public Stage self;

			public YouBetterRun <>4__this;

			private IEnumerator<PlayerCharacterMasterController> <>s__1;

			private PlayerCharacterMasterController <player>5__2;

			private CharacterBody <body>5__3;

			private Inventory <inventory>5__4;

			private CharacterMaster <master>5__5;

			private ItemDef <functionalCoupler>5__6;

			private EquipmentIndex <seedOfLifeIndex>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<player>5__2 = null;
				<body>5__3 = null;
				<inventory>5__4 = null;
				<master>5__5 = null;
				<functionalCoupler>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Expected O, but got Unknown
				//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bb: Invalid comparison between Unknown and I4
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_0257: Invalid comparison between Unknown and I4
				//IL_0276: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = orig.Invoke(self);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (SceneInfo.instance.sceneDef.baseSceneName == "bazaar")
					{
						return false;
					}
					((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"[You Better Run] Spawning extra drones...");
					<>4__this.SpawnExtraDrones(ExtraDronesPerStage.Value);
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>s__1 = PlayerCharacterMasterController.instances.GetEnumerator();
					try
					{
						while (<>s__1.MoveNext())
						{
							<player>5__2 = <>s__1.Current;
							PlayerCharacterMasterController obj = <player>5__2;
							if ((Object)(object)((obj != null) ? obj.master : null) == (Object)null || (Object)(object)<player>5__2.master.GetBody() == (Object)null)
							{
								continue;
							}
							<body>5__3 = <player>5__2.master.GetBody();
							<inventory>5__4 = <body>5__3.inventory;
							<master>5__5 = <player>5__2.master;
							if (!((Object)(object)<inventory>5__4 == (Object)null) && !((Object)(object)<master>5__5 == (Object)null))
							{
								<inventory>5__4.GiveItemPermanent(Items.MushroomVoid, 1);
								<inventory>5__4.GiveItemPermanent(Items.EquipmentMagazine, StartingEquipmentCharges.Value);
								<functionalCoupler>5__6 = (((int)ItemCatalog.FindItemIndex("ExtraEquipment") != -1) ? ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex("ExtraEquipment")) : null);
								if ((Object)(object)<functionalCoupler>5__6 != (Object)null)
								{
									<inventory>5__4.GiveItemPermanent(<functionalCoupler>5__6, 1);
									((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"[You Better Run] Gave Functional Coupler");
								}
								else
								{
									((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)"[You Better Run] Functional Coupler not found");
								}
								<inventory>5__4.SetEquipmentIndex(Equipment.Scanner.equipmentIndex, false);
								<seedOfLifeIndex>5__7 = EquipmentCatalog.FindEquipmentIndex("EliteEarthEquipment");
								if ((int)<seedOfLifeIndex>5__7 != -1 && (Object)(object)<functionalCoupler>5__6 != (Object)null)
								{
									<inventory>5__4.SetEquipment(new EquipmentState(<seedOfLifeIndex>5__7, FixedTimeStamp.now, (byte)1, false), 0u, 1u);
									((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"[You Better Run] Gave His Reassurance to alternate slot");
								}
								<master>5__5.GiveMoney((uint)StartingMoney.Value);
								<>4__this.EnsureMinimumDrones(<master>5__5, <body>5__3, MinimumDronesPerPlayer.Value);
								Chat.AddMessage("<color=#9B59B6>The essence of " + <body>5__3.GetUserName() + " has returned as void fungi. You better run!</color>");
								Chat.AddMessage("<color=#ffffff>You're a pale imitation. Skills hurt to use.</color>");
								Chat.AddMessage("<color=#459b60>Gather drones and fungal copies of the dead to delay the inevitable.</color>");
								<body>5__3 = null;
								<inventory>5__4 = null;
								<master>5__5 = null;
								<functionalCoupler>5__6 = null;
								<player>5__2 = null;
							}
						}
					}
					finally
					{
						if (<>s__1 != null)
						{
							<>s__1.Dispose();
						}
					}
					<>s__1 = null;
					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();
			}
		}

		public static ConfigEntry<float> PlayerDamageReduction;

		public static ConfigEntry<float> PlayerAttackSpeedReduction;

		public static ConfigEntry<float> PlayerHealthReduction;

		public static ConfigEntry<float> EnemyDamageBoost;

		public static ConfigEntry<float> SkillHealthCost;

		public static ConfigEntry<float> NotSprintingDamagePercent;

		public static ConfigEntry<float> NotSprintingDamageInterval;

		public static ConfigEntry<int> ExtraDronesPerStage;

		public static ConfigEntry<int> StartingMoney;

		public static ConfigEntry<int> MinimumDronesPerPlayer;

		public static ConfigEntry<int> StartingEquipmentCharges;

		public static ConfigEntry<float> DroneHealthDrainMultiplier;

		public static ConfigEntry<float> MinionLifespan;

		public static ConfigEntry<string> PlayerColorBase;

		public static ConfigEntry<string> PlayerColorBright;

		public static ConfigEntry<string> PlayerColorPulse;

		public static ConfigEntry<string> DroneColorBase;

		public static ConfigEntry<string> DroneColorBright;

		public static ConfigEntry<string> GummyColorBase;

		public static ConfigEntry<string> GummyColorAccent;

		public static ConfigEntry<string> ReanimatedColorBase;

		public static ConfigEntry<string> ReanimatedColorAccent;

		public static ManualLogSource Log;

		private static readonly string[] FungusSpreadMessages = new string[6] { "<color=#9B59B6>The fungal spores sense fresh fuel. Something uncoils in the dark.</color>", "<color=#9B59B6>Your corruption spreads wherever you reach. A new growth emerges.</color>", "<color=#9B59B6>The void mycelium infection propagates.</color>", "<color=#9B59B6>The hyphae remember their passing.</color>", "<color=#9B59B6>Every surface we touch blooms. There is no containing the rot.</color>", "<color=#9B59B6>The void fungus hungers. It wears as many faces as it takes.</color>" };

		private static readonly string[] ReanimationMessages = new string[5] { "<color=#9B59B6>Death is not the end. The fungus remembers.</color>", "<color=#9B59B6>Spores, twisted and purple, bloom from the corpse.</color>", "<color=#9B59B6>The void claims another.</color>", "<color=#9B59B6>Mycelium threads through the nerves of dead meat. Its form will do.</color>", "<color=#9B59B6>Fungal growth, best growth.</color>" };

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			InitializeConfig();
			RegisterRiskOfOptions();
			Stage.Start += new hook_Start(OnStageStart);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(OnRecalculateStats);
			TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnTeleporterStart);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(OnEnemyRecalculateStats);
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
			HealthComponent.Heal += new hook_Heal(OnHeal);
			GenericSkill.ExecuteIfReady += new hook_ExecuteIfReady(OnSkillExecute);
			CharacterBody.OnDeathStart += new hook_OnDeathStart(OnCharacterDeath);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnPurchaseInteraction);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(OnReanimatedMinionRecalculateStats);
			GenericSkill.ExecuteIfReady += new hook_ExecuteIfReady(OnReanimatedSkillExecute);
			GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath);
			CharacterModel.UpdateOverlays += new hook_UpdateOverlays(CharacterModel_UpdateOverlays);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"You Better Run: Full Reanimation Protocol Loaded!");
		}

		public static Color ParseColor(string colorString, Color defaultColor)
		{
			//IL_0078: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string[] array = colorString.Split(',');
				if (array.Length >= 3)
				{
					float num = float.Parse(array[0].Trim());
					float num2 = float.Parse(array[1].Trim());
					float num3 = float.Parse(array[2].Trim());
					float num4 = ((array.Length >= 4) ? float.Parse(array[3].Trim()) : 1f);
					return new Color(num, num2, num3, num4);
				}
			}
			catch
			{
			}
			return defaultColor;
		}

		private void InitializeConfig()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			PlayerDamageReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Player Stats", "Damage Reduction", 0.8f, new ConfigDescription("Damage reduction multiplier for players (0.8 = 80% reduction)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			PlayerAttackSpeedReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Player Stats", "Attack Speed Reduction", 0.7f, new ConfigDescription("Attack speed reduction multiplier for players (0.7 = 70% reduction)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			PlayerHealthReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Player Stats", "Health Reduction", 0.5f, new ConfigDescription("Health reduction multiplier for players (0.5 = 50% reduction)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			EnemyDamageBoost = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy Stats", "Damage Boost", 0.15f, new ConfigDescription("Damage boost multiplier for enemies (0.15 = 15% increase)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			SkillHealthCost = ((BaseUnityPlugin)this).Config.Bind<float>("Skill Costs", "Health Cost Per Item", 0.005f, new ConfigDescription("Health cost per item when using skills (0.005 = 0.5% of max health per item)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.1f), Array.Empty<object>()));
			NotSprintingDamagePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Sprint Penalty", "Damage Percent", 0.2f, new ConfigDescription("Damage taken per interval when not sprinting (0.20 = 20% of max health)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			NotSprintingDamageInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Sprint Penalty", "Damage Interval", 1f, new ConfigDescription("How often damage is applied when not sprinting (in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			ExtraDronesPerStage = ((BaseUnityPlugin)this).Config.Bind<int>("Stage Setup", "Extra Drones Per Stage", 15, new ConfigDescription("Number of extra broken drones to spawn at stage start", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50), Array.Empty<object>()));
			StartingMoney = ((BaseUnityPlugin)this).Config.Bind<int>("Stage Setup", "Starting Money", 800, new ConfigDescription("Money given to players at stage start", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5000), Array.Empty<object>()));
			MinimumDronesPerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Stage Setup", "Minimum Drones Per Player", 3, new ConfigDescription("Minimum number of drones each player starts with", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			StartingEquipmentCharges = ((BaseUnityPlugin)this).Config.Bind<int>("Stage Setup", "Starting Equipment Charges", 3, new ConfigDescription("Number of Fuel Cells given at stage start", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			DroneHealthDrainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Drone Mechanics", "Health Drain Multiplier", 0.5f, new ConfigDescription("Multiplier for how much healing drains drone max health (0.5 = 50% of healing)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			MinionLifespan = ((BaseUnityPlugin)this).Config.Bind<float>("Reanimation", "Minion Lifespan", 60f, new ConfigDescription("How long reanimated enemies live before decaying (in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
			PlayerColorBase = ((BaseUnityPlugin)this).Config.Bind<string>("Player Visuals", "Base Color", "0.5,0.1,0.7,1", "Base purple tint color for infected players (R,G,B,A format, values 0-1).");
			PlayerColorBright = ((BaseUnityPlugin)this).Config.Bind<string>("Player Visuals", "Bright Color", "0.4,0.1,0.5,1", "Brighter purple vein color for infected players (R,G,B,A format, values 0-1).");
			PlayerColorPulse = ((BaseUnityPlugin)this).Config.Bind<string>("Player Visuals", "Pulse Color", "0.4,0.1,0.5,1", "Pulsing fungal breathing color for infected players (R,G,B,A format, values 0-1).");
			DroneColorBase = ((BaseUnityPlugin)this).Config.Bind<string>("Drone Visuals", "Base Color", "0.169,0,0.2,1", "Deep purple base color for infected drones (R,G,B,A format, values 0-1).");
			DroneColorBright = ((BaseUnityPlugin)this).Config.Bind<string>("Drone Visuals", "Bright Color", "0.6,0.2,0.8,1", "Brighter purple pulsing color for infected drones (R,G,B,A format, values 0-1).");
			GummyColorBase = ((BaseUnityPlugin)this).Config.Bind<string>("GummyClone Visuals", "Base Color", "0.5,0.1,0.7,1", "Purple base color for GummyClones (R,G,B,A format, values 0-1).");
			GummyColorAccent = ((BaseUnityPlugin)this).Config.Bind<string>("GummyClone Visuals", "Accent Color", "0.8,0.3,1.0,1", "Bright purple accent for GummyClones (R,G,B,A format, values 0-1).");
			ReanimatedColorBase = ((BaseUnityPlugin)this).Config.Bind<string>("Reanimated Visuals", "Base Color", "0.4,0,0.6,1", "Purple base color for reanimated enemies (R,G,B,A format, values 0-1).");
			ReanimatedColorAccent = ((BaseUnityPlugin)this).Config.Bind<string>("Reanimated Visuals", "Accent Color", "0.6,0.2,0.8,1", "Bright purple accent for reanimated enemies (R,G,B,A format, values 0-1).");
		}

		private void RegisterRiskOfOptions()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_003d: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_0103: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_0192: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01d4: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Expected O, but got Unknown
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Expected O, but got Unknown
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(PlayerDamageReduction, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.05f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(PlayerAttackSpeedReduction, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.05f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(PlayerHealthReduction, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.05f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(EnemyDamageBoost, new StepSliderConfig
			{
				min = 0f,
				max = 2f,
				increment = 0.05f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(SkillHealthCost, new StepSliderConfig
			{
				min = 0f,
				max = 0.1f,
				increment = 0.001f,
				FormatString = "{0:P1}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(NotSprintingDamagePercent, new StepSliderConfig
			{
				min = 0f,
				max = 1f,
				increment = 0.05f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(NotSprintingDamageInterval, new StepSliderConfig
			{
				min = 0.1f,
				max = 10f,
				increment = 0.1f,
				FormatString = "{0:0.0}s"
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ExtraDronesPerStage, new IntSliderConfig
			{
				min = 0,
				max = 50
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StartingMoney, new IntSliderConfig
			{
				min = 0,
				max = 5000
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(MinimumDronesPerPlayer, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StartingEquipmentCharges, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(DroneHealthDrainMultiplier, new StepSliderConfig
			{
				min = 0f,
				max = 2f,
				increment = 0.1f,
				FormatString = "{0:P0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(MinionLifespan, new StepSliderConfig
			{
				min = 1f,
				max = 300f,
				increment = 10f,
				FormatString = "{0:0}s"
			}));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(PlayerColorBase));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(PlayerColorBright));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(PlayerColorPulse));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(DroneColorBase));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(DroneColorBright));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(GummyColorBase));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(GummyColorAccent));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(ReanimatedColorBase));
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(ReanimatedColorAccent));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[You Better Run] Risk of Options integration successful!");
		}

		private void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			orig.Invoke(self, damageReport);
			if (NetworkServer.active && !((Object)(object)damageReport.victimBody == (Object)null) && (int)damageReport.attackerTeamIndex == 1 && (int)damageReport.victimTeamIndex != 1)
			{
				ReanimateMonster(damageReport.victimBody, damageReport.attackerMaster);
			}
		}

		private void ReanimateMonster(CharacterBody victimBody, CharacterMaster playerMaster)
		{
			//IL_006c: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)((Component)victimBody).GetComponent<GummyCloneMarker>()))
			{
				return;
			}
			string text = ((Object)((Component)victimBody.master).gameObject).name.Replace("(Clone)", "");
			GameObject val = MasterCatalog.FindMasterPrefab(text);
			if (!Object.op_Implicit((Object)(object)val))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("[You Better Run] Could not find master prefab for: " + text));
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, victimBody.corePosition, ((Component)victimBody).transform.rotation);
			CharacterMaster component = val2.GetComponent<CharacterMaster>();
			component.teamIndex = (TeamIndex)1;
			component.preventGameOver = true;
			component.destroyOnBodyDeath = true;
			BaseAI component2 = val2.GetComponent<BaseAI>();
			if ((Object)(object)component2 != (Object)null && Object.op_Implicit((Object)(object)playerMaster) && Object.op_Implicit((Object)(object)playerMaster.GetBodyObject()))
			{
				component2.leader.gameObject = playerMaster.GetBodyObject();
			}
			MinionOwnership val3 = val2.GetComponent<MinionOwnership>() ?? val2.AddComponent<MinionOwnership>();
			val3.SetOwner(playerMaster);
			NetworkServer.Spawn(val2);
			CharacterBody val4 = component.SpawnBody(victimBody.corePosition, ((Component)victimBody).transform.rotation);
			if (Object.op_Implicit((Object)(object)val4))
			{
				((Component)val4).gameObject.AddComponent<GummyCloneMarker>();
				((Component)val4).gameObject.AddComponent<FungalDecayTimer>().Initialize(val4, MinionLifespan.Value);
				ApplyFungalVisuals(val4);
				if ((Object)(object)val4.healthComponent != (Object)null)
				{
					HealthComponent healthComponent = val4.healthComponent;
					healthComponent.health *= 0.35f;
				}
				if (!Object.op_Implicit((Object)(object)((Component)val4).gameObject.GetComponent<BodyFungusAttachment>()))
				{
					BodyFungusAttachment bodyFungusAttachment = ((Component)val4).gameObject.AddComponent<BodyFungusAttachment>();
					bodyFungusAttachment.Initialize(val4);
				}
				EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/VoidSurvivorMeleeImpact"), new EffectData
				{
					origin = val4.corePosition,
					scale = 2f
				}, true);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("[You Better Run] Reanimated " + text + " as fungal minion"));
				Chat.AddMessage(ReanimationMessages[Random.Range(0, ReanimationMessages.Length)]);
			}
		}

		private void ApplyFungalVisuals(CharacterBody body)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
			{
				return;
			}
			CharacterModel component = ((Component)body.modelLocator.modelTransform).GetComponent<CharacterModel>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Color val = ParseColor(ReanimatedColorBase.Value, new Color(0.4f, 0f, 0.6f, 1f));
				Color val2 = ParseColor(ReanimatedColorAccent.Value, new Color(0.6f, 0.2f, 0.8f, 1f));
				TemporaryOverlay val3 = ((Component)component).gameObject.AddComponent<TemporaryOverlay>();
				val3.duration = float.PositiveInfinity;
				val3.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.5f);
				val3.animateShaderAlpha = true;
				val3.destroyComponentOnEnd = false;
				val3.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashBright");
				val3.AddToCharacerModel(component);
				if (Object.op_Implicit((Object)(object)val3.materialInstance))
				{
					val3.materialInstance.SetColor("_TintColor", val);
				}
				TemporaryOverlay val4 = ((Component)component).gameObject.AddComponent<TemporaryOverlay>();
				val4.duration = float.PositiveInfinity;
				val4.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.3f);
				val4.animateShaderAlpha = true;
				val4.destroyComponentOnEnd = false;
				val4.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashExpanded");
				val4.AddToCharacerModel(component);
				if (Object.op_Implicit((Object)(object)val4.materialInstance))
				{
					val4.materialInstance.SetColor("_TintColor", val2);
				}
			}
		}

		private void CharacterModel_UpdateOverlays(orig_UpdateOverlays orig, CharacterModel self)
		{
			orig.Invoke(self);
		}

		private void OnPurchaseInteraction(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, activator);
			if (NetworkServer.active)
			{
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				if (!((Object)(object)component == (Object)null) && component.isPlayerControlled && !((Object)(object)component.master == (Object)null) && !((Object)(object)((Component)component).GetComponent<GummyCloneMarker>() != (Object)null))
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)("[You Better Run] " + component.GetUserName() + " touched an interactable — spawning fungal growth"));
					SpawnGrandchildMinion(((Component)self).transform.position, component.master);
					Chat.AddMessage(FungusSpreadMessages[Random.Range(0, FungusSpreadMessages.Length)]);
				}
			}
		}

		private void OnCharacterDeath(orig_OnDeathStart orig, CharacterBody self)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00ad: 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_0065: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if ((Object)(object)self != (Object)null && (Object)(object)self.master != (Object)null && (Object)(object)self.master.minionOwnership != (Object)null && (Object)(object)self.master.minionOwnership.ownerMaster != (Object)null && (Object)(object)self.teamComponent != (Object)null && (int)self.teamComponent.teamIndex == 1 && !self.isPlayerControlled)
			{
				Vector3 corePosition = self.corePosition;
				CharacterMaster ownerMaster = self.master.minionOwnership.ownerMaster;
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"[You Better Run] Drone died at {corePosition}, spawning Grandchild minion...");
				SpawnGrandchildMinion(corePosition, ownerMaster);
			}
		}

		private void SpawnGrandchildMinion(Vector3 spawnPosition, CharacterMaster ownerMaster)
		{
			//IL_004c: 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_0075: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || (Object)(object)ownerMaster == (Object)null)
			{
				return;
			}
			GameObject val = Resources.Load<GameObject>("prefabs/charactermasters/grandchildmaster");
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[You Better Run] Could not load Grandchild master prefab — check path: prefabs/charactermasters/grandchildmaster");
				return;
			}
			Vector3 val2 = spawnPosition + new Vector3(Random.Range(-2f, 2f), 1f, Random.Range(-2f, 2f));
			GameObject val3 = Object.Instantiate<GameObject>(val, val2, Quaternion.identity);
			val3.transform.SetParent((Transform)null);
			CharacterMaster component = val3.GetComponent<CharacterMaster>();
			if ((Object)(object)component == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[You Better Run] Spawned Grandchild has no CharacterMaster");
				Object.Destroy((Object)(object)val3);
				return;
			}
			component.teamIndex = (TeamIndex)1;
			component.preventGameOver = true;
			component.destroyOnBodyDeath = true;
			MinionOwnership val4 = val3.GetComponent<MinionOwnership>();
			if ((Object)(object)val4 == (Object)null)
			{
				val4 = val3.AddComponent<MinionOwnership>();
			}
			val4.SetOwner(ownerMaster);
			NetworkServer.Spawn(val3);
			CharacterBody val5 = component.SpawnBody(val2, Quaternion.identity);
			if ((Object)(object)val5 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[You Better Run] Failed to spawn Grandchild body");
				Object.Destroy((Object)(object)val3);
				return;
			}
			ModelLocator modelLocator = val5.modelLocator;
			if ((Object)(object)((modelLocator != null) ? modelLocator.modelTransform : null) != (Object)null)
			{
				CharacterModel component2 = ((Component)val5.modelLocator.modelTransform).GetComponent<CharacterModel>();
				if ((Object)(object)component2 != (Object)null)
				{
					Color val6 = ParseColor(GummyColorBase.Value, new Color(0.5f, 0.1f, 0.7f, 1f));
					Color val7 = ParseColor(GummyColorAccent.Value, new Color(0.8f, 0.3f, 1f, 1f));
					TemporaryOverlay val8 = ((Component)component2).gameObject.AddComponent<TemporaryOverlay>();
					val8.duration = float.PositiveInfinity;
					val8.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.6f);
					val8.animateShaderAlpha = true;
					val8.destroyComponentOnEnd = false;
					val8.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashBright");
					val8.AddToCharacerModel(component2);
					if (Object.op_Implicit((Object)(object)val8.materialInstance))
					{
						val8.materialInstance.SetColor("_TintColor", val6);
					}
					TemporaryOverlay val9 = ((Component)component2).gameObject.AddComponent<TemporaryOverlay>();
					val9.duration = float.PositiveInfinity;
					val9.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.4f);
					val9.animateShaderAlpha = true;
					val9.destroyComponentOnEnd = false;
					val9.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashExpanded");
					val9.AddToCharacerModel(component2);
					if (Object.op_Implicit((Object)(object)val9.materialInstance))
					{
						val9.materialInstance.SetColor("_TintColor", val7);
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)((Component)val5).gameObject.GetComponent<BodyFungusAttachment>()))
			{
				BodyFungusAttachment bodyFungusAttachment = ((Component)val5).gameObject.AddComponent<BodyFungusAttachment>();
				bodyFungusAttachment.Initialize(val5);
			}
			GummyCloneDeathTimer gummyCloneDeathTimer = ((Component)val5).gameObject.AddComponent<GummyCloneDeathTimer>();
			gummyCloneDeathTimer.Initialize(val5, 15f);
			((Component)val5).gameObject.AddComponent<GummyCloneMarker>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"[You Better Run] Spawned purple Grandchild minion at {val2}");
		}

		private void OnRecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (!((Object)(object)sender == (Object)null) && sender.isPlayerControlled && !((Object)(object)((Component)sender).GetComponent<GummyCloneMarker>() != (Object)null))
			{
				args.damageMultAdd += 0f - PlayerDamageReduction.Value;
				args.attackSpeedMultAdd += 0f - PlayerAttackSpeedReduction.Value;
				args.healthMultAdd += 0f - PlayerHealthReduction.Value;
			}
		}

		private void OnEnemyRecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			if (!((Object)(object)sender == (Object)null) && !sender.isPlayerControlled && !((Object)(object)sender.teamComponent == (Object)null) && (int)sender.teamComponent.teamIndex == 2)
			{
				args.damageMultAdd += EnemyDamageBoost.Value;
			}
		}

		private void OnReanimatedMinionRecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			if (!((Object)(object)sender == (Object)null) && Object.op_Implicit((Object)(object)((Component)sender).GetComponent<GummyCloneMarker>()))
			{
				TeamComponent teamComponent = sender.teamComponent;
				if (teamComponent != null && (int)teamComponent.teamIndex == 1)
				{
					args.damageMultAdd += -0.7f;
				}
			}
		}

		private bool OnReanimatedSkillExecute(orig_ExecuteIfReady orig, GenericSkill self)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)self.characterBody) && (Object)(object)((Component)self.characterBody).GetComponent<GummyCloneMarker>() != (Object)null)
			{
				CharacterBody characterBody = self.characterBody;
				if ((Object)(object)characterBody.healthComponent != (Object)null)
				{
					TeamComponent teamComponent = characterBody.teamComponent;
					if (teamComponent != null && (int)teamComponent.teamIndex == 1 && self.skillFamily?.variants != null)
					{
						CharacterBody characterBody2 = self.characterBody;
						if (!((Object)(object)self == (Object)(object)((characterBody2 == null) ? null : characterBody2.skillLocator?.primary)))
						{
							CharacterBody characterBody3 = self.characterBody;
							if (!((Object)(object)self == (Object)(object)((characterBody3 == null) ? null : characterBody3.skillLocator?.secondary)))
							{
								goto IL_0117;
							}
						}
						float damage = characterBody.healthComponent.fullHealth * 0.01f;
						characterBody.healthComponent.TakeDamage(new DamageInfo
						{
							damage = damage,
							position = characterBody.corePosition,
							damageType = DamageTypeCombo.op_Implicit((DamageType)67),
							damageColorIndex = (DamageColorIndex)0
						});
					}
				}
			}
			goto IL_0117;
			IL_0117:
			return orig.Invoke(self);
		}

		private void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && self.isPlayerControlled && !((Object)(object)((Component)self).GetComponent<GummyCloneMarker>() != (Object)null))
			{
				self.AddItemBehavior<PlayerRunTrackerComponent>(1);
			}
		}

		private bool OnSkillExecute(orig_ExecuteIfReady orig, GenericSkill self)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)self.characterBody) && self.characterBody.isPlayerControlled)
			{
				if ((Object)(object)((Component)self.characterBody).GetComponent<GummyCloneMarker>() != (Object)null)
				{
					return orig.Invoke(self);
				}
				CharacterBody characterBody = self.characterBody;
				Inventory inventory = characterBody.inventory;
				if ((Object)(object)inventory != (Object)null && (Object)(object)characterBody.healthComponent != (Object)null)
				{
					int totalItemCount = inventory.GetTotalItemCount();
					if (totalItemCount > 0)
					{
						float damage = characterBody.healthComponent.fullHealth * ((float)totalItemCount * SkillHealthCost.Value);
						characterBody.healthComponent.TakeDamage(new DamageInfo
						{
							damage = damage,
							position = characterBody.corePosition,
							damageType = DamageTypeCombo.op_Implicit((DamageType)67),
							damageColorIndex = (DamageColorIndex)0
						});
						SkillDamageVisualEffect component = ((Component)characterBody).gameObject.GetComponent<SkillDamageVisualEffect>();
						if ((Object)(object)component != (Object)null)
						{
							component.TriggerRedFlash();
						}
					}
				}
			}
			return orig.Invoke(self);
		}

		private float OnHeal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0004: 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_0081: Invalid comparison between Unknown and I4
			float num = orig.Invoke(self, amount, procChainMask, nonRegen);
			if ((Object)(object)self.body == (Object)null || (Object)(object)self.body.master == (Object)null)
			{
				return num;
			}
			if ((Object)(object)self.body.master.minionOwnership != (Object)null && (Object)(object)self.body.master.minionOwnership.ownerMaster != (Object)null && (int)self.body.master.teamIndex == 1 && !self.body.isPlayerControlled && num > 0f)
			{
				DroneHealthDrainTracker droneHealthDrainTracker = ((Component)self.body).gameObject.GetComponent<DroneHealthDrainTracker>();
				if ((Object)(object)droneHealthDrainTracker == (Object)null)
				{
					droneHealthDrainTracker = ((Component)self.body).gameObject.AddComponent<DroneHealthDrainTracker>();
				}
				droneHealthDrainTracker.AccumulateDrain(num);
			}
			return num;
		}

		[IteratorStateMachine(typeof(<OnStageStart>d__43))]
		private IEnumerator OnStageStart(orig_Start orig, Stage self)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnStageStart>d__43(0)
			{
				<>4__this = this,
				orig = orig,
				self = self
			};
		}

		private void EnsureMinimumDrones(CharacterMaster playerMaster, CharacterBody body, int minimumCount)
		{
			int num = CountPlayerDrones(playerMaster);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"[You Better Run] {body.GetUserName()} has {num} drones");
			if (num < minimumCount)
			{
				int num2 = minimumCount - num;
				int num3 = AssignExistingDrones(playerMaster, body, num2);
				if (num3 < num2)
				{
					SpawnGunnerDronesForPlayer(playerMaster, body, num2 - num3);
				}
			}
		}

		private int CountPlayerDrones(CharacterMaster playerMaster)
		{
			int num = 0;
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1))
			{
				CharacterBody body = teamMember.body;
				object obj;
				if (body == null)
				{
					obj = null;
				}
				else
				{
					CharacterMaster master = body.master;
					if (master == null)
					{
						obj = null;
					}
					else
					{
						MinionOwnership minionOwnership = master.minionOwnership;
						obj = ((minionOwnership != null) ? minionOwnership.ownerMaster : null);
					}
				}
				if ((Object)obj == (Object)(object)playerMaster)
				{
					num++;
				}
			}
			return num;
		}

		private int AssignExistingDrones(CharacterMaster playerMaster, CharacterBody body, int count)
		{
			int num = 0;
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1))
			{
				if (num >= count)
				{
					break;
				}
				CharacterBody body2 = teamMember.body;
				object obj;
				if (body2 == null)
				{
					obj = null;
				}
				else
				{
					CharacterMaster master = body2.master;
					obj = ((master != null) ? master.minionOwnership : null);
				}
				if ((Object)obj != (Object)null && (Object)(object)teamMember.body.master.minionOwnership.ownerMaster == (Object)null)
				{
					teamMember.body.master.minionOwnership.SetOwner(playerMaster);
					num++;
				}
			}
			return num;
		}

		private void OnTeleporterStart(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator)
		{
			orig.Invoke(self, activator);
			SpawnTricornAtTeleporter(self);
		}

		private void SpawnTricornAtTeleporter(TeleporterInteraction teleporter)
		{
			//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_0047: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			InteractableSpawnCard val = Resources.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/iscTrophyHuntersTricorn");
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[You Better Run] Could not find Tricorn spawn card");
				return;
			}
			DirectorCore instance = DirectorCore.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)val, new DirectorPlacementRule
				{
					placementMode = (PlacementMode)3,
					position = ((Component)teleporter).gameObject.transform.position,
					minDistance = 5f,
					maxDistance = 20f
				}, Run.instance.treasureRng));
				((BaseUnityPlugin)this).Logger.LogInfo((object)"[You Better Run] Spawned Tricorn at teleporter");
			}
		}

		private void SpawnExtraDrones(int count)
		{
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"[You Better Run] Not server, skipping drone spawn");
				return;
			}
			List<string> list = new List<string> { "iscBrokenDrone1", "iscBrokenDrone2", "iscBrokenEquipmentDrone", "iscBrokenMegaDrone", "iscBrokenTurret1", "iscBrokenEmergencyDrone" };
			List<InteractableSpawnCard> list2 = new List<InteractableSpawnCard>();
			foreach (string item in list)
			{
				InteractableSpawnCard val = Resources.Load<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard/" + item);
				if ((Object)(object)val != (Object)null)
				{
					list2.Add(val);
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("[You Better Run] Failed to load: " + item));
				}
			}
			if (list2.Count == 0)
			{
				return;
			}
			int num = 0;
			for (int i = 0; i < count; i++)
			{
				DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)list2[Random.Range(0, list2.Count)], new DirectorPlacementRule
				{
					placementMode = (PlacementMode)4
				}, Run.instance.spawnRng)
				{
					ignoreTeamMemberLimit = true
				};
				if ((Object)(object)DirectorCore.instance.TrySpawnObject(val2) != (Object)null)
				{
					num++;
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"[You Better Run] Spawned {num}/{count} drones");
		}

		private void SpawnGunnerDronesForPlayer(CharacterMaster master, CharacterBody body, int count)
		{
			//IL_0047: 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_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)master == (Object)null)
			{
				return;
			}
			GameObject val = MasterCatalog.FindMasterPrefab("Drone1Master");
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[You Better Run] Could not find Drone1Master");
				return;
			}
			for (int i = 0; i < count; i++)
			{
				Vector3 val2 = body.corePosition + Random.insideUnitSphere * 3f;
				val2.y = body.corePosition.y + 2f;
				GameObject val3 = Object.Instantiate<GameObject>(val, val2, Quaternion.identity);
				CharacterMaster component = val3.GetComponent<CharacterMaster>();
				if ((Object)(object)component != (Object)null)
				{
					component.teamIndex = (TeamIndex)1;
					MinionOwnership component2 = val3.GetComponent<MinionOwnership>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.SetOwner(master);
					}
					NetworkServer.Spawn(val3);
					component.SpawnBody(val2, Quaternion.identity);
				}
			}
		}
	}
	public class BodyFungusAttachment : MonoBehaviour
	{
		private CharacterBody body;

		private readonly List<GameObject> attachedGrowths = new List<GameObject>();

		private bool initialized = false;

		private const int MaxGrowths = 8;

		private static readonly string[] NamedBones = new string[26]
		{
			"Head", "head", "Neck", "Chest", "chest", "Pelvis", "pelvis", "spine", "Spine", "HandL",
			"HandR", "hand.l", "hand.r", "UpperArmL", "UpperArmR", "LowerArmL", "LowerArmR", "ThighL", "ThighR", "CalfL",
			"CalfR", "FootL", "FootR", "Muzzle", "GunTarget", "AimOrigin"
		};

		public void Initialize(CharacterBody targetBody)
		{
			body = targetBody;
		}

		private void Update()
		{
			if (initialized)
			{
				((Behaviour)this).enabled = false;
			}
			else if (!((Object)(object)body == (Object)null) && !((Object)(object)body.modelLocator == (Object)null) && !((Object)(object)body.modelLocator.modelTransform == (Object)null))
			{
				AttachFungusGrowths();
				initialized = true;
				((Behaviour)this).enabled = false;
			}
		}

		private void AttachFungusGrowths()
		{
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Resources.Load<GameObject>("Prefabs/NetworkedObjects/MushroomVoidFungus") ?? Resources.Load<GameObject>("Prefabs/Effects/MushroomVoidEffect");
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource log = YouBetterRun.Log;
				if (log != null)
				{
					log.LogWarning((object)"[You Better Run] BodyFungusAttachment: could not find mushroom effect prefab");
				}
				return;
			}
			Transform modelTransform = body.modelLocator.modelTransform;
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			List<Transform> list = new List<Transform>();
			if ((Object)(object)component != (Object)null)
			{
				string[] namedBones = NamedBones;
				foreach (string text in namedBones)
				{
					Transform val2 = component.FindChild(text);
					if ((Object)(object)val2 != (Object)null && !list.Contains(val2))
					{
						list.Add(val2);
					}
					if (list.Count >= 8)
					{
						break;
					}
				}
			}
			if (list.Count < 4)
			{
				SkinnedMeshRenderer componentInChildren = ((Component)modelTransform).GetComponentInChildren<SkinnedMeshRenderer>();
				if ((Object)(object)componentInChildren != (Object)null && componentInChildren.bones != null && componentInChildren.bones.Length != 0)
				{
					int num = Mathf.Max(1, componentInChildren.bones.Length / 8);
					for (int j = 0; j < componentInChildren.bones.Length; j += num)
					{
						if (list.Count >= 8)
						{
							break;
						}
						Transform val3 = componentInChildren.bones[j];
						if ((Object)(object)val3 != (Object)null && !list.Contains(val3))
						{
							list.Add(val3);
						}
					}
				}
			}
			if (list.Count == 0)
			{
				list.Add(modelTransform);
			}
			int num2 = Mathf.Min(list.Count, 8);
			for (int k = 0; k < num2; k++)
			{
				Transform val4 = list[k];
				if (!((Object)(object)val4 == (Object)null))
				{
					GameObject val5 = Object.Instantiate<GameObject>(val, val4);
					val5.transform.localPosition = Vector3.zero;
					float num3 = Random.Range(0.18f, 0.3f);
					val5.transform.localScale = Vector3.one * num3;
					ParticleSystem[] componentsInChildren = val5.GetComponentsInChildren<ParticleSystem>();
					foreach (ParticleSystem val6 in componentsInChildren)
					{
						MainModule main = val6.main;
						((MainModule)(ref main)).loop = true;
						((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.05f, 0f, 0.08f, 1f), new Color(0.5f, 0.1f, 0.7f, 1f));
					}
					attachedGrowths.Add(val5);
				}
			}
			ManualLogSource log2 = YouBetterRun.Log;
			if (log2 != null)
			{
				log2.LogInfo((object)$"[You Better Run] BodyFungusAttachment: attached {attachedGrowths.Count} fungal growths");
			}
		}

		private void OnDestroy()
		{
			foreach (GameObject attachedGrowth in attachedGrowths)
			{
				if ((Object)(object)attachedGrowth != (Object)null)
				{
					Object.Destroy((Object)(object)attachedGrowth);
				}
			}
			attachedGrowths.Clear();
		}
	}
	public class PlayerRunTrackerComponent : ItemBehavior
	{
		private float damageTimer = 0f;

		private void Start()
		{
			if (Object.op_Implicit((Object)(object)base.body) && !Object.op_Implicit((Object)(object)((Component)base.body).gameObject.GetComponent<SkillDamageVisualEffect>()))
			{
				SkillDamageVisualEffect skillDamageVisualEffect = ((Component)base.body).gameObject.AddComponent<SkillDamageVisualEffect>();
				skillDamageVisualEffect.Initialize(base.body);
			}
			if (Object.op_Implicit((Object)(object)base.body) && !Object.op_Implicit((Object)(object)((Component)base.body).gameObject.GetComponent<BodyFungusAttachment>()))
			{
				BodyFungusAttachment bodyFungusAttachment = ((Component)base.body).gameObject.AddComponent<BodyFungusAttachment>();
				bodyFungusAttachment.Initialize(base.body);
			}
		}

		private void FixedUpdate()
		{
			//IL_0099: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			if ((Object)(object)base.body == (Object)null || (Object)(object)base.body.healthComponent == (Object)null || !base.body.healthComponent.alive)
			{
				return;
			}
			if (!base.body.isSprinting)
			{
				damageTimer += Time.fixedDeltaTime;
				if (damageTimer >= YouBetterRun.NotSprintingDamageInterval.Value)
				{
					damageTimer = 0f;
					base.body.healthComponent.TakeDamage(new DamageInfo
					{
						damage = base.body.healthComponent.fullHealth * YouBetterRun.NotSprintingDamagePercent.Value,
						position = base.body.corePosition,
						damageType = DamageTypeCombo.op_Implicit((DamageType)66),
						damageColorIndex = (DamageColorIndex)0
					});
				}
			}
			else
			{
				damageTimer = 0f;
			}
		}
	}
	public class DroneHealthDrainTracker : MonoBehaviour
	{
		private float accumulatedDrain = 0f;

		private float originalMaxHealth = -0.1f;

		private bool fungusApplied = false;

		public void AccumulateDrain(float amount)
		{
			accumulatedDrain += amount * YouBetterRun.DroneHealthDrainMultiplier.Value;
		}

		private void Update()
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
			if ((Object)(object)component == (Object)null || (Object)(object)component.healthComponent == (Object)null)
			{
				return;
			}
			if (originalMaxHealth < 0f)
			{
				originalMaxHealth = component.maxHealth;
			}
			if (!fungusApplied && Object.op_Implicit((Object)(object)component.modelLocator) && Object.op_Implicit((Object)(object)component.modelLocator.modelTransform))
			{
				fungusApplied = true;
				CharacterModel component2 = ((Component)component.modelLocator.modelTransform).GetComponent<CharacterModel>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Color val = YouBetterRun.ParseColor(YouBetterRun.DroneColorBase.Value, new Color(0.169f, 0f, 0.2f));
					Color val2 = YouBetterRun.ParseColor(YouBetterRun.DroneColorBright.Value, new Color(0.6f, 0.2f, 0.8f, 1f));
					TemporaryOverlay val3 = ((Component)component2).gameObject.AddComponent<TemporaryOverlay>();
					val3.duration = float.PositiveInfinity;
					val3.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.5f);
					val3.animateShaderAlpha = true;
					val3.destroyComponentOnEnd = false;
					val3.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashBright");
					val3.AddToCharacerModel(component2);
					if (Object.op_Implicit((Object)(object)val3.materialInstance))
					{
						val3.materialInstance.SetColor("_TintColor", val);
					}
					TemporaryOverlay val4 = ((Component)component2).gameObject.AddComponent<TemporaryOverlay>();
					val4.duration = float.PositiveInfinity;
					val4.alphaCurve = AnimationCurve.Constant(0f, 1f, 0.3f);
					val4.animateShaderAlpha = true;
					val4.destroyComponentOnEnd = false;
					val4.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashExpanded");
					val4.AddToCharacerModel(component2);
					if (Object.op_Implicit((Object)(object)val4.materialInstance))
					{
						val4.materialInstance.SetColor("_TintColor", val2);
					}
				}
				if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<BodyFungusAttachment>()))
				{
					BodyFungusAttachment bodyFungusAttachment = ((Component)this).gameObject.AddComponent<BodyFungusAttachment>();
					bodyFungusAttachment.Initialize(component);
				}
			}
			if (!(accumulatedDrain <= 0f))
			{
				float num = Mathf.Max(1f, originalMaxHealth - accumulatedDrain);
				if (component.healthComponent.health > num)
				{
					component.healthComponent.health = num;
				}
				if (num <= 1f)
				{
					component.healthComponent.TakeDamage(new DamageInfo
					{
						damage = component.healthComponent.fullHealth + 1f,
						position = component.corePosition,
						damageType = DamageTypeCombo.op_Implicit((DamageType)66),
						damageColorIndex = (DamageColorIndex)0
					});
				}
			}
		}
	}
	public class SkillDamageVisualEffect : MonoBehaviour
	{
		private CharacterBody body;

		private CharacterModel characterModel;

		private const float FLASH_DURATION = 0.4f;

		private Color redFlash = new Color(0.6f, 0f, 0f, 0.5f);

		private bool isFlashing = false;

		private float flashTimer = 0f;

		private float pulseTimer = 0f;

		private TemporaryOverlay pulseOverlay;

		public void Initialize(CharacterBody targetBody)
		{
			body = targetBody;
			if (Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
			{
				characterModel = ((Component)body.modelLocator.modelTransform).GetComponent<CharacterModel>();
			}
		}

		private void Start()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				Color color2 = YouBetterRun.ParseColor(YouBetterRun.PlayerColorBase.Value, new Color(0.5f, 0.1f, 0.7f, 1f));
				Color color3 = YouBetterRun.ParseColor(YouBetterRun.PlayerColorBright.Value, new Color(0.4f, 0.1f, 0.5f, 1f));
				Color color4 = YouBetterRun.ParseColor(YouBetterRun.PlayerColorPulse.Value, new Color(0.4f, 0.1f, 0.5f, 1f));
				TemporaryOverlay stored2 = null;
				MakeOverlay(Resources.Load<Material>("Materials/matHuntressFlashBright"), 0.4f, color2, ref stored2);
				MakeOverlay(Resources.Load<Material>("Materials/matHuntressFlashExpanded"), 0.25f, color3, ref stored2);
				MakeOverlay(Resources.Load<Material>("Materials/matHuntressFlashBright"), 0.15f, color4, ref pulseOverlay);
			}
			void MakeOverlay(Material mat, float alpha, Color color, ref TemporaryOverlay stored)
			{
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				TemporaryOverlay val = ((Component)characterModel).gameObject.AddComponent<TemporaryOverlay>();
				val.duration = float.PositiveInfinity;
				val.alphaCurve = AnimationCurve.Constant(0f, 1f, alpha);
				val.animateShaderAlpha = true;
				val.destroyComponentOnEnd = false;
				val.originalMaterial = mat;
				val.AddToCharacerModel(characterModel);
				if (Object.op_Implicit((Object)(object)val.materialInstance))
				{
					val.materialInstance.SetColor("_TintColor", color);
				}
				stored = val;
			}
		}

		public void TriggerRedFlash()
		{
			isFlashing = true;
			flashTimer = 0.4f;
		}

		private void Update()
		{
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			TemporaryOverlay obj = pulseOverlay;
			if ((Object)(object)((obj != null) ? obj.materialInstance : null) != (Object)null)
			{
				pulseTimer += Time.deltaTime;
				pulseOverlay.materialInstance.SetFloat("_Alpha", Mathf.Lerp(0.1f, 0.35f, Mathf.Sin(pulseTimer * 2.5f) * 0.5f + 0.5f));
			}
			if (!isFlashing || (Object)(object)characterModel == (Object)null)
			{
				return;
			}
			flashTimer -= Time.deltaTime;
			if (flashTimer > 0f)
			{
				TemporaryOverlay val = ((Component)characterModel).gameObject.AddComponent<TemporaryOverlay>();
				val.duration = 0.4f;
				val.alphaCurve = AnimationCurve.EaseInOut(0f, 0.8f, 1f, 0f);
				val.animateShaderAlpha = true;
				val.destroyComponentOnEnd = true;
				val.originalMaterial = Resources.Load<Material>("Materials/matHuntressFlashBright");
				val.AddToCharacerModel(characterModel);
				if (Object.op_Implicit((Object)(object)val.materialInstance))
				{
					val.materialInstance.SetColor("_TintColor", redFlash);
				}
				isFlashing = false;
			}
		}
	}
	public class FungalDecayTimer : MonoBehaviour
	{
		private CharacterBody body;

		private float decayPerSecond;

		public void Initialize(CharacterBody b, float duration)
		{
			body = b;
			CharacterBody obj = body;
			if ((Object)(object)((obj != null) ? obj.healthComponent : null) != (Object)null)
			{
				decayPerSecond = body.healthComponent.fullHealth / duration;
			}
		}

		private void FixedUpdate()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00c3: 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)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)
			{
				body.healthComponent.TakeDamage(new DamageInfo
				{
					damage = decayPerSecond * Time.fixedDeltaTime,
					damageType = DamageTypeCombo.op_Implicit((DamageType)3),
					attacker = null,
					position = body.corePosition,
					damageColorIndex = (DamageColorIndex)0
				});
				if (body.healthComponent.combinedHealth <= 1f)
				{
					body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
				}
			}
		}
	}
	public class GummyCloneDeathTimer : MonoBehaviour
	{
		private CharacterBody body;

		private float timer;

		public void Initialize(CharacterBody b, float d)
		{
			body = b;
			timer = d;
		}

		private void Update()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null || (Object)(object)body.healthComponent == (Object)null || !body.healthComponent.alive)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			timer -= Time.deltaTime;
			if (timer <= 0f)
			{
				body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
				Object.Destroy((Object)(object)this);
			}
		}
	}
	public class FungalHealthDrain : MonoBehaviour
	{
		private CharacterBody body;

		private float drainRate = 0.017f;

		public void Initialize(CharacterBody b, float ratePerSecond = 0.017f)
		{
			body = b;
			drainRate = ratePerSecond;
		}

		private void Update()
		{
			//IL_0051: 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_0079: 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_008a: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			if ((Object)(object)body == (Object)null || (Object)(object)body.healthComponent == (Object)null || !body.healthComponent.alive)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			body.healthComponent.TakeDamage(new DamageInfo
			{
				damage = body.healthComponent.fullHealth * drainRate * Time.deltaTime,
				position = body.corePosition,
				damageType = DamageTypeCombo.op_Implicit((DamageType)66),
				damageColorIndex = (DamageColorIndex)0
			});
		}
	}
	public class FungalResurrectedMarker : MonoBehaviour
	{
	}
	public class GummyCloneMarker : MonoBehaviour
	{
	}
}