Decompiled source of Hypercrit2 v1.3.0

NotHypercrit.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Huntress.HuntressWeapon;
using IL.EntityStates.Huntress.HuntressWeapon;
using IL.RoR2;
using IL.RoR2.Orbs;
using LookingGlass.StatsDisplay;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MysticsItems;
using MysticsItems.Items;
using On.EntityStates.Huntress.HuntressWeapon;
using On.RoR2;
using R2API;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.Orbs;
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("NotHypercrit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4a829132e75355e7d966e90b83709ad63044bfe8")]
[assembly: AssemblyProduct("NotHypercrit")]
[assembly: AssemblyTitle("NotHypercrit")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 NotHypercrit
{
	public static class BleedExtension
	{
		public static float GetBleedDamage(this CharacterBody body)
		{
			if (!Bleed.bleedDamage.ContainsKey(body))
			{
				Bleed.bleedDamage.Add(body, 1f);
			}
			return Bleed.bleedDamage[body];
		}

		public static CharacterBody SetBleedDamage(this CharacterBody body, float value)
		{
			if (!Bleed.bleedDamage.ContainsKey(body))
			{
				Bleed.bleedDamage.Add(body, value);
			}
			else
			{
				Bleed.bleedDamage[body] = value;
			}
			return body;
		}

		public static float GetCollapseDamage(this CharacterBody body)
		{
			if (!Bleed.collapseDamage.ContainsKey(body))
			{
				Bleed.collapseDamage.Add(body, 1f);
			}
			return Bleed.collapseDamage[body];
		}

		public static CharacterBody SetCollapseDamage(this CharacterBody body, float value)
		{
			if (!Bleed.collapseDamage.ContainsKey(body))
			{
				Bleed.collapseDamage.Add(body, value);
			}
			else
			{
				Bleed.collapseDamage[body] = value;
			}
			return body;
		}
	}
	public class Bleed
	{
		public class InflictHyperbleedInfo : Main.AdditionalProcInfo
		{
			public GameObject attacker;

			public DotIndex dotIndex;

			public new void Deserialize(NetworkReader reader)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				base.Deserialize(reader);
				dotIndex = (DotIndex)reader.ReadInt32();
			}

			public new void Serialize(NetworkWriter writer)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected I4, but got Unknown
				base.Serialize(writer);
				writer.Write((int)dotIndex);
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<Run> <>9__6_0;

			public static hook_Start <>9__6_1;

			public static StatHookEventHandler <>9__6_2;

			public static Func<Instruction, bool> <>9__6_6;

			public static Func<Instruction, bool> <>9__6_7;

			public static Func<Instruction, bool> <>9__6_8;

			public static Action<DamageInfo> <>9__6_9;

			public static Func<Instruction, bool> <>9__6_10;

			public static Func<Instruction, bool> <>9__6_11;

			public static Func<Instruction, bool> <>9__6_12;

			public static Action<DamageInfo> <>9__6_13;

			public static Manipulator <>9__6_3;

			public static Func<Instruction, bool> <>9__6_14;

			public static Func<Instruction, bool> <>9__6_15;

			public static Func<Instruction, bool> <>9__6_16;

			public static Action<OnDotInflictedServerGlobalDelegate, DotController> <>9__6_17;

			public static Manipulator <>9__6_4;

			public static Func<Instruction, bool> <>9__6_19;

			public static Action<DamageDealtMessage, TeamComponent> <>9__6_20;

			public static Manipulator <>9__6_5;

			public static hook_InflictDot_refInflictDotInfo <>9__7_0;

			public static Func<Instruction, bool> <>9__7_5;

			public static Func<Instruction, bool> <>9__7_6;

			public static Manipulator <>9__7_1;

			public static hook_GetLocalizedStringByToken <>9__7_2;

			public static hook_RecalculateStats <>9__7_7;

			public static Action <>9__7_3;

			public static Func<Instruction, bool> <>9__7_8;

			public static Func<Instruction, bool> <>9__7_9;

			public static Func<float, float> <>9__7_10;

			public static Manipulator <>9__7_4;

			internal void <Patch>b__6_0(Run run)
			{
				bleedDamage.Clear();
			}

			internal void <Patch>b__6_1(orig_Start orig, CharacterBody self)
			{
				self.GetBleedDamage();
				self.GetCollapseDamage();
				orig.Invoke(self);
			}

			internal void <Patch>b__6_2(CharacterBody self, StatHookEventArgs args)
			{
				bleedDamage[self] = 1f;
				collapseDamage[self] = 1f;
			}

			internal void <Patch>b__6_3(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				int num = -1;
				if (!Main.BleedEnable.Value)
				{
					return;
				}
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance")
				});
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5)
				});
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc")
				});
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info)
				{
					if (Object.op_Implicit((Object)(object)info.attacker))
					{
						CharacterBody component2 = info.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							InflictHyperbleedInfo item2 = RollHyperbleed((DotIndex)0, component2.GetBleedDamage() - 1f, component2);
							inflictHyperBleedInfos.Add(item2);
						}
					}
				});
				if (!Main.CollapseEnable.Value)
				{
					return;
				}
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid")
				});
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 19)
				});
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc")
				});
				val.Emit(OpCodes.Ldarg, 1);
				val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info)
				{
					if (Object.op_Implicit((Object)(object)info.attacker))
					{
						CharacterBody component = info.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component.GetCollapseDamage() - 1f, component);
							inflictHyperBleedInfos.Add(item);
						}
					}
				});
			}

			internal bool <Patch>b__6_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance");
			}

			internal bool <Patch>b__6_7(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcI4(x, 5);
			}

			internal bool <Patch>b__6_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc");
			}

			internal void <Patch>b__6_9(DamageInfo info)
			{
				if (Object.op_Implicit((Object)(object)info.attacker))
				{
					CharacterBody component = info.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						InflictHyperbleedInfo item = RollHyperbleed((DotIndex)0, component.GetBleedDamage() - 1f, component);
						inflictHyperBleedInfos.Add(item);
					}
				}
			}

			internal bool <Patch>b__6_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid");
			}

			internal bool <Patch>b__6_11(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcI4(x, 19);
			}

			internal bool <Patch>b__6_12(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc");
			}

			internal void <Patch>b__6_13(DamageInfo info)
			{
				if (Object.op_Implicit((Object)(object)info.attacker))
				{
					CharacterBody component = info.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component.GetCollapseDamage() - 1f, component);
						inflictHyperBleedInfos.Add(item);
					}
				}
			}

			internal void <Patch>b__6_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke")
				});
				val.GotoPrev(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
				});
				val.Remove();
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke")
				});
				val.Remove();
				val.EmitDelegate<Action<OnDotInflictedServerGlobalDelegate, DotController>>((Action<OnDotInflictedServerGlobalDelegate, DotController>)delegate(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController self)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: 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_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Invalid comparison between Unknown and I4
					<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0
					{
						attacker = lastInfo.attackerObject,
						dotIndex = lastInfo.dotIndex
					};
					if (Object.op_Implicit((Object)(object)CS$<>8__locals0.attacker) && (((int)CS$<>8__locals0.dotIndex == 0 && Main.BleedEnable.Value) || ((int)CS$<>8__locals0.dotIndex == 8 && Main.CollapseEnable.Value)))
					{
						InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)CS$<>8__locals0.attacker && x.dotIndex == CS$<>8__locals0.dotIndex);
						if (inflictHyperbleedInfo != null)
						{
							if (inflictedServerGlobal != null)
							{
								for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++)
								{
									inflictedServerGlobal.Invoke(self, ref lastInfo);
								}
							}
							inflictHyperBleedInfos.Remove(inflictHyperbleedInfo);
						}
					}
				});
			}

			internal bool <Patch>b__6_14(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke");
			}

			internal bool <Patch>b__6_15(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, 0);
			}

			internal bool <Patch>b__6_16(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke");
			}

			internal void <Patch>b__6_17(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController self)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: 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_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0
				{
					attacker = lastInfo.attackerObject,
					dotIndex = lastInfo.dotIndex
				};
				if (!Object.op_Implicit((Object)(object)CS$<>8__locals0.attacker) || (((int)CS$<>8__locals0.dotIndex != 0 || !Main.BleedEnable.Value) && ((int)CS$<>8__locals0.dotIndex != 8 || !Main.CollapseEnable.Value)))
				{
					return;
				}
				InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)CS$<>8__locals0.attacker && x.dotIndex == CS$<>8__locals0.dotIndex);
				if (inflictHyperbleedInfo == null)
				{
					return;
				}
				if (inflictedServerGlobal != null)
				{
					for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++)
					{
						inflictedServerGlobal.Invoke(self, ref lastInfo);
					}
				}
				inflictHyperBleedInfos.Remove(inflictHyperbleedInfo);
			}

			internal void <Patch>b__6_5(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: 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_0087: 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)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber")
				});
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Pop);
				val.Remove();
				val.Emit(OpCodes.Ldloc_0);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitDelegate<Action<DamageDealtMessage, TeamComponent>>((Action<DamageDealtMessage, TeamComponent>)delegate(DamageDealtMessage msg, TeamComponent team)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Invalid comparison between Unknown and I4
					//IL_0241: Unknown result type (might be due to invalid IL or missing references)
					//IL_0258: Unknown result type (might be due to invalid IL or missing references)
					//IL_025e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0268: Expected I4, but got F4
					//IL_0268: Expected F4, but got I4
					//IL_0120: Unknown result type (might be due to invalid IL or missing references)
					//IL_0125: Unknown result type (might be due to invalid IL or missing references)
					//IL_0128: Unknown result type (might be due to invalid IL or missing references)
					//IL_012e: Invalid comparison between Unknown and I4
					//IL_0145: Unknown result type (might be due to invalid IL or missing references)
					//IL_014b: Invalid comparison between Unknown and I4
					//IL_0136: Unknown result type (might be due to invalid IL or missing references)
					//IL_0138: Unknown result type (might be due to invalid IL or missing references)
					//IL_013d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0142: Unknown result type (might be due to invalid IL or missing references)
					//IL_017c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0185: Unknown result type (might be due to invalid IL or missing references)
					//IL_0192: Unknown result type (might be due to invalid IL or missing references)
					//IL_0194: Unknown result type (might be due to invalid IL or missing references)
					//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
					//IL_0153: Unknown result type (might be due to invalid IL or missing references)
					//IL_0164: Unknown result type (might be due to invalid IL or missing references)
					//IL_0169: Unknown result type (might be due to invalid IL or missing references)
					//IL_016e: Unknown result type (might be due to invalid IL or missing references)
					//IL_020b: Unknown result type (might be due to invalid IL or missing references)
					//IL_025d->IL025d: Incompatible stack types: I4 vs F4
					//IL_025d->IL025d: Incompatible stack types: F4 vs I4
					//IL_025d->IL025d: Incompatible stack types: O vs I4
					//IL_0257->IL025d: Incompatible stack types: I4 vs O
					//IL_0257->IL025d: Incompatible stack types: I4 vs F4
					//IL_0257->IL025d: Incompatible stack types: F4 vs I4
					//IL_0257->IL025d: Incompatible stack types: O vs I4
					if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker))
					{
						CharacterBody component = msg.attacker.GetComponent<CharacterBody>();
						CharacterBody component2 = msg.victim.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2))
						{
							float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage);
							float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1));
							if (num > 0f && inverseDamage > 0f)
							{
								float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1);
								Color val2 = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2);
								if ((int)team.teamIndex == -1)
								{
									val2 *= Color.gray;
								}
								if ((int)team.teamIndex == 2)
								{
									val2 *= new Color(0.5568628f, 0.2941177f, 0.6039216f);
								}
								ParticleSystem ps = DamageNumberManager.instance.ps;
								EmitParams val3 = default(EmitParams);
								((EmitParams)(ref val3)).position = msg.position;
								((EmitParams)(ref val3)).startColor = Color32.op_Implicit(val2);
								((EmitParams)(ref val3)).applyShapeToPosition = true;
								ps.Emit(val3, 1);
								DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
								DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f);
								DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
								return;
							}
						}
					}
					object obj = DamageNumberManager.instance;
					float num3 = msg.damage;
					Vector3 position = msg.position;
					int num4 = (msg.crit ? 1 : 0);
					int num5;
					if (Object.op_Implicit((Object)(object)team))
					{
						obj = team.teamIndex;
						num3 = num4;
						num4 = (int)num3;
						num5 = (int)obj;
					}
					else
					{
						num5 = -1;
						obj = num5;
						num3 = num4;
						num4 = (int)num3;
						num5 = (int)obj;
					}
					((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj, msg.damageColorIndex);
				});
			}

			internal bool <Patch>b__6_19(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber");
			}

			internal void <Patch>b__6_20(DamageDealtMessage msg, TeamComponent team)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0258: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0268: Expected I4, but got F4
				//IL_0268: Expected F4, but got I4
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Invalid comparison between Unknown and I4
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Invalid comparison between Unknown and I4
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0169: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_025d->IL025d: Incompatible stack types: I4 vs F4
				//IL_025d->IL025d: Incompatible stack types: F4 vs I4
				//IL_025d->IL025d: Incompatible stack types: O vs I4
				//IL_0257->IL025d: Incompatible stack types: I4 vs O
				//IL_0257->IL025d: Incompatible stack types: I4 vs F4
				//IL_0257->IL025d: Incompatible stack types: F4 vs I4
				//IL_0257->IL025d: Incompatible stack types: O vs I4
				if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker))
				{
					CharacterBody component = msg.attacker.GetComponent<CharacterBody>();
					CharacterBody component2 = msg.victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2))
					{
						float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage);
						float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1));
						if (num > 0f && inverseDamage > 0f)
						{
							float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1);
							Color val = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2);
							if ((int)team.teamIndex == -1)
							{
								val *= Color.gray;
							}
							if ((int)team.teamIndex == 2)
							{
								val *= new Color(0.5568628f, 0.2941177f, 0.6039216f);
							}
							ParticleSystem ps = DamageNumberManager.instance.ps;
							EmitParams val2 = default(EmitParams);
							((EmitParams)(ref val2)).position = msg.position;
							((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val);
							((EmitParams)(ref val2)).applyShapeToPosition = true;
							ps.Emit(val2, 1);
							DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
							DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f);
							DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
							return;
						}
					}
				}
				object obj = DamageNumberManager.instance;
				float num3 = msg.damage;
				Vector3 position = msg.position;
				int num4 = (msg.crit ? 1 : 0);
				int num5;
				if (Object.op_Implicit((Object)(object)team))
				{
					obj = team.teamIndex;
					num3 = num4;
					num4 = (int)num3;
					num5 = (int)obj;
				}
				else
				{
					num5 = -1;
					obj = num5;
					num3 = num4;
					num4 = (int)num3;
					num5 = (int)obj;
				}
				((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj, msg.damageColorIndex);
			}

			internal void <PatchStack>b__7_0(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo info)
			{
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: 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_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				//IL_005c: 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_00a0: Invalid comparison between Unknown and I4
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Invalid comparison between Unknown and I4
				if (NetworkServer.active)
				{
					GameObject attackerObject = info.attackerObject;
					DotIndex dotIndex = info.dotIndex;
					if (Object.op_Implicit((Object)(object)attackerObject))
					{
						if (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value))
						{
							info.damageMultiplier *= HyperbleedMultiplier(attackerObject, dotIndex);
						}
						if ((Object)(object)info.victimObject != (Object)null)
						{
							CharacterBody component = info.victimObject.GetComponent<CharacterBody>();
							if ((Object)(object)component != (Object)null)
							{
								if ((int)info.dotIndex == 0)
								{
									info.damageMultiplier *= Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component.GetBuffCount(Buffs.Bleeding) + 1);
								}
								else if ((int)info.dotIndex == 8)
								{
									info.damageMultiplier *= Main.Calc(Main.CollapseStackMode.Value, Main.CollapseStackBase.Value, Main.CollapseStackMult.Value, Main.CollapseStackDecay.Value, component.GetBuffCount(Buffs.Fracture) + 1);
								}
							}
						}
					}
				}
				lastInfo = info;
				orig.Invoke(ref info);
			}

			internal void <PatchStack>b__7_1(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0071: 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)
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode"),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
				}))
				{
					val.Index += 2;
					val.Emit(OpCodes.Pop);
					val.Emit(OpCodes.Ldc_I4, 0);
				}
			}

			internal bool <PatchStack>b__7_5(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode");
			}

			internal bool <PatchStack>b__7_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount");
			}

			internal string <PatchStack>b__7_2(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				if (token == "ITEM_BLEEDONHITANDEXPLODE_DESC")
				{
					string text = "Gain <style=cIsDamage>5%</style> critical chance. Gain <style=cIsDamage>Bleed chance</style> equal to your <style=cIsDamage>Critical chance</style>. <style=cIsDamage>Bleeding</style> enemies <style=cIsDamage>explode</style> on death for <style=cIsDamage>400%</style> <style=cStack>(+400% per stack)</style> damage";
					if (!Main.Mods("Hayaku.VanillaRebalance"))
					{
						text += ", plus an additional <style=cIsDamage>15%</style> <style=cStack>(+15% per stack)</style> of their maximum health";
					}
					return text + ".";
				}
				return orig.Invoke(self, token);
			}

			internal void <PatchStack>b__7_3()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				object obj = <>9__7_7;
				if (obj == null)
				{
					hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
					{
						orig.Invoke(self);
						if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null))
						{
							if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0)
							{
								self.bleedChance += self.crit;
							}
							if (Main.HyperbolicBleed.Value)
							{
								self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance);
							}
						}
					};
					<>9__7_7 = val;
					obj = (object)val;
				}
				CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
			}

			internal void <PatchStack>b__7_7(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null))
				{
					if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0)
					{
						self.bleedChance += self.crit;
					}
					if (Main.HyperbolicBleed.Value)
					{
						self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance);
					}
				}
			}

			internal void <PatchStack>b__7_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 24),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x)
				});
				val.Index += 2;
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float chance) => 10f - 10f / (1f + 0.011111f * chance)));
			}

			internal bool <PatchStack>b__7_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 24);
			}

			internal bool <PatchStack>b__7_9(Instruction x)
			{
				return ILPatternMatchingExt.MatchConvR4(x);
			}

			internal float <PatchStack>b__7_10(float chance)
			{
				return 10f - 10f / (1f + 0.011111f * chance);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0
		{
			public GameObject attacker;

			public DotIndex dotIndex;

			internal bool <Patch>b__18(InflictHyperbleedInfo x)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				return (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex;
			}
		}

		public static List<InflictHyperbleedInfo> inflictHyperBleedInfos = new List<InflictHyperbleedInfo>();

		public static InflictHyperbleedInfo lastNetworkedBleedInfo = null;

		public static Dictionary<CharacterBody, float> bleedDamage = new Dictionary<CharacterBody, float>();

		public static Dictionary<CharacterBody, float> collapseDamage = new Dictionary<CharacterBody, float>();

		public static InflictDotInfo lastInfo;

		public static void Patch()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//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_007a: Expected O, but got Unknown
			//IL_0094: 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_009f: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			Main.Log.LogDebug((object)"The Spirit of TheMysticSword Burns Alight...");
			Run.onRunStartGlobal += delegate
			{
				bleedDamage.Clear();
			};
			object obj = <>c.<>9__6_1;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, CharacterBody self)
				{
					self.GetBleedDamage();
					self.GetCollapseDamage();
					orig.Invoke(self);
				};
				<>c.<>9__6_1 = val;
				obj = (object)val;
			}
			CharacterBody.Start += (hook_Start)obj;
			object obj2 = <>c.<>9__6_2;
			if (obj2 == null)
			{
				StatHookEventHandler val2 = delegate(CharacterBody self, StatHookEventArgs args)
				{
					bleedDamage[self] = 1f;
					collapseDamage[self] = 1f;
				};
				<>c.<>9__6_2 = val2;
				obj2 = (object)val2;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
			object obj3 = <>c.<>9__6_3;
			if (obj3 == null)
			{
				Manipulator val3 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_00af: Unknown result type (might be due to invalid IL or missing references)
					//IL_0185: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val10 = new ILCursor(il);
					int num6 = -1;
					if (Main.BleedEnable.Value)
					{
						val10.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance")
						});
						val10.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5)
						});
						val10.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc")
						});
						val10.Emit(OpCodes.Ldarg_1);
						val10.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info)
						{
							if (Object.op_Implicit((Object)(object)info.attacker))
							{
								CharacterBody component4 = info.attacker.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component4))
								{
									InflictHyperbleedInfo item2 = RollHyperbleed((DotIndex)0, component4.GetBleedDamage() - 1f, component4);
									inflictHyperBleedInfos.Add(item2);
								}
							}
						});
						if (Main.CollapseEnable.Value)
						{
							val10.GotoNext(new Func<Instruction, bool>[1]
							{
								(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid")
							});
							val10.GotoNext(new Func<Instruction, bool>[1]
							{
								(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 19)
							});
							val10.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
							{
								(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc")
							});
							val10.Emit(OpCodes.Ldarg, 1);
							val10.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info)
							{
								if (Object.op_Implicit((Object)(object)info.attacker))
								{
									CharacterBody component3 = info.attacker.GetComponent<CharacterBody>();
									if (Object.op_Implicit((Object)(object)component3))
									{
										InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component3.GetCollapseDamage() - 1f, component3);
										inflictHyperBleedInfos.Add(item);
									}
								}
							});
						}
					}
				};
				<>c.<>9__6_3 = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj3;
			object obj4 = <>c.<>9__6_4;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val9 = new ILCursor(il);
					val9.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke")
					});
					val9.GotoPrev(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
					});
					val9.Remove();
					val9.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke")
					});
					val9.Remove();
					val9.EmitDelegate<Action<OnDotInflictedServerGlobalDelegate, DotController>>((Action<OnDotInflictedServerGlobalDelegate, DotController>)delegate(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController self)
					{
						//IL_001d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: 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_0049: Unknown result type (might be due to invalid IL or missing references)
						//IL_004f: Invalid comparison between Unknown and I4
						GameObject attacker = lastInfo.attackerObject;
						DotIndex dotIndex = lastInfo.dotIndex;
						if (Object.op_Implicit((Object)(object)attacker) && (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value)))
						{
							InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex);
							if (inflictHyperbleedInfo != null)
							{
								if (inflictedServerGlobal != null)
								{
									for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++)
									{
										inflictedServerGlobal.Invoke(self, ref lastInfo);
									}
								}
								inflictHyperBleedInfos.Remove(inflictHyperbleedInfo);
							}
						}
					});
				};
				<>c.<>9__6_4 = val4;
				obj4 = (object)val4;
			}
			DotController.InflictDot_refInflictDotInfo += (Manipulator)obj4;
			if (!Main.BleedEnable.Value || Main.BleedColor.Value <= 1)
			{
				return;
			}
			object obj5 = <>c.<>9__6_5;
			if (obj5 == null)
			{
				Manipulator val5 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_0050: Unknown result type (might be due to invalid IL or missing references)
					//IL_005c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: 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_0087: 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)
					ILCursor val6 = new ILCursor(il);
					val6.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber")
					});
					val6.Emit(OpCodes.Pop);
					val6.Emit(OpCodes.Pop);
					val6.Emit(OpCodes.Pop);
					val6.Emit(OpCodes.Pop);
					val6.Emit(OpCodes.Pop);
					val6.Emit(OpCodes.Pop);
					val6.Remove();
					val6.Emit(OpCodes.Ldloc_0);
					val6.Emit(OpCodes.Ldloc_2);
					val6.EmitDelegate<Action<DamageDealtMessage, TeamComponent>>((Action<DamageDealtMessage, TeamComponent>)delegate(DamageDealtMessage msg, TeamComponent team)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Invalid comparison between Unknown and I4
						//IL_0241: Unknown result type (might be due to invalid IL or missing references)
						//IL_0258: Unknown result type (might be due to invalid IL or missing references)
						//IL_025e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0268: Expected I4, but got F4
						//IL_0268: Expected F4, but got I4
						//IL_0120: Unknown result type (might be due to invalid IL or missing references)
						//IL_0125: Unknown result type (might be due to invalid IL or missing references)
						//IL_0128: Unknown result type (might be due to invalid IL or missing references)
						//IL_012e: Invalid comparison between Unknown and I4
						//IL_0145: Unknown result type (might be due to invalid IL or missing references)
						//IL_014b: Invalid comparison between Unknown and I4
						//IL_0136: Unknown result type (might be due to invalid IL or missing references)
						//IL_0138: Unknown result type (might be due to invalid IL or missing references)
						//IL_013d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0142: Unknown result type (might be due to invalid IL or missing references)
						//IL_017c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0185: Unknown result type (might be due to invalid IL or missing references)
						//IL_0192: Unknown result type (might be due to invalid IL or missing references)
						//IL_0194: Unknown result type (might be due to invalid IL or missing references)
						//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
						//IL_0153: Unknown result type (might be due to invalid IL or missing references)
						//IL_0164: Unknown result type (might be due to invalid IL or missing references)
						//IL_0169: Unknown result type (might be due to invalid IL or missing references)
						//IL_016e: Unknown result type (might be due to invalid IL or missing references)
						//IL_020b: Unknown result type (might be due to invalid IL or missing references)
						//IL_025d->IL025d: Incompatible stack types: I4 vs F4
						//IL_025d->IL025d: Incompatible stack types: F4 vs I4
						//IL_025d->IL025d: Incompatible stack types: O vs I4
						//IL_0257->IL025d: Incompatible stack types: I4 vs O
						//IL_0257->IL025d: Incompatible stack types: I4 vs F4
						//IL_0257->IL025d: Incompatible stack types: F4 vs I4
						//IL_0257->IL025d: Incompatible stack types: O vs I4
						if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker))
						{
							CharacterBody component = msg.attacker.GetComponent<CharacterBody>();
							CharacterBody component2 = msg.victim.GetComponent<CharacterBody>();
							if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2))
							{
								float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage);
								float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1));
								if (num > 0f && inverseDamage > 0f)
								{
									float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1);
									Color val7 = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2);
									if ((int)team.teamIndex == -1)
									{
										val7 *= Color.gray;
									}
									if ((int)team.teamIndex == 2)
									{
										val7 *= new Color(0.5568628f, 0.2941177f, 0.6039216f);
									}
									ParticleSystem ps = DamageNumberManager.instance.ps;
									EmitParams val8 = default(EmitParams);
									((EmitParams)(ref val8)).position = msg.position;
									((EmitParams)(ref val8)).startColor = Color32.op_Implicit(val7);
									((EmitParams)(ref val8)).applyShapeToPosition = true;
									ps.Emit(val8, 1);
									DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
									DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f);
									DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0);
									return;
								}
							}
						}
						object obj6 = DamageNumberManager.instance;
						float num3 = msg.damage;
						Vector3 position = msg.position;
						int num4 = (msg.crit ? 1 : 0);
						int num5;
						if (Object.op_Implicit((Object)(object)team))
						{
							obj6 = team.teamIndex;
							num3 = num4;
							num4 = (int)num3;
							num5 = (int)obj6;
						}
						else
						{
							num5 = -1;
							obj6 = num5;
							num3 = num4;
							num4 = (int)num3;
							num5 = (int)obj6;
						}
						((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj6, msg.damageColorIndex);
					});
				};
				<>c.<>9__6_5 = val5;
				obj5 = (object)val5;
			}
			HealthComponent.HandleDamageDealt += (Manipulator)obj5;
		}

		public static void PatchStack()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_00d5: 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)
			//IL_00e0: Expected O, but got Unknown
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				hook_InflictDot_refInflictDotInfo val = delegate(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo info)
				{
					//IL_014a: Unknown result type (might be due to invalid IL or missing references)
					//IL_014f: 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_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Invalid comparison between Unknown and I4
					//IL_005c: 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_00a0: Invalid comparison between Unknown and I4
					//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f7: Invalid comparison between Unknown and I4
					if (NetworkServer.active)
					{
						GameObject attackerObject = info.attackerObject;
						DotIndex dotIndex = info.dotIndex;
						if (Object.op_Implicit((Object)(object)attackerObject))
						{
							if (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value))
							{
								info.damageMultiplier *= HyperbleedMultiplier(attackerObject, dotIndex);
							}
							if ((Object)(object)info.victimObject != (Object)null)
							{
								CharacterBody component = info.victimObject.GetComponent<CharacterBody>();
								if ((Object)(object)component != (Object)null)
								{
									if ((int)info.dotIndex == 0)
									{
										info.damageMultiplier *= Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component.GetBuffCount(Buffs.Bleeding) + 1);
									}
									else if ((int)info.dotIndex == 8)
									{
										info.damageMultiplier *= Main.Calc(Main.CollapseStackMode.Value, Main.CollapseStackBase.Value, Main.CollapseStackMult.Value, Main.CollapseStackDecay.Value, component.GetBuffCount(Buffs.Fracture) + 1);
									}
								}
							}
						}
					}
					lastInfo = info;
					orig.Invoke(ref info);
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)obj;
			if (Main.LamerShatterspleen.Value)
			{
				object obj2 = <>c.<>9__7_1;
				if (obj2 == null)
				{
					Manipulator val2 = delegate(ILContext il)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Expected O, but got Unknown
						//IL_0071: 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)
						ILCursor val7 = new ILCursor(il);
						if (val7.TryGotoNext(new Func<Instruction, bool>[2]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode"),
							(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount")
						}))
						{
							val7.Index += 2;
							val7.Emit(OpCodes.Pop);
							val7.Emit(OpCodes.Ldc_I4, 0);
						}
					};
					<>c.<>9__7_1 = val2;
					obj2 = (object)val2;
				}
				GlobalEventManager.ProcessHitEnemy += (Manipulator)obj2;
				object obj3 = <>c.<>9__7_2;
				if (obj3 == null)
				{
					hook_GetLocalizedStringByToken val3 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token)
					{
						if (token == "ITEM_BLEEDONHITANDEXPLODE_DESC")
						{
							string text = "Gain <style=cIsDamage>5%</style> critical chance. Gain <style=cIsDamage>Bleed chance</style> equal to your <style=cIsDamage>Critical chance</style>. <style=cIsDamage>Bleeding</style> enemies <style=cIsDamage>explode</style> on death for <style=cIsDamage>400%</style> <style=cStack>(+400% per stack)</style> damage";
							if (!Main.Mods("Hayaku.VanillaRebalance"))
							{
								text += ", plus an additional <style=cIsDamage>15%</style> <style=cStack>(+15% per stack)</style> of their maximum health";
							}
							return text + ".";
						}
						return orig.Invoke(self, token);
					};
					<>c.<>9__7_2 = val3;
					obj3 = (object)val3;
				}
				Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj3;
			}
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				object obj5 = <>c.<>9__7_7;
				if (obj5 == null)
				{
					hook_RecalculateStats val6 = delegate(orig_RecalculateStats orig, CharacterBody self)
					{
						orig.Invoke(self);
						if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null))
						{
							if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0)
							{
								self.bleedChance += self.crit;
							}
							if (Main.HyperbolicBleed.Value)
							{
								self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance);
							}
						}
					};
					<>c.<>9__7_7 = val6;
					obj5 = (object)val6;
				}
				CharacterBody.RecalculateStats += (hook_RecalculateStats)obj5;
			});
			if (!Main.HyperbolicCollapse.Value)
			{
				return;
			}
			object obj4 = <>c.<>9__7_4;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val5 = new ILCursor(il);
					val5.GotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 24),
						(Instruction x) => ILPatternMatchingExt.MatchConvR4(x)
					});
					val5.Index += 2;
					val5.EmitDelegate<Func<float, float>>((Func<float, float>)((float chance) => 10f - 10f / (1f + 0.011111f * chance)));
				};
				<>c.<>9__7_4 = val4;
				obj4 = (object)val4;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj4;
		}

		public static float HyperbleedMultiplier(GameObject attacker, DotIndex dotIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.FirstOrDefault((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex);
			if (inflictHyperbleedInfo != null && inflictHyperbleedInfo != null)
			{
				return inflictHyperbleedInfo.damageMult;
			}
			return 1f;
		}

		public static InflictHyperbleedInfo RollHyperbleed(DotIndex dotIndex, float damage, CharacterBody body, bool forceSingleBleed = false)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0047: 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_00b2: Invalid comparison between Unknown and I4
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Invalid comparison between Unknown and I4
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Invalid comparison between Unknown and I4
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Invalid comparison between Unknown and I4
			InflictHyperbleedInfo inflictHyperbleedInfo = new InflictHyperbleedInfo();
			if (Object.op_Implicit((Object)(object)body))
			{
				inflictHyperbleedInfo.attacker = ((Component)body).gameObject;
				inflictHyperbleedInfo.dotIndex = dotIndex;
				inflictHyperbleedInfo.totalChance = body.bleedChance;
				float effectiveCount = GetEffectiveCount(body.bleedChance, body, (int)dotIndex == 8, forceSingleBleed);
				inflictHyperbleedInfo.num = ((((int)dotIndex == 0) ? Main.BleedFraction.Value : Main.CollapseFraction.Value) ? ((int)effectiveCount) : (Mathf.FloorToInt(effectiveCount) + (Util.CheckRoll(effectiveCount % 1f * 100f, body.master) ? 1 : 0)));
				if (inflictHyperbleedInfo.num == 0)
				{
					inflictHyperbleedInfo.damageMult = 1f;
				}
				else if ((int)dotIndex == 0)
				{
					inflictHyperbleedInfo.damageMult = Main.Calc(Main.BleedMode.Value, Main.BleedBase.Value + damage, Main.BleedMult.Value + (Main.BleedDamageBonus.Value ? damage : 0f), Main.BleedDecay.Value, effectiveCount);
				}
				else if ((int)dotIndex == 8)
				{
					inflictHyperbleedInfo.damageMult = Main.Calc(Main.CollapseMode.Value, Main.CollapseBase.Value + damage, Main.CollapseMult.Value + (Main.CollapseDamageBonus.Value ? damage : 0f), Main.CollapseDecay.Value, effectiveCount);
				}
				float num = 0f;
				if (inflictHyperbleedInfo.num != 0)
				{
					if ((int)dotIndex == 0)
					{
						num = Main.Calc(Main.BleedProcMode.Value, Main.BleedProcBase.Value, Main.BleedProcMult.Value, Main.BleedProcDecay.Value, effectiveCount);
					}
					else if ((int)dotIndex == 8)
					{
						num = Main.Calc(Main.CollapseProcMode.Value, Main.CollapseProcBase.Value, Main.CollapseProcMult.Value, Main.CollapseProcDecay.Value, effectiveCount);
					}
				}
				inflictHyperbleedInfo.numProcs = (int)num + (Util.CheckRoll(num % 1f * 100f, 0f, (CharacterMaster)null) ? 1 : 0);
			}
			return inflictHyperbleedInfo;
		}

		public static float GetDamage(float chance, float damage, CharacterBody body, bool collapse = false)
		{
			if (!collapse)
			{
				return Main.Calc(Main.BleedMode.Value, Main.BleedBase.Value + damage, Main.BleedMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.BleedDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body)));
			}
			return Main.Calc(Main.CollapseMode.Value, Main.CollapseBase.Value + damage, Main.CollapseMult.Value + (Main.CollapseDamageBonus.Value ? damage : 0f), Main.CollapseDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body, collapse: true)));
		}

		public static float GetEffectiveCount(InflictHyperbleedInfo aci)
		{
			if (Main.BleedFraction.Value)
			{
				float num = aci.totalChance / 100f;
				if (num < 1f)
				{
					num = 0f;
				}
				return num;
			}
			return aci.num;
		}

		public static float GetEffectiveCount(float chance, CharacterBody body, bool collapse = false, bool forceSingleBleed = false)
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(0f, (chance - (float)(forceSingleBleed ? 100 : 0)) / 100f);
			if ((collapse ? Main.CollapseCap.Value : Main.BleedCap.Value) >= 0f)
			{
				num = Mathf.Min(num, collapse ? Main.CollapseCap.Value : Main.BleedCap.Value);
			}
			if (((Main.BleedFraction.Value && !collapse) || (Main.CollapseFraction.Value && collapse)) && Main.Mods("com.themysticsword.mysticsitems") && (Object)(object)((body != null) ? body.inventory : null) != (Object)null && num > 0f)
			{
				num += 0.01f * (float)body.inventory.GetItemCount(ItemCatalog.FindItemIndex("MysticsItems_ScratchTicket"));
			}
			if (num <= 0f)
			{
				return 0f;
			}
			if (!(collapse ? Main.CollapseFraction.Value : Main.BleedFraction.Value))
			{
				return Mathf.FloorToInt(num) + (Util.CheckRoll(num % 1f * 100f, body.master) ? 1 : 0);
			}
			return num;
		}

		public static float GetInverseDamage(float mult)
		{
			switch (Main.BleedMode.Value)
			{
			case Main.CritStackingMode.Linear:
				if (Main.BleedMult.Value == 0f)
				{
					return 0f;
				}
				return (mult - Main.BleedBase.Value) / Main.BleedMult.Value + 1f;
			case Main.CritStackingMode.Exponential:
				if (Main.BleedBase.Value == 0f || Main.BleedMult.Value == 1f || Main.BleedMult.Value <= 0f)
				{
					return 0f;
				}
				return Mathf.Log(mult / Main.BleedBase.Value, Main.BleedMult.Value) + 1f;
			case Main.CritStackingMode.Hyperbolic:
				if (Main.BleedBase.Value == mult || Main.BleedMult.Value * Main.BleedDecay.Value / (mult - Main.BleedBase.Value) - Main.BleedDecay.Value == 0f)
				{
					return 0f;
				}
				return (Main.BleedMult.Value - Main.BleedDecay.Value) / (Main.BleedMult.Value * Main.BleedDecay.Value / (mult - Main.BleedBase.Value) - Main.BleedDecay.Value);
			case Main.CritStackingMode.Asymptotic:
				if (Main.BleedMult.Value == 0f)
				{
					return 0f;
				}
				return (0f - Mathf.Log(1f - (mult - Main.BleedBase.Value) / Main.BleedMult.Value, 2f)) * Main.BleedDecay.Value + 1f;
			default:
				Main.Log.LogError((object)"Invalid Mode??");
				return 0f;
			}
		}
	}
	public class Crit
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__2_10;

			public static Func<Instruction, bool> <>9__2_11;

			public static Func<Instruction, bool> <>9__2_12;

			public static Func<Instruction, bool> <>9__2_13;

			public static Func<Instruction, bool> <>9__2_14;

			public static Func<float, CharacterBody, HealthComponent, DamageInfo, float> <>9__2_15;

			public static Manipulator <>9__2_0;

			public static Func<Instruction, bool> <>9__2_16;

			public static Action<DamageDealtMessage, DamageReport> <>9__2_17;

			public static Manipulator <>9__2_1;

			public static hook_Serialize <>9__2_2;

			public static hook_Deserialize <>9__2_3;

			public static hook_OnCrit <>9__2_4;

			public static Func<Instruction, bool> <>9__2_18;

			public static Func<Color, Color> <>9__2_19;

			public static Manipulator <>9__2_5;

			public static hook_OnEnter <>9__2_6;

			public static Func<Instruction, bool> <>9__2_20;

			public static Action<GenericDamageOrb, FireSeekingArrow> <>9__2_21;

			public static Manipulator <>9__2_7;

			public static Func<Instruction, bool> <>9__2_22;

			public static Action<DamageInfo, GenericDamageOrb> <>9__2_23;

			public static Manipulator <>9__2_8;

			public static hook_RecalculateStats <>9__3_0;

			public static StatHookEventHandler <>9__4_0;

			public static Func<float, string> <>9__4_3;

			public static Func<float, string> <>9__4_4;

			public static hook_GetLocalizedStringByToken <>9__4_1;

			public static Func<ItemIndex, bool> <>9__5_2;

			public static hook_RecalculateStats <>9__5_0;

			public static hook_GetLocalizedStringByToken <>9__5_1;

			internal void <Patch>b__2_0(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: 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)
				<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
				ILCursor val = new ILCursor(il);
				CS$<>8__locals0.damageInfoIndex = -1;
				ILLabel val2 = default(ILLabel);
				int num = default(int);
				val = val.GotoNext((MoveType)2, new Func<Instruction, bool>[6]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref CS$<>8__locals0.damageInfoIndex),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit"),
					(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier")
				});
				val.Emit(OpCodes.Ldloc_1);
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg, CS$<>8__locals0.damageInfoIndex);
				val.EmitDelegate<Func<float, CharacterBody, HealthComponent, DamageInfo, float>>((Func<float, CharacterBody, HealthComponent, DamageInfo, float>)delegate(float orig, CharacterBody self, HealthComponent self2, DamageInfo info)
				{
					if (!Object.op_Implicit((Object)(object)self))
					{
						return orig;
					}
					Main.AdditionalProcInfo value = null;
					if (!critInfoAttachments.TryGetValue(info, out value))
					{
						value = RollHypercrit(orig - 2f, self, self2.body);
						critInfoAttachments.Add(info, value);
					}
					return Mathf.Max(orig, value.damageMult);
				});
			}

			internal bool <Patch>b__2_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit");
			}

			internal bool <Patch>b__2_11(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBrfalse(x, ref val);
			}

			internal bool <Patch>b__2_12(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdloc(x, ref num);
			}

			internal bool <Patch>b__2_13(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, 1);
			}

			internal bool <Patch>b__2_14(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier");
			}

			internal float <Patch>b__2_15(float orig, CharacterBody self, HealthComponent self2, DamageInfo info)
			{
				if (!Object.op_Implicit((Object)(object)self))
				{
					return orig;
				}
				Main.AdditionalProcInfo value = null;
				if (!critInfoAttachments.TryGetValue(info, out value))
				{
					value = RollHypercrit(orig - 2f, self, self2.body);
					critInfoAttachments.Add(info, value);
				}
				return Mathf.Max(orig, value.damageMult);
			}

			internal void <Patch>b__2_1(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: 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)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x)
				});
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<DamageDealtMessage, DamageReport>>((Action<DamageDealtMessage, DamageReport>)delegate(DamageDealtMessage msg, DamageReport report)
				{
					TryPassHypercrit(report.damageInfo, msg);
				});
			}

			internal bool <Patch>b__2_16(Instruction x)
			{
				return ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x);
			}

			internal void <Patch>b__2_17(DamageDealtMessage msg, DamageReport report)
			{
				TryPassHypercrit(report.damageInfo, msg);
			}

			internal void <Patch>b__2_2(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer)
			{
				orig.Invoke(self, writer);
				if (!critInfoAttachments.TryGetValue(self, out var value))
				{
					value = new Main.AdditionalProcInfo();
				}
				value.Serialize(writer);
			}

			internal void <Patch>b__2_3(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader)
			{
				orig.Invoke(self, reader);
				Main.AdditionalProcInfo additionalProcInfo = new Main.AdditionalProcInfo();
				additionalProcInfo.Deserialize(reader);
				critInfoAttachments.Add(self, additionalProcInfo);
				lastNetworkedCritInfo = additionalProcInfo;
			}

			internal void <Patch>b__2_4(orig_OnCrit orig, GlobalEventManager self, CharacterBody body, DamageInfo damageInfo, CharacterMaster master, float procCoefficient, ProcChainMask procChainMask)
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				critInfoAttachments.TryGetValue(damageInfo, out var value);
				if (value != null && value.numProcs > 1)
				{
					int numProcs = value.numProcs;
					value.numProcs = 0;
					for (int i = 0; i < numProcs; i++)
					{
						orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask);
					}
				}
				else
				{
					orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask);
				}
			}

			internal void <Patch>b__2_5(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor")
				});
				val.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color origColor)
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_0034: 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)
					if (Crit.lastNetworkedCritInfo == null)
					{
						return origColor;
					}
					Main.AdditionalProcInfo lastNetworkedCritInfo = Crit.lastNetworkedCritInfo;
					Crit.lastNetworkedCritInfo = null;
					float effectiveCount = GetEffectiveCount(lastNetworkedCritInfo);
					if (effectiveCount == 0f)
					{
						return origColor;
					}
					float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value;
					return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f);
				});
			}

			internal bool <Patch>b__2_18(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor");
			}

			internal Color <Patch>b__2_19(Color origColor)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: 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)
				if (Crit.lastNetworkedCritInfo == null)
				{
					return origColor;
				}
				Main.AdditionalProcInfo lastNetworkedCritInfo = Crit.lastNetworkedCritInfo;
				Crit.lastNetworkedCritInfo = null;
				float effectiveCount = GetEffectiveCount(lastNetworkedCritInfo);
				if (effectiveCount == 0f)
				{
					return origColor;
				}
				float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value;
				return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f);
			}

			internal void <Patch>b__2_6(orig_OnEnter orig, FireFlurrySeekingArrow self)
			{
				orig.Invoke(self);
				Main.AdditionalProcInfo additionalProcInfo = RollHypercrit(((EntityState)self).characterBody.critMultiplier - 2f, ((EntityState)self).characterBody);
				if (additionalProcInfo.num > 1)
				{
					additionalProcInfo.damageMult *= 6f / (float)(3 + 3 * additionalProcInfo.num);
				}
				critInfoAttachments.Add(self, additionalProcInfo);
				((FireSeekingArrow)self).isCrit = additionalProcInfo.num > 0;
				((FireSeekingArrow)self).maxArrowCount = 3 + additionalProcInfo.num * 3;
				((FireSeekingArrow)self).arrowReloadDuration = ((FireSeekingArrow)self).baseArrowReloadDuration * (3f / (float)((FireSeekingArrow)self).maxArrowCount) / ((BaseState)self).attackSpeedStat;
			}

			internal void <Patch>b__2_7(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
				});
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<GenericDamageOrb, FireSeekingArrow>>((Action<GenericDamageOrb, FireSeekingArrow>)delegate(GenericDamageOrb orb, FireSeekingArrow self)
				{
					TryPassHypercrit(self, orb);
				});
			}

			internal bool <Patch>b__2_20(Instruction x)
			{
				return ILPatternMatchingExt.MatchStloc(x, 0);
			}

			internal void <Patch>b__2_21(GenericDamageOrb orb, FireSeekingArrow self)
			{
				TryPassHypercrit(self, orb);
			}

			internal void <Patch>b__2_8(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: 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)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x)
				});
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<DamageInfo, GenericDamageOrb>>((Action<DamageInfo, GenericDamageOrb>)delegate(DamageInfo di, GenericDamageOrb orb)
				{
					TryPassHypercrit(orb, di);
				});
			}

			internal bool <Patch>b__2_22(Instruction x)
			{
				return ILPatternMatchingExt.MatchNewobj<DamageInfo>(x);
			}

			internal void <Patch>b__2_23(DamageInfo di, GenericDamageOrb orb)
			{
				TryPassHypercrit(orb, di);
			}

			internal void <PatchHyperbolic>b__3_0(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && Main.HyperbolicCrit.Value)
				{
					self.crit = 100f - 10000f / (100f + 1.111111f * self.crit);
				}
			}

			internal void <LaserScopeRework>b__4_0(CharacterBody self, StatHookEventArgs args)
			{
				if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null))
				{
					int itemCount = self.inventory.GetItemCount(Items.CritDamage);
					if (itemCount > 0)
					{
						args.critDamageMultAdd += (Main.LaserScopeDamage.Value + (float)(itemCount - 1) * Main.LaserScopeDamageStack.Value) / 100f - (float)itemCount;
						args.critAdd += Main.LaserScope.Value + (float)(itemCount - 1) * Main.LaserScopeStack.Value;
					}
				}
			}

			internal string <LaserScopeRework>b__4_1(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				if (token == "ITEM_CRITDAMAGE_DESC")
				{
					return ((Main.LaserScope.Value != 0f || Main.LaserScopeStack.Value != 0f) ? ("Gain " + <LaserScopeRework>g__s|4_2(Main.LaserScope.Value, Main.LaserScopeStack.Value, (float f) => f + "%") + " chance to <style=cIsDamage>Critically Strike</style>. ") : "") + ((Main.LaserScopeDamage.Value != 0f || Main.LaserScopeDamageStack.Value != 0f) ? ("<style=cIsDamage>Critical Strikes</style> deal an additional " + <LaserScopeRework>g__s|4_2(Main.LaserScopeDamage.Value, Main.LaserScopeDamageStack.Value, (float f) => f + "%") + ".") : "");
				}
				return orig.Invoke(self, token);
			}

			internal string <LaserScopeRework>b__4_3(float f)
			{
				return f + "%";
			}

			internal string <LaserScopeRework>b__4_4(float f)
			{
				return f + "%";
			}

			internal bool <MoonglassesRework>b__5_2(ItemIndex x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return ((Object)ItemCatalog.GetItemDef(x)).name == "MysticsItems_Moonglasses";
			}

			internal void <MoonglassesRework>b__5_0(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (!((Object)(object)((self != null) ? self.inventory : null) != (Object)null))
				{
					return;
				}
				int itemCount = self.inventory.GetItemCount(Items.MysticsItems_Moonglasses);
				if (itemCount != 0)
				{
					self.crit *= Mathf.Pow(2f, (float)itemCount);
					self.crit -= Main.Moonglasses.Value * (float)itemCount;
					if (self.crit < 0f && self.inventory.GetItemCount(Items.ConvertCritChanceToCritDamage) > 0)
					{
						Chat.AddMessage("Hypercrit makes crit chance past 100 give a chance to do a hit that is your crit damage +100%. So in a scenario where your crit is 101% and crit damage is x2, mean your actual crit damage will be x2 in 100% cases and x3 in 1% cases. So to put it simply from x2 to x3.\r\nNow negative crit would work like this. Let's say you have -50% chance and x3.5 crit damage. Obviously no way for you to proc crits randomly, but could give a change to deal \"negative crit\" in other ways, that is -100% from you crit damage for every -100% crit chance past 0. So your crit damage range would be from x2.5 to x3.5.\r\nAt the least I was hoping that negative would work with survivors that can't have chance and instead get it converted to crit damage. Like railgunner.");
						self.master.TrueKill();
					}
					self.crit = Mathf.Max(0f, self.crit);
				}
			}

			internal string <MoonglassesRework>b__5_1(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_PICKUP")
				{
					return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_PICKUP");
				}
				if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_DESC")
				{
					return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_DESC");
				}
				return orig.Invoke(self, token);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public int damageInfoIndex;

			internal bool <Patch>b__9(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdarg(x, ref damageInfoIndex);
			}
		}

		public static ConditionalWeakTable<object, Main.AdditionalProcInfo> critInfoAttachments = new ConditionalWeakTable<object, Main.AdditionalProcInfo>();

		public static Main.AdditionalProcInfo lastNetworkedCritInfo = null;

		public static void Patch()
		{
			//IL_0025: 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_0030: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//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_007a: Expected O, but got Unknown
			//IL_0094: 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_009f: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			Main.Log.LogDebug((object)"The Spirit of ThinkInvis Embraces You...");
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Expected O, but got Unknown
					//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e9: 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)
					ILCursor val14 = new ILCursor(il);
					int damageInfoIndex = -1;
					ILLabel val15 = default(ILLabel);
					int num2 = default(int);
					val14 = val14.GotoNext((MoveType)2, new Func<Instruction, bool>[6]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref damageInfoIndex),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit"),
						(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val15),
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2),
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier")
					});
					val14.Emit(OpCodes.Ldloc_1);
					val14.Emit(OpCodes.Ldarg_0);
					val14.Emit(OpCodes.Ldarg, damageInfoIndex);
					val14.EmitDelegate<Func<float, CharacterBody, HealthComponent, DamageInfo, float>>((Func<float, CharacterBody, HealthComponent, DamageInfo, float>)delegate(float orig, CharacterBody self, HealthComponent self2, DamageInfo info)
					{
						if (!Object.op_Implicit((Object)(object)self))
						{
							return orig;
						}
						Main.AdditionalProcInfo value3 = null;
						if (!critInfoAttachments.TryGetValue(info, out value3))
						{
							value3 = RollHypercrit(orig - 2f, self, self2.body);
							critInfoAttachments.Add(info, value3);
						}
						return Mathf.Max(orig, value3.damageMult);
					});
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamageProcess += (Manipulator)obj;
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0039: 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)
					ILCursor val13 = new ILCursor(il);
					val13.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x)
					});
					val13.Emit(OpCodes.Dup);
					val13.Emit(OpCodes.Ldarg_0);
					val13.EmitDelegate<Action<DamageDealtMessage, DamageReport>>((Action<DamageDealtMessage, DamageReport>)delegate(DamageDealtMessage msg, DamageReport report)
					{
						TryPassHypercrit(report.damageInfo, msg);
					});
				};
				<>c.<>9__2_1 = val2;
				obj2 = (object)val2;
			}
			HealthComponent.SendDamageDealt += (Manipulator)obj2;
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				hook_Serialize val3 = delegate(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer)
				{
					orig.Invoke(self, writer);
					if (!critInfoAttachments.TryGetValue(self, out var value2))
					{
						value2 = new Main.AdditionalProcInfo();
					}
					value2.Serialize(writer);
				};
				<>c.<>9__2_2 = val3;
				obj3 = (object)val3;
			}
			DamageDealtMessage.Serialize += (hook_Serialize)obj3;
			object obj4 = <>c.<>9__2_3;
			if (obj4 == null)
			{
				hook_Deserialize val4 = delegate(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader)
				{
					orig.Invoke(self, reader);
					Main.AdditionalProcInfo additionalProcInfo2 = new Main.AdditionalProcInfo();
					additionalProcInfo2.Deserialize(reader);
					critInfoAttachments.Add(self, additionalProcInfo2);
					lastNetworkedCritInfo = additionalProcInfo2;
				};
				<>c.<>9__2_3 = val4;
				obj4 = (object)val4;
			}
			DamageDealtMessage.Deserialize += (hook_Deserialize)obj4;
			object obj5 = <>c.<>9__2_4;
			if (obj5 == null)
			{
				hook_OnCrit val5 = delegate(orig_OnCrit orig, GlobalEventManager self, CharacterBody body, DamageInfo damageInfo, CharacterMaster master, float procCoefficient, ProcChainMask procChainMask)
				{
					//IL_0061: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					critInfoAttachments.TryGetValue(damageInfo, out var value);
					if (value != null && value.numProcs > 1)
					{
						int numProcs = value.numProcs;
						value.numProcs = 0;
						for (int i = 0; i < numProcs; i++)
						{
							orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask);
						}
					}
					else
					{
						orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask);
					}
				};
				<>c.<>9__2_4 = val5;
				obj5 = (object)val5;
			}
			GlobalEventManager.OnCrit += (hook_OnCrit)obj5;
			object obj6 = <>c.<>9__2_5;
			if (obj6 == null)
			{
				Manipulator val6 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val12 = new ILCursor(il);
					val12.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor")
					});
					val12.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color origColor)
					{
						//IL_000d: Unknown result type (might be due to invalid IL or missing references)
						//IL_000e: Unknown result type (might be due to invalid IL or missing references)
						//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
						//IL_0034: 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)
						if (lastNetworkedCritInfo == null)
						{
							return origColor;
						}
						Main.AdditionalProcInfo aci = lastNetworkedCritInfo;
						lastNetworkedCritInfo = null;
						float effectiveCount = GetEffectiveCount(aci);
						if (effectiveCount == 0f)
						{
							return origColor;
						}
						float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value;
						return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f);
					});
				};
				<>c.<>9__2_5 = val6;
				obj6 = (object)val6;
			}
			DamageNumberManager.SpawnDamageNumber += (Manipulator)obj6;
			if (!Main.Flurry.Value)
			{
				return;
			}
			object obj7 = <>c.<>9__2_6;
			if (obj7 == null)
			{
				hook_OnEnter val7 = delegate(orig_OnEnter orig, FireFlurrySeekingArrow self)
				{
					orig.Invoke(self);
					Main.AdditionalProcInfo additionalProcInfo = RollHypercrit(((EntityState)self).characterBody.critMultiplier - 2f, ((EntityState)self).characterBody);
					if (additionalProcInfo.num > 1)
					{
						additionalProcInfo.damageMult *= 6f / (float)(3 + 3 * additionalProcInfo.num);
					}
					critInfoAttachments.Add(self, additionalProcInfo);
					((FireSeekingArrow)self).isCrit = additionalProcInfo.num > 0;
					((FireSeekingArrow)self).maxArrowCount = 3 + additionalProcInfo.num * 3;
					((FireSeekingArrow)self).arrowReloadDuration = ((FireSeekingArrow)self).baseArrowReloadDuration * (3f / (float)((FireSeekingArrow)self).maxArrowCount) / ((BaseState)self).attackSpeedStat;
				};
				<>c.<>9__2_6 = val7;
				obj7 = (object)val7;
			}
			FireFlurrySeekingArrow.OnEnter += (hook_OnEnter)obj7;
			object obj8 = <>c.<>9__2_7;
			if (obj8 == null)
			{
				Manipulator val8 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val11 = new ILCursor(il);
					val11.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
					});
					val11.Emit(OpCodes.Dup);
					val11.Emit(OpCodes.Ldarg_0);
					val11.EmitDelegate<Action<GenericDamageOrb, FireSeekingArrow>>((Action<GenericDamageOrb, FireSeekingArrow>)delegate(GenericDamageOrb orb, FireSeekingArrow self)
					{
						TryPassHypercrit(self, orb);
					});
				};
				<>c.<>9__2_7 = val8;
				obj8 = (object)val8;
			}
			FireSeekingArrow.FireOrbArrow += (Manipulator)obj8;
			object obj9 = <>c.<>9__2_8;
			if (obj9 == null)
			{
				Manipulator val9 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0039: 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)
					ILCursor val10 = new ILCursor(il);
					val10.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x)
					});
					val10.Emit(OpCodes.Dup);
					val10.Emit(OpCodes.Ldarg_0);
					val10.EmitDelegate<Action<DamageInfo, GenericDamageOrb>>((Action<DamageInfo, GenericDamageOrb>)delegate(DamageInfo di, GenericDamageOrb orb)
					{
						TryPassHypercrit(orb, di);
					});
				};
				<>c.<>9__2_8 = val9;
				obj9 = (object)val9;
			}
			GenericDamageOrb.OnArrival += (Manipulator)obj9;
		}

		public static void PatchHyperbolic()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && Main.HyperbolicCrit.Value)
					{
						self.crit = 100f - 10000f / (100f + 1.111111f * self.crit);
					}
				};
				<>c.<>9__3_0 = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
		}

		public static void LaserScopeRework()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				StatHookEventHandler val = delegate(CharacterBody self, StatHookEventArgs args)
				{
					if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null))
					{
						int itemCount = self.inventory.GetItemCount(Items.CritDamage);
						if (itemCount > 0)
						{
							args.critDamageMultAdd += (Main.LaserScopeDamage.Value + (float)(itemCount - 1) * Main.LaserScopeDamageStack.Value) / 100f - (float)itemCount;
							args.critAdd += Main.LaserScope.Value + (float)(itemCount - 1) * Main.LaserScopeStack.Value;
						}
					}
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>c.<>9__4_1;
			if (obj2 == null)
			{
				hook_GetLocalizedStringByToken val2 = (orig_GetLocalizedStringByToken orig, Language self, string token) => (token == "ITEM_CRITDAMAGE_DESC") ? (((Main.LaserScope.Value != 0f || Main.LaserScopeStack.Value != 0f) ? ("Gain " + s(Main.LaserScope.Value, Main.LaserScopeStack.Value, (float f) => f + "%") + " chance to <style=cIsDamage>Critically Strike</style>. ") : "") + ((Main.LaserScopeDamage.Value != 0f || Main.LaserScopeDamageStack.Value != 0f) ? ("<style=cIsDamage>Critical Strikes</style> deal an additional " + s(Main.LaserScopeDamage.Value, Main.LaserScopeDamageStack.Value, (float f) => f + "%") + ".") : "")) : orig.Invoke(self, token);
				<>c.<>9__4_1 = val2;
				obj2 = (object)val2;
			}
			Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2;
			static string s(float first, float stack, Func<float, string> fn)
			{
				string text = "<style=cIsDamage>" + fn(first) + "</style>";
				if (stack != 0f)
				{
					text = text + "<style=cStack>(" + ((stack > 0f) ? "+" : "-") + fn(stack) + " per stack)</style>";
				}
				return text;
			}
		}

		public static void MoonglassesRework()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			if (General.disabledItems.Keys.Any((ItemIndex x) => ((Object)ItemCatalog.GetItemDef(x)).name == "MysticsItems_Moonglasses"))
			{
				return;
			}
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if ((Object)(object)((self != null) ? self.inventory : null) != (Object)null)
					{
						int itemCount = self.inventory.GetItemCount(Items.MysticsItems_Moonglasses);
						if (itemCount != 0)
						{
							self.crit *= Mathf.Pow(2f, (float)itemCount);
							self.crit -= Main.Moonglasses.Value * (float)itemCount;
							if (self.crit < 0f && self.inventory.GetItemCount(Items.ConvertCritChanceToCritDamage) > 0)
							{
								Chat.AddMessage("Hypercrit makes crit chance past 100 give a chance to do a hit that is your crit damage +100%. So in a scenario where your crit is 101% and crit damage is x2, mean your actual crit damage will be x2 in 100% cases and x3 in 1% cases. So to put it simply from x2 to x3.\r\nNow negative crit would work like this. Let's say you have -50% chance and x3.5 crit damage. Obviously no way for you to proc crits randomly, but could give a change to deal \"negative crit\" in other ways, that is -100% from you crit damage for every -100% crit chance past 0. So your crit damage range would be from x2.5 to x3.5.\r\nAt the least I was hoping that negative would work with survivors that can't have chance and instead get it converted to crit damage. Like railgunner.");
								self.master.TrueKill();
							}
							self.crit = Mathf.Max(0f, self.crit);
						}
					}
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
			object obj2 = <>c.<>9__5_1;
			if (obj2 == null)
			{
				hook_GetLocalizedStringByToken val2 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token)
				{
					if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_PICKUP")
					{
						return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_PICKUP");
					}
					return (token == "ITEM_MYSTICSITEMS_MOONGLASSES_DESC") ? orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_DESC") : orig.Invoke(self, token);
				};
				<>c.<>9__5_1 = val2;
				obj2 = (object)val2;
			}
			Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2;
			LanguageAPI.Add("ITEM_HYPERCRIT_MOONGLASSES_PICKUP", "Increase Critical Strike damage... <color=#FF7F7F>BUT reduce Critical Strike chance.</color>");
			LanguageAPI.Add("ITEM_HYPERCRIT_MOONGLASSES_DESC", "Increase Critical Strike damage by <style=cIsDamage>{CritDamageIncrease}% <style=cStack>(+{CritDamageIncreasePerStack}% per stack)</style></style>. <style=cIsUtility>reduce Critical Strike chance by {0}% <style=cStack>(+{0}% per stack)</style> for each stack.</style>".Replace("{0}", Main.Moonglasses.Value.ToString()).Replace("{CritDamageIncrease}", ((object)Moonglasses.critDamageIncrease).ToString()).Replace("{CritDamageIncreasePerStack}", ((object)Moonglasses.critDamageIncreasePerStack).ToString()));
		}

		public static bool TryGetHypercrit(object target, ref Main.AdditionalProcInfo aci)
		{
			return critInfoAttachments.TryGetValue(target, out aci);
		}

		private static bool TryPassHypercrit(object from, object to)
		{
			Main.AdditionalProcInfo value;
			bool flag = critInfoAttachments.TryGetValue(from, out value);
			if (flag)
			{
				critInfoAttachments.Add(to, value);
			}
			return flag;
		}

		private static bool TryPassHypercrit(object from, object to, out Main.AdditionalProcInfo aci)
		{
			bool flag = critInfoAttachments.TryGetValue(from, out aci);
			if (flag)
			{
				critInfoAttachments.Add(to, aci);
			}
			return flag;
		}

		public static Main.AdditionalProcInfo RollHypercrit(float damage, CharacterBody body, CharacterBody body2 = null)
		{
			Main.AdditionalProcInfo additionalProcInfo = new Main.AdditionalProcInfo();
			if (Object.op_Implicit((Object)(object)body))
			{
				additionalProcInfo.totalChance = body.crit;
				float effectiveCount = GetEffectiveCount(body.crit, body);
				additionalProcInfo.num = (Main.CritFraction.Value ? (Mathf.FloorToInt(effectiveCount) + (Util.CheckRoll(effectiveCount % 1f * 100f, body.master) ? 1 : 0)) : ((int)effectiveCount));
				if (additionalProcInfo.num == 0)
				{
					additionalProcInfo.damageMult = 1f;
				}
				else
				{
					additionalProcInfo.damageMult = Main.Calc(Main.CritMode.Value, Main.CritBase.Value + damage, Main.CritMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.CritDecay.Value, effectiveCount);
				}
				float num = 0f;
				if (additionalProcInfo.num != 0)
				{
					num = Main.Calc(Main.CritProcMode.Value, Main.CritProcBase.Value, Main.CritProcMult.Value, Main.CritProcDecay.Value, effectiveCount);
				}
				additionalProcInfo.numProcs = (int)num + (Util.CheckRoll(num % 1f * 100f, 0f, (CharacterMaster)null) ? 1 : 0);
			}
			return additionalProcInfo;
		}

		public static float GetDamage(float chance, float damage, CharacterBody body)
		{
			return Main.Calc(Main.CritMode.Value, Main.CritBase.Value + damage, Main.CritMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.CritDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body)));
		}

		public static float GetEffectiveCount(Main.AdditionalProcInfo aci)
		{
			if (Main.CritFraction.Value)
			{
				float num = aci.totalChance / 100f;
				if (num < 1f)
				{
					num = 0f;
				}
				return num;
			}
			return aci.num;
		}

		public static float GetEffectiveCount(float chance, CharacterBody body, bool forceSingleCrit = false)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(0f, (chance - (float)(forceSingleCrit ? 100 : 0)) / 100f);
			if (Main.CritCap.Value >= 0f)
			{
				num = Mathf.Min(num, Main.CritCap.Value);
			}
			if (Main.CritFraction.Value && Main.Mods("com.themysticsword.mysticsitems") && (Object)(object)((body != null) ? body.inventory : null) != (Object)null && num > 0f)
			{
				num += 0.01f * (float)body.inventory.GetItemCount(ItemCatalog.FindItemIndex("MysticsItems_ScratchTicket"));
			}
			if (num <= 0f)
			{
				return 0f;
			}
			if (!Main.CritFraction.Value)
			{
				return Mathf.FloorToInt(num) + (Util.CheckRoll(num % 1f * 100f, body.master) ? 1 : 0);
			}
			return num;
		}

		[CompilerGenerated]
		internal static string <LaserScopeRework>g__s|4_2(float first, float stack, Func<float, string> fn)
		{
			string text = "<style=cIsDamage>" + fn(first) + "</style>";
			if (stack != 0f)
			{
				text = text + "<style=cStack>(" + ((stack > 0f) ? "+" : "-") + fn(stack) + " per stack)</style>";
			}
			return text;
		}
	}
	[BepInDependency(/*Could not