beautifying surgery

This commit is contained in:
Stardust3D 2022-01-15 03:33:32 +01:00
parent eb4b532a9c
commit 5bd23a88d4
4 changed files with 32 additions and 21 deletions

Binary file not shown.

View file

@ -34,10 +34,10 @@
</fixedIngredientFilter> </fixedIngredientFilter>
</RecipeDef> </RecipeDef>
<RecipeDef ParentName="Surgery_Beautify_X"> <RecipeDef ParentName="Surgery_Beautify_X">
<defName>Surgery_Beautify_Base</defName> <defName>Surgery_Beautify_Beautiful</defName>
<label>beautify (base)</label> <label>beautify (beautiful)</label>
<description>Surgically beautifies the pawn.</description> <description>Surgically beautifies the pawn.</description>
<workerClass>RJW_PlasticSurgeries.Recipe_Surgery_Beautify_Base</workerClass> <workerClass>RJW_PlasticSurgeries.Recipe_Surgery_Beautify_Beautiful</workerClass>
<jobString>beautify the pawn.</jobString> <jobString>beautify the pawn.</jobString>
</RecipeDef> </RecipeDef>
</Defs> </Defs>

View file

@ -1,22 +1,19 @@
using System; using System.Collections.Generic;
using RimWorld; using RimWorld;
using rjw;
using System.Collections.Generic;
using Dyspareunia;
using Verse; using Verse;
using static RimWorld.TraitDefOf;
namespace RJW_PlasticSurgeries namespace RJW_PlasticSurgeries
{ {
/// <inheritdoc />
public abstract class Recipe_Surgery_Beautify : Recipe_Surgery public abstract class Recipe_Surgery_Beautify : Recipe_Surgery
{ {
/// <inheritdoc />
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{ {
var part = Genital_Helper.get_genitalsBPR(pawn); if (!pawn.story.traits.HasTrait(Beauty) ||
if (part != null) pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2)
{ yield return pawn.RaceProps.body.corePart;
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
if (Genital_Helper.has_vagina(pawn, hediffs)) yield return part;
}
} }
/// <inheritdoc /> /// <inheritdoc />
@ -30,20 +27,34 @@ namespace RJW_PlasticSurgeries
} }
} }
/// <summary>
///
/// </summary>
/// <param name="pawn"></param>
public abstract void SurgeryResult(Pawn pawn); public abstract void SurgeryResult(Pawn pawn);
protected void SurgeryX(Pawn pawn, float severity) /// <summary>
/// Setts the severity of the Beautiful trait for the selected pawn.
/// If the trait doesn't exist in the pawns traits, it will be added.
/// </summary>
/// <param name="pawn">the pawn to modify</param>
/// <param name="severity">the new severity of the pawn's Beautiful trait</param>
protected void SurgeryX(Pawn pawn, int severity)
{ {
// pawn.story.traits.HasTrait(Beautiful) if (pawn.story.traits.HasTrait(Beauty))
// pawn.random_pick_a_trait() {
pawn.story.traits.allTraits.FindAll(t => Beauty.ConflictsWith(t))
.ForEach(t => pawn.story.traits.RemoveTrait(t));
pawn.story.traits.RemoveTrait(pawn.story.traits.allTraits.Find(t => t.def == Beauty));
}
pawn.story.traits.GainTrait(new Trait(Beauty, severity));
} }
} }
public class Recipe_Surgery_Beautify_Base : Recipe_Surgery_Beautify /// <inheritdoc />
public class Recipe_Surgery_Beautify_Beautiful : Recipe_Surgery_Beautify
{ {
public override void SurgeryResult(Pawn pawn) /// <inheritdoc />
{ public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 2);
this.SurgeryX(pawn, 0.1f);
}
} }
} }