Skip to content

Commit

Permalink
Updated json with new variables, added support for early ejection per…
Browse files Browse the repository at this point in the history
… class of mechs.
  • Loading branch information
RealityMachina committed Jun 1, 2018
1 parent c4dfe9e commit 23adf9a
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 5 deletions.
4 changes: 2 additions & 2 deletions PunchinOut/BasicPanic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ internal class ModSettings
public bool EnemyMediumsConsiderEjectingEarly = false;
public PanicStatus MediumMechEarlyPanicThreshold = PanicStatus.Stressed;

public bool PlayerLargesConsiderEjectingEarly = false;
public bool EnemyLargessConsiderEjectingEarly = false;
public bool PlayerHeaviesConsiderEjectingEarly = false;
public bool EnemyHeaviesConsiderEjectingEarly = false;
public PanicStatus HeavyMechEarlyPanicThreshold = PanicStatus.Stressed;

public bool PlayerAssaultsConsiderEjectingEarly = false;
Expand Down
85 changes: 83 additions & 2 deletions PunchinOut/PanicHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BattleTech;
using System;
using BattleTech;
using PunchinOut;

namespace BasicPanic
Expand Down Expand Up @@ -34,7 +35,11 @@ public static bool IsPanicking(Mech mech, ref bool IsEarlyPanic)
return true;
}

if
if(CanEarlyPanic(mech, i))
{
IsEarlyPanic = true;
return true;
}

}
if (mech.Combat.GetAllAlliesOf(mech).TrueForAll(m => m.IsDead || m.GUID == mech.GUID))
Expand All @@ -45,6 +50,82 @@ public static bool IsPanicking(Mech mech, ref bool IsEarlyPanic)
return false;
}

private static bool CanEarlyPanic(Mech mech, int i)
{
if (Holder.TrackedPilots[i].trackedMech == mech.GUID)
{
if(mech.team == mech.Combat.LocalPlayerTeam)
{
if (BasicPanic.Settings.PlayerLightsConsiderEjectingEarly && mech.weightClass == WeightClass.LIGHT)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.LightMechEarlyPanicThreshold)
{
return true;
}
}

else if(BasicPanic.Settings.PlayerMediumsConsiderEjectingEarly && mech.weightClass == WeightClass.MEDIUM)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.MediumMechEarlyPanicThreshold)
{
return true;
}
}
else if (BasicPanic.Settings.PlayerHeaviesConsiderEjectingEarly && mech.weightClass == WeightClass.HEAVY)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.HeavyMechEarlyPanicThreshold)
{
return true;
}
}

else if (BasicPanic.Settings.PlayerAssaultsConsiderEjectingEarly && mech.weightClass == WeightClass.ASSAULT)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.AssaultMechEarlyPanicThreshold)
{
return true;
}
}
}
else
{
if (BasicPanic.Settings.EnemyLightsConsiderEjectingEarly && mech.weightClass == WeightClass.LIGHT)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.LightMechEarlyPanicThreshold)
{
return true;
}
}

else if (BasicPanic.Settings.EnemyMediumsConsiderEjectingEarly && mech.weightClass == WeightClass.MEDIUM)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.MediumMechEarlyPanicThreshold)
{
return true;
}
}
else if (BasicPanic.Settings.EnemyHeaviesConsiderEjectingEarly && mech.weightClass == WeightClass.HEAVY)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.HeavyMechEarlyPanicThreshold)
{
return true;
}
}

else if (BasicPanic.Settings.EnemyAssaultsConsiderEjectingEarly && mech.weightClass == WeightClass.ASSAULT)
{
if (Holder.TrackedPilots[i].pilotStatus == BasicPanic.Settings.AssaultMechEarlyPanicThreshold)
{
return true;
}
}
}

}

return false;
}

public static int GetTrackedPilotIndex(Mech mech)
{
if (mech == null)
Expand Down
20 changes: 19 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "BasicPanicSystem",

"Version": "0.4.1",
"Version": "0.5.0",
"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 @@ -11,6 +11,23 @@
"Settings": {
"PlayerCharacterAlwaysResists": true,

"PlayerLightsConsiderEjectingEarly": false,
"EnemyLightsConsiderEjectingEarly": true,
"LightMechEarlyPanicThreshold": 1,

"PlayerMediumsConsiderEjectingEarly": false,
"EnemyMediumsConsiderEjectingEarly": false,
"MediumMechEarlyPanicThreshold": 2,

"PlayerHeaviesConsiderEjectingEarly": false,
"EnemyHeaviesConsiderEjectingEarly": false,
"HeavyMechEarlyPanicThreshold": 2,

"PlayerAssaultsConsiderEjectingEarly": false,
"EnemyAssaultsConsiderEjectingEarly": false,
"AssaultMechEarlyPanicThreshold": 2,
"MaxEjectChanceWhenEarly": 10,

"AtLeastOneChanceToPanic": true,
"AlwaysGatedChanges": true,
"MaxPanicResistTotal": 15,
Expand All @@ -27,6 +44,7 @@
"TacticsTenAlwaysResists": false,
"KnockedDownCannotEject": true,
"ConsiderEjectingWithNoWeaps": true,
"UseNextShotLikeThatCouldKill": true,

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

0 comments on commit 23adf9a

Please sign in to comment.