mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
62 lines
No EOL
2.1 KiB
C#
62 lines
No EOL
2.1 KiB
C#
using System.Collections.Generic;
|
|
using Dyspareunia;
|
|
using RimWorld;
|
|
using rjw;
|
|
using Verse;
|
|
using DamageDefOf = Dyspareunia.DamageDefOf;
|
|
|
|
namespace RJW_PlasticSurgeries
|
|
{
|
|
public abstract class Recipe_Plastic_Surgery : Recipe_Surgery
|
|
{
|
|
protected readonly bool HasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
|
protected readonly bool HasLicentia = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs");
|
|
|
|
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
|
{
|
|
var part = GetPartCandidate(pawn);
|
|
if (part != null)
|
|
{
|
|
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
|
if (HasPart(pawn, hediffs)) yield return part;
|
|
}
|
|
}
|
|
|
|
protected abstract BodyPartRecord GetPartCandidate(Pawn pawn);
|
|
protected abstract bool HasPart(Pawn pawn, List<Hediff> hediffs);
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
protected abstract void SurgeryResult(Pawn pawn);
|
|
|
|
private static void DamageHediff(Hediff hed)
|
|
{
|
|
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
|
|
}
|
|
|
|
protected void SurgeryX(Pawn pawn, float severity, bool damagePart = false)
|
|
{
|
|
GetHediffs(pawn).ForEach(hed =>
|
|
{
|
|
hed.Severity = severity;
|
|
if (damagePart && HasDyspareunia) DamageHediff(hed);
|
|
if (damagePart && HasLicentia)
|
|
{
|
|
var (type, damage) = GetLicentiaDamage();
|
|
LicentiaLabs.DamageHelper.ApplyDamage(pawn, hed.Part, type, damage);
|
|
}
|
|
});
|
|
}
|
|
|
|
protected abstract List<Hediff> GetHediffs(Pawn pawn);
|
|
protected abstract (HediffDef, float) GetLicentiaDamage();
|
|
}
|
|
} |