rjw-plasticsurgeries/Source/RJW_PlasticSurgeries/Recipe_Surgery_Mammoplasty.cs
2022-10-19 19:46:54 +02:00

205 lines
No EOL
5.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using rjw;
using Verse;
namespace RJW_PlasticSurgeries
{
public abstract class Recipe_Surgery_Mammoplasty : Recipe_Plastic_Surgery
{
protected override BodyPartRecord GetPartCandidate(Pawn pawn)
{
return Genital_Helper.get_genitalsBPR(pawn);
}
protected override bool HasPart(Pawn pawn, List<Hediff> hediffs)
{
return Genital_Helper.has_breasts(pawn, hediffs) &&
pawn.GetBreastList().Any(hed => hed.Severity >= 0.02f);
}
protected override List<Hediff> GetHediffs(Pawn pawn)
{
throw new NotSupportedException();
}
protected void SurgeryCupX(Pawn pawn, int stage)
{
pawn.GetBreastList().ForEach(hed =>
{
float severity;
if (TryGetSeverityFromSize(hed, stage, out severity)) hed.Severity = severity;
});
}
private static bool TryGetSeverityFromSize(Hediff hediff, float cupSize, out float severity)
{
if (!hediff.def.HasModExtension<PartSizeExtension>())
{
severity = 0f;
return false;
}
var extension = hediff.def.GetModExtension<PartSizeExtension>();
var list = extension.cupSizes;
if (list == null)
{
severity = 0f;
return false;
}
var curve = new SimpleCurve(hediff.def.stages.Zip(list,
(stage, s) => new CurvePoint(s, stage.minSeverity)));
severity = curve.Evaluate(cupSize);
return true;
}
protected override (HediffDef, float) GetLicentiaDamage() => throw new NotSupportedException();
}
public class Recipe_Surgery_Mammoplasty_A : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 1);
}
}
public class Recipe_Surgery_Mammoplasty_B : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 2);
}
}
public class Recipe_Surgery_Mammoplasty_C : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 3);
}
}
public class Recipe_Surgery_Mammoplasty_D : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 4);
}
}
public class Recipe_Surgery_Mammoplasty_E : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 6);
}
}
public class Recipe_Surgery_Mammoplasty_F : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 7);
}
}
public class Recipe_Surgery_Mammoplasty_G : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 9);
}
}
public class Recipe_Surgery_Mammoplasty_H : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 11);
}
}
public class Recipe_Surgery_Mammoplasty_J : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 13);
}
}
public class Recipe_Surgery_Mammoplasty_K : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 15);
}
}
public class Recipe_Surgery_Mammoplasty_L : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 17);
}
}
public class Recipe_Surgery_Mammoplasty_M : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 19);
}
}
public class Recipe_Surgery_Mammoplasty_N : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 21);
}
}
public class Recipe_Surgery_Mammoplasty_O : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 23);
}
}
public class Recipe_Surgery_Mammoplasty_P : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 25);
}
}
public class Recipe_Surgery_Mammoplasty_Q : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 27);
}
}
public class Recipe_Surgery_Mammoplasty_R : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 29);
}
}
public class Recipe_Surgery_Mammoplasty_Unknown : Recipe_Surgery_Mammoplasty
{
protected override void SurgeryResult(Pawn pawn)
{
SurgeryCupX(pawn, 31);
}
}
}