예제 #1
0
        internal void CECaptorStripVictim(Hero captive)
        {
            if (captive == null)
            {
                return;
            }
            Equipment randomElement = new Equipment(false);

            ItemObject itemObjectBody = captive.IsFemale
                ? MBObjectManager.Instance.GetObject <ItemObject>("burlap_sack_dress")
                : MBObjectManager.Instance.GetObject <ItemObject>("tattered_rags");

            randomElement.AddEquipmentToSlotWithoutAgent(EquipmentIndex.Body, new EquipmentElement(itemObjectBody));
            Equipment randomElement2 = new Equipment(true);

            randomElement2.FillFrom(randomElement, false);

            if (CESettings.Instance != null && CESettings.Instance.EventCaptorGearCaptives)
            {
                CECampaignBehavior.AddReturnEquipment(captive, captive.BattleEquipment, captive.CivilianEquipment);
            }



            foreach (EquipmentCustomIndex index in Enum.GetValues(typeof(EquipmentCustomIndex)))
            {
                EquipmentIndex i = (EquipmentIndex)index;

                try
                {
                    if (!captive.BattleEquipment.GetEquipmentFromSlot(i).IsEmpty)
                    {
                        PartyBase.MainParty.ItemRoster.AddToCounts(captive.BattleEquipment.GetEquipmentFromSlot(i).Item, 1);
                    }
                }
                catch (Exception) { }

                try
                {
                    if (!captive.CivilianEquipment.GetEquipmentFromSlot(i).IsEmpty)
                    {
                        PartyBase.MainParty.ItemRoster.AddToCounts(captive.CivilianEquipment.GetEquipmentFromSlot(i).Item, 1);
                    }
                }
                catch (Exception) { }
            }

            EquipmentHelper.AssignHeroEquipmentFromEquipment(captive, randomElement);
            EquipmentHelper.AssignHeroEquipmentFromEquipment(captive, randomElement2);
        }
예제 #2
0
        private void ConsequenceStrip(Companion companion, Hero hero)
        {
            if (companion.MultipleRestrictedListOfConsequences.Contains(RestrictedListOfConsequences.Strip))
            {
                if (hero == null)
                {
                    return;
                }
                Equipment randomElement = new Equipment(false);

                ItemObject itemObjectBody = hero.IsFemale
                    ? MBObjectManager.Instance.GetObject <ItemObject>("burlap_sack_dress")
                    : MBObjectManager.Instance.GetObject <ItemObject>("tattered_rags");
                randomElement.AddEquipmentToSlotWithoutAgent(EquipmentIndex.Body, new EquipmentElement(itemObjectBody));
                Equipment randomElement2 = new Equipment(true);
                randomElement2.FillFrom(randomElement, false);

                if (CESettings.Instance != null && CESettings.Instance.EventCaptorGearCaptives)
                {
                    CECampaignBehavior.AddReturnEquipment(hero, hero.BattleEquipment, hero.CivilianEquipment);
                }

                foreach (EquipmentCustomIndex index in Enum.GetValues(typeof(EquipmentCustomIndex)))
                {
                    EquipmentIndex i = (EquipmentIndex)index;

                    try
                    {
                        if (!hero.BattleEquipment.GetEquipmentFromSlot(i).IsEmpty)
                        {
                            PartyBase.MainParty.ItemRoster.AddToCounts(hero.BattleEquipment.GetEquipmentFromSlot(i).Item, 1);
                        }
                    }
                    catch (Exception) { }

                    try
                    {
                        if (!hero.CivilianEquipment.GetEquipmentFromSlot(i).IsEmpty)
                        {
                            PartyBase.MainParty.ItemRoster.AddToCounts(hero.CivilianEquipment.GetEquipmentFromSlot(i).Item, 1);
                        }
                    }
                    catch (Exception) { }
                }

                EquipmentHelper.AssignHeroEquipmentFromEquipment(hero, randomElement);
                EquipmentHelper.AssignHeroEquipmentFromEquipment(hero, randomElement2);
            }
        }
예제 #3
0
 private bool IsHeroAgeSuitableForPregnancy(Hero hero) => hero != null && hero.Age >= 18f && hero.Age <= 45f && !CECampaignBehavior.CheckIfPregnancyExists(hero);
예제 #4
0
        // Captor / Captive Version
        public void CaptivityImpregnationChance(Hero targetHero, int modifier = 0, bool forcePreg = false, bool lord = true, Hero captorHero = null)
        {
            ScoresCalculation scoresCalculation = new ScoresCalculation();


            if (targetHero != null && targetHero.IsFemale && !targetHero.IsPregnant && !CECampaignBehavior.CheckIfPregnancyExists(targetHero))
            {
                if (CESettings.Instance != null && IsHeroAgeSuitableForPregnancy(targetHero) && CESettings.Instance.PregnancyToggle)
                {
                    if (!CESettings.Instance.UsePregnancyModifiers)
                    {
                        modifier = 0;
                    }

                    if (MBRandom.Random.Next(100)
                        >= (CESettings.Instance.AttractivenessSkill
                            ? scoresCalculation.AttractivenessScore(targetHero) / 20 + modifier
                            : CESettings.Instance.PregnancyChance + modifier))
                    {
                        return;
                    }

                    Hero randomSoldier;

                    if (captorHero != null)
                    {
                        if (!captorHero.IsFemale)
                        {
                            randomSoldier = captorHero;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else if (lord && CECampaignBehavior.ExtraProps.Owner != null)
                    {
                        randomSoldier = CECampaignBehavior.ExtraProps.Owner;
                    }
                    else if (lord && targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsMobile && targetHero.PartyBelongedToAsPrisoner.MobileParty?.LeaderHero != null && !targetHero.PartyBelongedToAsPrisoner.MobileParty.LeaderHero.IsFemale)
                    {
                        randomSoldier = targetHero.PartyBelongedToAsPrisoner.MobileParty.LeaderHero;
                    }
                    else if (targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsMobile && targetHero.PartyBelongedToAsPrisoner.MobileParty != null)
                    {
                        IEnumerable <TroopRosterElement> maleMembers         = targetHero.PartyBelongedToAsPrisoner.MobileParty.MemberRoster.GetTroopRoster().Where(characterObject => characterObject.Character.IsFemale == false);
                        List <TroopRosterElement>        troopRosterElements = maleMembers.ToList();

                        if (!troopRosterElements.Any())
                        {
                            return;
                        }

                        CharacterObject m = troopRosterElements.GetRandomElement().Character;
                        randomSoldier = HeroCreator.CreateSpecialHero(m, targetHero.PartyBelongedToAsPrisoner.MobileParty.HomeSettlement, CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(20) + 20);
                    }
                    else if (targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsSettlement && targetHero.PartyBelongedToAsPrisoner.Settlement.Party != null && !targetHero.PartyBelongedToAsPrisoner.Settlement.Party.MemberRoster.GetTroopRoster().IsEmpty())
                    {
                        Settlement playerCaptor = targetHero.PartyBelongedToAsPrisoner.Settlement;
                        IEnumerable <TroopRosterElement> maleMembers         = playerCaptor.Party.MemberRoster.GetTroopRoster().Where(characterObject => characterObject.Character.IsFemale == false);
                        List <TroopRosterElement>        troopRosterElements = maleMembers.ToList();

                        if (!troopRosterElements.Any())
                        {
                            return;
                        }

                        CharacterObject m = troopRosterElements.GetRandomElement().Character;
                        randomSoldier = HeroCreator.CreateSpecialHero(m, playerCaptor, CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(20) + 20);
                    }
                    else
                    {
                        CharacterObject m = CharacterObject.Templates.Where(characterObject => characterObject.IsFemale == false && characterObject.Occupation == Occupation.Outlaw).GetRandomElementInefficiently();
                        randomSoldier = HeroCreator.CreateSpecialHero(m, SettlementHelper.FindRandomSettlement(x => x.IsTown && x.Culture == m.Culture), CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(20) + 20);
                    }

                    TextObject textObject3 = GameTexts.FindText("str_CE_impregnated");
                    textObject3.SetTextVariable("HERO", targetHero.Name);
                    textObject3.SetTextVariable("SPOUSE", randomSoldier.Name);
                    InformationManager.DisplayMessage(new InformationMessage(textObject3.ToString(), Colors.Magenta));

                    CEHelper.spouseOne = randomSoldier;
                    CEHelper.spouseTwo = targetHero;
                    MakePregnantAction.Apply(targetHero);
                    CEHelper.spouseOne = CEHelper.spouseTwo = null;

                    //RelationsModifier(randomSoldier, 50, targetHero);
                }
                else if (forcePreg)
                {
                    CharacterObject m             = CharacterObject.Templates.Where(characterObject => characterObject.IsFemale == false).GetRandomElementInefficiently();
                    Hero            randomSoldier = HeroCreator.CreateSpecialHero(m, targetHero.BornSettlement, CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(20) + 20);
                    CEHelper.spouseOne = randomSoldier;
                    CEHelper.spouseTwo = targetHero;
                    MakePregnantAction.Apply(targetHero);
                    CEHelper.spouseOne = CEHelper.spouseTwo = null;
                    TextObject textObject4 = new TextObject("{PLAYER_HERO} forced impregnated by {PLAYER_SPOUSE}.");
                    textObject4.SetTextVariable("PLAYER_HERO", targetHero.Name);
                    textObject4.SetTextVariable("PLAYER_SPOUSE", randomSoldier.Name);
                    InformationManager.DisplayMessage(new InformationMessage(textObject4.ToString(), Colors.Magenta));
                }
            }
            else if (targetHero != null && !targetHero.IsFemale)
            {
                if (CESettings.Instance != null && !CESettings.Instance.PregnancyToggle)
                {
                    return;
                }
                if (CESettings.Instance != null && !CESettings.Instance.UsePregnancyModifiers)
                {
                    modifier = 0;
                }

                if (CESettings.Instance != null &&
                    MBRandom.Random.Next(100)
                    >= (CESettings.Instance.AttractivenessSkill
                        ? scoresCalculation.AttractivenessScore(targetHero) / 20 + modifier
                        : CESettings.Instance.PregnancyChance + modifier))
                {
                    return;
                }

                Hero randomSoldier = null;

                if (captorHero != null)
                {
                    randomSoldier = captorHero;
                    if (!(randomSoldier.IsFemale && !randomSoldier.IsPregnant && !CECampaignBehavior.CheckIfPregnancyExists(randomSoldier)))
                    {
                        return;
                    }
                }
                else if (lord && targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsMobile && targetHero.PartyBelongedToAsPrisoner.MobileParty?.LeaderHero != null)
                {
                    randomSoldier = targetHero.PartyBelongedToAsPrisoner.MobileParty.LeaderHero;
                    if (!(randomSoldier.IsFemale && !randomSoldier.IsPregnant && !CECampaignBehavior.CheckIfPregnancyExists(randomSoldier)))
                    {
                        return;
                    }
                }
                else if (targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsMobile && targetHero.PartyBelongedToAsPrisoner.MobileParty != null)
                {
                    IEnumerable <TroopRosterElement> femaleMembers       = targetHero.PartyBelongedToAsPrisoner.MobileParty.MemberRoster.GetTroopRoster().Where(characterObject => characterObject.Character.IsFemale);
                    List <TroopRosterElement>        troopRosterElements = femaleMembers.ToList();

                    if (!troopRosterElements.Any())
                    {
                        return;
                    }

                    do
                    {
                        CharacterObject m = troopRosterElements.GetRandomElement().Character;
                        randomSoldier = HeroCreator.CreateSpecialHero(m, targetHero.PartyBelongedToAsPrisoner.MobileParty.HomeSettlement, CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(15) + 18);
                    } while (!IsHeroAgeSuitableForPregnancy(randomSoldier));
                }
                else if (targetHero.PartyBelongedToAsPrisoner != null && targetHero.PartyBelongedToAsPrisoner.IsSettlement && targetHero.PartyBelongedToAsPrisoner.Settlement.Party != null && !targetHero.PartyBelongedToAsPrisoner.Settlement.Party.MemberRoster.GetTroopRoster().IsEmpty())
                {
                    Settlement playerCaptor = targetHero.PartyBelongedToAsPrisoner.Settlement;
                    IEnumerable <TroopRosterElement> femaleMembers       = playerCaptor.Party.MemberRoster.GetTroopRoster().Where(characterObject => characterObject.Character.IsFemale);
                    List <TroopRosterElement>        troopRosterElements = femaleMembers.ToList();

                    if (!troopRosterElements.Any())
                    {
                        return;
                    }

                    do
                    {
                        CharacterObject m = troopRosterElements.GetRandomElement().Character;
                        if (targetHero.PartyBelongedToAsPrisoner.MobileParty != null)
                        {
                            randomSoldier = HeroCreator.CreateSpecialHero(m, targetHero.PartyBelongedToAsPrisoner.MobileParty.HomeSettlement, CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(15) + 18);
                        }
                    } while (!IsHeroAgeSuitableForPregnancy(randomSoldier));
                }
                else
                {
                    CharacterObject m = CharacterObject.Templates.Where(characterObject => characterObject.IsFemale && characterObject.IsRegular).GetRandomElementInefficiently();
                    randomSoldier = HeroCreator.CreateSpecialHero(m, SettlementHelper.FindRandomSettlement(x => x.IsTown && x.Culture == m.Culture), CampaignData.NeutralFaction, CampaignData.NeutralFaction, MBRandom.Random.Next(15) + 18);
                }

                TextObject textObject3 = GameTexts.FindText("str_CE_impregnated");

                if (randomSoldier != null)
                {
                    textObject3.SetTextVariable("HERO", randomSoldier.Name);
                    textObject3.SetTextVariable("SPOUSE", targetHero.Name);
                    InformationManager.DisplayMessage(new InformationMessage(textObject3.ToString(), Colors.Magenta));

                    CEHelper.spouseOne = randomSoldier;
                }

                CEHelper.spouseTwo = targetHero;
                MakePregnantAction.Apply(randomSoldier);
                CEHelper.spouseOne = CEHelper.spouseTwo = null;

                //RelationsModifier(randomSoldier, 50, targetHero);
            }
        }