static void Postfix() { if (SettingClass.Instance.EnableAutoFixBrokenKids) { InheritHelper.FixCappedKids(); } }
public static int GrowSibling(Hero hero) { int currentAge = (int)hero.Age; hero.BirthDay = HeroHelper.GetRandomBirthDayForAge((int)hero.Age + 1); if ((SettingClass.Instance.NPCChildrenGrowthBoostEnabled || hero.Clan == Clan.PlayerClan) && (int)hero.Age == SettingClass.Instance.BecomeHeroAge) { if (hero.Clan == Clan.PlayerClan) { GrowthDebug.LogInfo( $"Your child {hero.Name} has now become a hero and is ready to fight for his clan!", "Grow Sibling"); InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"你的孩子{hero.Name}已经成年, 成为了一个可以为家族而战的英雄") : new TextObject( $"Your child {hero.Name} has become a hero and is ready to fight for his clan!"), 0, null, "event:/ui/notification/quest_finished"); InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"你的孩子{hero.Name}从父母那里继承了部分能力, 在许多方面都突出常人") : new TextObject( $"Your child{hero.Name} inherits from its parents and become capable in many fields"), 0, null, "event:/ui/notification/quest_finished"); } InheritHelper.Inherit(hero); } currentAge = (int)hero.Age; return(currentAge); }
public static int GrowTargetHero(Hero hero) { if (hero == null) { return(-1); } int currentAge = (int)hero.Age; bool notified = false; if ((int)hero.Age > SettingClass.Instance.BecomeHeroAge) { foreach (var heroSibling in hero.Siblings) { if (heroSibling.Age >= currentAge) { GrowSibling(heroSibling); GrowthDebug.LogInfo( $"${hero.Name}'s older siblings are 1 year older due to the growth of {hero.Name}"); if (heroSibling.Clan == Clan.PlayerClan && !notified) { InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"因为{hero.Name}的成长,他的哥哥姐姐都长大了一岁") : new TextObject( $"{hero.Name}'s older siblings are 1 year older due to the growth of {hero.Name}"), 0, null, "event:/ui/notification/quest_update"); notified = true; } } } } hero.BirthDay = HeroHelper.GetRandomBirthDayForAge((int)hero.Age + 1); if (hero.Father == Hero.MainHero || hero.Mother == Hero.MainHero) { InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"你的孩子:{hero.Name} 现在已经{(int) hero.Age}岁了") : new TextObject($"Now your child: {hero.Name} is {(int) hero.Age} years old"), 0, null, "event:/ui/notification/quest_update"); if (hero.Age >= SettingClass.Instance.BecomeHeroAge && hero.Age <= SettingClass.Instance.GrowthStopAge) { // Only Main Heros get the notification InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"因为你的孩子的成长,你和你的配偶都老了一岁") : new TextObject( "You and your spouse are 1 year older due to the growth of your children"), 0, null, "event:/ui/notification/quest_update"); } } if ((int)hero.Age >= SettingClass.Instance.BecomeHeroAge && (int)hero.Age <= SettingClass.Instance.GrowthStopAge) { if (hero.Mother != null) { GrowTargetHero(hero.Mother); } if (hero.Father != null) { GrowTargetHero(hero.Father); } } if ((int)hero.Age == SettingClass.Instance.BecomeHeroAge) { InheritHelper.Inherit(hero); if (hero.Clan == Clan.PlayerClan) { GrowthDebug.LogInfo( $"Your child {hero.Name} has now become a hero and is ready to fight for his clan!", "Grow Target"); InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"你的孩子{hero.Name}已经成年, 成为了一个可以为家族而战的英雄") : new TextObject( $"Your child {hero.Name} has become a hero and is ready to fight for his clan!"), 0, null, "event:/ui/notification/quest_finished"); InformationManager.AddQuickInformation( SettingClass.CurrentLanguage == "zh" ? new TextObject($"你的孩子{hero.Name}从父母那里继承了部分能力, 在许多方面都突出常人") : new TextObject( $"Your child {hero.Name} inherits from its parents and become capable in many fields"), 0, null, "event:/ui/notification/quest_finished"); } } currentAge = (int)hero.Age; return(currentAge); }