mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
Merge branch 'feature/beautify_surgery' into develop
This commit is contained in:
commit
2a8ed18132
5 changed files with 107 additions and 0 deletions
Binary file not shown.
Binary file not shown.
43
Defs/Recipe_Surgery/Recipes_Surgery_Beautify.xml
Normal file
43
Defs/Recipe_Surgery/Recipes_Surgery_Beautify.xml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<Defs>
|
||||||
|
<RecipeDef Name="Surgery_Beautify_X" Abstract="True">
|
||||||
|
<defName>Surgery_Beautify</defName>
|
||||||
|
<label>beautify</label>
|
||||||
|
<description>Surgically beautifies the pawn.</description>
|
||||||
|
<jobString>beautifying</jobString>
|
||||||
|
<effectWorking>Surgery</effectWorking>
|
||||||
|
<soundWorking>Recipe_Surgery</soundWorking>
|
||||||
|
<workSpeedStat>MedicalOperationSpeed</workSpeedStat>
|
||||||
|
<workSkill>Medicine</workSkill>
|
||||||
|
<workSkillLearnFactor>0.2</workSkillLearnFactor>
|
||||||
|
<workAmount>400</workAmount>
|
||||||
|
<anesthetize>true</anesthetize>
|
||||||
|
<recipeUsers>
|
||||||
|
<li>Human</li>
|
||||||
|
</recipeUsers>
|
||||||
|
<surgerySuccessChanceFactor>95</surgerySuccessChanceFactor>
|
||||||
|
<ingredients>
|
||||||
|
<li>
|
||||||
|
<filter>
|
||||||
|
<categories>
|
||||||
|
<li>Medicine</li>
|
||||||
|
</categories>
|
||||||
|
</filter>
|
||||||
|
<count>1</count>
|
||||||
|
</li>
|
||||||
|
</ingredients>
|
||||||
|
<fixedIngredientFilter>
|
||||||
|
<categories>
|
||||||
|
<li>Medicine</li>
|
||||||
|
</categories>
|
||||||
|
</fixedIngredientFilter>
|
||||||
|
</RecipeDef>
|
||||||
|
<RecipeDef ParentName="Surgery_Beautify_X">
|
||||||
|
<defName>Surgery_Beautify_Beautiful</defName>
|
||||||
|
<label>beautify (beautiful)</label>
|
||||||
|
<description>Surgically beautifies the pawn.</description>
|
||||||
|
<workerClass>RJW_PlasticSurgeries.Recipe_Surgery_Beautify_Beautiful</workerClass>
|
||||||
|
<jobString>beautify the pawn.</jobString>
|
||||||
|
</RecipeDef>
|
||||||
|
</Defs>
|
|
@ -73,6 +73,7 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Recipe_Surgery_Mammoplasty.cs" />
|
<Compile Include="Recipe_Surgery_Mammoplasty.cs" />
|
||||||
<Compile Include="Recipe_Surgery_Sphinctoplasty.cs" />
|
<Compile Include="Recipe_Surgery_Sphinctoplasty.cs" />
|
||||||
|
<Compile Include="Recipe_Surgery_Beautify.cs" />
|
||||||
<Compile Include="Recipe_Surgery_Vaginoplasty.cs" />
|
<Compile Include="Recipe_Surgery_Vaginoplasty.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -82,6 +83,9 @@
|
||||||
<Content Include="..\..\About\Manifest.xml">
|
<Content Include="..\..\About\Manifest.xml">
|
||||||
<Link>About\Manifest.xml</Link>
|
<Link>About\Manifest.xml</Link>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="..\..\Defs\Recipe_Surgery\Recipes_Surgery_Beautify.xml">
|
||||||
|
<Link>Defs\Recipe_Surgery\Recipes_Surgery_Beautify.xml</Link>
|
||||||
|
</Content>
|
||||||
<Content Include="..\..\Defs\Recipe_Surgery\Recipes_Surgery_Mammoplasty.xml">
|
<Content Include="..\..\Defs\Recipe_Surgery\Recipes_Surgery_Mammoplasty.xml">
|
||||||
<Link>Defs\Recipe_Surgery\Recipes_Surgery_Mammoplasty.xml</Link>
|
<Link>Defs\Recipe_Surgery\Recipes_Surgery_Mammoplasty.xml</Link>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
60
Source/RJW_PlasticSurgeries/Recipe_Surgery_Beautify.cs
Normal file
60
Source/RJW_PlasticSurgeries/Recipe_Surgery_Beautify.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using RimWorld;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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 />
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pawn"></param>
|
||||||
|
public abstract void SurgeryResult(Pawn pawn);
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public class Recipe_Surgery_Beautify_Beautiful : Recipe_Surgery_Beautify
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void SurgeryResult(Pawn pawn) => SurgeryX(pawn, 2);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue