rjw-plasticsurgeries/Source/RJW_PlasticSurgeries/Recipe_Surgery_Penoplasty.cs
2022-01-15 23:43:57 +01:00

78 lines
No EOL
2.5 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_Penoplasty : Recipe_Surgery
{
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_penis_fertile(pawn, hediffs) ||
Genital_Helper.has_penis_infertile(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_penis).ForEach(hed =>
{
hed.Severity = severity;
try
{
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
}
catch (Exception e)
{
Log.Error("Try enabling Dyspareunia for sore genitals");
}
});
}
}
public class Recipe_Surgery_Penoplasty_Micro : Recipe_Surgery_Penoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.1f);
}
public class Recipe_Surgery_Penoplasty_Small : Recipe_Surgery_Penoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.3f);
}
public class Recipe_Surgery_Penoplasty_Average : Recipe_Surgery_Penoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.5f);
}
public class Recipe_Surgery_Penoplasty_Large : Recipe_Surgery_Penoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.7f);
}
public class Recipe_Surgery_Penoplasty_Huge : Recipe_Surgery_Penoplasty
{
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.9f);
}
}