sex history

This commit is contained in:
moreoreganostodump 2021-09-12 17:54:15 +09:00
parent 7ee78bb4e3
commit a3c073a43e
12 changed files with 420 additions and 45 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RJW Sexperience</identifier>
<version>1.0.1.11</version>
<version>1.0.2.0</version>
<dependencies>
</dependencies>
<incompatibleWith />

Binary file not shown.

View File

@ -14,46 +14,74 @@
<description>The number of times of anal sex.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>OralSexCount</defName>
<label>oral intercourses</label>
<description>The number of times of oral sex.</description>
<description>The number of times of received oral sex.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>TitjobCount</defName>
<label>titjob</label>
<description>The number of times of titjob.</description>
<defName>BlowjobCount</defName>
<label>blowjobs</label>
<description>The number of times of blowjob.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>HandjobCount</defName>
<label>fingering/handjob</label>
<description>The number of times of caress using hands.</description>
<defName>CunnilingusCount</defName>
<label>cunnilingus</label>
<description>The number of times of cunnilingus.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>GotHandjobCount</defName>
<label>handjob/fingering received</label>
<description>The number of times of got caress using hands.</description>
<defName>GenitalCaressCount</defName>
<label>genital touched</label>
<description>The number of times of handjob/fingering.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>GotLickedCount</defName>
<label>got licked</label>
<description>The number of times of licked by others.</description>
<defName>HadnjobCount</defName>
<label>handjobs</label>
<description>The number of times of handjob.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>FingeringCount</defName>
<label>fingerings</label>
<description>The number of times of fingering.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>LickedCount</defName>
<label>licked</label>
<description>The number of times of licked others.</description>
<defName>FootjobCount</defName>
<label>footjob</label>
<description>The number of times of footjob.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>MiscSexualBehaviorCount</defName>
<label>misc. intercourses</label>
<description>The number of times of something sexual.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>OrgasmCount</defName>
<label>orgasms</label>
<description>The number of times of orgasm.</description>
<type>Int</type>
</RecordDef>
<RecordDef>
<defName>SexPartnerCount</defName>
<label>sex partners</label>
<description>The number of sex partners.</description>
<type>Int</type>
</RecordDef>
</Defs>

View File

@ -8,7 +8,7 @@
<degreeDatas>
<li>
<label>virgin</label>
<description>[PAWN_nameDef] </description>
<description>[PAWN_nameDef] has no experience.</description>
<statOffsets>
<SexFrequency>0.1</SexFrequency>
</statOffsets>

View File

@ -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
{

View File

@ -81,6 +81,7 @@
<Compile Include="Configurations.cs" />
<Compile Include="DebugAction.cs" />
<Compile Include="Harmony.cs" />
<Compile Include="SexHistory.cs" />
<Compile Include="PawnRelationWorkers.cs" />
<Compile Include="Keyed.cs" />
<Compile Include="Rimworld_Patch.cs" />

View File

@ -40,24 +40,139 @@ namespace RJWSexperience
/// <summary>
/// If pawn is virgin, lose his/her virginity.
/// </summary>
//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<SexPartnerHistory>();
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);
}
}
}

View File

@ -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<SexHistory> histories = new List<SexHistory>();
protected Dictionary<string,SexHistory> histories = new Dictionary<string,SexHistory>();
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;
}
}
}
}

View File

@ -12,6 +12,17 @@ namespace RJWSexperience
{
public static readonly RecordDef NumofEatenCum = DefDatabase<RecordDef>.GetNamed("NumofEatenCum");
public static readonly RecordDef Lust = DefDatabase<RecordDef>.GetNamed("Lust");
public static readonly RecordDef VaginalSexCount = DefDatabase<RecordDef>.GetNamed("VaginalSexCount");
public static readonly RecordDef AnalSexCount = DefDatabase<RecordDef>.GetNamed("AnalSexCount");
public static readonly RecordDef OralSexCount = DefDatabase<RecordDef>.GetNamed("OralSexCount");
public static readonly RecordDef BlowjobCount = DefDatabase<RecordDef>.GetNamed("BlowjobCount");
public static readonly RecordDef CunnilingusCount = DefDatabase<RecordDef>.GetNamed("CunnilingusCount");
public static readonly RecordDef GenitalCaressCount = DefDatabase<RecordDef>.GetNamed("GenitalCaressCount");
public static readonly RecordDef HadnjobCount = DefDatabase<RecordDef>.GetNamed("HadnjobCount");
public static readonly RecordDef FingeringCount = DefDatabase<RecordDef>.GetNamed("FingeringCount");
public static readonly RecordDef FootjobCount = DefDatabase<RecordDef>.GetNamed("FootjobCount");
public static readonly RecordDef MiscSexualBehaviorCount = DefDatabase<RecordDef>.GetNamed("MiscSexualBehaviorCount");
public static readonly RecordDef SexPartnerCount = DefDatabase<RecordDef>.GetNamed("SexPartnerCount");
public static readonly SkillDef SexSkill = DefDatabase<SkillDef>.GetNamed("Sex");
public static readonly ThoughtDef_Recordbased AteCum = DefDatabase<ThoughtDef_Recordbased>.GetNamed("AteCum");
public static readonly PawnRelationDef Bastard = DefDatabase<PawnRelationDef>.GetNamed("Bastard");

View File

@ -3,8 +3,8 @@
<!-- Issues -->
<IssueDef>
<defName>Rape</defName>
<label>rape</label>
<defName>Birth</defName>
<label>birth</label>
<iconPath>UI/Issues/Rape</iconPath>
</IssueDef>

View File

@ -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