using System;
using Verse;
using RimWorld;
using HarmonyLib;
using System.Linq;
using System.Text;

namespace SCE
{
    [HarmonyPatch(typeof(Precept), "get_" + nameof(Precept.DescriptionForTip))]
    public static class UserInterfacePatches
    {
        public static void Postfix(ref string __result, Precept __instance)
        {
            var descComp = __instance.def.comps.OfType<PreceptComp_GameplayEffectDescription>().FirstOrDefault();
            if (descComp == null)
            {
                return;
            }
            __result ??= "";
            StringBuilder sb = new();
            sb.AppendLine();
            sb.AppendInNewLine("DescriptionPrecept_GameplayEffectHeading".Translate().Colorize(ColoredText.TipSectionTitleColor));
            sb.AppendInNewLine(descComp.description);
            __result += sb.ToString();
        }
    }
}