Separate method to add trait on generation

This commit is contained in:
amevarashi 2022-06-17 19:16:31 +05:00
parent 81794f752c
commit bb65120dd9
4 changed files with 24 additions and 14 deletions

View file

@ -14,7 +14,7 @@ namespace RJWSexperience
if (virgin != null) p.story.traits.RemoveTrait(virgin); if (virgin != null) p.story.traits.RemoveTrait(virgin);
ResetRecord(p, true); ResetRecord(p, true);
if (ResetRecord(p, false)) if (ResetRecord(p, false))
Virginity.TraitHandler.AddVirginTrait(p); Virginity.TraitHandler.GenerateVirginTrait(p);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!"); MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!");
} }

View file

@ -19,7 +19,7 @@ namespace RJWSexperience
doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result); doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
if (doVirginTrait) if (doVirginTrait)
Virginity.TraitHandler.AddVirginTrait(__result); Virginity.TraitHandler.GenerateVirginTrait(__result);
} }
} }
} }

View file

@ -31,16 +31,7 @@ namespace RJWSexperience.Virginity
billDoer, billDoer,
pawn pawn
}); });
SurgeryResult(pawn); TraitHandler.AddVirginTrait(pawn);
}
protected void SurgeryResult(Pawn pawn)
{
int degree = TraitDegree.FemaleAfterSurgery;
if (pawn.IsVirgin())
degree = TraitDegree.FemaleVirgin;
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
pawn.story.traits.GainTrait(virgin);
} }
} }
} }

View file

@ -8,6 +8,24 @@ namespace RJWSexperience.Virginity
{ {
private const float hymenSurgeryChance = 0.05f; private const float hymenSurgeryChance = 0.05f;
public static void GenerateVirginTrait(Pawn pawn)
{
if (pawn.story?.traits == null)
return;
if (pawn.gender == Gender.Female && !pawn.IsVirgin())
{
if (Rand.Chance(hymenSurgeryChance))
{
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
pawn.story.traits.GainTrait(virgin);
}
return;
}
AddVirginTrait(pawn);
}
public static void AddVirginTrait(Pawn pawn) public static void AddVirginTrait(Pawn pawn)
{ {
if (pawn.story?.traits == null) if (pawn.story?.traits == null)
@ -16,11 +34,12 @@ namespace RJWSexperience.Virginity
if (pawn.IsVirgin()) if (pawn.IsVirgin())
{ {
int degree = TraitDegree.MaleVirgin; int degree = TraitDegree.MaleVirgin;
if (pawn.gender == Gender.Female) degree = TraitDegree.FemaleVirgin; if (pawn.gender == Gender.Female)
degree = TraitDegree.FemaleVirgin;
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true); Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
pawn.story.traits.GainTrait(virgin); pawn.story.traits.GainTrait(virgin);
} }
else if (pawn.gender == Gender.Female && Rand.Chance(hymenSurgeryChance)) else if (pawn.gender == Gender.Female)
{ {
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true); Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
pawn.story.traits.GainTrait(virgin); pawn.story.traits.GainTrait(virgin);