mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Move the extension methods to separate classes
This commit is contained in:
parent
bd6df7a2d7
commit
8b2d1b3dc7
14 changed files with 321 additions and 324 deletions
|
@ -15,11 +15,11 @@ namespace RJWSexperience.Ideology
|
|||
if (ModLister.HasActiveModWithName("RJW Sexperience"))
|
||||
{
|
||||
//Log.Message("[RJWSexperience.Ideology] Found RJWSexperience, patching");
|
||||
harmony.Patch(AccessTools.Method("RJWSexperience.Utility:IsIncest"),
|
||||
harmony.Patch(AccessTools.Method(typeof(ExtensionMethods.PawnExtensions), nameof(ExtensionMethods.PawnExtensions.IsIncest)),
|
||||
prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)),
|
||||
postfix: null
|
||||
);
|
||||
harmony.Patch(AccessTools.Method("RJWSexperience.RJWUtility:ThrowVirginHIstoryEvent"),
|
||||
harmony.Patch(AccessTools.Method(typeof(RJWSexperience.RJWUtility), nameof(RJWSexperience.RJWUtility.ThrowVirginHIstoryEvent)),
|
||||
prefix: null,
|
||||
postfix: new HarmonyMethod(typeof(Sexperience_Patch_ThrowVirginHIstoryEvent), nameof(Sexperience_Patch_ThrowVirginHIstoryEvent.Postfix))
|
||||
);
|
||||
|
|
|
@ -80,5 +80,11 @@
|
|||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RJWSexperience\RJWSexperience.csproj">
|
||||
<Project>{9c728e06-573b-4b04-a07f-acbf60cb424d}</Project>
|
||||
<Name>RJWSexperience</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
|
@ -12,7 +7,7 @@ using Verse;
|
|||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class Configurations : ModSettings
|
||||
public class Configurations : ModSettings
|
||||
{
|
||||
public const float MaxInitialLustDefault = 500;
|
||||
public const float AvgLustDefault = 0;
|
||||
|
@ -73,12 +68,12 @@ namespace RJWSexperience
|
|||
}
|
||||
}
|
||||
|
||||
public class RJWSexperience : Mod
|
||||
public class RjwSexperienceMod : Mod
|
||||
{
|
||||
private readonly Configurations config;
|
||||
private static Vector2 scroll;
|
||||
|
||||
public RJWSexperience(ModContentPack content) : base(content)
|
||||
public RjwSexperienceMod(ModContentPack content) : base(content)
|
||||
{
|
||||
config = GetSettings<Configurations>();
|
||||
}
|
||||
|
|
|
@ -1,63 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class DebugToolsSexperience
|
||||
{
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecords(Pawn p)
|
||||
{
|
||||
Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin != null) p.story.traits.RemoveTrait(virgin);
|
||||
p.ResetRecord(true);
|
||||
p.ResetRecord(false);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!");
|
||||
}
|
||||
public static class DebugToolsSexperience
|
||||
{
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecords(Pawn p)
|
||||
{
|
||||
Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin != null) p.story.traits.RemoveTrait(virgin);
|
||||
p.ResetRecord(true);
|
||||
p.ResetRecord(false);
|
||||
p.AddVirginTrait();
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!");
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecordsZero(Pawn p)
|
||||
{
|
||||
p.ResetRecord(true);
|
||||
p.AddVirginTrait();
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!\nVirginified!");
|
||||
}
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecordsZero(Pawn p)
|
||||
{
|
||||
p.ResetRecord(true);
|
||||
p.AddVirginTrait();
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!\nVirginified!");
|
||||
}
|
||||
|
||||
|
||||
[DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetLust(Pawn p)
|
||||
{
|
||||
float lust = RecordRandomizer.RandomizeLust(p);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust);
|
||||
}
|
||||
[DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetLust(Pawn p)
|
||||
{
|
||||
float lust = RecordRandomizer.RandomizeLust(p);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust);
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SetLust(Pawn p)
|
||||
{
|
||||
p.records.SetTo(VariousDefOf.Lust, 0);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0");
|
||||
}
|
||||
[DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SetLust(Pawn p)
|
||||
{
|
||||
p.records.SetTo(VariousDefOf.Lust, 0);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0");
|
||||
}
|
||||
|
||||
|
||||
[DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void AddLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, 10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
[DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void AddLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, 10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SubtractLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, -10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
[DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SubtractLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, -10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
246
RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs
Normal file
246
RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs
Normal file
|
@ -0,0 +1,246 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJWSexperience.ExtensionMethods
|
||||
{
|
||||
public static class PawnExtensions
|
||||
{
|
||||
public static bool IsIncest(this Pawn pawn, Pawn otherpawn)
|
||||
{
|
||||
if (otherpawn != null)
|
||||
{
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
|
||||
if (!relations.EnumerableNullOrEmpty()) foreach (PawnRelationDef relation in relations)
|
||||
{
|
||||
if (relation.incestOpinionOffset < 0) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float GetSexStat(this Pawn pawn)
|
||||
{
|
||||
if (xxx.is_human(pawn) && !pawn.Dead)
|
||||
{
|
||||
return pawn.GetStatValue(xxx.sex_stat);
|
||||
}
|
||||
else return 1.0f;
|
||||
}
|
||||
|
||||
public static T GetAdjacentBuilding<T>(this Pawn pawn) where T : Building
|
||||
{
|
||||
if (pawn.Spawned)
|
||||
{
|
||||
EdificeGrid edifice = pawn.Map.edificeGrid;
|
||||
if (edifice[pawn.Position] is T) return (T)edifice[pawn.Position];
|
||||
IEnumerable<IntVec3> adjcells = GenAdjFast.AdjacentCells8Way(pawn.Position);
|
||||
foreach (IntVec3 pos in adjcells)
|
||||
{
|
||||
if (edifice[pos] is T) return (T)edifice[pos];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty()) return 0;
|
||||
else return pawn.GetCumVolume(hediffs);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
|
||||
return pawn.GetCumVolume(part);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part)
|
||||
{
|
||||
float res;
|
||||
|
||||
try
|
||||
{
|
||||
res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f;
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
res = 0.0f;
|
||||
}
|
||||
if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the pawn is virgin, return true.
|
||||
/// </summary>
|
||||
public static bool IsVirgin(this Pawn pawn)
|
||||
{
|
||||
return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0;
|
||||
}
|
||||
public static bool HasHymen(this Pawn pawn)
|
||||
{
|
||||
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin != null)
|
||||
{
|
||||
if (virgin.Degree > 0) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If pawn is virgin, lose his/her virginity.
|
||||
/// </summary>
|
||||
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
|
||||
{
|
||||
if (props != null && props.sexType == xxx.rjwSextype.Vaginal)
|
||||
{
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
SexPartnerHistory history = pawn.GetPartnerHistory();
|
||||
if (history != null)
|
||||
{
|
||||
history.RecordFirst(partner, props);
|
||||
}
|
||||
if (RJWUtility.RemoveVirginTrait(pawn, partner, props))
|
||||
{
|
||||
if (Configurations.EnableRecordRandomizer) Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RJWUtility.RemoveVirginTrait(pawn, partner, props);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Gender PreferGender(this Pawn pawn)
|
||||
{
|
||||
if (pawn.gender == Gender.Male)
|
||||
{
|
||||
if (xxx.is_homosexual(pawn)) return Gender.Male;
|
||||
else return Gender.Female;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xxx.is_homosexual(pawn)) return Gender.Female;
|
||||
else return Gender.Male;
|
||||
}
|
||||
}
|
||||
|
||||
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
|
||||
{
|
||||
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket);
|
||||
Dictionary<Building, float> targets = new Dictionary<Building, float>();
|
||||
if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++)
|
||||
{
|
||||
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
|
||||
{
|
||||
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
|
||||
}
|
||||
}
|
||||
if (!targets.NullOrEmpty())
|
||||
{
|
||||
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void AteCum(this Pawn pawn, float amount, bool doDrugEffect = false)
|
||||
{
|
||||
pawn.records.AddTo(VariousDefOf.NumofEatenCum, 1);
|
||||
pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount);
|
||||
if (doDrugEffect) pawn.CumDrugEffect();
|
||||
}
|
||||
|
||||
public static void CumDrugEffect(this Pawn pawn)
|
||||
{
|
||||
Need need = pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum);
|
||||
if (need != null) need.CurLevel += VariousDefOf.CumneedLevelOffset;
|
||||
Hediff addictive = HediffMaker.MakeHediff(VariousDefOf.CumTolerance, pawn);
|
||||
addictive.Severity = 0.032f;
|
||||
pawn.health.AddHediff(addictive);
|
||||
Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction);
|
||||
if (addiction != null) addiction.Severity += VariousDefOf.CumexistingAddictionSeverityOffset;
|
||||
|
||||
pawn.needs?.mood?.thoughts?.memories?.TryGainMemoryFast(VariousDefOf.AteCum);
|
||||
}
|
||||
|
||||
public static void AddVirginTrait(this Pawn pawn)
|
||||
{
|
||||
if (pawn.story?.traits != null)
|
||||
{
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
int degree = 0;
|
||||
if (pawn.gender == Gender.Female) degree = 2;
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
else if (pawn.gender == Gender.Female && Rand.Chance(0.05f))
|
||||
{
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, 1, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetRecord(this Pawn pawn, bool allzero)
|
||||
{
|
||||
if (!allzero)
|
||||
{
|
||||
if (Configurations.EnableRecordRandomizer && pawn != null && xxx.is_human(pawn))
|
||||
{
|
||||
RecordRandomizer.Randomize(pawn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pawn.records.SetTo(VariousDefOf.Lust, 0);
|
||||
pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AnalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OralSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.BlowjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.HandjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FingeringCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FootjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OrgasmCount, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthAnimal, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthEgg, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthHuman, 0);
|
||||
pawn.records.SetTo(xxx.CountOfFappin, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSex, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithCorpse, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfWhore, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,5 +28,14 @@ namespace RJWSexperience.ExtensionMethods
|
|||
return props.partner;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBestiality(this SexProps props)
|
||||
{
|
||||
if (props.partner != null)
|
||||
{
|
||||
return props.pawn.IsAnimal() ^ props.partner.IsAnimal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using rjw;
|
||||
using RimWorld;
|
||||
using RimWorld;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using Verse;
|
||||
|
||||
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class CumOutcomeDoers : IngestionOutcomeDoer
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<Compile Include="Building_Cumbucket.cs" />
|
||||
<Compile Include="Configurations.cs" />
|
||||
<Compile Include="DebugAction.cs" />
|
||||
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
|
||||
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
|
||||
<Compile Include="Harmony.cs" />
|
||||
<Compile Include="IngestionOutcomeDoers.cs" />
|
||||
|
|
|
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||
using rjw;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using UnityEngine;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Interactions.Helpers;
|
||||
|
@ -16,63 +15,11 @@ namespace RJWSexperience
|
|||
{
|
||||
public static class RJWUtility
|
||||
{
|
||||
public static float GetSexStat(this Pawn pawn)
|
||||
{
|
||||
if (xxx.is_human(pawn) && !pawn.Dead)
|
||||
{
|
||||
return pawn.GetStatValue(xxx.sex_stat);
|
||||
}
|
||||
else return 1.0f;
|
||||
}
|
||||
|
||||
public static float LustIncrementFactor(float lust)
|
||||
{
|
||||
return Mathf.Exp(-Mathf.Pow(lust / Configurations.LustLimit, 2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the pawn is virgin, return true.
|
||||
/// </summary>
|
||||
public static bool IsVirgin(this Pawn pawn)
|
||||
{
|
||||
return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0;
|
||||
}
|
||||
public static bool HasHymen(this Pawn pawn)
|
||||
{
|
||||
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin != null)
|
||||
{
|
||||
if (virgin.Degree > 0) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If pawn is virgin, lose his/her virginity.
|
||||
/// </summary>
|
||||
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
|
||||
{
|
||||
if (props != null && props.sexType == xxx.rjwSextype.Vaginal)
|
||||
{
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
SexPartnerHistory history = pawn.GetPartnerHistory();
|
||||
if (history != null)
|
||||
{
|
||||
history.RecordFirst(partner, props);
|
||||
}
|
||||
if (RemoveVirginTrait(pawn, partner, props))
|
||||
{
|
||||
if (Configurations.EnableRecordRandomizer) Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveVirginTrait(pawn, partner, props);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool RemoveVirginTrait(Pawn pawn, Pawn partner, SexProps props)
|
||||
{
|
||||
int degree;
|
||||
|
@ -247,85 +194,5 @@ namespace RJWSexperience
|
|||
pawn.records?.AddTo(recordforpawn, 1);
|
||||
partner.records?.AddTo(recordforpartner, 1);
|
||||
}
|
||||
|
||||
public static Gender PreferGender(this Pawn pawn)
|
||||
{
|
||||
if (pawn.gender == Gender.Male)
|
||||
{
|
||||
if (xxx.is_homosexual(pawn)) return Gender.Male;
|
||||
else return Gender.Female;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xxx.is_homosexual(pawn)) return Gender.Female;
|
||||
else return Gender.Male;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBestiality(this SexProps props)
|
||||
{
|
||||
if (props.partner != null)
|
||||
{
|
||||
return props.pawn.IsAnimal() ^ props.partner.IsAnimal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
|
||||
{
|
||||
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket);
|
||||
Dictionary<Building, float> targets = new Dictionary<Building, float>();
|
||||
if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++)
|
||||
{
|
||||
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
|
||||
{
|
||||
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
|
||||
}
|
||||
}
|
||||
if (!targets.NullOrEmpty())
|
||||
{
|
||||
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void AteCum(this Pawn pawn, float amount, bool doDrugEffect = false)
|
||||
{
|
||||
pawn.records.AddTo(VariousDefOf.NumofEatenCum, 1);
|
||||
pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount);
|
||||
if (doDrugEffect) pawn.CumDrugEffect();
|
||||
}
|
||||
|
||||
public static void CumDrugEffect(this Pawn pawn)
|
||||
{
|
||||
Need need = pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum);
|
||||
if (need != null) need.CurLevel += VariousDefOf.CumneedLevelOffset;
|
||||
Hediff addictive = HediffMaker.MakeHediff(VariousDefOf.CumTolerance, pawn);
|
||||
addictive.Severity = 0.032f;
|
||||
pawn.health.AddHediff(addictive);
|
||||
Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction);
|
||||
if (addiction != null) addiction.Severity += VariousDefOf.CumexistingAddictionSeverityOffset;
|
||||
|
||||
pawn.needs?.mood?.thoughts?.memories?.TryGainMemoryFast(VariousDefOf.AteCum);
|
||||
}
|
||||
|
||||
public static void AddVirginTrait(this Pawn pawn)
|
||||
{
|
||||
if (pawn.story?.traits != null)
|
||||
{
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
int degree = 0;
|
||||
if (pawn.gender == Gender.Female) degree = 2;
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
else if (pawn.gender == Gender.Female && Rand.Chance(0.05f))
|
||||
{
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, 1, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using Verse;
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ using Verse;
|
|||
using Verse.Sound;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
|
||||
namespace RJWSexperience.UI
|
||||
{
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
|
@ -14,19 +7,6 @@ namespace RJWSexperience
|
|||
{
|
||||
public static System.Random random = new System.Random(Environment.TickCount);
|
||||
|
||||
public static bool IsIncest(this Pawn pawn, Pawn otherpawn)
|
||||
{
|
||||
if (otherpawn != null)
|
||||
{
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
|
||||
if (!relations.EnumerableNullOrEmpty()) foreach (PawnRelationDef relation in relations)
|
||||
{
|
||||
if (relation.incestOpinionOffset < 0) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float RandGaussianLike(float min, float max, int iterations = 3)
|
||||
{
|
||||
double res = 0;
|
||||
|
@ -39,61 +19,12 @@ namespace RJWSexperience
|
|||
return (float)res * (max - min) + min;
|
||||
}
|
||||
|
||||
public static void SetTo(this Pawn_RecordsTracker records, RecordDef record ,float value)
|
||||
public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value)
|
||||
{
|
||||
float recordval = records.GetValue(record);
|
||||
records.AddTo(record, value - recordval);
|
||||
}
|
||||
|
||||
public static T GetAdjacentBuilding<T>(this Pawn pawn) where T : Building
|
||||
{
|
||||
if (pawn.Spawned)
|
||||
{
|
||||
EdificeGrid edifice = pawn.Map.edificeGrid;
|
||||
if (edifice[pawn.Position] is T) return (T)edifice[pawn.Position];
|
||||
IEnumerable<IntVec3> adjcells = GenAdjFast.AdjacentCells8Way(pawn.Position);
|
||||
foreach(IntVec3 pos in adjcells)
|
||||
{
|
||||
if (edifice[pos] is T) return (T)edifice[pos];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty()) return 0;
|
||||
else return pawn.GetCumVolume(hediffs);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
|
||||
return pawn.GetCumVolume(part);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part)
|
||||
{
|
||||
float res;
|
||||
|
||||
try
|
||||
{
|
||||
res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f;
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
res = 0.0f;
|
||||
}
|
||||
if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static float Normalization(this float num, float min, float max)
|
||||
{
|
||||
return (num - min)/(max - min);
|
||||
|
@ -103,55 +34,5 @@ namespace RJWSexperience
|
|||
{
|
||||
return num * (max - min) + min;
|
||||
}
|
||||
|
||||
public static void ResetRecord(this Pawn pawn, bool allzero)
|
||||
{
|
||||
if (!allzero)
|
||||
{
|
||||
if (Configurations.EnableRecordRandomizer && pawn != null && xxx.is_human(pawn))
|
||||
{
|
||||
RecordRandomizer.Randomize(pawn);
|
||||
}
|
||||
pawn.AddVirginTrait();
|
||||
}
|
||||
else
|
||||
{
|
||||
pawn.records.SetTo(VariousDefOf.Lust, 0);
|
||||
pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AnalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OralSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.BlowjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.HandjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FingeringCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FootjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OrgasmCount, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthAnimal, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthEgg, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthHuman, 0);
|
||||
pawn.records.SetTo(xxx.CountOfFappin, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSex, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithCorpse, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfWhore, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue