From 88c356d17c61c3c53a565d0ddd5f427e6eeea2ad Mon Sep 17 00:00:00 2001 From: "Michael P. Starkweather" Date: Fri, 8 Jun 2018 16:06:52 -0500 Subject: [PATCH] Code cleanup --- PunchinOut.sln | 3 --- PunchinOut/Properties/AssemblyInfo.cs | 2 +- PunchinOut/PunchinOut.cs | 37 +++++++++------------------ PunchinOut/PunchinOut.csproj | 9 ------- 4 files changed, 13 insertions(+), 38 deletions(-) diff --git a/PunchinOut.sln b/PunchinOut.sln index 1e38119..2751392 100644 --- a/PunchinOut.sln +++ b/PunchinOut.sln @@ -7,12 +7,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PunchinOut", "PunchinOut\Pu EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D8483027-7E80-4E31-B5B7-F7C4A1A78600}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D8483027-7E80-4E31-B5B7-F7C4A1A78600}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8483027-7E80-4E31-B5B7-F7C4A1A78600}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8483027-7E80-4E31-B5B7-F7C4A1A78600}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/PunchinOut/Properties/AssemblyInfo.cs b/PunchinOut/Properties/AssemblyInfo.cs index a43a193..f4e8603 100644 --- a/PunchinOut/Properties/AssemblyInfo.cs +++ b/PunchinOut/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ // 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("0.1.0.*")] \ No newline at end of file +[assembly: AssemblyVersion("0.1.1.*")] \ No newline at end of file diff --git a/PunchinOut/PunchinOut.cs b/PunchinOut/PunchinOut.cs index 6c349ac..92d6f6d 100644 --- a/PunchinOut/PunchinOut.cs +++ b/PunchinOut/PunchinOut.cs @@ -1,17 +1,16 @@ using System; -using System.Diagnostics.CodeAnalysis; using System.Reflection; using BattleTech; using Harmony; -using JetBrains.Annotations; using Newtonsoft.Json; +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global + namespace PunchinOut { - [UsedImplicitly] - [SuppressMessage("ReSharper", "InconsistentNaming")] [HarmonyPatch(typeof(AttackStackSequence), "OnAttackComplete")] - public static class AttackStackSequence_OnAttackComplete_Patch + public static class AttackStackSequence_OnAttack_Complete_Patch { public static void Prefix(AttackStackSequence __instance, MessageCenterMessage message) { @@ -33,10 +32,10 @@ internal class ModSettings public bool GutsTenAlwaysResists = true; public bool KnockedDownCannotEject = true; - public float MaxEjectChance = 50; + public float MaxEjectChance = 25; public float BaseEjectionResist = 10; - public float GutsEjectionResistPerPoint = 2; + public float GutsEjectionResistPerPoint = 3; public float UnsteadyModifier = 3; public float PilotHealthMaxModifier = 5; @@ -48,13 +47,13 @@ internal class ModSettings public float NextShotLikeThatCouldKill = 10; - public float WeaponlessModifier = 10; - public float AloneModifier = 10; + public float WeaponlessModifier = 15; + public float AloneModifier = 5; } public static class PunchinOut { - internal static ModSettings Settings; + private static ModSettings Settings; public static void Init(string modDir, string modSettings) { @@ -88,7 +87,7 @@ public static bool RollForEjectionResult(Mech mech, AttackDirector.AttackSequenc var weapons = mech.Weapons; var guts = mech.SkillGuts; - float lowestRemaining = mech.CenterTorsoStructure + mech.CenterTorsoFrontArmor; + var lowestRemaining = mech.CenterTorsoStructure + mech.CenterTorsoFrontArmor; float ejectModifiers = 0; // guts 10 makes you immune, player character cannot be forced to eject @@ -105,22 +104,16 @@ public static bool RollForEjectionResult(Mech mech, AttackDirector.AttackSequenc var pilotHealthPercent = 1 - (pilot.Injuries / pilot.Health); if (pilotHealthPercent < 1) - { ejectModifiers += Settings.PilotHealthMaxModifier * (1 - pilotHealthPercent); - } } if (mech.IsUnsteady) - { ejectModifiers += Settings.UnsteadyModifier; - } // Head var headHealthPercent = (mech.HeadArmor + mech.HeadStructure) / (mech.GetMaxArmor(ArmorLocation.Head) + mech.GetMaxStructure(ChassisLocations.Head)); if (headHealthPercent < 1) - { ejectModifiers += Settings.HeadDamageMaxModifier * (1 - headHealthPercent); - } // CT var ctPercent = (mech.CenterTorsoFrontArmor + mech.CenterTorsoStructure) / (mech.GetMaxArmor(ArmorLocation.CenterTorso) + mech.GetMaxStructure(ChassisLocations.CenterTorso)); @@ -133,16 +126,12 @@ public static bool RollForEjectionResult(Mech mech, AttackDirector.AttackSequenc // side torsos var ltStructurePercent = mech.LeftTorsoStructure / mech.GetMaxStructure(ChassisLocations.LeftTorso); if (ltStructurePercent < 1) - { ejectModifiers += Settings.SideTorsoInternalDamageMaxModifier * (1 - ltStructurePercent); - } var rtStructurePercent = mech.RightTorsoStructure / mech.GetMaxStructure(ChassisLocations.RightTorso); if (rtStructurePercent < 1) - { ejectModifiers += Settings.SideTorsoInternalDamageMaxModifier * (1 - rtStructurePercent); - } - + // legs if (mech.RightLegDamageLevel == LocationDamageLevel.Destroyed || mech.LeftLegDamageLevel == LocationDamageLevel.Destroyed) { @@ -166,10 +155,8 @@ public static bool RollForEjectionResult(Mech mech, AttackDirector.AttackSequenc // next shot could kill if (lowestRemaining <= attackSequence.cumulativeDamage) - { ejectModifiers += Settings.NextShotLikeThatCouldKill; - } - + // weaponless if (weapons.TrueForAll(w => w.DamageLevel == ComponentDamageLevel.Destroyed || w.DamageLevel == ComponentDamageLevel.NonFunctional)) diff --git a/PunchinOut/PunchinOut.csproj b/PunchinOut/PunchinOut.csproj index 10e0c6a..506581a 100644 --- a/PunchinOut/PunchinOut.csproj +++ b/PunchinOut/PunchinOut.csproj @@ -12,15 +12,6 @@ v3.5 512 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - pdbonly true