private static void OnPrisonerReleased(Hero hero, IFaction arg2, EndCaptivityDetail arg3) { if (hero == null) { return; } ZenDzeeRomanceHelper.EndLoverRomances(hero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner); if (hero != Hero.MainHero && !Hero.MainHero.IsPrisoner) { MenuContext currentMenuContext = Campaign.Current.CurrentMenuContext; if (currentMenuContext == null) { return; } if (currentMenuContext.GameMenu.StringId == "zendzee_town_wait_menus" && ZenDzeeRomanceHelper.GetLover(Hero.MainHero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner) == null) { GameMenu.SwitchToMenu("town_wait_menus"); } } }
private static void OnDailyTickHero(Hero hero) { if (!hero.IsTemplate && hero.IsNoble && hero.IsAlive && hero.IsActive && hero.Clan != null && hero.Clan != Clan.PlayerClan && hero.Age >= ZenDzeeRomanceHelper.LoversAgeMin && (!hero.IsFemale || hero.Age < ZenDzeeRomanceHelper.PregnancyAgeMax) && (hero.Spouse == null || hero.Spouse.IsDead || (hero.Spouse.IsFemale && hero.Spouse.Age > ZenDzeeRomanceHelper.PregnancyAgeMax)) && hero.Clan.Heroes.Count(h => h.IsAlive) < 6 && hero.Children.Count(c => c.IsAlive && c.Clan == hero.Clan) == 0) { // Next day after birthday. if ((int)(hero.BirthDay.ElapsedDaysUntilNow - 1) % CampaignTime.DaysInYear == 0) { Hero lover = ZenDzeeRomanceHelper.GetLover(hero); if (lover == null) { // Find a lover. TODO maybe this should had random chance? IEnumerable <Hero> list = hero.Clan.SupporterNotables; if (list != null) { lover = GetSuitableLoverForHero(hero, list); if (lover != null) { ChangeRomanticStateAction.Apply(hero, lover, (Romance.RomanceLevelEnum)ZenDzeeRomanceHelper.RomanceLevel_Lovers); return; } } if (hero.Age >= DesperateToFindSpouseAge && lover == null) { list = Hero.All.Where(h => h.IsWanderer && h.CurrentSettlement != null && h.CurrentSettlement.MapFaction == hero.MapFaction && h.Clan != Clan.PlayerClan && IsHeroSuitableLoverForHero(hero, h)); if (list != null) { lover = GetSuitableLoverForHero(hero, list); if (lover != null) { ChangeRomanticStateAction.Apply(hero, lover, (Romance.RomanceLevelEnum)ZenDzeeRomanceHelper.RomanceLevel_Lovers); return; } } } // Add here other romance options } } } }
private static bool IsHeroSuitableLoverForHero(Hero hero, Hero lover) { return(lover.IsFemale != hero.IsFemale && !lover.IsTemplate && lover.IsActive && lover.IsAlive && lover.Spouse == null && lover.Age >= ZenDzeeRomanceHelper.LoversAgeMin && (!lover.IsFemale || lover.Age < ZenDzeeRomanceHelper.PregnancyAgeMax) && ZenDzeeRomanceHelper.GetLover(lover) == null); }
private static void OnChildConceived(Hero mother) { if (mother.IsPrisoner && mother.StayingInSettlementOfNotable != null) { Hero captor = ZenDzeeRomanceHelper.GetLover(mother, ZenDzeeRomanceHelper.RomanceLevel_Prisoner); if (captor == null) { InformationManager.DisplayMessage(new InformationMessage("ERROR: Captor is null: " + mother.Name)); return; } InformationManager.DisplayMessage(new InformationMessage(captor.Name + " impregnates prisoner " + mother.Name)); } }
public static void Prefix_DailyTickHero(ref Hero hero) { if (!hero.IsFemale || hero.IsDead || hero.Age < 18f || hero.IsPregnant) { return; } Settlement settlement = hero.CurrentSettlement; if (hero.IsHumanPlayerCharacter && !hero.IsPrisoner && hero.Spouse != null && hero.Spouse.CurrentSettlement == settlement) { return; } Hero lover; if (settlement != null) { lover = ZenDzeeRomanceHelper.GetLover(hero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner); if (lover != null) { ZenDzeeRomanceHelper.FakeSpouses(hero, lover); return; } } lover = ZenDzeeRomanceHelper.GetLover(hero, ZenDzeeRomanceHelper.RomanceLevel_Lovers); if (lover != null) { if (lover.IsDead) { ZenDzeeRomanceHelper.EndLoverRomances(lover); return; } if (!lover.IsPrisoner) { ZenDzeeRomanceHelper.FakeSpouses(hero, lover); return; } } }
private static void OnGameMenuOpened(MenuCallbackArgs menuCallbackArgs) { MenuContext menuContext = menuCallbackArgs.MenuContext; GameOverlays.MenuOverlayType menuOverlayType = Campaign.Current.GameMenuManager.GetMenuOverlayType(menuContext); if (menuOverlayType == GameOverlays.MenuOverlayType.SettlementWithCharacters) { Location lordshall = LocationComplex.Current.GetLocationWithId("lordshall"); if (lordshall == null) { return; } Settlement settlement = Hero.MainHero.CurrentSettlement; if (settlement == null) { return; } IEnumerable <Hero> list = settlement.HeroesWithoutParty.Where(h => h.IsPrisoner); if (list == null) { return; } foreach (Hero hero in list) { Location current = LocationComplex.Current.GetLocationOfCharacter(hero); if (current == lordshall) { continue; } if (current == null) { Tuple <string, Monster> actionSetAndMonster = new Tuple <string, Monster>("as_human_lady", Campaign.Current.HumanMonsterSettlement); AgentData agentData = new AgentData( new SimpleAgentOrigin( hero.CharacterObject, -1, null, default(UniqueTroopDescriptor))).Monster(actionSetAndMonster.Item2).NoHorses(true); lordshall.AddCharacter( new LocationCharacter(agentData, new LocationCharacter.AddBehaviorsDelegate(SandBoxManager.Instance.AgentBehaviorManager.AddFixedCharacterBehaviors), null, true, LocationCharacter.CharacterRelations.Neutral, actionSetAndMonster.Item1, true, true, null, false, false, true)); } else { LocationComplex.Current.ChangeLocation(LocationComplex.Current.GetLocationCharacterOfHero(hero), current, lordshall); } } } if (menuContext.GameMenu.StringId == "town_wait_menus") { if (ZenDzeeRomanceHelper.GetLover(Hero.MainHero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner) != null) { GameMenu.SwitchToMenu("zendzee_town_wait_menus"); } } }