Fix second stage of AteCum thought and refactor ThoughtDefs

This commit is contained in:
amevarashi 2022-04-24 01:12:02 +05:00
parent ad76a1857b
commit a7a0d3f6cf
11 changed files with 176 additions and 122 deletions

View file

@ -1,18 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<RJWSexperience.ThoughtDef_Recordbased>
<ThoughtDef>
<defName>AteCum</defName>
<durationDays>0.5</durationDays>
<stackLimit>1</stackLimit>
<stackedEffectMultiplier>0.4</stackedEffectMultiplier>
<recordDef>NumofEatenCum</recordDef>
<thoughtClass>RJWSexperience.Thought_AteCum</thoughtClass>
<minimumValueforStage>
<li>10</li>
<li>60</li>
<li>120</li>
</minimumValueforStage>
<stages>
<li>
<label>ate cum</label>
@ -35,7 +29,16 @@
<baseMoodEffect>3</baseMoodEffect>
</li>
</stages>
</RJWSexperience.ThoughtDef_Recordbased>
<modExtensions>
<li Class="RJWSexperience.ThoughtDefExtension_StageFromRecord">
<recordDef>NumofEatenCum</recordDef>
<minimumValueforStage>
<li>0</li>
<li>10</li>
<li>60</li>
<li>120</li>
</minimumValueforStage>
</li>
</modExtensions>
</ThoughtDef>
</Defs>

View file

@ -0,0 +1,14 @@
using RimWorld;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience
{
public class ThoughtDefExtension_IncreaseRecord : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public RecordDef recordDef;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public float increment;
}
}

View file

@ -1,13 +1,10 @@
using RimWorld;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience
{
/// <summary>
/// ThoughtDef using opinion
/// </summary>
public class ThoughtDef_Opinionbased : ThoughtDef
public class ThoughtDefExtension_StageFromOpinion : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<float> minimumValueforStage = new List<float>();

View file

@ -1,19 +1,15 @@
using RimWorld;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience
{
/// <summary>
/// ThoughtDef using record
/// </summary>
public class ThoughtDef_Recordbased : ThoughtDef
public class ThoughtDefExtension_StageFromRecord : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public RecordDef recordDef;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<float> minimumValueforStage = new List<float>();
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public float increment;
}
}

View file

@ -3,8 +3,23 @@ using Verse;
namespace RJWSexperience
{
public class Thought_IncreaseRecord : Thought_Recordbased
public class Thought_IncreaseRecord : Thought_Memory
{
private ThoughtDefExtension_IncreaseRecord extension;
protected ThoughtDefExtension_IncreaseRecord Extension
{
get
{
if (extension == null)
extension = def.GetModExtension<ThoughtDefExtension_IncreaseRecord>();
return extension;
}
}
protected RecordDef RecordDef => Extension.recordDef;
protected float Increment => Extension.increment;
protected float recordIncrement;
public override void ExposeData()
@ -21,7 +36,6 @@ namespace RJWSexperience
pawn.records.AddTo(RecordDef, recordIncrement);
recordIncrement = 0;
}
}
public override bool TryMergeWithExistingMemory(out bool showBubble)
@ -46,6 +60,7 @@ namespace RJWSexperience
base.Init();
recordIncrement = Increment;
}
protected virtual void Merged()
{
age = 0;

View file

@ -8,8 +8,19 @@ namespace RJWSexperience
/// </summary>
public class Thought_Opinionbased : Thought_Memory
{
protected ThoughtDef_Opinionbased Def => (ThoughtDef_Opinionbased)def;
protected List<float> MinimumValueforStage => Def.minimumValueforStage;
private ThoughtDefExtension_StageFromOpinion extension;
protected ThoughtDefExtension_StageFromOpinion Extension
{
get
{
if (extension == null)
extension = def.GetModExtension<ThoughtDefExtension_StageFromOpinion>();
return extension;
}
}
protected List<float> MinimumValueforStage => Extension.minimumValueforStage;
public override int CurStageIndex
{

View file

@ -8,10 +8,20 @@ namespace RJWSexperience
/// </summary>
public class Thought_Recordbased : Thought_Memory
{
protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
protected RecordDef RecordDef => Def.recordDef;
protected List<float> MinimumValueforStage => Def.minimumValueforStage;
protected float Increment => Def.increment;
private ThoughtDefExtension_StageFromRecord extension;
protected ThoughtDefExtension_StageFromRecord Extension
{
get
{
if (extension == null)
extension = def.GetModExtension<ThoughtDefExtension_StageFromRecord>();
return extension;
}
}
protected RecordDef RecordDef => Extension.recordDef;
protected List<float> MinimumValueforStage => Extension.minimumValueforStage;
public override int CurStageIndex
{
@ -20,7 +30,7 @@ namespace RJWSexperience
float value = pawn?.records?.GetValue(RecordDef) ?? 0f;
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
{
if (MinimumValueforStage[i] < value) return i + 1;
if (MinimumValueforStage[i] < value) return i;
}
return 0;
}

View file

@ -1,78 +1,74 @@
using System;
using System.Collections.Generic;
using RimWorld;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJWSexperience
{
public static class VariousDefOf
{
public static readonly RecordDef NumofEatenCum = DefDatabase<RecordDef>.GetNamed("NumofEatenCum");
public static readonly RecordDef AmountofEatenCum = DefDatabase<RecordDef>.GetNamed("AmountofEatenCum");
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 HandjobCount = DefDatabase<RecordDef>.GetNamed("HandjobCount");
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 RecordDef OrgasmCount = DefDatabase<RecordDef>.GetNamed("OrgasmCount");
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");
public static readonly ThingDef GatheredCum = DefDatabase<ThingDef>.GetNamed("GatheredCum");
public static readonly ThingDef FilthCum = ThingDef.Named("FilthCum");
public static readonly ThingDef FilthGirlcum = ThingDef.Named("FilthGirlCum");
public static readonly HediffDef CumAddiction = DefDatabase<HediffDef>.GetNamed("CumAddiction");
public static readonly HediffDef CumTolerance = DefDatabase<HediffDef>.GetNamed("CumTolerance");
public static readonly ChemicalDef Cum = DefDatabase<ChemicalDef>.GetNamed("Cum");
public static readonly NeedDef Chemical_Cum = DefDatabase<NeedDef>.GetNamed("Chemical_Cum");
public static readonly TraitDef Virgin = DefDatabase<TraitDef>.GetNamed("Virgin");
public static readonly JobDef CleanSelfwithBucket = DefDatabase<JobDef>.GetNamed("CleanSelfwithBucket");
public static readonly PawnRelationDef relation_birthgiver = DefDatabase<PawnRelationDef>.GetNamed("RJW_Sire");
public static readonly PawnRelationDef relation_spawn = DefDatabase<PawnRelationDef>.GetNamed("RJW_Pup");
public static readonly KeyBindingDef OpenSexStatistics = DefDatabase<KeyBindingDef>.GetNamed("OpenSexStatistics");
public static class VariousDefOf
{
public static readonly RecordDef NumofEatenCum = DefDatabase<RecordDef>.GetNamed("NumofEatenCum");
public static readonly RecordDef AmountofEatenCum = DefDatabase<RecordDef>.GetNamed("AmountofEatenCum");
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 HandjobCount = DefDatabase<RecordDef>.GetNamed("HandjobCount");
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 RecordDef OrgasmCount = DefDatabase<RecordDef>.GetNamed("OrgasmCount");
public static readonly SkillDef SexSkill = DefDatabase<SkillDef>.GetNamed("Sex");
public static readonly ThoughtDef AteCum = DefDatabase<ThoughtDef>.GetNamed("AteCum");
public static readonly PawnRelationDef Bastard = DefDatabase<PawnRelationDef>.GetNamed("Bastard");
public static readonly ThingDef GatheredCum = DefDatabase<ThingDef>.GetNamed("GatheredCum");
public static readonly ThingDef FilthCum = ThingDef.Named("FilthCum");
public static readonly ThingDef FilthGirlcum = ThingDef.Named("FilthGirlCum");
public static readonly HediffDef CumAddiction = DefDatabase<HediffDef>.GetNamed("CumAddiction");
public static readonly HediffDef CumTolerance = DefDatabase<HediffDef>.GetNamed("CumTolerance");
public static readonly ChemicalDef Cum = DefDatabase<ChemicalDef>.GetNamed("Cum");
public static readonly NeedDef Chemical_Cum = DefDatabase<NeedDef>.GetNamed("Chemical_Cum");
public static readonly TraitDef Virgin = DefDatabase<TraitDef>.GetNamed("Virgin");
public static readonly JobDef CleanSelfwithBucket = DefDatabase<JobDef>.GetNamed("CleanSelfwithBucket");
public static readonly PawnRelationDef relation_birthgiver = DefDatabase<PawnRelationDef>.GetNamed("RJW_Sire");
public static readonly PawnRelationDef relation_spawn = DefDatabase<PawnRelationDef>.GetNamed("RJW_Pup");
public static readonly KeyBindingDef OpenSexStatistics = DefDatabase<KeyBindingDef>.GetNamed("OpenSexStatistics");
public static float CumneedLevelOffset
{
get
{
if (cumneedLevelOffsetcache == null)
{
CreateCumCompCache();
}
return cumneedLevelOffsetcache ?? 1.0f;
}
}
public static float CumexistingAddictionSeverityOffset
{
get
{
if (cumexistingAddictionSeverityOffsetcache == null)
{
CreateCumCompCache();
}
return cumexistingAddictionSeverityOffsetcache ?? 1.0f;
}
}
public static float CumneedLevelOffset
{
get
{
if (cumneedLevelOffsetcache == null)
{
CreateCumCompCache();
}
return cumneedLevelOffsetcache ?? 1.0f;
}
}
private static void CreateCumCompCache()
{
CompProperties_Drug comp = (CompProperties_Drug)GatheredCum.comps.FirstOrDefault(x => x is CompProperties_Drug);
cumneedLevelOffsetcache = comp.needLevelOffset;
cumexistingAddictionSeverityOffsetcache = comp.existingAddictionSeverityOffset;
}
public static float CumexistingAddictionSeverityOffset
{
get
{
if (cumexistingAddictionSeverityOffsetcache == null)
{
CreateCumCompCache();
}
return cumexistingAddictionSeverityOffsetcache ?? 1.0f;
}
}
private static void CreateCumCompCache()
{
CompProperties_Drug comp = (CompProperties_Drug)GatheredCum.comps.FirstOrDefault(x => x is CompProperties_Drug);
cumneedLevelOffsetcache = comp.needLevelOffset;
cumexistingAddictionSeverityOffsetcache = comp.existingAddictionSeverityOffset;
}
private static float? cumneedLevelOffsetcache = null;
private static float? cumexistingAddictionSeverityOffsetcache = null;
}
private static float? cumneedLevelOffsetcache = null;
private static float? cumexistingAddictionSeverityOffsetcache = null;
}
}

View file

@ -236,13 +236,11 @@
<!-- Thoughts -->
<RJWSexperience.ThoughtDef_Recordbased>
<ThoughtDef>
<defName>Sex_Promiscuous</defName>
<durationDays>1</durationDays>
<stackLimit>1</stackLimit>
<thoughtClass>RJWSexperience.Thought_IncreaseRecord</thoughtClass>
<recordDef>Lust</recordDef>
<increment>3.0</increment>
<stages>
<li>
<label>promiscuous sex</label>
@ -250,7 +248,13 @@
<baseMoodEffect>5</baseMoodEffect>
</li>
</stages>
</RJWSexperience.ThoughtDef_Recordbased>
<modExtensions>
<li Class="RJWSexperience.ThoughtDefExtension_IncreaseRecord">
<recordDef>Lust</recordDef>
<increment>3.0</increment>
</li>
</modExtensions>
</ThoughtDef>
<ThoughtDef>
<defName>Sex_NonPromiscuous</defName>

View file

@ -150,7 +150,7 @@
<!-- Thoughts -->
<RJWSexperience.ThoughtDef_Recordbased>
<ThoughtDef>
<defName>BeenRaped_Submissive</defName>
<durationDays>10</durationDays>
<stackLimit>100</stackLimit>
@ -166,9 +166,9 @@
<baseMoodEffect>-3</baseMoodEffect>
</li>
</stages>
</RJWSexperience.ThoughtDef_Recordbased>
</ThoughtDef>
<RJWSexperience.ThoughtDef_Recordbased>
<ThoughtDef>
<defName>BeenRaped_NotSubmissive</defName>
<durationDays>15</durationDays>
<stackLimit>100</stackLimit>
@ -185,7 +185,7 @@
<baseOpinionOffset>-200</baseOpinionOffset>
</li>
</stages>
</RJWSexperience.ThoughtDef_Recordbased>
</ThoughtDef>
<ThoughtDef>
<defName>Raped_Know_NotBeingSubmissive</defName>

View file

@ -258,17 +258,11 @@
</stages>
</ThoughtDef>
<RJWSexperience.ThoughtDef_Opinionbased>
<ThoughtDef>
<defName>Virgin_Precious_Taken</defName>
<thoughtClass>RJWSexperience.Thought_Opinionbased</thoughtClass>
<durationDays>7</durationDays>
<stackLimit>1</stackLimit>
<minimumValueforStage>
<li>-100</li>
<li>-50</li>
<li>0</li>
<li>75</li>
</minimumValueforStage>
<stages>
<li>
<label>Lost virginity by {0}</label>
@ -291,18 +285,23 @@
<baseMoodEffect>5</baseMoodEffect>
</li>
</stages>
</RJWSexperience.ThoughtDef_Opinionbased>
<modExtensions>
<li Class="RJWSexperience.ThoughtDefExtension_StageFromOpinion">
<minimumValueforStage>
<li>-100</li>
<li>-50</li>
<li>0</li>
<li>75</li>
</minimumValueforStage>
</li>
</modExtensions>
</ThoughtDef>
<RJWSexperience.ThoughtDef_Opinionbased>
<ThoughtDef>
<defName>Virgin_Shameful_Taken</defName>
<thoughtClass>RJWSexperience.Thought_Opinionbased</thoughtClass>
<durationDays>7</durationDays>
<stackLimit>1</stackLimit>
<minimumValueforStage>
<li>-100</li>
<li>0</li>
<li>75</li>
</minimumValueforStage>
<stages>
<li>
<label>Lost virginity by {0}</label>
@ -320,7 +319,16 @@
<baseMoodEffect>20</baseMoodEffect>
</li>
</stages>
</RJWSexperience.ThoughtDef_Opinionbased>
<modExtensions>
<li Class="RJWSexperience.ThoughtDefExtension_StageFromOpinion">
<minimumValueforStage>
<li>-100</li>
<li>0</li>
<li>75</li>
</minimumValueforStage>
</li>
</modExtensions>
</ThoughtDef>
<ThoughtDef>