Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EnemyCritFix v1.0.0
EnemyCritFix/EnemyCritFix.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.BeetleGuardMonster; using EntityStates.BeetleMonster; using EntityStates.Bison; using EntityStates.BrotherMonster; using EntityStates.ClayGrenadier; using EntityStates.GolemMonster; using EntityStates.Halcyonite; using EntityStates.JellyfishMonster; using EntityStates.ParentMonster; using EntityStates.SolusAmalgamator; using IL.EntityStates.BrotherMonster; using IL.EntityStates.ClayGrenadier; using IL.EntityStates.GolemMonster; using IL.EntityStates.Halcyonite; using IL.EntityStates.JellyfishMonster; using IL.EntityStates.MajorConstruct.Weapon; using IL.EntityStates.ParentMonster; using IL.EntityStates.SolusAmalgamator; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.BeetleGuardMonster; using On.EntityStates.BeetleMonster; using On.EntityStates.Bison; using R2API; using RoR2; using RoR2.Projectile; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("EnemyCritFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EnemyCritFix")] [assembly: AssemblyTitle("EnemyCritFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace EnemyCritFix; internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Samuel17.EnemyCritFix", "EnemyCritFix", "1.0.0")] public class Main : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__5_0; public static Func<Instruction, bool> <>9__5_19; public static Manipulator <>9__5_1; public static hook_OnEnter <>9__5_2; public static hook_OnEnter <>9__5_3; public static hook_ResetOverlapAttack <>9__5_4; public static Func<Instruction, bool> <>9__5_20; public static Manipulator <>9__5_5; public static Func<Instruction, bool> <>9__5_21; public static Manipulator <>9__5_6; public static Func<Instruction, bool> <>9__5_22; public static Manipulator <>9__5_7; public static Func<Instruction, bool> <>9__5_23; public static Manipulator <>9__5_8; public static Func<Instruction, bool> <>9__5_24; public static Manipulator <>9__5_9; public static Func<Instruction, bool> <>9__5_26; public static Func<Instruction, bool> <>9__5_27; public static Func<WhirlWindPersuitCycle, bool> <>9__5_25; public static Manipulator <>9__5_10; public static Func<Instruction, bool> <>9__5_28; public static Manipulator <>9__5_11; public static Func<Instruction, bool> <>9__5_29; public static Manipulator <>9__5_12; public static Func<Instruction, bool> <>9__5_31; public static Func<Instruction, bool> <>9__5_32; public static Func<ShockArmor, GameObject> <>9__5_30; public static Manipulator <>9__5_13; public static Func<Instruction, bool> <>9__5_33; public static Manipulator <>9__5_14; public static Func<Instruction, bool> <>9__5_34; public static Manipulator <>9__5_15; public static Func<Instruction, bool> <>9__5_35; public static Manipulator <>9__5_16; public static Func<Instruction, bool> <>9__5_36; public static Manipulator <>9__5_17; public static Func<Instruction, bool> <>9__5_37; public static Manipulator <>9__5_18; internal void <CritHooks>b__5_0(orig_OnEnter orig, HeadbuttState self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } } internal void <CritHooks>b__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<JellyNova>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Jellyfish crit hook failed!"); } } internal bool <CritHooks>b__5_19(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_2(orig_OnEnter orig, GroundSlam self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } } internal void <CritHooks>b__5_3(orig_OnEnter orig, Headbutt self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } } internal void <CritHooks>b__5_4(orig_ResetOverlapAttack orig, Charge self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } } internal void <CritHooks>b__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Stone Golem laser crit hook failed!"); } } internal bool <CritHooks>b__5_20(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_6(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<ClapState>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Stone Golem clap crit hook failed!"); } } internal bool <CritHooks>b__5_21(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<GroundSlam>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Parent crit hook failed!"); } } internal bool <CritHooks>b__5_22(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<FaceSlam>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Clay Apothecary melee slam crit hook failed!"); } } internal bool <CritHooks>b__5_23(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_9(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Halcyonite laser crit hook failed!"); } } internal bool <CritHooks>b__5_24(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_10(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; int num = default(int); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "crit") }) && val.TryGotoPrev((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num) })) { val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<WhirlWindPersuitCycle, bool>>((Func<WhirlWindPersuitCycle, bool>)((WhirlWindPersuitCycle self) => ((EntityState)self).characterBody.RollCrit())); flag = false; } if (flag) { Log.Error("Halcyonite Whirlwind crit hook failed!"); } } internal bool <CritHooks>b__5_26(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "crit"); } internal bool <CritHooks>b__5_27(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <CritHooks>b__5_25(WhirlWindPersuitCycle self) { return ((EntityState)self).characterBody.RollCrit(); } internal void <CritHooks>b__5_11(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Xi Construct laser finisher crit hook failed!"); } } internal bool <CritHooks>b__5_28(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_12(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Solus Amalgamator shock pulse crit hook failed!"); } } internal bool <CritHooks>b__5_29(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_13(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "attacker") }) && val.TryGotoPrev((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdnull(x) })) { val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<ShockArmor, GameObject>>((Func<ShockArmor, GameObject>)((ShockArmor self) => ((EntityState)self).gameObject)); flag = false; } if (flag) { Log.Error("Solus Amalgamator shock pulse attacker hook failed!"); } } internal bool <CritHooks>b__5_31(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "attacker"); } internal bool <CritHooks>b__5_32(Instruction x) { return ILPatternMatchingExt.MatchLdnull(x); } internal GameObject <CritHooks>b__5_30(ShockArmor self) { return ((EntityState)self).gameObject; } internal void <CritHooks>b__5_14(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage") })) { val.Emit(OpCodes.Ldloca, 3); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<FireProjectileInfo>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Solus Amalgamator energy orb crit hook failed!"); } } internal bool <CritHooks>b__5_33(Instruction x) { return ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage"); } internal void <CritHooks>b__5_15(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage") })) { val.Emit(OpCodes.Ldloca, 2); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<FireProjectileInfo>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Severed Breaker crit hook failed!"); } } internal bool <CritHooks>b__5_34(Instruction x) { return ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage"); } internal void <CritHooks>b__5_16(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<OverlapAttack>(OpCodes.Stfld, "isCrit"); flag = false; } if (flag) { Log.Error("Mithrix hammer slam (direct) crit hook failed!"); } } internal bool <CritHooks>b__5_35(Instruction x) { return ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage"); } internal void <CritHooks>b__5_17(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<WeaponSlam>(OpCodes.Ldfld, "blastAttack"); val.Emit(OpCodes.Ldarg_0); val.Emit<BaseState>(OpCodes.Call, "RollCrit"); val.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag = false; } if (flag) { Log.Error("Mithrix hammer slam (explosion) crit hook failed!"); } } internal bool <CritHooks>b__5_36(Instruction x) { return ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage"); } internal void <CritHooks>b__5_18(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: 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) ILCursor val = new ILCursor(il); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<ContactDamage>(OpCodes.Ldfld, "overlapAttack"); val.Emit(OpCodes.Ldarg_0); val.Emit<ContactDamage>(OpCodes.Ldfld, "characterBody"); val.Emit<CharacterBody>(OpCodes.Callvirt, "RollCrit"); val.Emit<OverlapAttack>(OpCodes.Stfld, "isCrit"); flag = false; } if (flag) { Log.Error("Contact damage crit hook failed!"); } } internal bool <CritHooks>b__5_37(Instruction x) { return ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage"); } } public static ConfigEntry<float> enemyCritChance { get; private set; } public void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); enemyCritChance = ((BaseUnityPlugin)this).Config.Bind<float>("heha", "Monster Crit Chance", 0f, "Bonus crit percentage applied to all enemies. Set to a negative value (or zero) to disable."); CritHooks(); if (enemyCritChance.Value > 0f) { RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(EnemyCritChance); } } private void CritHooks() { //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 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0084: 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_008f: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //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_0148: Expected O, but got Unknown //IL_0162: 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_016d: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Expected O, but got Unknown object obj = <>c.<>9__5_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, HeadbuttState self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } }; <>c.<>9__5_0 = val; obj = (object)val; } HeadbuttState.OnEnter += (hook_OnEnter)obj; object obj2 = <>c.<>9__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val34 = new ILCursor(il); bool flag15 = true; if (val34.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val34.Emit(OpCodes.Ldarg_0); val34.Emit<JellyNova>(OpCodes.Ldfld, "attack"); val34.Emit(OpCodes.Ldarg_0); val34.Emit<BaseState>(OpCodes.Call, "RollCrit"); val34.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag15 = false; } if (flag15) { Log.Error("Jellyfish crit hook failed!"); } }; <>c.<>9__5_1 = val2; obj2 = (object)val2; } JellyNova.Detonate += (Manipulator)obj2; object obj3 = <>c.<>9__5_2; if (obj3 == null) { hook_OnEnter val3 = delegate(orig_OnEnter orig, GroundSlam self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } }; <>c.<>9__5_2 = val3; obj3 = (object)val3; } GroundSlam.OnEnter += (hook_OnEnter)obj3; object obj4 = <>c.<>9__5_3; if (obj4 == null) { hook_OnEnter val4 = delegate(orig_OnEnter orig, Headbutt self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } }; <>c.<>9__5_3 = val4; obj4 = (object)val4; } Headbutt.OnEnter += (hook_OnEnter)obj4; object obj5 = <>c.<>9__5_4; if (obj5 == null) { hook_ResetOverlapAttack val5 = delegate(orig_ResetOverlapAttack orig, Charge self) { orig.Invoke(self); if (self.attack != null) { self.attack.isCrit = ((BaseState)self).RollCrit(); } }; <>c.<>9__5_4 = val5; obj5 = (object)val5; } Charge.ResetOverlapAttack += (hook_ResetOverlapAttack)obj5; object obj6 = <>c.<>9__5_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 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val33 = new ILCursor(il); bool flag14 = true; if (val33.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val33.Emit(OpCodes.Dup); val33.Emit(OpCodes.Ldarg_0); val33.Emit<BaseState>(OpCodes.Call, "RollCrit"); val33.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag14 = false; } if (flag14) { Log.Error("Stone Golem laser crit hook failed!"); } }; <>c.<>9__5_5 = val6; obj6 = (object)val6; } FireLaser.OnEnter += (Manipulator)obj6; object obj7 = <>c.<>9__5_6; if (obj7 == null) { Manipulator val7 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val32 = new ILCursor(il); bool flag13 = true; if (val32.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val32.Emit(OpCodes.Ldarg_0); val32.Emit<ClapState>(OpCodes.Ldfld, "attack"); val32.Emit(OpCodes.Ldarg_0); val32.Emit<BaseState>(OpCodes.Call, "RollCrit"); val32.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag13 = false; } if (flag13) { Log.Error("Stone Golem clap crit hook failed!"); } }; <>c.<>9__5_6 = val7; obj7 = (object)val7; } ClapState.FixedUpdate += (Manipulator)obj7; object obj8 = <>c.<>9__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val31 = new ILCursor(il); bool flag12 = true; if (val31.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val31.Emit(OpCodes.Ldarg_0); val31.Emit<GroundSlam>(OpCodes.Ldfld, "attack"); val31.Emit(OpCodes.Ldarg_0); val31.Emit<BaseState>(OpCodes.Call, "RollCrit"); val31.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag12 = false; } if (flag12) { Log.Error("Parent crit hook failed!"); } }; <>c.<>9__5_7 = val8; obj8 = (object)val8; } GroundSlam.FixedUpdate += (Manipulator)obj8; object obj9 = <>c.<>9__5_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val30 = new ILCursor(il); bool flag11 = true; if (val30.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val30.Emit(OpCodes.Ldarg_0); val30.Emit<FaceSlam>(OpCodes.Ldfld, "attack"); val30.Emit(OpCodes.Ldarg_0); val30.Emit<BaseState>(OpCodes.Call, "RollCrit"); val30.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag11 = false; } if (flag11) { Log.Error("Clay Apothecary melee slam crit hook failed!"); } }; <>c.<>9__5_8 = val9; obj9 = (object)val9; } FaceSlam.FixedUpdate += (Manipulator)obj9; object obj10 = <>c.<>9__5_9; if (obj10 == null) { Manipulator val10 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val29 = new ILCursor(il); bool flag10 = true; if (val29.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val29.Emit(OpCodes.Dup); val29.Emit(OpCodes.Ldarg_0); val29.Emit<BaseState>(OpCodes.Call, "RollCrit"); val29.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag10 = false; } if (flag10) { Log.Error("Halcyonite laser crit hook failed!"); } }; <>c.<>9__5_9 = val10; obj10 = (object)val10; } TriLaser.FireTriLaser += (Manipulator)obj10; object obj11 = <>c.<>9__5_10; if (obj11 == null) { Manipulator val11 = 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_007a: Unknown result type (might be due to invalid IL or missing references) ILCursor val28 = new ILCursor(il); bool flag9 = true; int num = default(int); if (val28.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "crit") }) && val28.TryGotoPrev((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num) })) { val28.Remove(); val28.Emit(OpCodes.Ldarg_0); val28.EmitDelegate<Func<WhirlWindPersuitCycle, bool>>((Func<WhirlWindPersuitCycle, bool>)((WhirlWindPersuitCycle self) => ((EntityState)self).characterBody.RollCrit())); flag9 = false; } if (flag9) { Log.Error("Halcyonite Whirlwind crit hook failed!"); } }; <>c.<>9__5_10 = val11; obj11 = (object)val11; } WhirlWindPersuitCycle.UpdateAttack += (Manipulator)obj11; object obj12 = <>c.<>9__5_11; if (obj12 == null) { Manipulator val12 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val27 = new ILCursor(il); bool flag8 = true; if (val27.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val27.Emit(OpCodes.Dup); val27.Emit(OpCodes.Ldarg_0); val27.Emit<BaseState>(OpCodes.Call, "RollCrit"); val27.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag8 = false; } if (flag8) { Log.Error("Xi Construct laser finisher crit hook failed!"); } }; <>c.<>9__5_11 = val12; obj12 = (object)val12; } TerminateLaser.OnEnter += (Manipulator)obj12; object obj13 = <>c.<>9__5_12; if (obj13 == null) { Manipulator val13 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val26 = new ILCursor(il); bool flag7 = true; if (val26.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val26.Emit(OpCodes.Dup); val26.Emit(OpCodes.Ldarg_0); val26.Emit<BaseState>(OpCodes.Call, "RollCrit"); val26.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag7 = false; } if (flag7) { Log.Error("Solus Amalgamator shock pulse crit hook failed!"); } }; <>c.<>9__5_12 = val13; obj13 = (object)val13; } ShockArmor.ApplyShock += (Manipulator)obj13; object obj14 = <>c.<>9__5_13; if (obj14 == null) { Manipulator val14 = 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_007a: Unknown result type (might be due to invalid IL or missing references) ILCursor val25 = new ILCursor(il); bool flag6 = true; if (val25.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "attacker") }) && val25.TryGotoPrev((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdnull(x) })) { val25.Remove(); val25.Emit(OpCodes.Ldarg_0); val25.EmitDelegate<Func<ShockArmor, GameObject>>((Func<ShockArmor, GameObject>)((ShockArmor self) => ((EntityState)self).gameObject)); flag6 = false; } if (flag6) { Log.Error("Solus Amalgamator shock pulse attacker hook failed!"); } }; <>c.<>9__5_13 = val14; obj14 = (object)val14; } ShockArmor.ApplyShock += (Manipulator)obj14; object obj15 = <>c.<>9__5_14; if (obj15 == null) { Manipulator val15 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ILCursor val24 = new ILCursor(il); bool flag5 = true; if (val24.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage") })) { val24.Emit(OpCodes.Ldloca, 3); val24.Emit(OpCodes.Ldarg_0); val24.Emit<BaseState>(OpCodes.Call, "RollCrit"); val24.Emit<FireProjectileInfo>(OpCodes.Stfld, "crit"); flag5 = false; } if (flag5) { Log.Error("Solus Amalgamator energy orb crit hook failed!"); } }; <>c.<>9__5_14 = val15; obj15 = (object)val15; } ArtilleryStrike.FireMissiles += (Manipulator)obj15; object obj16 = <>c.<>9__5_15; if (obj16 == null) { Manipulator val16 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ILCursor val23 = new ILCursor(il); bool flag4 = true; if (val23.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<FireProjectileInfo>(x, "damage") })) { val23.Emit(OpCodes.Ldloca, 2); val23.Emit(OpCodes.Ldarg_0); val23.Emit<BaseState>(OpCodes.Call, "RollCrit"); val23.Emit<FireProjectileInfo>(OpCodes.Stfld, "crit"); flag4 = false; } if (flag4) { Log.Error("Severed Breaker crit hook failed!"); } }; <>c.<>9__5_15 = val16; obj16 = (object)val16; } MissilePod.OnEnter += (Manipulator)obj16; object obj17 = <>c.<>9__5_16; if (obj17 == null) { Manipulator val17 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ILCursor val22 = new ILCursor(il); bool flag3 = true; if (val22.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage") })) { val22.Emit(OpCodes.Dup); val22.Emit(OpCodes.Ldarg_0); val22.Emit<BaseState>(OpCodes.Call, "RollCrit"); val22.Emit<OverlapAttack>(OpCodes.Stfld, "isCrit"); flag3 = false; } if (flag3) { Log.Error("Mithrix hammer slam (direct) crit hook failed!"); } }; <>c.<>9__5_16 = val17; obj17 = (object)val17; } WeaponSlam.OnEnter += (Manipulator)obj17; object obj18 = <>c.<>9__5_17; if (obj18 == null) { Manipulator val18 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val21 = new ILCursor(il); bool flag2 = true; if (val21.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<BlastAttack>(x, "baseDamage") })) { val21.Emit(OpCodes.Ldarg_0); val21.Emit<WeaponSlam>(OpCodes.Ldfld, "blastAttack"); val21.Emit(OpCodes.Ldarg_0); val21.Emit<BaseState>(OpCodes.Call, "RollCrit"); val21.Emit<BlastAttack>(OpCodes.Stfld, "crit"); flag2 = false; } if (flag2) { Log.Error("Mithrix hammer slam (explosion) crit hook failed!"); } }; <>c.<>9__5_17 = val18; obj18 = (object)val18; } WeaponSlam.FixedUpdate += (Manipulator)obj18; object obj19 = <>c.<>9__5_18; if (obj19 == null) { Manipulator val19 = 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0079: 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) ILCursor val20 = new ILCursor(il); bool flag = true; if (val20.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<OverlapAttack>(x, "damage") })) { val20.Emit(OpCodes.Ldarg_0); val20.Emit<ContactDamage>(OpCodes.Ldfld, "overlapAttack"); val20.Emit(OpCodes.Ldarg_0); val20.Emit<ContactDamage>(OpCodes.Ldfld, "characterBody"); val20.Emit<CharacterBody>(OpCodes.Callvirt, "RollCrit"); val20.Emit<OverlapAttack>(OpCodes.Stfld, "isCrit"); flag = false; } if (flag) { Log.Error("Contact damage crit hook failed!"); } }; <>c.<>9__5_18 = val19; obj19 = (object)val19; } ContactDamage.FireOverlaps += (Manipulator)obj19; } private void EnemyCritChance(CharacterBody body, StatHookEventArgs args) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent) && (int)body.teamComponent.teamIndex != 1) { args.critAdd += enemyCritChance.Value; } } }