mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
moved most surgery logic into Recipe_Plastic_Surgery.cs
This commit is contained in:
parent
69d9346ee5
commit
94711f740a
6 changed files with 227 additions and 183 deletions
|
@ -70,6 +70,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Mod.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Recipe_Plastic_Surgery.cs" />
|
||||
<Compile Include="Recipe_Surgery_Mammoplasty.cs" />
|
||||
<Compile Include="Recipe_Surgery_Penoplasty.cs" />
|
||||
<Compile Include="Recipe_Surgery_Sphinctoplasty.cs" />
|
||||
|
|
55
Source/RJW_PlasticSurgeries/Recipe_Plastic_Surgery.cs
Normal file
55
Source/RJW_PlasticSurgeries/Recipe_Plastic_Surgery.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
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");
|
||||
|
||||
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 useDyspareunia = false)
|
||||
{
|
||||
GetHediffs(pawn).ForEach(hed =>
|
||||
{
|
||||
hed.Severity = severity;
|
||||
if (useDyspareunia && HasDyspareunia) DamageHediff(hed);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract List<Hediff> GetHediffs(Pawn pawn);
|
||||
}
|
||||
}
|
|
@ -1,57 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Surgery_Mammoplasty : Recipe_Surgery
|
||||
public abstract class Recipe_Surgery_Mammoplasty : Recipe_Plastic_Surgery
|
||||
{
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
protected override BodyPartRecord GetPartCandidate(Pawn pawn)
|
||||
{
|
||||
var part = Genital_Helper.get_genitalsBPR(pawn);
|
||||
if (part != null)
|
||||
{
|
||||
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
||||
if (Genital_Helper.has_breasts(pawn, hediffs) && pawn.GetBreastList().Any(hed => hed.Severity >= 0.02f))
|
||||
yield return part;
|
||||
}
|
||||
return Genital_Helper.get_genitalsBPR(pawn);
|
||||
}
|
||||
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||
Bill bill)
|
||||
protected override bool HasPart(Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
if (billDoer != null)
|
||||
{
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||
SurgeryResult(pawn);
|
||||
}
|
||||
return Genital_Helper.has_breasts(pawn, hediffs) &&
|
||||
pawn.GetBreastList().Any(hed => hed.Severity >= 0.02f);
|
||||
}
|
||||
|
||||
public abstract void SurgeryResult(Pawn pawn);
|
||||
/*{
|
||||
pawn.GetBreastList().ForEach(hed => hed.Severity = Math.Min(1.0f, hed.Severity * 1.25f));
|
||||
//Log.Message($"Cup sizes: {pawn.GetBreastList().SelectMany(hed => hed.def.GetModExtension<PartSizeExtension>().cupSizes.Join()).Join(delimiter: ";")}");
|
||||
float val = 0;
|
||||
PartSizeExtension.TryGetCupSize(pawn.GetBreastList().First(), out val);
|
||||
pawn.GetBreastList().First().def.stages.First();
|
||||
Log.Message($"Cup size: {val}");
|
||||
}*/
|
||||
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;
|
||||
}
|
||||
if (TryGetSeverityFromSize(hed, stage, out severity)) hed.Severity = severity;
|
||||
});
|
||||
}
|
||||
|
||||
static bool TryGetSeverityFromSize(Hediff hediff, float cupSize, out float severity)
|
||||
private static bool TryGetSeverityFromSize(Hediff hediff, float cupSize, out float severity)
|
||||
{
|
||||
if (!hediff.def.HasModExtension<PartSizeExtension>())
|
||||
{
|
||||
|
@ -77,91 +59,145 @@ namespace RJW_PlasticSurgeries
|
|||
|
||||
public class Recipe_Surgery_Mammoplasty_A : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 1);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_B : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 2);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_C : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 3);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_D : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 4);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_E : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 6);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 6);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_F : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 7);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 7);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_G : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 9);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 9);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_H : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 11);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 11);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_J : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 13);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 13);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_K : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 15);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 15);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_L : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 17);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 17);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_M : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 19);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 19);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_N : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 21);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 21);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_O : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 23);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 23);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_P : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 25);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 25);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_Q : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 27);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 27);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_R : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 29);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 29);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Mammoplasty_Unknown : Recipe_Surgery_Mammoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryCupX(pawn, 31);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryCupX(pawn, 31);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,81 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dyspareunia;
|
||||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using rjw;
|
||||
using Verse;
|
||||
using DamageDefOf = Dyspareunia.DamageDefOf;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Surgery_Penoplasty : Recipe_Surgery
|
||||
public abstract class Recipe_Surgery_Penoplasty : Recipe_Plastic_Surgery
|
||||
{
|
||||
private readonly bool hasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
protected override BodyPartRecord GetPartCandidate(Pawn pawn)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return Genital_Helper.get_genitalsBPR(pawn);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||
Bill bill)
|
||||
protected override bool HasPart(Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
if (billDoer != null)
|
||||
{
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||
SurgeryResult(pawn);
|
||||
}
|
||||
return Genital_Helper.has_penis_fertile(pawn, hediffs) ||
|
||||
Genital_Helper.has_penis_infertile(pawn, hediffs);
|
||||
}
|
||||
|
||||
public abstract void SurgeryResult(Pawn pawn);
|
||||
|
||||
protected void SurgeryX(Pawn pawn, float severity)
|
||||
protected override List<Hediff> GetHediffs(Pawn pawn)
|
||||
{
|
||||
pawn.GetGenitalsList().FindAll(Genital_Helper.is_penis).ForEach(hed =>
|
||||
{
|
||||
hed.Severity = severity;
|
||||
if (hasDyspareunia)
|
||||
{
|
||||
DamageHediff(hed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void DamageHediff(Hediff hed)
|
||||
{
|
||||
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
|
||||
return pawn.GetGenitalsList().FindAll(Genital_Helper.is_penis);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Penoplasty_Micro : Recipe_Surgery_Penoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.1f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.1f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Penoplasty_Small : Recipe_Surgery_Penoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.3f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.3f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Penoplasty_Average : Recipe_Surgery_Penoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.5f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.5f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Penoplasty_Large : Recipe_Surgery_Penoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.7f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.7f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Penoplasty_Huge : Recipe_Surgery_Penoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.9f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.9f, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,80 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dyspareunia;
|
||||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using rjw;
|
||||
using Verse;
|
||||
using DamageDefOf = Dyspareunia.DamageDefOf;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Surgery_Sphinctoplasty : Recipe_Surgery
|
||||
public abstract class Recipe_Surgery_Sphinctoplasty : Recipe_Plastic_Surgery
|
||||
{
|
||||
private readonly bool hasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
protected override BodyPartRecord GetPartCandidate(Pawn pawn)
|
||||
{
|
||||
var part = Genital_Helper.get_anusBPR(pawn);
|
||||
if (part != null)
|
||||
{
|
||||
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
||||
if (Genital_Helper.has_anus(pawn, hediffs)) yield return part;
|
||||
}
|
||||
return Genital_Helper.get_anusBPR(pawn);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||
Bill bill)
|
||||
protected override bool HasPart(Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
if (billDoer != null)
|
||||
{
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||
SurgeryResult(pawn);
|
||||
}
|
||||
return Genital_Helper.has_anus(pawn, hediffs);
|
||||
}
|
||||
|
||||
public abstract void SurgeryResult(Pawn pawn);
|
||||
|
||||
protected void SurgeryX(Pawn pawn, float severity)
|
||||
protected override List<Hediff> GetHediffs(Pawn pawn)
|
||||
{
|
||||
pawn.GetAnusList().ForEach(hed =>
|
||||
{
|
||||
hed.Severity = severity;
|
||||
if (hasDyspareunia)
|
||||
{
|
||||
DamageHediff(hed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void DamageHediff(Hediff hed)
|
||||
{
|
||||
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
|
||||
return pawn.GetAnusList();
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Sphinctoplasty_Micro : Recipe_Surgery_Sphinctoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.1f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.1f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Sphinctoplasty_Tight : Recipe_Surgery_Sphinctoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.3f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.3f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Sphinctoplasty_Average : Recipe_Surgery_Sphinctoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.5f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.5f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Sphinctoplasty_Accomodating : Recipe_Surgery_Sphinctoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.7f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.7f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Sphinctoplasty_Cavernous : Recipe_Surgery_Sphinctoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.9f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.9f, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,80 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dyspareunia;
|
||||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using rjw;
|
||||
using Verse;
|
||||
using DamageDefOf = Dyspareunia.DamageDefOf;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Surgery_Vaginoplasty : Recipe_Surgery
|
||||
public abstract class Recipe_Surgery_Vaginoplasty : Recipe_Plastic_Surgery
|
||||
{
|
||||
private readonly bool hasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
protected override BodyPartRecord GetPartCandidate(Pawn pawn)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return Genital_Helper.get_genitalsBPR(pawn);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||
Bill bill)
|
||||
protected override bool HasPart(Pawn pawn, List<Hediff> hediffs)
|
||||
{
|
||||
if (billDoer != null)
|
||||
{
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||
SurgeryResult(pawn);
|
||||
}
|
||||
return Genital_Helper.has_vagina(pawn, hediffs);
|
||||
}
|
||||
|
||||
public abstract void SurgeryResult(Pawn pawn);
|
||||
|
||||
protected void SurgeryX(Pawn pawn, float severity)
|
||||
protected override List<Hediff> GetHediffs(Pawn pawn)
|
||||
{
|
||||
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);
|
||||
return pawn.GetGenitalsList().FindAll(Genital_Helper.is_vagina);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Vaginoplasty_Micro : Recipe_Surgery_Vaginoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.1f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.1f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Vaginoplasty_Tight : Recipe_Surgery_Vaginoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.3f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.3f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Vaginoplasty_Average : Recipe_Surgery_Vaginoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.5f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.5f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Vaginoplasty_Accomodating : Recipe_Surgery_Vaginoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.7f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.7f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Recipe_Surgery_Vaginoplasty_Cavernous : Recipe_Surgery_Vaginoplasty
|
||||
{
|
||||
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 0.9f);
|
||||
protected override void SurgeryResult(Pawn pawn)
|
||||
{
|
||||
SurgeryX(pawn, 0.9f, true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue