static void Postfix(CombatHUDWeaponSlot __instance, ICombatant target, Weapon ___displayedWeapon, CombatHUD ___HUD) { if (__instance == null || ___displayedWeapon == null || ___HUD.SelectedActor == null || target == null) { return; } Mod.Log.Trace?.Write("CHUDWS:SHC entered"); if (___HUD.SelectionHandler.ActiveState.SelectionType == SelectionType.FireMorale) { int calledShotMod = ActorHelper.CalledShotModifier(___HUD.SelectedActor); if (calledShotMod != 0) { Traverse addToolTipDetailT = Traverse.Create(__instance) .Method("AddToolTipDetail", new Type[] { typeof(string), typeof(int) }); string localText = new Text(Mod.LocalizedText.Modifiers[ModText.Mod_CalledShot]).ToString(); addToolTipDetailT.GetValue(new object[] { localText, calledShotMod }); Mod.Log.Debug?.Write($"Adding calledShot tooltip with text: {localText} and mod: {calledShotMod}"); } Mod.Log.Debug?.Write($"Updated TooltipsForFiring for actor: {___HUD.SelectedActor} with mod: {calledShotMod}"); } else { Mod.Log.Debug?.Write("Not FireMorale, skipping!"); } }
static void Postfix(ref float __result, bool isCalledShot, AbstractActor attacker) { if (isCalledShot) { Mod.Log.Trace?.Write("TH:GAM entered."); // Calculate called shot modifier int calledShotMod = ActorHelper.CalledShotModifier(attacker); Mod.Log.Debug?.Write($"Actor: {attacker.DistinctId()} has calledShotMod: {calledShotMod}"); __result += calledShotMod; } }
static void Postfix(ref string __result, bool isCalledShot, AbstractActor attacker) { if (isCalledShot) { Mod.Log.Trace?.Write("TH:GAMD entered."); // Calculate called shot modifier int calledShotMod = ActorHelper.CalledShotModifier(attacker); if (calledShotMod != 0) { // No need to localize, this is only printed in logs __result = string.Format("{0}CALLED-SHOT {1:+#;-#}; ", __result, (int)calledShotMod); } } }