Add psychic lust mechanic, works like psychic drone

This commit is contained in:
c0ffee 2022-11-19 16:51:02 -08:00
parent 06122c2b18
commit 60a4205e6f
11 changed files with 383 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<GameConditionDef>
<defName>PsychicArouse</defName>
<conditionClass>RJW_Events.GameCondition_PsychicArouse</conditionClass>
<label>psychic arouse</label>
<description>A distant archotech is emitting psychic signals through an orbital amplifier, sexually arousing people.</description>
<descriptionFuture>a [psychicDroneLevel] psychic drone will buzz the area around [map_definite] for [gameConditionDuration_duration], pushing all people of the [psychicDroneGender] gender towards arousal</descriptionFuture>
<endMessage>The psychic drone is ending.</endMessage>
<letterText>Every {0} colonist blushes with arousal.\n\nSome distant engine of lust is stirring. It is projecting a psychic drone onto this site through an orbital amplifier, tuned to only affect {0}s. For a few days, every {0} will experience increased arousal and sex need.</letterText>
<defaultDroneLevel>BadMedium</defaultDroneLevel>
<letterDef>NegativeEvent</letterDef>
<natural>false</natural>
</GameConditionDef>
</Defs>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<IncidentDef>
<defName>PsychicArouse</defName>
<label>psychic arouse</label>
<category>Misc</category>
<targetTags>
<li>Map_PlayerHome</li>
</targetTags>
<workerClass>RJW_Events.IncidentWorker_PsychicArouse</workerClass>
<gameCondition>PsychicArouse</gameCondition>
<baseChance>1.0</baseChance>
<minRefireDays>15</minRefireDays>
<durationDays>0.75~1.75</durationDays>
</IncidentDef>
</Defs>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThoughtDef>
<defName>PsychicArouse</defName>
<workerClass>RJW_Events.ThoughtWorker_PsychicArouse</workerClass>
<effectMultiplyingStat>PsychicSensitivity</effectMultiplyingStat>
<validWhileDespawned>true</validWhileDespawned>
<developmentalStageFilter>Baby, Child, Adult</developmentalStageFilter>
<stages>
<li>
<label>low psychic arouse</label>
<description>It's like someone's gently caressing my body, whispering sweet love to me. Distracting, but strangely nice.</description>
<baseMoodEffect>2</baseMoodEffect>
</li>
<li>
<label>moderate psychic arouse</label>
<description>Images of sex keep flashing in my mind, teasing me, moaning into my ear. It's making it hard to focus, is it getting hot in here?</description>
<baseMoodEffect>-2</baseMoodEffect>
</li>
<li>
<label>extreme psychic arouse</label>
<description>My sex is throbbing like crazy and I'm sweating. I NEED to cum right now, oh f-fuck...</description>
<baseMoodEffect>-3</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
</Defs>

View file

@ -54,10 +54,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Source\DefOfs\GameConditionDefOf.cs" />
<Compile Include="Source\DefOfs\OrgyDutyDefOf.cs" />
<Compile Include="Source\DefOfs\TaleDefOf.cs" />
<Compile Include="Source\DefOfs\ThoughtDefOf.cs" />
<Compile Include="Source\GameConditionManagerExtension\GameConditionManagerExtension.cs" />
<Compile Include="Source\GameConditions\GameCondition_PsychicArouse.cs" />
<Compile Include="Source\GatheringWorkers\GatheringWorker_Orgy.cs" />
<Compile Include="Source\IncidentWorkers\IncidentWorker_PsychicArouse.cs" />
<Compile Include="Source\Patches\HarmonyPatch_Need_Sex.cs" />
<Compile Include="Source\Patches\HarmonyPatch_ReclotheOnEnd.cs" />
<Compile Include="Source\JobDrivers\JobDriver_GetNaked.cs" />
<Compile Include="Source\JobDrivers\JobDriver_OrgySex.cs" />
@ -69,6 +74,7 @@
<Compile Include="Source\Patches\HarmonyPatch_StayNudeForOrgy.cs" />
<Compile Include="Source\Patches\Harmony_PatchAll.cs" />
<Compile Include="Source\ThinkNodes\ThinkNode_ConditionalNude.cs" />
<Compile Include="Source\ThoughtWorkers\ThoughtWorker_PsychicArouse.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="1.2\" />
@ -78,11 +84,14 @@
<ItemGroup>
<Content Include="1.1\Assemblies\RJW-Events.dll" />
<Content Include="Defs\DutyDefs\DutyDefs_Sex.xml" />
<Content Include="Defs\GameConditionDefs\GameConditions_Misc.xml" />
<Content Include="Defs\GatheringDefs\Gatherings_Sex.xml" />
<Content Include="Defs\IncidentDefs\Incidents_Map_Misc.xml" />
<Content Include="Defs\JobDefs\Jobs_OrgySex.xml" />
<Content Include="Defs\JobDefs\Jobs_Naked.xml" />
<Content Include="Defs\TaleDefs\Tales_Sex.xml" />
<Content Include="Defs\ThoughtDefs\Thoughts_Sex.xml" />
<Content Include="Defs\ThoughtDefs\Thoughts_Situation_Special.xml" />
<Content Include="Languages\ChineseSimplified\DefInjected\GatheringDef\Gatherings_Sex.xml" />
<Content Include="Languages\ChineseSimplified\DefInjected\JobDef\Jobs_Naked.xml" />
<Content Include="Languages\ChineseSimplified\DefInjected\JobDef\Jobs_OrgySex.xml" />

View file

@ -0,0 +1,22 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Events
{
[DefOf]
public static class GameConditionDefOf
{
static GameConditionDefOf()
{
DefOfHelper.EnsureInitializedInCtor(typeof(GameConditionDefOf));
}
public static GameConditionDef PsychicArouse;
}
}

View file

@ -0,0 +1,29 @@
using RimWorld;
using Verse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RJW_Events
{
public static class GameConditionManagerExtension
{
public static PsychicDroneLevel GetHighestPsychicArouseLevelFor(this GameConditionManager g, Gender gender)
{
PsychicDroneLevel psychicDroneLevel = PsychicDroneLevel.None;
for (int i = 0; i < g.ActiveConditions.Count; i++)
{
GameCondition_PsychicArouse gameCondition_PsychicEmanation = g.ActiveConditions[i] as GameCondition_PsychicArouse;
if (gameCondition_PsychicEmanation != null && gameCondition_PsychicEmanation.gender == gender && gameCondition_PsychicEmanation.level > psychicDroneLevel)
{
psychicDroneLevel = gameCondition_PsychicEmanation.level;
}
}
return psychicDroneLevel;
}
}
}

View file

@ -0,0 +1,123 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using Verse.Grammar;
namespace RJW_Events
{
public class GameCondition_PsychicArouse : GameCondition
{
// Token: 0x17000EA2 RID: 3746
// (get) Token: 0x06005437 RID: 21559 RVA: 0x001C44F0 File Offset: 0x001C26F0
public override string Label
{
get
{
if (this.level == PsychicDroneLevel.GoodMedium)
{
return this.def.label + ": " + this.gender.GetLabel(false).CapitalizeFirst();
}
if (this.gender != Gender.None)
{
return string.Concat(new string[]
{
this.def.label,
": ",
this.level.GetLabel().CapitalizeFirst(),
" (",
this.gender.GetLabel(false).ToLower(),
")"
});
}
return this.def.label + ": " + this.level.GetLabel().CapitalizeFirst();
}
}
// Token: 0x17000EA3 RID: 3747
// (get) Token: 0x06005438 RID: 21560 RVA: 0x001C45B4 File Offset: 0x001C27B4
public override string LetterText
{
get
{
if (this.level == PsychicDroneLevel.GoodMedium)
{
return this.def.letterText.Formatted(this.gender.GetLabel(false).ToLower());
}
return this.def.letterText.Formatted(this.gender.GetLabel(false).ToLower(), this.level.GetLabel());
}
}
// Token: 0x17000EA4 RID: 3748
// (get) Token: 0x06005439 RID: 21561 RVA: 0x001C4631 File Offset: 0x001C2831
public override string Description
{
get
{
return base.Description.Formatted(this.gender.GetLabel(false).ToLower());
}
}
// Token: 0x0600543A RID: 21562 RVA: 0x001C4659 File Offset: 0x001C2859
public override void PostMake()
{
base.PostMake();
this.level = this.def.defaultDroneLevel;
}
// Token: 0x0600543B RID: 21563 RVA: 0x001C4674 File Offset: 0x001C2874
public override void RandomizeSettings(float points, Map map, List<Rule> outExtraDescriptionRules, Dictionary<string, string> outExtraDescriptionConstants)
{
if (this.def.defaultDroneLevel == PsychicDroneLevel.GoodMedium)
{
this.level = PsychicDroneLevel.GoodMedium;
}
else if (points < 800f)
{
this.level = PsychicDroneLevel.BadLow;
}
else if (points < 2000f)
{
this.level = PsychicDroneLevel.BadMedium;
}
else
{
this.level = PsychicDroneLevel.BadHigh;
}
if (map.mapPawns.FreeColonistsCount > 0)
{
this.gender = map.mapPawns.FreeColonists.RandomElement<Pawn>().gender;
}
else
{
this.gender = Rand.Element<Gender>(Gender.Male, Gender.Female);
}
outExtraDescriptionRules.Add(new Rule_String("psychicArouseLevel", this.level.GetLabel()));
outExtraDescriptionRules.Add(new Rule_String("psychicArouseGender", this.gender.GetLabel(false)));
}
// Token: 0x0600543C RID: 21564 RVA: 0x001C4730 File Offset: 0x001C2930
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<Gender>(ref this.gender, "psychicArouseGender", Gender.None, false);
Scribe_Values.Look<PsychicDroneLevel>(ref this.level, "psychicArouseLevel", PsychicDroneLevel.None, false);
}
// Token: 0x04003496 RID: 13462
public Gender gender;
// Token: 0x04003497 RID: 13463
public PsychicDroneLevel level = PsychicDroneLevel.BadMedium;
// Token: 0x04003498 RID: 13464
public const float MaxPointsDroneLow = 800f;
// Token: 0x04003499 RID: 13465
public const float MaxPointsDroneMedium = 2000f;
}
}

View file

@ -0,0 +1,38 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Events
{
public class IncidentWorker_PsychicArouse : IncidentWorker_PsychicEmanation
{
protected override void DoConditionAndLetter(IncidentParms parms, Map map, int duration, Gender gender, float points)
{
PsychicDroneLevel level;
if (points < 800f)
{
level = PsychicDroneLevel.BadLow;
}
else if (points < 2000f)
{
level = PsychicDroneLevel.BadMedium;
}
else
{
level = PsychicDroneLevel.BadHigh;
}
GameCondition_PsychicArouse gameCondition_PsychicEmanation = (GameCondition_PsychicArouse)GameConditionMaker.MakeCondition(GameConditionDefOf.PsychicArouse, duration);
gameCondition_PsychicEmanation.gender = gender;
gameCondition_PsychicEmanation.level = level;
map.gameConditionManager.RegisterCondition(gameCondition_PsychicEmanation);
base.SendStandardLetter(gameCondition_PsychicEmanation.LabelCap, gameCondition_PsychicEmanation.LetterText, gameCondition_PsychicEmanation.def.letterDef, parms, LookTargets.Invalid, Array.Empty<NamedArgument>());
}
}
}

View file

@ -0,0 +1,56 @@
using HarmonyLib;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJW_Events
{
[HarmonyPatch(typeof(Need_Sex), "fall_per_tick")]
public static class HarmonyPatch_Need_Sex
{
public static void Postfix(Pawn pawn, ref float __result)
{
PsychicDroneLevel psychicDroneLevel = PsychicDroneLevel.None;
Map mapHeld = pawn.MapHeld;
if (mapHeld != null)
{
PsychicDroneLevel highestPsychicDroneLevelFor = mapHeld.gameConditionManager.GetHighestPsychicArouseLevelFor(pawn.gender);
if (highestPsychicDroneLevelFor > psychicDroneLevel)
{
psychicDroneLevel = highestPsychicDroneLevelFor;
}
}
switch (psychicDroneLevel)
{
case PsychicDroneLevel.None:
break;
case PsychicDroneLevel.GoodMedium:
__result *= 3;
break;
case PsychicDroneLevel.BadLow:
__result *= 3;
break;
case PsychicDroneLevel.BadMedium:
__result *= 6;
break;
case PsychicDroneLevel.BadHigh:
__result *= 9;
break;
case PsychicDroneLevel.BadExtreme:
__result *= 9;
break;
default:
throw new NotImplementedException();
}
}
}
}

View file

@ -0,0 +1,46 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Events
{
class ThoughtWorker_PsychicArouse : ThoughtWorker
{
protected override ThoughtState CurrentStateInternal(Pawn p)
{
PsychicDroneLevel psychicDroneLevel = PsychicDroneLevel.None;
Map mapHeld = p.MapHeld;
if (mapHeld != null)
{
PsychicDroneLevel highestPsychicDroneLevelFor = mapHeld.gameConditionManager.GetHighestPsychicArouseLevelFor(p.gender);
if (highestPsychicDroneLevelFor > psychicDroneLevel)
{
psychicDroneLevel = highestPsychicDroneLevelFor;
}
}
switch (psychicDroneLevel)
{
case PsychicDroneLevel.None:
return false;
case PsychicDroneLevel.GoodMedium:
return ThoughtState.ActiveAtStage(0);
case PsychicDroneLevel.BadLow:
return ThoughtState.ActiveAtStage(0);
case PsychicDroneLevel.BadMedium:
return ThoughtState.ActiveAtStage(1);
case PsychicDroneLevel.BadHigh:
return ThoughtState.ActiveAtStage(2);
case PsychicDroneLevel.BadExtreme:
return ThoughtState.ActiveAtStage(2);
default:
throw new NotImplementedException();
}
}
}
}