public static void Postfix(SelectionStateMove __instance, ref string __result) { try { if (__instance.HasDestination && Fields.JuggernautCharges) { Logger.Info($"[SelectionStateMove_FireButtonString_POSTFIX] Overriding description..."); __result = Strings.T("Sprint to TACKLE the target using Piloting skill to hit. Ignores EVASIVE. Hit removes GUARDED, deals damage and stability damage."); } } catch (Exception e) { Logger.Error(e); } }
public static void Postfix(SelectionStateMove __instance, ref float __result) { try { if ((__instance.SelectedActor is Mech mech) && Fields.JuggernautCharges) { Logger.Info($"[SelectionStateMove_ProjectedStabilityForState_POSTFIX] Overriding projected stability..."); // This would be vanilla: No stability change when sprinting //__result = mech.CurrentStability; // Charge and tackle causes slight instability __result = mech.GetMinStability(mech.CurrentStability, -1); } } catch (Exception e) { Logger.Error(e); } }
static void Postfix(SelectionStateMove __instance, ref float __result) { Mod.Log.Trace?.Write("SSM:PSFS - entered."); MeleeAttack selectedAttack = ModState.GetSelectedAttack(__instance.SelectedActor); if (__instance.SelectedActor is Mech selectedMech && selectedAttack != null && __instance.PotentialMeleeTarget != null) { float newStability = selectedMech.CurrentStability + selectedAttack.AttackerInstability; List <WayPoint> waypoints = ActorMovementSequence.ExtractWaypointsFromPath(selectedMech, selectedMech.Pathing.CurrentPath, selectedMech.Pathing.ResultDestination, selectedMech.Pathing.CurrentMeleeTarget, selectedMech.Pathing.MoveType); StabilityChangeSource changeSource = StabilityChangeSource.Moving; if (WayPoint.GetDistFromWaypointList(selectedMech.CurrentPosition, waypoints) < 1f) { changeSource = StabilityChangeSource.RemainingStationary; } float minStability = selectedMech.GetMinStability(changeSource, newStability); Mod.Log.Debug?.Write($"Stability change for {CombatantUtils.Label(selectedMech)} => " + $"current: {selectedMech.CurrentStability} projectedNew: {selectedAttack.AttackerInstability} " + $"totalChange: {newStability} afterDump: {minStability}"); __result = minStability; } }