diff --git a/1.3/Assemblies/RJW_PlasticSurgeries.dll b/1.3/Assemblies/RJW_PlasticSurgeries.dll index 11c6633..9f2000d 100644 Binary files a/1.3/Assemblies/RJW_PlasticSurgeries.dll and b/1.3/Assemblies/RJW_PlasticSurgeries.dll differ diff --git a/Assemblies/RJW_PlasticSurgeries.dll b/Assemblies/RJW_PlasticSurgeries.dll index 11c6633..9f2000d 100644 Binary files a/Assemblies/RJW_PlasticSurgeries.dll and b/Assemblies/RJW_PlasticSurgeries.dll differ diff --git a/Defs/Recipe_Surgery/Recipes_Surgery_Beautify.xml b/Defs/Recipe_Surgery/Recipes_Surgery_Beautify.xml new file mode 100644 index 0000000..f48a7eb --- /dev/null +++ b/Defs/Recipe_Surgery/Recipes_Surgery_Beautify.xml @@ -0,0 +1,43 @@ + + + + + Surgery_Beautify + + Surgically beautifies the pawn. + beautifying + Surgery + Recipe_Surgery + MedicalOperationSpeed + Medicine + 0.2 + 400 + true + +
  • Human
  • +
    + 95 + +
  • + + +
  • Medicine
  • + + + 1 + +
    + + +
  • Medicine
  • +
    +
    +
    + + Surgery_Beautify_Beautiful + + Surgically beautifies the pawn. + RJW_PlasticSurgeries.Recipe_Surgery_Beautify_Beautiful + beautify the pawn. + +
    \ No newline at end of file diff --git a/Source/RJW_PlasticSurgeries/RJW_PlasticSurgeries.csproj b/Source/RJW_PlasticSurgeries/RJW_PlasticSurgeries.csproj index bee43d6..a28f25d 100644 --- a/Source/RJW_PlasticSurgeries/RJW_PlasticSurgeries.csproj +++ b/Source/RJW_PlasticSurgeries/RJW_PlasticSurgeries.csproj @@ -73,6 +73,7 @@ + @@ -82,6 +83,9 @@ About\Manifest.xml + + Defs\Recipe_Surgery\Recipes_Surgery_Beautify.xml + Defs\Recipe_Surgery\Recipes_Surgery_Mammoplasty.xml diff --git a/Source/RJW_PlasticSurgeries/Recipe_Surgery_Beautify.cs b/Source/RJW_PlasticSurgeries/Recipe_Surgery_Beautify.cs new file mode 100644 index 0000000..7a93545 --- /dev/null +++ b/Source/RJW_PlasticSurgeries/Recipe_Surgery_Beautify.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using RimWorld; +using Verse; +using static RimWorld.TraitDefOf; + +namespace RJW_PlasticSurgeries +{ + /// + public abstract class Recipe_Surgery_Beautify : Recipe_Surgery + { + /// + public override IEnumerable GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) + { + if (!pawn.story.traits.HasTrait(Beauty) || + pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2) + yield return pawn.RaceProps.body.corePart; + } + + /// + public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List ingredients, + Bill bill) + { + if (billDoer != null) + { + TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn); + SurgeryResult(pawn); + } + } + + /// + /// + /// + /// + public abstract void SurgeryResult(Pawn pawn); + + /// + /// 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. + /// + /// the pawn to modify + /// the new severity of the pawn's Beautiful trait + protected void SurgeryX(Pawn pawn, int severity) + { + 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_Beautiful : Recipe_Surgery_Beautify + { + /// + public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 2); + } +} \ No newline at end of file