Beispiel #1
0
 //public static bool Prepare() { return false; }
 public static void Prefix(CombatSelectionHandler __instance)
 {
     Log.TWL(0, "CombatSelectionHandler.ProcessPressedButtons ActiveState:" + (__instance.ActiveState == null?"null":__instance.ActiveState.ToString()));
     foreach (string btn in __instance.PressedButtons)
     {
         Log.WL(1, btn);
     }
 }
 public static void Postfix(CombatSelectionHandler __instance, ref bool __state)
 {
     if (__state)
     {
         // Because we override movement states to ConsumesFiring=true during non-interleaved mode, we have to force an auto-select
         Mod.Log.Debug?.Write("Invoking auto select.");
         __instance.AutoSelectActor();
     }
 }
Beispiel #3
0
 public static void PreventMultiTargetBackout(CombatSelectionHandler __instance)
 {
     try {
         if (ReAddStateData)
         {
             // Re-add self state onto selection stack to prevent next backout from cancelling command
             __instance.NotifyChange(CombatSelectionHandler.SelectionChange.StateData);
         }
     }                 catch (Exception ex) { Error(ex); }
 }
Beispiel #4
0
 // NOTE: This is not called for AI
 static void Postfix(CombatSelectionHandler __instance, SelectionState newState)
 {
     try
     {
         Logger.Info("[CombatSelectionHandler_addNewState_POSTFIX] newState.SelectionType: " + newState.SelectionType);
         Fields.JumpPreview = newState.SelectionType == SelectionType.Jump ? true : false;
         Logger.Debug("[CombatSelectionHandler_addNewState_POSTFIX] Fields.JumpPreview: " + Fields.JumpPreview);
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Beispiel #5
0
 public static void Postfix(CombatSelectionHandler __instance, bool __result, AbstractActor actor, bool manualSelection)
 {
     Mod.Log.Debug?.Write($"=== CombatSelectionHandler:TrySelectActor:post - entered for {CombatantUtils.Label(actor)}.");
     if (__instance != null && actor != null && __result == true && actor.IsAvailableThisPhase)
     {
         // Do this to force a refresh during a combat save
         if (TurnDirector_OnEncounterBegin.IsFromSave)
         {
             DEBUG_ToggleForcedVisibility(false, actor.Combat);
             TurnDirector_OnEncounterBegin.IsFromSave = false;
         }
     }
 }
Beispiel #6
0
            // Token: 0x06000025 RID: 37
            private static void Postfix(ToHit __instance, ref float __result, AbstractActor attacker, Weapon weapon, ICombatant target, Vector3 attackPosition, Vector3 targetPosition, LineOfFireLevel lofLevel, bool isCalledShot)
            {
                if (UnityGameInstance.BattleTechGame.Simulation != null && weapon != null)
                {
                    Mod.Log.Trace("TH:GAM entered");
                    bool flag3;
                    if (!attacker.HasMovedThisRound || !attacker.JumpedLastRound || attacker.SkillTactics >= Mod.Config.TacticsSkillNegateJump)
                    {
                        CombatHUD combatHUD = ModState.CombatHUD;
                        bool      flag2;
                        if (combatHUD == null)
                        {
                            flag2 = false;
                        }
                        else
                        {
                            CombatSelectionHandler selectionHandler = combatHUD.SelectionHandler;
                            flag2 = (((selectionHandler != null) ? selectionHandler.ActiveState : null) != null);
                        }
                        if (flag2)
                        {
                            CombatHUD combatHUD2 = ModState.CombatHUD;
                            object    obj;
                            if (combatHUD2 == null)
                            {
                                obj = null;
                            }
                            else
                            {
                                CombatSelectionHandler selectionHandler2 = combatHUD2.SelectionHandler;
                                obj = ((selectionHandler2 != null) ? selectionHandler2.ActiveState : null);
                            }
                            if (obj is SelectionStateJump)
                            {
                                flag3 = (attacker.SkillTactics < Mod.Config.TacticsSkillNegateJump);
                                goto IL_D8;
                            }
                        }
                        flag3 = false;
                    }
                    else
                    {
                        flag3 = true;
                    }
IL_D8:
                    if (flag3)
                    {
                        __result += (float)Mod.Config.ToHitSelfJumped;
                    }
                }
            }
Beispiel #7
0
 // NOTE: This is not called for AI
 static void Prefix(CombatSelectionHandler __instance)
 {
     try
     {
         Logger.Info("[CombatSelectionHandler_RemoveTopState_PREFIX] __instance.ActiveState.SelectionType: " + __instance.ActiveState.SelectionType);
         if (__instance.ActiveState.SelectionType == SelectionType.Jump)
         {
             Fields.JumpPreview = false;
         }
         Logger.Debug("[CombatSelectionHandler_RemoveTopState_PREFIX] Fields.JumpPreview: " + Fields.JumpPreview);
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Beispiel #8
0
 public static bool CheckReverseSelection(CombatSelectionHandler __instance, ref bool __result, MethodInfo reverse)
 {
     try {
         if (!IsReverseKeyPressed())
         {
             return(true);                    // Shift not pressed. Abort.
         }
         IsSelectionReversed = !IsSelectionReversed;
         if (!IsSelectionReversed)
         {
             return(true);                                  // In reversed selection. Allow to pass.
         }
         __result = (bool)reverse.Invoke(__instance, null); // Otherwise call reverse selection.
         return(false);
     }                 catch (Exception ex) { return(Error(ex)); }
 }
Beispiel #9
0
            public static void Postfix(CombatSelectionHandler __instance, ICombatant target)
            {
                try
                {
                    Logger.Debug($"[CombatSelectionHandler_TrySelectTarget_POSTFIX] Called");

                    CombatGameState ___combatGameState = (CombatGameState)AccessTools.Property(typeof(CombatSelectionHandler), "Combat").GetValue(__instance, null);

                    if (target != null && target.team != ___combatGameState.LocalPlayerTeam && !target.IsDead && target != __instance.SelectedTarget)
                    {
                        CameraControl.Instance.SetMovingToGroundPos(target.CurrentPosition, 0.95f);
                    }
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                }
            }
            public static bool Prefix(CombatSelectionHandler __instance)
            {
                try
                {
                    Logger.Debug($"[CombatSelectionHandler_ProcessRightRelease_PREFIX] IsPortraitRightClick: {IsPortraitRightClick}");

                    // Cancel backing out for regular right clicks IF a portrait is the target
                    if (IsPortraitRightClick)
                    {
                        IsPortraitRightClick = false;
                        return(false);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                    return(true);
                }
            }
Beispiel #11
0
            public static void Prefix(CombatSelectionHandler __instance)
            {
                try
                {
                    if (!settings.FastForwardKeyIsToggle)
                    {
                        return;
                    }

                    if (SpeedUpAction == null || !SpeedUpAction.HasChanged || !SpeedUpAction.IsPressed)
                    {
                        return;
                    }

                    speedToggled = !speedToggled;

                    mod.Logger.Log("toggled speed " + speedToggled);
                }
                catch (Exception e)
                {
                    mod.Logger.LogError(e);
                }
            }
        public static void Prefix(CombatSelectionHandler __instance, ref bool __state)
        {
            __state = false;

            if (__instance == null || __instance.ActiveState == null)
            {
                return;
            }
            if (__instance.SelectedActor != null && __instance.SelectedActor.IsDead)
            {
                return;
            }

            Mod.Log.Trace?.Write($"CSH:RCI");

            AbstractActor   selectedActor = __instance.SelectedActor;
            Traverse        combatT       = Traverse.Create(__instance).Property("Combat");
            CombatGameState combat        = combatT.GetValue <CombatGameState>();

            if (__instance.ActiveState.IsComplete && !combat.TurnDirector.IsInterleaved)
            {
                __state = true;
            }
        }
Beispiel #13
0
 public static bool CheckReversePrevSelection(CombatSelectionHandler __instance, ref bool __result)
 {
     return(CheckReverseSelection(__instance, ref __result, SelectNextMethod));
 }