diff --git a/RJWSexperience/IdeologyAddon/Harmony.cs b/RJWSexperience/IdeologyAddon/Harmony.cs index a40e1de..74ca75d 100644 --- a/RJWSexperience/IdeologyAddon/Harmony.cs +++ b/RJWSexperience/IdeologyAddon/Harmony.cs @@ -15,11 +15,11 @@ namespace RJWSexperience.Ideology if (ModLister.HasActiveModWithName("RJW Sexperience")) { //Log.Message("[RJWSexperience.Ideology] Found RJWSexperience, patching"); - harmony.Patch(AccessTools.Method("RJWSexperience.Utility:IsIncest"), + harmony.Patch(AccessTools.Method(typeof(ExtensionMethods.PawnExtensions), nameof(ExtensionMethods.PawnExtensions.IsIncest)), prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)), postfix: null ); - harmony.Patch(AccessTools.Method("RJWSexperience.RJWUtility:ThrowVirginHIstoryEvent"), + harmony.Patch(AccessTools.Method(typeof(RJWSexperience.RJWUtility), nameof(RJWSexperience.RJWUtility.ThrowVirginHIstoryEvent)), prefix: null, postfix: new HarmonyMethod(typeof(Sexperience_Patch_ThrowVirginHIstoryEvent), nameof(Sexperience_Patch_ThrowVirginHIstoryEvent.Postfix)) ); diff --git a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj index 42d15dc..fe49aa0 100644 --- a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj +++ b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj @@ -80,5 +80,11 @@ + + + {9c728e06-573b-4b04-a07f-acbf60cb424d} + RJWSexperience + + \ No newline at end of file diff --git a/RJWSexperience/RJWSexperience/Configurations.cs b/RJWSexperience/RJWSexperience/Configurations.cs index 25ff35d..9a2a1f4 100644 --- a/RJWSexperience/RJWSexperience/Configurations.cs +++ b/RJWSexperience/RJWSexperience/Configurations.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using RimWorld; +using RimWorld; using UnityEngine; using Verse; @@ -12,7 +7,7 @@ using Verse; namespace RJWSexperience { - public class Configurations : ModSettings + public class Configurations : ModSettings { public const float MaxInitialLustDefault = 500; public const float AvgLustDefault = 0; @@ -73,12 +68,12 @@ namespace RJWSexperience } } - public class RJWSexperience : Mod + public class RjwSexperienceMod : Mod { private readonly Configurations config; private static Vector2 scroll; - public RJWSexperience(ModContentPack content) : base(content) + public RjwSexperienceMod(ModContentPack content) : base(content) { config = GetSettings(); } diff --git a/RJWSexperience/RJWSexperience/DebugAction.cs b/RJWSexperience/RJWSexperience/DebugAction.cs index decf105..c99fd27 100644 --- a/RJWSexperience/RJWSexperience/DebugAction.cs +++ b/RJWSexperience/RJWSexperience/DebugAction.cs @@ -1,63 +1,59 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using RimWorld; +using RJWSexperience.ExtensionMethods; using Verse; -using RimWorld; -using rjw; namespace RJWSexperience { - public static class DebugToolsSexperience - { - [DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void ResetRecords(Pawn p) - { - Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin); - if (virgin != null) p.story.traits.RemoveTrait(virgin); - p.ResetRecord(true); - p.ResetRecord(false); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!"); - } + public static class DebugToolsSexperience + { + [DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void ResetRecords(Pawn p) + { + Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin); + if (virgin != null) p.story.traits.RemoveTrait(virgin); + p.ResetRecord(true); + p.ResetRecord(false); + p.AddVirginTrait(); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!"); + } - [DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void ResetRecordsZero(Pawn p) - { - p.ResetRecord(true); - p.AddVirginTrait(); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!\nVirginified!"); - } + [DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void ResetRecordsZero(Pawn p) + { + p.ResetRecord(true); + p.AddVirginTrait(); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!\nVirginified!"); + } - [DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void ResetLust(Pawn p) - { - float lust = RecordRandomizer.RandomizeLust(p); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust); - } + [DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void ResetLust(Pawn p) + { + float lust = RecordRandomizer.RandomizeLust(p); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust); + } - [DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void SetLust(Pawn p) - { - p.records.SetTo(VariousDefOf.Lust, 0); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0"); - } + [DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void SetLust(Pawn p) + { + p.records.SetTo(VariousDefOf.Lust, 0); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0"); + } - [DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void AddLust(Pawn p) - { - p.records.AddTo(VariousDefOf.Lust, 10); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); - } + [DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void AddLust(Pawn p) + { + p.records.AddTo(VariousDefOf.Lust, 10); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); + } - [DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void SubtractLust(Pawn p) - { - p.records.AddTo(VariousDefOf.Lust, -10); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); - } + [DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void SubtractLust(Pawn p) + { + p.records.AddTo(VariousDefOf.Lust, -10); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); + } - } + } } diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs new file mode 100644 index 0000000..7112fc4 --- /dev/null +++ b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -0,0 +1,246 @@ +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using Verse; +using Verse.AI; + +namespace RJWSexperience.ExtensionMethods +{ + public static class PawnExtensions + { + public static bool IsIncest(this Pawn pawn, Pawn otherpawn) + { + if (otherpawn != null) + { + IEnumerable relations = pawn.GetRelations(otherpawn); + if (!relations.EnumerableNullOrEmpty()) foreach (PawnRelationDef relation in relations) + { + if (relation.incestOpinionOffset < 0) return true; + } + } + return false; + } + + public static float GetSexStat(this Pawn pawn) + { + if (xxx.is_human(pawn) && !pawn.Dead) + { + return pawn.GetStatValue(xxx.sex_stat); + } + else return 1.0f; + } + + public static T GetAdjacentBuilding(this Pawn pawn) where T : Building + { + if (pawn.Spawned) + { + EdificeGrid edifice = pawn.Map.edificeGrid; + if (edifice[pawn.Position] is T) return (T)edifice[pawn.Position]; + IEnumerable adjcells = GenAdjFast.AdjacentCells8Way(pawn.Position); + foreach (IntVec3 pos in adjcells) + { + if (edifice[pos] is T) return (T)edifice[pos]; + } + } + return null; + } + + public static float GetCumVolume(this Pawn pawn) + { + List hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); + if (hediffs.NullOrEmpty()) return 0; + else return pawn.GetCumVolume(hediffs); + } + + public static float GetCumVolume(this Pawn pawn, List hediffs) + { + CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + + return pawn.GetCumVolume(part); + } + + public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part) + { + float res; + + try + { + res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f; + } + catch (NullReferenceException) + { + res = 0.0f; + } + if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f); + + return res; + } + + /// + /// If the pawn is virgin, return true. + /// + public static bool IsVirgin(this Pawn pawn) + { + return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0; + } + public static bool HasHymen(this Pawn pawn) + { + Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); + if (virgin != null) + { + if (virgin.Degree > 0) return true; + } + return false; + } + + /// + /// If pawn is virgin, lose his/her virginity. + /// + public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props) + { + if (props != null && props.sexType == xxx.rjwSextype.Vaginal) + { + if (pawn.IsVirgin()) + { + SexPartnerHistory history = pawn.GetPartnerHistory(); + if (history != null) + { + history.RecordFirst(partner, props); + } + if (RJWUtility.RemoveVirginTrait(pawn, partner, props)) + { + if (Configurations.EnableRecordRandomizer) Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); + } + } + else + { + RJWUtility.RemoveVirginTrait(pawn, partner, props); + } + } + } + + public static Gender PreferGender(this Pawn pawn) + { + if (pawn.gender == Gender.Male) + { + if (xxx.is_homosexual(pawn)) return Gender.Male; + else return Gender.Female; + } + else + { + if (xxx.is_homosexual(pawn)) return Gender.Female; + else return Gender.Male; + } + } + + public static Building_CumBucket FindClosestBucket(this Pawn pawn) + { + List buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket); + Dictionary targets = new Dictionary(); + if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++) + { + if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None)) + { + targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position)); + } + } + if (!targets.NullOrEmpty()) + { + return (Building_CumBucket)targets.MinBy(x => x.Value).Key; + } + return null; + } + + public static void AteCum(this Pawn pawn, float amount, bool doDrugEffect = false) + { + pawn.records.AddTo(VariousDefOf.NumofEatenCum, 1); + pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount); + if (doDrugEffect) pawn.CumDrugEffect(); + } + + public static void CumDrugEffect(this Pawn pawn) + { + Need need = pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum); + if (need != null) need.CurLevel += VariousDefOf.CumneedLevelOffset; + Hediff addictive = HediffMaker.MakeHediff(VariousDefOf.CumTolerance, pawn); + addictive.Severity = 0.032f; + pawn.health.AddHediff(addictive); + Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction); + if (addiction != null) addiction.Severity += VariousDefOf.CumexistingAddictionSeverityOffset; + + pawn.needs?.mood?.thoughts?.memories?.TryGainMemoryFast(VariousDefOf.AteCum); + } + + public static void AddVirginTrait(this Pawn pawn) + { + if (pawn.story?.traits != null) + { + if (pawn.IsVirgin()) + { + int degree = 0; + if (pawn.gender == Gender.Female) degree = 2; + Trait virgin = new Trait(VariousDefOf.Virgin, degree, true); + pawn.story.traits.GainTrait(virgin); + } + else if (pawn.gender == Gender.Female && Rand.Chance(0.05f)) + { + Trait virgin = new Trait(VariousDefOf.Virgin, 1, true); + pawn.story.traits.GainTrait(virgin); + } + } + } + + public static void ResetRecord(this Pawn pawn, bool allzero) + { + if (!allzero) + { + if (Configurations.EnableRecordRandomizer && pawn != null && xxx.is_human(pawn)) + { + RecordRandomizer.Randomize(pawn); + } + } + else + { + pawn.records.SetTo(VariousDefOf.Lust, 0); + pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0); + pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0); + pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0); + pawn.records.SetTo(VariousDefOf.AnalSexCount, 0); + pawn.records.SetTo(VariousDefOf.OralSexCount, 0); + pawn.records.SetTo(VariousDefOf.BlowjobCount, 0); + pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0); + pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0); + pawn.records.SetTo(VariousDefOf.HandjobCount, 0); + pawn.records.SetTo(VariousDefOf.FingeringCount, 0); + pawn.records.SetTo(VariousDefOf.FootjobCount, 0); + pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0); + pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0); + pawn.records.SetTo(VariousDefOf.OrgasmCount, 0); + pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0); + pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0); + pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0); + pawn.records.SetTo(xxx.CountOfBeenRapedByOthers, 0); + pawn.records.SetTo(xxx.CountOfBirthAnimal, 0); + pawn.records.SetTo(xxx.CountOfBirthEgg, 0); + pawn.records.SetTo(xxx.CountOfBirthHuman, 0); + pawn.records.SetTo(xxx.CountOfFappin, 0); + pawn.records.SetTo(xxx.CountOfRapedAnimals, 0); + pawn.records.SetTo(xxx.CountOfRapedHumanlikes, 0); + pawn.records.SetTo(xxx.CountOfRapedInsects, 0); + pawn.records.SetTo(xxx.CountOfRapedOthers, 0); + pawn.records.SetTo(xxx.CountOfSex, 0); + pawn.records.SetTo(xxx.CountOfSexWithAnimals, 0); + pawn.records.SetTo(xxx.CountOfSexWithCorpse, 0); + pawn.records.SetTo(xxx.CountOfSexWithHumanlikes, 0); + pawn.records.SetTo(xxx.CountOfSexWithInsects, 0); + pawn.records.SetTo(xxx.CountOfSexWithOthers, 0); + pawn.records.SetTo(xxx.CountOfWhore, 0); + } + } + } +} diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs index cf07b63..7f23118 100644 --- a/RJWSexperience/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs +++ b/RJWSexperience/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs @@ -28,5 +28,14 @@ namespace RJWSexperience.ExtensionMethods return props.partner; } } + + public static bool IsBestiality(this SexProps props) + { + if (props.partner != null) + { + return props.pawn.IsAnimal() ^ props.partner.IsAnimal(); + } + return false; + } } } diff --git a/RJWSexperience/RJWSexperience/IngestionOutcomeDoers.cs b/RJWSexperience/RJWSexperience/IngestionOutcomeDoers.cs index 6b44141..0e90cbb 100644 --- a/RJWSexperience/RJWSexperience/IngestionOutcomeDoers.cs +++ b/RJWSexperience/RJWSexperience/IngestionOutcomeDoers.cs @@ -1,14 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; -using RimWorld; +using RimWorld; +using RJWSexperience.ExtensionMethods; using Verse; - - namespace RJWSexperience { public class CumOutcomeDoers : IngestionOutcomeDoer diff --git a/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs b/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs index 9700f47..e414423 100644 --- a/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs +++ b/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs @@ -1,6 +1,7 @@ using HarmonyLib; using RimWorld; using rjw; +using RJWSexperience.ExtensionMethods; using System; using System.Collections.Generic; using UnityEngine; diff --git a/RJWSexperience/RJWSexperience/RJWSexperience.csproj b/RJWSexperience/RJWSexperience/RJWSexperience.csproj index 9a58f05..9b79505 100644 --- a/RJWSexperience/RJWSexperience/RJWSexperience.csproj +++ b/RJWSexperience/RJWSexperience/RJWSexperience.csproj @@ -68,6 +68,7 @@ + diff --git a/RJWSexperience/RJWSexperience/RJWUtility.cs b/RJWSexperience/RJWSexperience/RJWUtility.cs index 05d50ad..b45efbb 100644 --- a/RJWSexperience/RJWSexperience/RJWUtility.cs +++ b/RJWSexperience/RJWSexperience/RJWUtility.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using rjw; using RimWorld; using Verse; -using Verse.AI; using UnityEngine; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Helpers; @@ -16,63 +15,11 @@ namespace RJWSexperience { public static class RJWUtility { - public static float GetSexStat(this Pawn pawn) - { - if (xxx.is_human(pawn) && !pawn.Dead) - { - return pawn.GetStatValue(xxx.sex_stat); - } - else return 1.0f; - } - public static float LustIncrementFactor(float lust) { return Mathf.Exp(-Mathf.Pow(lust / Configurations.LustLimit, 2)); } - /// - /// If the pawn is virgin, return true. - /// - public static bool IsVirgin(this Pawn pawn) - { - return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0; - } - public static bool HasHymen(this Pawn pawn) - { - Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); - if (virgin != null) - { - if (virgin.Degree > 0) return true; - } - return false; - } - - /// - /// If pawn is virgin, lose his/her virginity. - /// - public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props) - { - if (props != null && props.sexType == xxx.rjwSextype.Vaginal) - { - if (pawn.IsVirgin()) - { - SexPartnerHistory history = pawn.GetPartnerHistory(); - if (history != null) - { - history.RecordFirst(partner, props); - } - if (RemoveVirginTrait(pawn, partner, props)) - { - if (Configurations.EnableRecordRandomizer) Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); - } - } - else - { - RemoveVirginTrait(pawn, partner, props); - } - } - } - public static bool RemoveVirginTrait(Pawn pawn, Pawn partner, SexProps props) { int degree; @@ -247,85 +194,5 @@ namespace RJWSexperience pawn.records?.AddTo(recordforpawn, 1); partner.records?.AddTo(recordforpartner, 1); } - - public static Gender PreferGender(this Pawn pawn) - { - if (pawn.gender == Gender.Male) - { - if (xxx.is_homosexual(pawn)) return Gender.Male; - else return Gender.Female; - } - else - { - if (xxx.is_homosexual(pawn)) return Gender.Female; - else return Gender.Male; - } - } - - public static bool IsBestiality(this SexProps props) - { - if (props.partner != null) - { - return props.pawn.IsAnimal() ^ props.partner.IsAnimal(); - } - return false; - } - - public static Building_CumBucket FindClosestBucket(this Pawn pawn) - { - List buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket); - Dictionary targets = new Dictionary(); - if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++) - { - if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None)) - { - targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position)); - } - } - if (!targets.NullOrEmpty()) - { - return (Building_CumBucket)targets.MinBy(x => x.Value).Key; - } - return null; - } - - public static void AteCum(this Pawn pawn, float amount, bool doDrugEffect = false) - { - pawn.records.AddTo(VariousDefOf.NumofEatenCum, 1); - pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount); - if (doDrugEffect) pawn.CumDrugEffect(); - } - - public static void CumDrugEffect(this Pawn pawn) - { - Need need = pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum); - if (need != null) need.CurLevel += VariousDefOf.CumneedLevelOffset; - Hediff addictive = HediffMaker.MakeHediff(VariousDefOf.CumTolerance, pawn); - addictive.Severity = 0.032f; - pawn.health.AddHediff(addictive); - Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction); - if (addiction != null) addiction.Severity += VariousDefOf.CumexistingAddictionSeverityOffset; - - pawn.needs?.mood?.thoughts?.memories?.TryGainMemoryFast(VariousDefOf.AteCum); - } - - public static void AddVirginTrait(this Pawn pawn) - { - if (pawn.story?.traits != null) - { - if (pawn.IsVirgin()) - { - int degree = 0; - if (pawn.gender == Gender.Female) degree = 2; - Trait virgin = new Trait(VariousDefOf.Virgin, degree, true); - pawn.story.traits.GainTrait(virgin); - } - else if (pawn.gender == Gender.Female && Rand.Chance(0.05f)) - { - Trait virgin = new Trait(VariousDefOf.Virgin, 1, true); - pawn.story.traits.GainTrait(virgin); - } - } - } } } diff --git a/RJWSexperience/RJWSexperience/Recipe_HymenSurgery.cs b/RJWSexperience/RJWSexperience/Recipe_HymenSurgery.cs index 62962d2..bdde00c 100644 --- a/RJWSexperience/RJWSexperience/Recipe_HymenSurgery.cs +++ b/RJWSexperience/RJWSexperience/Recipe_HymenSurgery.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using RimWorld; using Verse; using rjw; +using RJWSexperience.ExtensionMethods; namespace RJWSexperience { diff --git a/RJWSexperience/RJWSexperience/SexHistory/RecordRandomizer.cs b/RJWSexperience/RJWSexperience/SexHistory/RecordRandomizer.cs index 5bf0c69..96c2513 100644 --- a/RJWSexperience/RJWSexperience/SexHistory/RecordRandomizer.cs +++ b/RJWSexperience/RJWSexperience/SexHistory/RecordRandomizer.cs @@ -3,6 +3,7 @@ using System; using Verse; using RimWorld; using UnityEngine; +using RJWSexperience.ExtensionMethods; namespace RJWSexperience { diff --git a/RJWSexperience/RJWSexperience/UI/SexStatus.cs b/RJWSexperience/RJWSexperience/UI/SexStatus.cs index 54c6f86..55bdf7a 100644 --- a/RJWSexperience/RJWSexperience/UI/SexStatus.cs +++ b/RJWSexperience/RJWSexperience/UI/SexStatus.cs @@ -8,7 +8,7 @@ using Verse; using Verse.Sound; using RimWorld; using rjw; - +using RJWSexperience.ExtensionMethods; namespace RJWSexperience.UI { diff --git a/RJWSexperience/RJWSexperience/Utility.cs b/RJWSexperience/RJWSexperience/Utility.cs index a83c01a..a73c305 100644 --- a/RJWSexperience/RJWSexperience/Utility.cs +++ b/RJWSexperience/RJWSexperience/Utility.cs @@ -1,12 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using RimWorld; -using Verse; -using rjw; -using UnityEngine; namespace RJWSexperience { @@ -14,19 +7,6 @@ namespace RJWSexperience { public static System.Random random = new System.Random(Environment.TickCount); - public static bool IsIncest(this Pawn pawn, Pawn otherpawn) - { - if (otherpawn != null) - { - IEnumerable relations = pawn.GetRelations(otherpawn); - if (!relations.EnumerableNullOrEmpty()) foreach (PawnRelationDef relation in relations) - { - if (relation.incestOpinionOffset < 0) return true; - } - } - return false; - } - public static float RandGaussianLike(float min, float max, int iterations = 3) { double res = 0; @@ -39,61 +19,12 @@ namespace RJWSexperience return (float)res * (max - min) + min; } - public static void SetTo(this Pawn_RecordsTracker records, RecordDef record ,float value) + public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value) { float recordval = records.GetValue(record); records.AddTo(record, value - recordval); } - public static T GetAdjacentBuilding(this Pawn pawn) where T : Building - { - if (pawn.Spawned) - { - EdificeGrid edifice = pawn.Map.edificeGrid; - if (edifice[pawn.Position] is T) return (T)edifice[pawn.Position]; - IEnumerable adjcells = GenAdjFast.AdjacentCells8Way(pawn.Position); - foreach(IntVec3 pos in adjcells) - { - if (edifice[pos] is T) return (T)edifice[pos]; - } - } - return null; - } - - public static float GetCumVolume(this Pawn pawn) - { - List hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); - if (hediffs.NullOrEmpty()) return 0; - else return pawn.GetCumVolume(hediffs); - } - - public static float GetCumVolume(this Pawn pawn, List hediffs) - { - CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - - return pawn.GetCumVolume(part); - } - - public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part) - { - float res; - - try - { - res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f; - } - catch (NullReferenceException) - { - res = 0.0f; - } - if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f); - - return res; - } - public static float Normalization(this float num, float min, float max) { return (num - min)/(max - min); @@ -103,55 +34,5 @@ namespace RJWSexperience { return num * (max - min) + min; } - - public static void ResetRecord(this Pawn pawn, bool allzero) - { - if (!allzero) - { - if (Configurations.EnableRecordRandomizer && pawn != null && xxx.is_human(pawn)) - { - RecordRandomizer.Randomize(pawn); - } - pawn.AddVirginTrait(); - } - else - { - pawn.records.SetTo(VariousDefOf.Lust, 0); - pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0); - pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0); - pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0); - pawn.records.SetTo(VariousDefOf.AnalSexCount, 0); - pawn.records.SetTo(VariousDefOf.OralSexCount, 0); - pawn.records.SetTo(VariousDefOf.BlowjobCount, 0); - pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0); - pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0); - pawn.records.SetTo(VariousDefOf.HandjobCount, 0); - pawn.records.SetTo(VariousDefOf.FingeringCount, 0); - pawn.records.SetTo(VariousDefOf.FootjobCount, 0); - pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0); - pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0); - pawn.records.SetTo(VariousDefOf.OrgasmCount, 0); - pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0); - pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0); - pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0); - pawn.records.SetTo(xxx.CountOfBeenRapedByOthers, 0); - pawn.records.SetTo(xxx.CountOfBirthAnimal, 0); - pawn.records.SetTo(xxx.CountOfBirthEgg, 0); - pawn.records.SetTo(xxx.CountOfBirthHuman, 0); - pawn.records.SetTo(xxx.CountOfFappin, 0); - pawn.records.SetTo(xxx.CountOfRapedAnimals, 0); - pawn.records.SetTo(xxx.CountOfRapedHumanlikes, 0); - pawn.records.SetTo(xxx.CountOfRapedInsects, 0); - pawn.records.SetTo(xxx.CountOfRapedOthers, 0); - pawn.records.SetTo(xxx.CountOfSex, 0); - pawn.records.SetTo(xxx.CountOfSexWithAnimals, 0); - pawn.records.SetTo(xxx.CountOfSexWithCorpse, 0); - pawn.records.SetTo(xxx.CountOfSexWithHumanlikes, 0); - pawn.records.SetTo(xxx.CountOfSexWithInsects, 0); - pawn.records.SetTo(xxx.CountOfSexWithOthers, 0); - pawn.records.SetTo(xxx.CountOfWhore, 0); - } - } - } }