2022-06-12 06:50:36 +00:00
|
|
|
|
using RimWorld;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace RJWSexperience.Virginity
|
|
|
|
|
{
|
|
|
|
|
public static class TraitHandler
|
|
|
|
|
{
|
|
|
|
|
private const float hymenSurgeryChance = 0.05f;
|
|
|
|
|
|
2022-06-17 14:16:31 +00:00
|
|
|
|
public static void GenerateVirginTrait(Pawn pawn)
|
|
|
|
|
{
|
|
|
|
|
if (pawn.story?.traits == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pawn.gender == Gender.Female && !pawn.IsVirgin())
|
|
|
|
|
{
|
|
|
|
|
if (Rand.Chance(hymenSurgeryChance))
|
|
|
|
|
{
|
2023-04-17 11:34:35 +00:00
|
|
|
|
Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true);
|
2022-06-17 14:16:31 +00:00
|
|
|
|
pawn.story.traits.GainTrait(virgin);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddVirginTrait(pawn);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-12 06:50:36 +00:00
|
|
|
|
public static void AddVirginTrait(Pawn pawn)
|
|
|
|
|
{
|
|
|
|
|
if (pawn.story?.traits == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pawn.IsVirgin())
|
|
|
|
|
{
|
2022-06-17 13:55:43 +00:00
|
|
|
|
int degree = TraitDegree.MaleVirgin;
|
2022-06-17 14:16:31 +00:00
|
|
|
|
if (pawn.gender == Gender.Female)
|
|
|
|
|
degree = TraitDegree.FemaleVirgin;
|
2023-04-17 11:34:35 +00:00
|
|
|
|
Trait virgin = new Trait(RsDefOf.Trait.Virgin, degree, true);
|
2022-06-12 06:50:36 +00:00
|
|
|
|
pawn.story.traits.GainTrait(virgin);
|
|
|
|
|
}
|
2022-06-17 14:16:31 +00:00
|
|
|
|
else if (pawn.gender == Gender.Female)
|
2022-06-12 06:50:36 +00:00
|
|
|
|
{
|
2023-04-17 11:34:35 +00:00
|
|
|
|
Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true);
|
2022-06-12 06:50:36 +00:00
|
|
|
|
pawn.story.traits.GainTrait(virgin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-21 15:19:37 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Remove virginity trait and spawn blood filth if applicable
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Degree of the removed trait</returns>
|
2022-06-17 14:47:49 +00:00
|
|
|
|
public static int? RemoveVirginTrait(Pawn pawn)
|
2022-06-12 06:50:36 +00:00
|
|
|
|
{
|
2023-04-17 11:34:35 +00:00
|
|
|
|
Trait virgin = pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin);
|
2022-06-12 06:50:36 +00:00
|
|
|
|
if (virgin == null)
|
2022-06-17 14:47:49 +00:00
|
|
|
|
return null;
|
2022-06-12 06:50:36 +00:00
|
|
|
|
|
|
|
|
|
int degree = virgin.Degree;
|
2022-11-12 05:45:17 +00:00
|
|
|
|
if (pawn.gender == Gender.Female && degree > 0 && pawn.Spawned && !pawn.Dead)
|
2022-06-12 06:50:36 +00:00
|
|
|
|
{
|
|
|
|
|
FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
|
|
|
|
|
}
|
|
|
|
|
pawn.story.traits.RemoveTrait(virgin);
|
2022-06-17 14:47:49 +00:00
|
|
|
|
return degree;
|
2022-06-12 06:50:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|