Skip to content

Commit

Permalink
Update to B18
Browse files Browse the repository at this point in the history
  • Loading branch information
NoImageAvailable committed Feb 10, 2018
1 parent d90f270 commit 0a73199
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 38 deletions.
4 changes: 2 additions & 2 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModMetaData>
<name>Panacea</name>
<author>NoImageAvailable</author>
<targetVersion>0.17.1546</targetVersion>
<description>v0.17.1.0\n\nAdds options for reconstructive surgery on missing facial features and scars.\n\nAlso includes painkiller drugs to remove pain mood debuffs of scars.</description>
<targetVersion>0.18.1722</targetVersion>
<description>v0.18.0.0\n\nAdds options for reconstructive surgery on missing facial features and scars.\n\nAlso includes painkiller drugs to remove pain mood debuffs of scars.</description>
<url>https://ludeon.com/forums/index.php?topic=33128.0</url>
</ModMetaData>
Binary file added About/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assemblies/Panacea.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Defs/Drugs/Methoxine.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Methoxine>
<Defs>

<!-- Methoxine -->

Expand Down Expand Up @@ -204,4 +204,4 @@
</stages>
</ThoughtDef>

</Methoxine>
</Defs>
4 changes: 2 additions & 2 deletions Defs/Drugs/Paradol.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Paradol>
<Defs>

<ThingDef ParentName="MakeableDrugPillBase">
<defName>Paradol</defName>
Expand Down Expand Up @@ -146,4 +146,4 @@
</stages>
</ThoughtDef>

</Paradol>
</Defs>
11 changes: 3 additions & 8 deletions Defs/Surgery/Panacea.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<graphicClass>Graphic_StackCount</graphicClass>
</graphicData>
<statBases>
<WorkToMake>1400</WorkToMake>
<MaxHitPoints>50</MaxHitPoints>
<Mass>0.02</Mass>
<Flammability>1.0</Flammability>
Expand All @@ -46,14 +47,8 @@
</recipeUsers>
<researchPrerequisite>MedicineProduction</researchPrerequisite>
<skillRequirements>
<li>
<skill>Medicine</skill>
<minLevel>6</minLevel>
</li>
<li>
<skill>Crafting</skill>
<minLevel>3</minLevel>
</li>
<Medicine>6</Medicine>
<Crafting>3</Crafting>
</skillRequirements>
</recipeMaker>
<costList>
Expand Down
25 changes: 8 additions & 17 deletions Defs/Surgery/Recipes_Surgery.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>
<Defs>

<RecipeDef Abstract="True" Name="SurgeryFlesh">
<effectWorking>Surgery</effectWorking>
Expand All @@ -16,7 +16,7 @@
<workerClass>Panacea.Recipe_RemoveOldHediff</workerClass>
<jobString>Grafting tissue.</jobString>
<workAmount>9000</workAmount>
<surgerySuccessChanceFactor>0.8</surgerySuccessChanceFactor>
<surgerySuccessChanceFactor>0.9</surgerySuccessChanceFactor>
<ingredients>
<li>
<filter>
Expand All @@ -32,7 +32,7 @@
<li>Panacea</li>
</thingDefs>
</filter>
<count>2</count>
<count>1</count>
</li>
</ingredients>
<fixedIngredientFilter>
Expand All @@ -44,10 +44,7 @@
</thingDefs>
</fixedIngredientFilter>
<skillRequirements>
<li>
<skill>Medicine</skill>
<minLevel>8</minLevel>
</li>
<Medicine>8</Medicine>
</skillRequirements>
<hideBodyPartNames>true</hideBodyPartNames>
</RecipeDef>
Expand All @@ -59,7 +56,7 @@
<workerClass>Recipe_InstallNaturalBodyPart</workerClass>
<jobString>Grafting digit.</jobString>
<workAmount>9000</workAmount>
<surgerySuccessChanceFactor>0.8</surgerySuccessChanceFactor>
<surgerySuccessChanceFactor>0.9</surgerySuccessChanceFactor>
<ingredients>
<li>
<filter>
Expand Down Expand Up @@ -96,10 +93,7 @@
</thingDefs>
</fixedIngredientFilter>
<skillRequirements>
<li>
<skill>Medicine</skill>
<minLevel>8</minLevel>
</li>
<Medicine>8</Medicine>
</skillRequirements>
<appliedOnFixedBodyParts>
<li>LeftHandPinky</li>
Expand Down Expand Up @@ -159,10 +153,7 @@
</thingDefs>
</fixedIngredientFilter>
<skillRequirements>
<li>
<skill>Medicine</skill>
<minLevel>6</minLevel>
</li>
<Medicine>6</Medicine>
</skillRequirements>
<appliedOnFixedBodyParts>
<li>Nose</li>
Expand All @@ -171,4 +162,4 @@
</appliedOnFixedBodyParts>
</RecipeDef>

</RecipeDefs>
</Defs>
Empty file.
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/Panacea/Panacea.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\RimWorld1557Win_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\RimWorld1722Win_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand All @@ -45,7 +45,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\RimWorld1557Win_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>..\..\..\..\RimWorld1722Win_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
11 changes: 6 additions & 5 deletions Source/Panacea/Recipe_RemoveOldHediff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ public class Recipe_RemoveOldHediff : Recipe_Surgery
private const float BaseSeverityReduction = 6f; // The base value for scar reduction
private const float reductionVariance = 2f; // Reduction is randomized by +- this value

public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients)
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
{
if (CheckSurgeryFail(billDoer, pawn, ingredients, part)) return;
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[] { billDoer, pawn });
if (CheckSurgeryFail(billDoer, pawn, ingredients, part, bill)) return;
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);

// Calculate how much damage we reduced
float amountReduced = Mathf.Max(0, BaseSeverityReduction + Rand.Range(-reductionVariance, reductionVariance)) * billDoer.GetStatValue(StatDefOf.MedicalTendQuality);

// Find all scars
List<Hediff> scars = pawn.health.hediffSet.hediffs.FindAll(h => h.IsOld());
var partsToApplyTo = GetPartsToApplyOn(pawn, bill.recipe).ToArray();
List<Hediff> scars = pawn.health.hediffSet.hediffs.FindAll(h => h.IsOld() && partsToApplyTo.Contains(h.Part));
foreach (Hediff scar in scars)
{
// Reduce scars until we run out of reduction
Expand All @@ -39,7 +40,7 @@ public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer,
}
}
}

public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
if (pawn.RaceProps.IsFlesh && pawn.health.hediffSet.hediffs.Any(h => h.IsOld() && h.Part.depth == BodyPartDepth.Outside && !h.Part.def.IsDelicate && !pawn.health.hediffSet.PartIsMissing(h.Part)))
Expand Down

0 comments on commit 0a73199

Please sign in to comment.