RJW-Sexperience/Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs
amevarashi 67c2328ad6 Change VariousDefOf to RsDefOf
Fix some IDE messages
2023-04-17 16:34:35 +05:00

35 lines
976 B
C#

using RimWorld;
using rjw;
using System.Collections.Generic;
using Verse;
namespace RJWSexperience.Virginity
{
public class Recipe_HymenSurgery : Recipe_Surgery
{
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
if (pawn.gender != Gender.Female)
yield break;
BodyPartRecord part = Genital_Helper.get_genitalsBPR(pawn);
if (part == null)
yield break;
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
if (Genital_Helper.has_vagina(pawn, hediffs) && !HasHymen(pawn))
yield return part;
}
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
{
if (billDoer == null)
return;
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
TraitHandler.AddVirginTrait(pawn);
}
private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin)?.Degree > 0;
}
}