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" ?> <?xml version="1.0" encoding="utf-8" ?>
<Defs> <Defs>
<RJWSexperience.ThoughtDef_Recordbased> <ThoughtDef>
<defName>AteCum</defName> <defName>AteCum</defName>
<durationDays>0.5</durationDays> <durationDays>0.5</durationDays>
<stackLimit>1</stackLimit> <stackLimit>1</stackLimit>
<stackedEffectMultiplier>0.4</stackedEffectMultiplier> <stackedEffectMultiplier>0.4</stackedEffectMultiplier>
<recordDef>NumofEatenCum</recordDef>
<thoughtClass>RJWSexperience.Thought_AteCum</thoughtClass> <thoughtClass>RJWSexperience.Thought_AteCum</thoughtClass>
<minimumValueforStage>
<li>10</li>
<li>60</li>
<li>120</li>
</minimumValueforStage>
<stages> <stages>
<li> <li>
<label>ate cum</label> <label>ate cum</label>
@ -35,7 +29,16 @@
<baseMoodEffect>3</baseMoodEffect> <baseMoodEffect>3</baseMoodEffect>
</li> </li>
</stages> </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> </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 System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience namespace RJWSexperience
{ {
/// <summary> public class ThoughtDefExtension_StageFromOpinion : DefModExtension
/// ThoughtDef using opinion
/// </summary>
public class ThoughtDef_Opinionbased : ThoughtDef
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<float> minimumValueforStage = new List<float>(); public List<float> minimumValueforStage = new List<float>();

View file

@ -1,19 +1,15 @@
using RimWorld; using RimWorld;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience namespace RJWSexperience
{ {
/// <summary> public class ThoughtDefExtension_StageFromRecord : DefModExtension
/// ThoughtDef using record
/// </summary>
public class ThoughtDef_Recordbased : ThoughtDef
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public RecordDef recordDef; public RecordDef recordDef;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<float> minimumValueforStage = new List<float>(); 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 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; protected float recordIncrement;
public override void ExposeData() public override void ExposeData()
@ -21,7 +36,6 @@ namespace RJWSexperience
pawn.records.AddTo(RecordDef, recordIncrement); pawn.records.AddTo(RecordDef, recordIncrement);
recordIncrement = 0; recordIncrement = 0;
} }
} }
public override bool TryMergeWithExistingMemory(out bool showBubble) public override bool TryMergeWithExistingMemory(out bool showBubble)
@ -46,6 +60,7 @@ namespace RJWSexperience
base.Init(); base.Init();
recordIncrement = Increment; recordIncrement = Increment;
} }
protected virtual void Merged() protected virtual void Merged()
{ {
age = 0; age = 0;

View file

@ -8,8 +8,19 @@ namespace RJWSexperience
/// </summary> /// </summary>
public class Thought_Opinionbased : Thought_Memory public class Thought_Opinionbased : Thought_Memory
{ {
protected ThoughtDef_Opinionbased Def => (ThoughtDef_Opinionbased)def; private ThoughtDefExtension_StageFromOpinion extension;
protected List<float> MinimumValueforStage => Def.minimumValueforStage;
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 public override int CurStageIndex
{ {

View file

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

View file

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

View file

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

View file

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

View file

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