Skip to content

Commit

Permalink
Added new setting for when ejection rolls can occur, fixed logic erro…
Browse files Browse the repository at this point in the history
…r in panic recovery.
  • Loading branch information
RealityMachina committed May 26, 2018
1 parent 7c8be51 commit 4b0fd49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions PunchinOut/BasicPanic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>("Panic Turn: Panicking Aim!", -1, "AccuracyModifier", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.PanickedAimModifier, -1, true);
__instance.StatCollection.ModifyStat<float>("Panic Turn: Panicking Defence!", -1, "ToHitThisActor", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.PanickedToHitModifier, -1, true);
}
}

Expand Down Expand Up @@ -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 &&
Expand All @@ -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))
{
Expand Down Expand Up @@ -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;
Expand All @@ -481,6 +484,7 @@ internal class ModSettings

public float WeaponlessModifier = 15;
public float AloneModifier = 20;

}

public static class BasicPanic
Expand Down
3 changes: 2 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -26,6 +26,7 @@
"ComboTenAlwaysResists": false,
"TacticsTenAlwaysResists": false,
"KnockedDownCannotEject": true,
"ConsiderEjectingWithNoWeaps": true,

"BaseEjectionResist": 10,
"GutsEjectionResistPerPoint": 2,
Expand Down

0 comments on commit 4b0fd49

Please sign in to comment.