Example #1
0
 public static void Postfix(BlueprintKingdomEventBase __instance, ref LeaderState __result)
 {
     if (Settings.toggleIgnoreStartTaskRestrictions)
     {
         __result = new LeaderState(__instance.GetDefaultResolutionType());
     }
 }
Example #2
0
        public static bool CausesGameOver(BlueprintKingdomEventBase blueprint)
        {
            var results = blueprint.GetComponent <EventFinalResults>();

            if (results == null)
            {
                return(false);
            }
            foreach (var result in results.Results)
            {
                foreach (var action in result.Actions.Actions)
                {
                    if (action is GameOver)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        public static void ShowBlueprintEvent(BlueprintKingdomEventBase blueprint)
        {
            GUILayout.Label($"Bluerpint: {blueprint.DisplayName} ({blueprint.name})", Util.BoldLabel);
            GUILayout.Label($"Description: {blueprint.LocalizedDescription}");
            GUILayout.Label($"ResolutionTime: {blueprint.ResolutionTime} days");
            GUILayout.Label($"NeedToVistTheThroneRoom: {blueprint.NeedToVisitTheThroneRoom}");
            GUILayout.Label($"TriggerCondition: {Util.FormatConditions(blueprint.TriggerCondition)}");
            if (blueprint.HasDC)
            {
                GUILayout.Label($"ResolutionDC: {blueprint.ResolutionDC}");
            }
            if (!blueprint.HasDC)
            {
                GUILayout.Label($"AutoResolveResult: {blueprint.AutoResolveResult}");
            }
            if (blueprint is BlueprintKingdomEvent bke)
            {
                var actionText      = Util.FormatActions(bke.OnTrigger);
                var statChangesText = bke.StatsOnTrigger.ToStringWithPrefix(" ");
                if (actionText != "")
                {
                    GUILayout.Label($"OnTrigger: {actionText}");
                }
                if (!bke.StatsOnTrigger.IsEmpty)
                {
                    GUILayout.Label($"StatsOnTrigger: {statChangesText}");
                }
            }
            if (blueprint is BlueprintKingdomProject bkp)
            {
                GUILayout.Label($"ProjectType: {bkp.ProjectType}");
            }
            if (blueprint is BlueprintKingdomClaim bkc)
            {
                if (bkc.KnownCondition != null && bkc.KnownCondition.Conditions.Length > 0)
                {
                    GUILayout.Label($"KnownConditions: {Util.FormatConditions(bkc.KnownCondition)}");
                }
                if (bkc.FailCondition != null && bkc.FailCondition.Conditions.Length > 0)
                {
                    GUILayout.Label($"FailCondition: {Util.FormatConditions(bkc.FailCondition)}");
                }
                if (string.IsNullOrEmpty(bkc.UnknownDescription))
                {
                    GUILayout.Label($"UnknownDescription: {bkc.UnknownDescription}");
                }
                if (string.IsNullOrEmpty(bkc.KnownDescription))
                {
                    GUILayout.Label($"KnownDescription: {bkc.KnownDescription}");
                }
                if (string.IsNullOrEmpty(bkc.FailedDescription))
                {
                    GUILayout.Label($"FailedDescription: {bkc.FailedDescription}");
                }
                if (string.IsNullOrEmpty(bkc.FulfilledDescription))
                {
                    GUILayout.Label($"FulfilledDescription: {bkc.FulfilledDescription}");
                }
            }
            GUILayout.Label($"ResolveAutomatically: {blueprint.ResolveAutomatically}");
            if (!blueprint.ResolveAutomatically)
            {
                foreach (var solution in blueprint.Solutions.Entries)
                {
                    foreach (var result in solution.Resolutions)
                    {
                        if (IsResultEmpty(result))
                        {
                            continue;
                        }
                        var statChangesText = result.StatChanges.ToStringWithPrefix(" ");
                        var actionText      = Util.FormatActions(result.Actions);
                        GUILayout.Label($"PossibleSolution: {result.Margin}, Leader {solution.Leader}, DC {solution.DCModifier}", Util.BoldLabel);
                        if (result.LeaderAlignment != Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Any)
                        {
                            GUILayout.Label($"Alignment: {result.LeaderAlignment}");
                        }
                        if (actionText != "")
                        {
                            GUILayout.Label($"Actions: {actionText}");
                        }
                        if (!result.StatChanges.IsEmpty)
                        {
                            GUILayout.Label($"StatChanges: {statChangesText}");
                        }
                        if (result.SuccessCount != 0)
                        {
                            GUILayout.Label($"SuccessCount: {result.SuccessCount}");
                        }
                        if (result.LocalizedDescription != "")
                        {
                            GUILayout.Label($"Description: {result.LocalizedDescription}");
                        }
                        if (result.Condition != null && result.Condition.Conditions.Length > 0)
                        {
                            GUILayout.Label($"Conditions: {Util.FormatConditions(result.Condition)}");
                        }
                    }
                }
            }
            var finalResults = blueprint.GetComponent <EventFinalResults>();

            if (finalResults != null)
            {
                foreach (var result in finalResults.Results)
                {
                    var statChangesText = result.StatChanges.ToStringWithPrefix(" ");
                    var actionText      = Util.FormatActions(result.Actions);
                    GUILayout.Label($"FinalResult {result.Margin}", Util.BoldLabel);
                    if (result.LeaderAlignment != Kingmaker.UnitLogic.Alignments.AlignmentMaskType.Any)
                    {
                        GUILayout.Label($"Alignment: {result.LeaderAlignment}");
                    }
                    if (actionText != "")
                    {
                        GUILayout.Label($"Actions: {actionText}");
                    }
                    if (!result.StatChanges.IsEmpty)
                    {
                        GUILayout.Label($"StatChanges: {statChangesText}");
                    }
                    if (result.SuccessCount != 0)
                    {
                        GUILayout.Label($"SuccessCount: {result.SuccessCount}");
                    }
                    if (result.LocalizedDescription != "")
                    {
                        GUILayout.Label($"Description: {result.LocalizedDescription}");
                    }
                    if (result.Condition != null && result.Condition.Conditions.Length > 0)
                    {
                        GUILayout.Label($"Conditions: {Util.FormatConditions(result.Condition)}");
                    }
                }
            }
        }
 public KingdomEventNew(BlueprintKingdomEventBase blueprint, RegionState region) : base(blueprint, region)
 {
 }