From 4b0fd495bf6ba425adb63f81a7ceccec60375d39 Mon Sep 17 00:00:00 2001 From: RealityMachina Date: Sat, 26 May 2018 15:18:05 -0400 Subject: [PATCH] Added new setting for when ejection rolls can occur, fixed logic error in panic recovery. --- PunchinOut/BasicPanic.cs | 10 +++++++--- mod.json | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/PunchinOut/BasicPanic.cs b/PunchinOut/BasicPanic.cs index 5ccb6a4..1afa65f 100644 --- a/PunchinOut/BasicPanic.cs +++ b/PunchinOut/BasicPanic.cs @@ -138,8 +138,6 @@ public static void Prefix(AbstractActor __instance) else //now normal { __instance.Combat.MessageCenter.PublishMessage(new AddSequenceToStackMessage(new ShowActorInfoSequence(mech, $"Recovered To Normal!", FloatieMessage.MessageNature.Buff, true))); - __instance.StatCollection.ModifyStat("Panic Turn: Panicking Aim!", -1, "AccuracyModifier", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.PanickedAimModifier, -1, true); - __instance.StatCollection.ModifyStat("Panic Turn: Panicking Defence!", -1, "ToHitThisActor", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.PanickedToHitModifier, -1, true); } } @@ -169,7 +167,7 @@ public static bool IsPanicking(Mech mech) if (mech != null) { int i = GetTrackedPilotIndex(mech); - + var weapons = mech.Weapons; if (i > -1) { if (Holder.TrackedPilots[i].trackedMech == mech.GUID && @@ -183,6 +181,10 @@ public static bool IsPanicking(Mech mech) { return true; } + if (weapons.TrueForAll(w => w.DamageLevel == ComponentDamageLevel.Destroyed || w.DamageLevel == ComponentDamageLevel.NonFunctional) && BasicPanic.Settings.ConsiderEjectingWithNoWeaps) + { + return true; + } } if (mech.Combat.GetAllAlliesOf(mech).TrueForAll(m => m.IsDead || m.GUID == mech.GUID)) { @@ -464,6 +466,7 @@ internal class ModSettings public int MinimumHealthToAlwaysEjectRoll = 1; public bool KnockedDownCannotEject = true; + public bool ConsiderEjectingWithNoWeaps = true; public float MaxEjectChance = 50; public float BaseEjectionResist = 10; @@ -481,6 +484,7 @@ internal class ModSettings public float WeaponlessModifier = 15; public float AloneModifier = 20; + } public static class BasicPanic diff --git a/mod.json b/mod.json index cec9fcd..f22310d 100644 --- a/mod.json +++ b/mod.json @@ -1,7 +1,7 @@ { "Name": "BasicPanicSystem", - "Version": "0.1.0", + "Version": "0.4.1", "Description": "Adds basic panic system, based on mpstark's Punchin' Out.", "Author": "RealityMachina, forked from mpstark's work", "Website": "https://github.com/RealityMachina/PunchinOut", @@ -26,6 +26,7 @@ "ComboTenAlwaysResists": false, "TacticsTenAlwaysResists": false, "KnockedDownCannotEject": true, + "ConsiderEjectingWithNoWeaps": true, "BaseEjectionResist": 10, "GutsEjectionResistPerPoint": 2,