rjw-plasticsurgeries/Source/RJW_PlasticSurgeries/Recipe_Surgery_Vaginoplasty.cs
2022-02-03 02:01:01 +01:00

92 lines
No EOL
2.8 KiB
C#

using System;
using System.Collections.Generic;
using Dyspareunia;
using RimWorld;
using rjw;
using Verse;
using DamageDefOf = Dyspareunia.DamageDefOf;
namespace RJW_PlasticSurgeries
{
public abstract class Recipe_Surgery_Vaginoplasty : Recipe_Surgery
{
private readonly bool hasDyspareunia;
public Recipe_Surgery_Vaginoplasty()
{
try
{
hasDyspareunia = Type.GetType("Dyspareunia.PenetrationUtility").ToString() != null;
}
catch (Exception e)
{
hasDyspareunia = false;
}
}
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
var part = Genital_Helper.get_genitalsBPR(pawn);
if (part != null)
{
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
if (Genital_Helper.has_vagina(pawn, hediffs)) yield return part;
}
}
/// <inheritdoc />
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
Bill bill)
{
if (billDoer != null)
{
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
SurgeryResult(pawn);
}
}
public abstract void SurgeryResult(Pawn pawn);
protected void SurgeryX(Pawn pawn, float severity)
{
pawn.GetGenitalsList().FindAll(Genital_Helper.is_vagina).ForEach(hed =>
{
hed.Severity = severity;
if (hasDyspareunia)
{
DamageHediff(hed);
}
});
}
private static void DamageHediff(Hediff hed)
{
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
}
}
public class Recipe_Surgery_Vaginoplasty_Micro : Recipe_Surgery_Vaginoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.1f);
}
public class Recipe_Surgery_Vaginoplasty_Tight : Recipe_Surgery_Vaginoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.3f);
}
public class Recipe_Surgery_Vaginoplasty_Average : Recipe_Surgery_Vaginoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.5f);
}
public class Recipe_Surgery_Vaginoplasty_Accomodating : Recipe_Surgery_Vaginoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.7f);
}
public class Recipe_Surgery_Vaginoplasty_Cavernous : Recipe_Surgery_Vaginoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.9f);
}
}