Skip to content

Commit

Permalink
Fixed more logic and math errors.
Browse files Browse the repository at this point in the history
(My brain derped about zero-based arrays)
  • Loading branch information
RealityMachina committed May 21, 2018
1 parent ea37851 commit 57a68ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
35 changes: 21 additions & 14 deletions PunchinOut/BasicPanic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void Prefix(AbstractActor __instance)
return;

index = PanicHelpers.GetTrackedPilotIndex(pilot);
if (index > 0)
if (index > -1)
{
FoundPilot = true;
}
Expand All @@ -66,17 +66,20 @@ public static void Prefix(AbstractActor __instance)
Holder.TrackedPilots.Add(new PanicTracker(pilot)); //add a new tracker to tracked pilot, then we run it all over again;

index = PanicHelpers.GetTrackedPilotIndex(pilot);
if(index > 0)
if(index > -1)
{
FoundPilot = true;
}
else
{
return;
}
}

if(FoundPilot && !Holder.TrackedPilots[index].ChangedRecently)
{
if(Holder.TrackedPilots[index].pilotStatus == PanicStatus.Fatigued)
{

Holder.TrackedPilots[index].pilotStatus = PanicStatus.Normal;
}

Expand Down Expand Up @@ -151,7 +154,7 @@ public static bool IsPanicking(Mech mech)
{
int i = GetTrackedPilotIndex(pilot);

if (i > 0)
if (i > -1)
{
if (Holder.TrackedPilots[i].trackedPilot == pilot.GUID &&
Holder.TrackedPilots[i].pilotStatus == PanicStatus.Panicked)
Expand Down Expand Up @@ -232,6 +235,10 @@ public static bool ShouldPanic(Mech mech, AttackDirector.AttackSequence attackSe
Holder.TrackedPilots.Add(new PanicTracker(pilot)); //add a new tracker to tracked pilot, then we run it all over again;

index = PanicHelpers.GetTrackedPilotIndex(pilot);
if(index < 0)
{
return false;
}
}

if (Holder.TrackedPilots[index].trackedPilot != pilot.GUID)
Expand Down Expand Up @@ -411,20 +418,20 @@ internal class ModSettings
public bool AlwaysGatedChanges = true;
public float MaxPanicResistTotal = 15; //at least 20% chance to panic if you can't nullify the whole thing
//fatigued debuffs
//-5 to aim
public float FatiguedAimModifier = -5;
//+1 difficulty to attacks
public float FatiguedAimModifier = 1;

//stressed debuffs
//-10 to aim
//+5 to being hit
//+2 difficulty to attacks
//-1 difficulty to being hit

public float StressedAimModifier = -10;
public float StressedToHitModifier = 5;
public float StressedAimModifier = 2;
public float StressedToHitModifier = -1;
//ejection
//-15 to aim
//+5 to being hit
public float PanickedAimModifier = -15;
public float PanickedToHitModifier = 5;
//+4 difficulty to attacks
//-2 difficulty to being hit
public float PanickedAimModifier = 4;
public float PanickedToHitModifier = -2;
public bool GutsTenAlwaysResists = false;
public bool ComboTenAlwaysResists = false;
public bool TacticsTenAlwaysResists = false;
Expand Down
10 changes: 5 additions & 5 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"AtLeastOneChanceToPanic": true,
"AlwaysGatedChanges": true,
"MaxPanicResistTotal": 15,
"FatiguedAimModifier": -5,
"StressedAimModifier": -10,
"StressedToHitModifier": 5,
"PanickedAimModifier": -15,
"PanickedToHitModifier": 5,
"FatiguedAimModifier": 1,
"StressedAimModifier": 2,
"StressedToHitModifier": -1,
"PanickedAimModifier": 4,
"PanickedToHitModifier": -2,

"MinimumHealthToAlwaysEjectRoll": 1,
"MaxEjectChance": 50,
Expand Down

0 comments on commit 57a68ab

Please sign in to comment.