diff --git a/Patches/InjuryPatches.cs b/Patches/InjuryPatches.cs index 10ddaaa..d5c1cd0 100644 --- a/Patches/InjuryPatches.cs +++ b/Patches/InjuryPatches.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Reflection.Emit; using Harmony; using BattleTech; using TisButAScratch.Framework; @@ -516,7 +517,21 @@ public static bool Prefix(Contract __instance) } } + [HarmonyPatch(typeof(SimGameState), "RefreshInjuries")] + public static class SimGameState_RefreshInjuries + { + public static IEnumerable Transpiler(IEnumerable instructions) + { + List codes = instructions.ToList(); + + // only update injury cost of new cost is greater than old cost + int index = codes.FindIndex(c => c == codes.First(x => x.opcode == OpCodes.Beq)); + + codes[index].opcode = OpCodes.Bge; + return codes.AsEnumerable(); + } + } [HarmonyPatch(typeof(SimGameState))] [HarmonyPatch("GetInjuryCost", typeof(Pilot))] diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index f6b6897..9635679 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.4.2")] -[assembly: AssemblyFileVersion("1.0.4.2")] +[assembly: AssemblyVersion("1.0.4.3")] +[assembly: AssemblyFileVersion("1.0.4.3")] diff --git a/bin/Debug/TisButAScratch.dll b/bin/Debug/TisButAScratch.dll index 6481213..6978abc 100644 Binary files a/bin/Debug/TisButAScratch.dll and b/bin/Debug/TisButAScratch.dll differ diff --git a/bin/Debug/TisButAScratch.pdb b/bin/Debug/TisButAScratch.pdb index 7b6a1f3..c3bb7aa 100644 Binary files a/bin/Debug/TisButAScratch.pdb and b/bin/Debug/TisButAScratch.pdb differ diff --git a/obj/Debug/TisButAScratch.dll b/obj/Debug/TisButAScratch.dll index 6481213..6978abc 100644 Binary files a/obj/Debug/TisButAScratch.dll and b/obj/Debug/TisButAScratch.dll differ diff --git a/obj/Debug/TisButAScratch.pdb b/obj/Debug/TisButAScratch.pdb index 7b6a1f3..c3bb7aa 100644 Binary files a/obj/Debug/TisButAScratch.pdb and b/obj/Debug/TisButAScratch.pdb differ