Decompiled source of UncappedChances v1.1.0

UncappedChances.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RoR2;
using RoR2.Projectile;
using UncappedChances.Effects;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("UncappedChances")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ac568060a64e68fa64ed2214b28e7ed427059e79")]
[assembly: AssemblyProduct("UncappedChances")]
[assembly: AssemblyTitle("UncappedChances")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UncappedChances
{
	public static class Configs
	{
		public static ConfigFile ModConfig;

		private const string Section_Crit = "Crit";

		private const string Section_Bleed = "Bleed";

		private const string Section_Collapse = "Collapse";

		private const string Section_Ghors = "Ghors Tome";

		private const string Section_Sticky = "Sticky Bomb";

		private const string Label_EnableChange = "Enable Changes";

		private const string Desc_Enable = "Enables changes for this item.";

		public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, MainPlugin.pluginInfo.Metadata.GUID);

		public static void Setup()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			ModConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "ModConfig.cfg"), true);
			Read_AllConfigs();
		}

		private static void Read_AllConfigs()
		{
			Crit.Enable = ModConfig.Bind<bool>("Crit", "Enable Changes", Crit.EnableDefault, "Enables changes for this item.").Value;
			Crit.HarderSuccessive = ModConfig.Bind<bool>("Crit", "Lower Successive Crits", Crit.HarderSuccessiveDefault, "Each successive crit has a low chance to proc.").Value;
			Crit.MultiplicativeCrit = ModConfig.Bind<bool>("Crit", "Multiplicative Crits", Crit.MultiplicativeCritDefault, "Each crit multiplies the previous, ie 2-4-8 instead of 2-4-6").Value;
			Bleed.Enable = ModConfig.Bind<bool>("Bleed", "Enable Changes", Bleed.EnableDefault, "Enables changes for this item.").Value;
			Bleed.HarderSuccessive = ModConfig.Bind<bool>("Bleed", "Lower Successive Stacks", Bleed.HarderSuccessiveDefault, "Each successive bleed stack has a low chance to proc.").Value;
			Collapse.Enable = ModConfig.Bind<bool>("Collapse", "Enable Changes", Collapse.EnableDefault, "Enables changes for this item.").Value;
			Collapse.HarderSuccessive = ModConfig.Bind<bool>("Collapse", "Lower Successive Stacks", Collapse.HarderSuccessiveDefault, "Each successive collapse stack has a low chance to proc.").Value;
			GhorsTome.Enable = ModConfig.Bind<bool>("Ghors Tome", "Enable Changes", GhorsTome.EnableDefault, "Enables changes for this item.").Value;
			GhorsTome.HarderSuccessive = ModConfig.Bind<bool>("Ghors Tome", "Lower Successive Drops", GhorsTome.HarderSuccessiveDefault, "Each successive drop has a low chance to proc.").Value;
			StickyBomb.Enable = ModConfig.Bind<bool>("Sticky Bomb", "Enable Changes", StickyBomb.EnableDefault, "Enables changes for this item.").Value;
			StickyBomb.HarderSuccessive = ModConfig.Bind<bool>("Sticky Bomb", "Lower Successive Bombs", StickyBomb.HarderSuccessiveDefault, "Each successive sticky bomb has a low chance to proc.").Value;
			StickyBomb.SingleBomb = ModConfig.Bind<bool>("Sticky Bomb", "One Bomb", StickyBomb.SingleBombDefault, "Instead of applying multiple bombs, apply 1 with the total damage.").Value;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("ZetaDaemon.UncappedChances", "UncappedChances", "1.1.0")]
	public class MainPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "ZetaDaemon.UncappedChances";

		public const string PluginAuthor = "ZetaDaemon";

		public const string PluginName = "UncappedChances";

		public const string PluginVersion = "1.1.0";

		internal static ManualLogSource ModLogger;

		public static PluginInfo pluginInfo;

		private void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Configs.Setup();
			EnableChanges();
			SharedHooks.Setup();
		}

		private void EnableChanges()
		{
			new Crit();
			new Bleed();
			new Collapse();
			new GhorsTome();
			new StickyBomb();
		}
	}
	public class SharedHooks
	{
		public delegate void Handle_GlobalHitEvent(GameObject victim, CharacterBody attackerBody, DamageInfo damageInfo);

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnHitEnemy <0>__GlobalEventManager_HitEnemy;
		}

		public static Handle_GlobalHitEvent Handle_GlobalHitEvent_Actions;

		public static void Setup()
		{
			//IL_001e: 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_0029: Expected O, but got Unknown
			if (Handle_GlobalHitEvent_Actions != null)
			{
				object obj = <>O.<0>__GlobalEventManager_HitEnemy;
				if (obj == null)
				{
					hook_OnHitEnemy val = GlobalEventManager_HitEnemy;
					<>O.<0>__GlobalEventManager_HitEnemy = val;
					obj = (object)val;
				}
				GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj;
			}
		}

		internal static void GlobalEventManager_HitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			orig.Invoke(self, damageInfo, victim);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Handle_GlobalHitEvent_Actions(victim, component, damageInfo);
				}
			}
		}
	}
}
namespace UncappedChances.Effects
{
	public class Bleed
	{
		internal static bool EnableDefault = true;

		internal static bool HarderSuccessiveDefault = false;

		internal static bool Enable = EnableDefault;

		internal static bool HarderSuccessive = HarderSuccessiveDefault;

		public Bleed()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying Bleed IL modifications");
			SharedHooks.Handle_GlobalHitEvent_Actions = (SharedHooks.Handle_GlobalHitEvent)Delegate.Combine(SharedHooks.Handle_GlobalHitEvent_Actions, new SharedHooks.Handle_GlobalHitEvent(GlobalEventManager_HitEnemy));
			GlobalEventManager.OnHitEnemy += new Manipulator(IL_OnHitEnemy);
		}

		private void IL_OnHitEnemy(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = default(ILLabel);
			if (!val.TryGotoNext(new Func<Instruction, bool>[8]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 22),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "get_bleedChance"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchCgt(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 22),
				(Instruction x) => ILPatternMatchingExt.MatchOr(x),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
			}))
			{
				MainPlugin.ModLogger.LogError((object)"Bleed - IL Hook Failed");
				return;
			}
			val.Index += 7;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}

		private static void ApplyBleed(CharacterBody attacker, GameObject victim, DamageInfo damageInfo, uint? maxStacksFromAttacker = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			ProcChainMask procChainMask = damageInfo.procChainMask;
			((ProcChainMask)(ref procChainMask)).AddProc((ProcType)5);
			DotController.InflictDot(victim, damageInfo.attacker, (DotIndex)0, 3f * damageInfo.procCoefficient, 1f, maxStacksFromAttacker);
		}

		private void GlobalEventManager_HitEnemy(GameObject victim, CharacterBody attackerBody, DamageInfo damageInfo)
		{
			//IL_007d: 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_0089: Invalid comparison between Unknown and I4
			if (((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)5))
			{
				return;
			}
			uint? maxStacksFromAttacker = null;
			if (Object.op_Implicit((Object)(object)damageInfo?.inflictor))
			{
				ProjectileDamage component = damageInfo.inflictor.GetComponent<ProjectileDamage>();
				if (Object.op_Implicit((Object)(object)component) && component.useDotMaxStacksFromAttacker)
				{
					maxStacksFromAttacker = component.dotMaxStacksFromAttacker;
				}
			}
			float num = attackerBody.bleedChance * damageInfo.procCoefficient;
			if ((damageInfo.damageType & 0x400) > 0)
			{
				ApplyBleed(attackerBody, victim, damageInfo, maxStacksFromAttacker);
			}
			if (!Object.op_Implicit((Object)(object)attackerBody.inventory))
			{
				return;
			}
			if (attackerBody.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0 && damageInfo.crit)
			{
				ApplyBleed(attackerBody, victim, damageInfo, maxStacksFromAttacker);
			}
			float num2 = 1f;
			while (num > 0f)
			{
				if (Util.CheckRoll(num / num2, attackerBody.master))
				{
					ApplyBleed(attackerBody, victim, damageInfo, maxStacksFromAttacker);
				}
				num -= num2 * 100f;
				if (HarderSuccessive)
				{
					num2 += 1f;
				}
			}
		}
	}
	public class Collapse
	{
		internal static bool EnableDefault = true;

		internal static bool HarderSuccessiveDefault = false;

		internal static bool Enable = EnableDefault;

		internal static bool HarderSuccessive = HarderSuccessiveDefault;

		public Collapse()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying Collapse IL modifications");
			GlobalEventManager.OnHitEnemy += new Manipulator(IL_OnHitEnemy);
		}

		private void IL_OnHitEnemy(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "BleedOnHitVoid")
			}))
			{
				MainPlugin.ModLogger.LogError((object)"Collapse - IL Hook Failed");
				return;
			}
			val.Index += 13;
			val.Emit(OpCodes.Ldloc_1);
			val.Emit(OpCodes.Ldarg_2);
			val.Emit(OpCodes.Ldloc, 24);
			val.Emit(OpCodes.Ldarg_1);
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Action<CharacterBody, GameObject, int, DamageInfo, uint?>>((Action<CharacterBody, GameObject, int, DamageInfo, uint?>)delegate(CharacterBody attackerBody, GameObject victim, int stacks, DamageInfo damageInfo, uint? maxStacksFromAttacker)
			{
				float num = (float)stacks * 10f * damageInfo.procCoefficient;
				float num2 = 1f;
				while (num > 0f)
				{
					if (Util.CheckRoll(num / num2, attackerBody.master))
					{
						ApplyCollapse(victim, damageInfo, maxStacksFromAttacker);
					}
					num -= num2 * 100f;
					if (HarderSuccessive)
					{
						num2 += 1f;
					}
				}
			});
			val.Index += 1;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}

		private static void ApplyCollapse(GameObject victim, DamageInfo damageInfo, uint? maxStacksFromAttacker = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			ProcChainMask procChainMask = damageInfo.procChainMask;
			((ProcChainMask)(ref procChainMask)).AddProc((ProcType)5);
			DotDef dotDef = DotController.GetDotDef((DotIndex)8);
			DotController.InflictDot(victim, damageInfo.attacker, (DotIndex)8, dotDef.interval, 1f, maxStacksFromAttacker);
		}
	}
	public class Crit
	{
		internal static bool EnableDefault = true;

		internal static bool HarderSuccessiveDefault = false;

		internal static bool MultiplicativeCritDefault = true;

		internal static bool Enable = EnableDefault;

		internal static bool HarderSuccessive = HarderSuccessiveDefault;

		internal static bool MultiplicativeCrit = MultiplicativeCritDefault;

		public Crit()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying Crit IL modifications");
			HealthComponent.TakeDamage += new Manipulator(IL_TakeDamage);
		}

		private void IL_TakeDamage(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 6),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "get_critMultiplier"),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 6)
			}))
			{
				MainPlugin.ModLogger.LogError((object)"Crit - IL Hook Failed");
				return;
			}
			val.Index += 3;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldloc_1);
			val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)delegate(CharacterBody body)
			{
				float num = 1f;
				float num2 = body.crit - 100f;
				float num3 = body.critMultiplier;
				while (num2 > 0f)
				{
					if (HarderSuccessive)
					{
						num += 1f;
					}
					if (Util.CheckRoll(num2 / num, body.master))
					{
						num3 = ((!MultiplicativeCrit) ? (num3 + body.critMultiplier) : (num3 * body.critMultiplier));
					}
					num2 -= num * 100f;
				}
				return num3;
			});
		}
	}
	public class GhorsTome
	{
		internal static bool EnableDefault = true;

		internal static bool HarderSuccessiveDefault = false;

		internal static bool Enable = EnableDefault;

		internal static bool HarderSuccessive = HarderSuccessiveDefault;

		public GhorsTome()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying Ghors IL modifications");
			GlobalEventManager.OnCharacterDeath += new Manipulator(IL_OnCharacterDeath);
		}

		private void IL_OnCharacterDeath(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "BonusGoldPackOnKill")
			}))
			{
				MainPlugin.ModLogger.LogError((object)"Ghors - IL Hook Failed");
				return;
			}
			val.Index += 3;
			val.Emit(OpCodes.Ldloc, 16);
			val.Emit(OpCodes.Ldloc, 85);
			val.Emit(OpCodes.Ldloc, 6);
			val.Emit(OpCodes.Ldloc, 18);
			val.EmitDelegate<Action<CharacterMaster, int, Vector3, TeamIndex>>((Action<CharacterMaster, int, Vector3, TeamIndex>)delegate(CharacterMaster attackerMaster, int stacks, Vector3 vector, TeamIndex attackerTeamIndex)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				float num = 1f;
				float num2 = 4f * (float)stacks;
				while (num2 > 0f)
				{
					if (Util.CheckRoll(num2 / num, attackerMaster))
					{
						GameObject val2 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/BonusMoneyPack"), vector, Random.rotation);
						TeamFilter component = val2.GetComponent<TeamFilter>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.teamIndex = attackerTeamIndex;
						}
						NetworkServer.Spawn(val2);
					}
					num2 -= num * 100f;
					if (HarderSuccessive)
					{
						num += 1f;
					}
				}
			});
			val.Index += 2;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}
	}
	public class StickyBomb
	{
		internal static bool EnableDefault = true;

		internal static bool HarderSuccessiveDefault = false;

		internal static bool SingleBombDefault = true;

		internal static bool Enable = EnableDefault;

		internal static bool HarderSuccessive = HarderSuccessiveDefault;

		internal static bool SingleBomb = SingleBombDefault;

		public StickyBomb()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			MainPlugin.ModLogger.LogInfo((object)"Applying Sticky IL modifications");
			GlobalEventManager.OnHitEnemy += new Manipulator(IL_OnHitEnemy);
		}

		private void IL_OnHitEnemy(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0063: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "StickyBomb")
			}))
			{
				MainPlugin.ModLogger.LogError((object)"Sticky - IL Hook Failed");
				return;
			}
			val.Index += 3;
			val.Emit(OpCodes.Ldloc_1);
			val.Emit(OpCodes.Ldloc_2);
			val.Emit(OpCodes.Ldloc, 14);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<CharacterBody, CharacterBody, int, DamageInfo>>((Action<CharacterBody, CharacterBody, int, DamageInfo>)delegate(CharacterBody attackerBody, CharacterBody victimBody, int stacks, DamageInfo damageInfo)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				if (stacks > 0)
				{
					bool alive = victimBody.healthComponent.alive;
					float num = 5f;
					Vector3 position = damageInfo.position;
					Vector3 val2 = victimBody.corePosition - position;
					float magnitude = ((Vector3)(ref val2)).magnitude;
					float num2 = 1.8f;
					float num3 = Util.OnHitProcDamage(damageInfo.damage, attackerBody.damage, num2);
					float num4 = (float)stacks * 5f * damageInfo.procCoefficient;
					float num5 = 1f;
					int num6 = 0;
					while (num4 > 0f)
					{
						if (Util.CheckRoll(num4 / num5, attackerBody.master))
						{
							if (!SingleBomb)
							{
								Quaternion val3 = ((magnitude != 0f) ? Util.QuaternionSafeLookRotation(val2) : Random.rotationUniform);
								ProjectileManager.instance.FireProjectile(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/StickyBomb"), position, val3, damageInfo.attacker, num3, 100f, damageInfo.crit, (DamageColorIndex)3, (GameObject)null, alive ? (magnitude * num) : (-1f));
							}
							else
							{
								num6++;
							}
						}
						num4 -= num5 * 100f;
						if (HarderSuccessive)
						{
							num5 += 1f;
						}
					}
					if (SingleBomb && num6 > 0)
					{
						Quaternion val4 = ((magnitude != 0f) ? Util.QuaternionSafeLookRotation(val2) : Random.rotationUniform);
						ProjectileManager.instance.FireProjectile(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/StickyBomb"), position, val4, damageInfo.attacker, (float)num6 * num3, 100f, damageInfo.crit, (DamageColorIndex)3, (GameObject)null, alive ? (magnitude * num) : (-1f));
					}
				}
			});
			val.Index += 1;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}
	}
}