コード例 #1
0
        static bool Prefix()
        {
            if (SettingClass.Instance.EnableHeroOverAgeDeath)
            {
                int howMany = AgingSystemHelper.KillOverAgedHero();
                if (howMany > 0)
                {
                    InformationManager.AddQuickInformation(
                        SettingClass.CurrentLanguage == "zh"
                            ? new TextObject($"很不幸, 今天有{howMany}位卡拉迪亚的战士因为衰老和疾病永远离开了我们。")
                            : new TextObject(
                            $"Unfortunately, {howMany} Hero(s) in Calradia died because of old age today"),
                        0, null, "event:/ui/notification/death");
                }
            }

            return(true);
        }
コード例 #2
0
        static void Postfix()
        {
            // if setting enabled, grow npc children
            if (SettingClass.Instance.NPCChildrenGrowthBoostEnabled)
            {
                int numberOfNobleChildrenGrow   = 0;
                int numberOfNotableChildrenGrow = 0;

                if ((int)(Campaign.Current.CampaignStartTime.ElapsedDaysUntilNow %
                          SettingClass.Instance.ChildrenGrowthCycle) == 0)
                {
                    Hero.All.ToList <Hero>().ForEach((heroEle) =>
                    {
                        if (heroEle.IsNoble && heroEle.Clan != Clan.PlayerClan)
                        {
                            if ((int)heroEle.Age < SettingClass.Instance.GrowthStopAge)
                            {
                                AgingSystemHelper.GrowTargetHero(heroEle);
                                numberOfNobleChildrenGrow += 1;
                            }
                        }

                        if (heroEle.IsNotable || heroEle.IsRuralNotable)
                        {
                            if ((int)heroEle.Age < SettingClass.Instance.GrowthStopAge)
                            {
                                GrowthDebug.LogInfo($"Handling Notable {heroEle.Name}", "Handling, notable");
                                AgingSystemHelper.GrowTargetHeroWithoutSideEffect(heroEle);
                                numberOfNotableChildrenGrow += 1;
                            }
                        }
                    });
                }

                if (numberOfNobleChildrenGrow > 0)
                {
                    InformationManager.DisplayMessage(SettingClass.CurrentLanguage == "zh"
                        ? new InformationMessage($"今天卡拉迪亚大陆有{numberOfNobleChildrenGrow}个贵族孩子又长大了一岁", Colors.Cyan)
                        : new InformationMessage(
                                                          $"Today, {numberOfNobleChildrenGrow} noble children grow up faster in the world of Calradia",
                                                          Colors.Cyan));
                    GrowthDebug.LogInfo($"Today, {numberOfNobleChildrenGrow} noble children grow faster in Calradia");
                }

                if (numberOfNotableChildrenGrow > 0)
                {
                    InformationManager.DisplayMessage(SettingClass.CurrentLanguage == "zh"
                        ? new InformationMessage($"今天卡拉迪亚大陆有{numberOfNotableChildrenGrow}个要人孩子又长大了一岁", Colors.Cyan)
                        : new InformationMessage(
                                                          $"Today, {numberOfNotableChildrenGrow} notable children grow up faster in the world of Calradia",
                                                          Colors.Cyan));
                    GrowthDebug.LogInfo(
                        $"Today, {numberOfNotableChildrenGrow} notable children grow faster in Calradia");
                }
            }

            if (Hero.MainHero.Children.Count != 0)
            {
                int cycleCeiling = SettingClass.Instance.ChildrenGrowthCycle;

                if ((int)(Campaign.Current.CampaignStartTime.ElapsedDaysUntilNow % cycleCeiling) == 0)
                {
                    Hero.MainHero.Children.ForEach((Hero child) =>
                    {
                        GrowthDebug.LogInfo($"Handling Your child {child.Name}");
                        GrowthDebug.LogInfo($"Your child is {child.Age} years old before");
                        GrowthDebug.LogInfo("Entering ForEach");

                        if (child.Age < SettingClass.Instance.GrowthStopAge)
                        {
                            AgingSystemHelper.GrowTargetHero(child);
                        }
                    });
                }
            }
        }