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>
</RecipeDef>
<RecipeDef ParentName="Surgery_Beautify_X">
<defName>Surgery_Beautify_Base</defName>
<label>beautify (base)</label>
<defName>Surgery_Beautify_Beautiful</defName>
<label>beautify (beautiful)</label>
<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>
</RecipeDef>
</Defs>

View file

@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using RimWorld;
using rjw;
using System.Collections.Generic;
using Dyspareunia;
using Verse;
using static RimWorld.TraitDefOf;
namespace RJW_PlasticSurgeries
{
/// <inheritdoc />
public abstract class Recipe_Surgery_Beautify : Recipe_Surgery
{
/// <inheritdoc />
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_vagina(pawn, hediffs)) yield return part;
}
if (!pawn.story.traits.HasTrait(Beauty) ||
pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2)
yield return pawn.RaceProps.body.corePart;
}
/// <inheritdoc />
@ -30,20 +27,34 @@ namespace RJW_PlasticSurgeries
}
}
/// <summary>
///
/// </summary>
/// <param name="pawn"></param>
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)
// pawn.random_pick_a_trait()
if (pawn.story.traits.HasTrait(Beauty))
{
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)
{
this.SurgeryX(pawn, 0.1f);
}
/// <inheritdoc />
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 2);
}
}