diff --git a/About/Manifest.xml b/About/Manifest.xml index 4ca776b..40ce23d 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Sexperience - 1.0.1.11 + 1.0.2.0 diff --git a/Assemblies/RJWSexperience.dll b/Assemblies/RJWSexperience.dll index 9a66324..0b2e387 100644 Binary files a/Assemblies/RJWSexperience.dll and b/Assemblies/RJWSexperience.dll differ diff --git a/Defs/RecordDefs/Records_Sextypes.xml b/Defs/RecordDefs/Records_Sextypes.xml index 2db9285..824b66f 100644 --- a/Defs/RecordDefs/Records_Sextypes.xml +++ b/Defs/RecordDefs/Records_Sextypes.xml @@ -14,46 +14,74 @@ The number of times of anal sex. Int - + OralSexCount - The number of times of oral sex. + The number of times of received oral sex. Int - TitjobCount - - The number of times of titjob. + BlowjobCount + + The number of times of blowjob. Int - HandjobCount - - The number of times of caress using hands. + CunnilingusCount + + The number of times of cunnilingus. Int - GotHandjobCount - - The number of times of got caress using hands. + GenitalCaressCount + + The number of times of handjob/fingering. Int - GotLickedCount - - The number of times of licked by others. + HadnjobCount + + The number of times of handjob. + Int + + + + FingeringCount + + The number of times of fingering. Int - LickedCount - - The number of times of licked others. + FootjobCount + + The number of times of footjob. + Int + + + + MiscSexualBehaviorCount + + The number of times of something sexual. + Int + + + + OrgasmCount + + The number of times of orgasm. + Int + + + + SexPartnerCount + + The number of sex partners. Int diff --git a/Defs/TraitDefs/Traits_sex.xml b/Defs/TraitDefs/Traits_sex.xml index 725cd49..4c023b5 100644 --- a/Defs/TraitDefs/Traits_sex.xml +++ b/Defs/TraitDefs/Traits_sex.xml @@ -8,7 +8,7 @@
  • - [PAWN_nameDef] + [PAWN_nameDef] has no experience. 0.1 diff --git a/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualOutcomeComps.cs b/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualOutcomeComps.cs index 04fb530..15650f8 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualOutcomeComps.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualOutcomeComps.cs @@ -38,8 +38,10 @@ namespace RJWSexperience.Ideology } return false; } + - public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments) + + public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments, RitualOutcomeComp_Data data) { return new ExpectedOutcomeDesc { @@ -74,7 +76,7 @@ namespace RJWSexperience.Ideology return false; } - public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments) + public override ExpectedOutcomeDesc GetExpectedOutcomeDesc(Precept_Ritual ritual, TargetInfo ritualTarget, RitualObligation obligation, RitualRoleAssignments assignments, RitualOutcomeComp_Data data) { return new ExpectedOutcomeDesc { diff --git a/RJWSexperience/RJWSexperience/RJWSexperience.csproj b/RJWSexperience/RJWSexperience/RJWSexperience.csproj index fc7d543..45fe3cc 100644 --- a/RJWSexperience/RJWSexperience/RJWSexperience.csproj +++ b/RJWSexperience/RJWSexperience/RJWSexperience.csproj @@ -81,6 +81,7 @@ + diff --git a/RJWSexperience/RJWSexperience/RJW_Patch.cs b/RJWSexperience/RJWSexperience/RJW_Patch.cs index bd111b0..bfd004c 100644 --- a/RJWSexperience/RJWSexperience/RJW_Patch.cs +++ b/RJWSexperience/RJWSexperience/RJW_Patch.cs @@ -40,24 +40,139 @@ namespace RJWSexperience /// /// If pawn is virgin, lose his/her virginity. /// - //public static void PoptheCherry(this Pawn pawn, Pawn partner, bool violent) - //{ - // if (pawn.IsVirgin()) - // { - // Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); - // RemoveVirginTrait(pawn); - // FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, 1, FilthSourceFlags.Pawn); - // } - //} - // - //public static void RemoveVirginTrait(Pawn pawn) - //{ - // Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); - // if (virgin != null) - // { - // pawn.story.traits.RemoveTrait(virgin); - // } - //} + public static void PoptheCherry(this Pawn pawn, Pawn partner, bool violent) + { + if (pawn.IsVirgin()) + { + Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); + RemoveVirginTrait(pawn); + FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, 1, FilthSourceFlags.Pawn); + } + } + + public static void RemoveVirginTrait(Pawn pawn) + { + Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); + if (virgin != null) + { + pawn.story.traits.RemoveTrait(virgin); + } + } + + public static void UpdateSextypeRecords(SexProps props) + { + xxx.rjwSextype sextype = props.sexType; + Pawn pawn = props.pawn; + Pawn partner = props.partner; + Pawn receiver = props.reciever; + Pawn giver = props.giver; + + if (partner != null) + { + + switch (sextype) + { + case xxx.rjwSextype.Vaginal: + case xxx.rjwSextype.Scissoring: + IncreaseSameRecords(pawn, partner, VariousDefOf.VaginalSexCount); + break; + case xxx.rjwSextype.Anal: + IncreaseSameRecords(pawn, partner, VariousDefOf.AnalSexCount); + break; + case xxx.rjwSextype.Oral: + case xxx.rjwSextype.Fellatio: + if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.BlowjobCount); + } + else if (Genital_Helper.has_penis_infertile(receiver) || Genital_Helper.has_penis_infertile(receiver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.BlowjobCount, VariousDefOf.OralSexCount); + } + break; + case xxx.rjwSextype.Sixtynine: + IncreaseSameRecords(pawn, partner, VariousDefOf.OralSexCount); + RecordDef recordpawn, recordpartner; + if (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn)) + { + recordpartner = VariousDefOf.BlowjobCount; + } + else + { + recordpartner = VariousDefOf.CunnilingusCount; + } + + if (Genital_Helper.has_penis_fertile(partner) || Genital_Helper.has_penis_infertile(partner)) + { + recordpawn = VariousDefOf.BlowjobCount; + } + else + { + recordpawn = VariousDefOf.CunnilingusCount; + } + IncreaseRecords(pawn, partner, recordpawn, recordpartner); + break; + case xxx.rjwSextype.Cunnilingus: + if (Genital_Helper.has_vagina(giver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.CunnilingusCount); + } + else if (Genital_Helper.has_vagina(receiver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.CunnilingusCount, VariousDefOf.OralSexCount); + } + break; + case xxx.rjwSextype.Masturbation: + break; + case xxx.rjwSextype.Handjob: + if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.HadnjobCount); + } + else + { + IncreaseRecords(giver, receiver, VariousDefOf.HadnjobCount, VariousDefOf.GenitalCaressCount); + } + break; + case xxx.rjwSextype.Fingering: + case xxx.rjwSextype.Fisting: + if (Genital_Helper.has_vagina(giver)) + { + IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.FingeringCount); + } + else + { + IncreaseRecords(giver, receiver, VariousDefOf.FingeringCount, VariousDefOf.GenitalCaressCount); + } + break; + case xxx.rjwSextype.Footjob: + IncreaseSameRecords(pawn, partner, VariousDefOf.FootjobCount); + break; + default: + IncreaseSameRecords(pawn, partner, VariousDefOf.MiscSexualBehaviorCount); + break; + } + } + } + + public static void UpdatePartnerHistory(Pawn pawn, Pawn partner, SexProps props, float satisfaction) + { + SexPartnerHistory pawnshistory = pawn.GetComp(); + pawnshistory.RecordHistory(partner, props); + } + + public static void IncreaseSameRecords(Pawn pawn, Pawn partner, RecordDef record) + { + pawn.records?.AddTo(record, 1); + partner.records?.AddTo(record, 1); + } + + public static void IncreaseRecords(Pawn pawn, Pawn partner, RecordDef recordforpawn, RecordDef recordforpartner) + { + pawn.records?.AddTo(recordforpawn, 1); + partner.records?.AddTo(recordforpartner, 1); + } + } @@ -103,13 +218,16 @@ namespace RJWSexperience { private const float base_sat_per_fuck = 0.4f; - public static void Prefix(Pawn pawn, Pawn partner, SexProps props, bool pawn_is_raping , ref float satisfaction) + public static void Prefix(SexProps props, ref float satisfaction) { + Pawn partner = props.partner; satisfaction = Mathf.Max(base_sat_per_fuck, satisfaction * partner.GetSexStat()); } - public static void Postfix(Pawn pawn, Pawn partner, SexProps props, bool pawn_is_raping, float satisfaction) + public static void Postfix(SexProps props, float satisfaction) { + Pawn pawn = props.pawn; + Pawn partner = props.partner; float? lust = pawn.records?.GetValue(VariousDefOf.Lust); xxx.rjwSextype sextype = props.sexType; if (lust != null) @@ -171,6 +289,16 @@ namespace RJWSexperience } } + [HarmonyPatch(typeof(AfterSexUtility), "UpdateRecords")] + public static class RJW_Patch_UpdateRecords + { + public static void Postfix(SexProps props) + { + RJWUtility.UpdateSextypeRecords(props); + } + + } + } diff --git a/RJWSexperience/RJWSexperience/SexHistory.cs b/RJWSexperience/RJWSexperience/SexHistory.cs new file mode 100644 index 0000000..a9f7d8b --- /dev/null +++ b/RJWSexperience/RJWSexperience/SexHistory.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; +using rjw; + + +namespace RJWSexperience +{ + public class SexPartnerHistory : ThingComp + { + //protected List histories = new List(); + protected Dictionary histories = new Dictionary(); + protected string first = ""; + protected bool dirty = true; + protected string bestaffinity = ""; + protected float bestaffinitysat = 0; + protected xxx.rjwSextype recentsex = xxx.rjwSextype.None; + protected string recentpartner = ""; + + protected string mostpartnercache = ""; + protected xxx.rjwSextype mostsextypecache = xxx.rjwSextype.None; + + public string FirstSexInfo + { + get + { + return + "Partner: " + histories[first]?.Label ?? "Unknown" + + "" + + "" + + ""; + + } + } + + + public override void PostExposeData() + { + Scribe_Collections.Look(ref histories, "histories", LookMode.Deep); + Scribe_Values.Look(ref first, "first", "", true); + Scribe_Values.Look(ref bestaffinity, "bestaffinity", "", true); + Scribe_Values.Look(ref bestaffinitysat, "bestaffinitysat", bestaffinitysat, true); + Scribe_Values.Look(ref recentsex, "recentsex", recentsex, true); + Scribe_Values.Look(ref recentpartner, "recentpartner", recentpartner, true); + base.PostExposeData(); + } + + public void RecordHistory(Pawn partner, SexProps props) + { + TryAddHistory(partner); + SexHistory history = histories[partner.ThingID]; + history?.RecordSex(props); + dirty = true; + } + + public void RecordSatisfactionHistory(Pawn partner, SexProps props, float satisfaction) + { + TryAddHistory(partner); + SexHistory history = histories[partner.ThingID]; + history?.RecordSatisfaction(props, satisfaction); + + dirty = true; + } + + protected bool TryAddHistory(Pawn partner) + { + if (!histories.ContainsKey(partner.ThingID)) + { + histories.Add(partner.ThingID, new SexHistory(partner)); + Pawn pawn = parent as Pawn; + if (pawn != null) + { + pawn.records.AddTo(VariousDefOf.SexPartnerCount, 1); + } + return true; + } + return false; + } + + protected void RecordFirst(Pawn partner, SexProps props) + { + if (VirginCheck() && props.sexType == xxx.rjwSextype.Vaginal) + { + first = partner.ThingID; + } + } + + protected void Update() + { + dirty = false; + } + + protected bool VirginCheck() + { + Pawn pawn = parent as Pawn; + if (pawn != null) + { + if (pawn.IsVirgin()) return true; + } + return false; + } + + } + + + public class SexHistory : IExposable + { + protected Pawn partner; + protected string namecache; + protected int totalsexhad = 0; + protected int raped = 0; + protected int rapedme = 0; + protected int orgasms = 0; + protected xxx.rjwSextype bestsextype = xxx.rjwSextype.None; + protected float bestsatisfaction = 0; + + + + public string Label + { + get + { + if (partner != null) + { + namecache = partner.Label; + return namecache; + } + else return namecache; + } + } + public xxx.rjwSextype BestSextype + { + get + { + return bestsextype; + } + } + public float BestSatisfaction + { + get + { + return bestsatisfaction; + } + } + + public SexHistory() { } + + public SexHistory(Pawn pawn) + { + partner = pawn; + namecache = pawn.Label; + } + + + public void ExposeData() + { + Scribe_References.Look(ref partner, "partner", true); + Scribe_Values.Look(ref namecache, "namecache", namecache, true); + Scribe_Values.Look(ref totalsexhad, "totalsexhad", totalsexhad, true); + Scribe_Values.Look(ref raped, "raped", raped, true); + Scribe_Values.Look(ref rapedme, "rapedme", rapedme, true); + Scribe_Values.Look(ref orgasms, "orgasms", orgasms, true); + Scribe_Values.Look(ref bestsextype, "bestsextype", bestsextype, true); + Scribe_Values.Look(ref bestsatisfaction, "bestsatisfaction", bestsatisfaction, true); + } + + public void RecordSex(SexProps props) + { + totalsexhad++; + if (props.isRape) + { + if (partner == props.giver) + { + rapedme++; + } + else if (partner == props.reciever) + { + raped++; + } + } + } + + public void RecordSatisfaction(SexProps props, float satisfaction) + { + if (satisfaction > bestsatisfaction) + { + orgasms++; + bestsextype = props.sexType; + bestsatisfaction = satisfaction; + } + } + + + } + +} diff --git a/RJWSexperience/RJWSexperience/VariousDefOf.cs b/RJWSexperience/RJWSexperience/VariousDefOf.cs index 28283e8..2210db1 100644 --- a/RJWSexperience/RJWSexperience/VariousDefOf.cs +++ b/RJWSexperience/RJWSexperience/VariousDefOf.cs @@ -12,6 +12,17 @@ namespace RJWSexperience { public static readonly RecordDef NumofEatenCum = DefDatabase.GetNamed("NumofEatenCum"); public static readonly RecordDef Lust = DefDatabase.GetNamed("Lust"); + public static readonly RecordDef VaginalSexCount = DefDatabase.GetNamed("VaginalSexCount"); + public static readonly RecordDef AnalSexCount = DefDatabase.GetNamed("AnalSexCount"); + public static readonly RecordDef OralSexCount = DefDatabase.GetNamed("OralSexCount"); + public static readonly RecordDef BlowjobCount = DefDatabase.GetNamed("BlowjobCount"); + public static readonly RecordDef CunnilingusCount = DefDatabase.GetNamed("CunnilingusCount"); + public static readonly RecordDef GenitalCaressCount = DefDatabase.GetNamed("GenitalCaressCount"); + public static readonly RecordDef HadnjobCount = DefDatabase.GetNamed("HadnjobCount"); + public static readonly RecordDef FingeringCount = DefDatabase.GetNamed("FingeringCount"); + public static readonly RecordDef FootjobCount = DefDatabase.GetNamed("FootjobCount"); + public static readonly RecordDef MiscSexualBehaviorCount = DefDatabase.GetNamed("MiscSexualBehaviorCount"); + public static readonly RecordDef SexPartnerCount = DefDatabase.GetNamed("SexPartnerCount"); public static readonly SkillDef SexSkill = DefDatabase.GetNamed("Sex"); public static readonly ThoughtDef_Recordbased AteCum = DefDatabase.GetNamed("AteCum"); public static readonly PawnRelationDef Bastard = DefDatabase.GetNamed("Bastard"); diff --git a/RJWSexperience_Ideology/Assemblies/RJWSexperience.Ideology.dll b/RJWSexperience_Ideology/Assemblies/RJWSexperience.Ideology.dll index fe8bdde..1f96d10 100644 Binary files a/RJWSexperience_Ideology/Assemblies/RJWSexperience.Ideology.dll and b/RJWSexperience_Ideology/Assemblies/RJWSexperience.Ideology.dll differ diff --git a/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_Rape.xml b/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_Rape.xml index 87a167d..0a9e155 100644 --- a/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_Rape.xml +++ b/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_Rape.xml @@ -3,8 +3,8 @@ - Rape - + Birth + UI/Issues/Rape diff --git a/changelogs.txt b/changelogs.txt index 3dea74a..eaf0bad 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,7 +1,12 @@ -Version Beta 1.0.1.11 +Version Beta 1.0.2.0 + - requires RimWorld 1.3.3117 or later + - requires RJW 4.8.1 or later + - added records + - added sex history + - Version Beta 1.0.1.10 - - requires RJW 4.8.0 or later + - requires RJW 4.8.0 Version Beta 1.0.1.9 - not compatible with RJW 4.8.0 or later