Skip to content

Commit

Permalink
Accuracy bonus to parts on downed targets
Browse files Browse the repository at this point in the history
  • Loading branch information
XeoNovaDan committed Nov 27, 2018
1 parent 45369f4 commit 7e109c7
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<name>[XND] Targeting Modes</name>
<author>XeoNovaDan</author>
<url>https://ludeon.com/forums/index.php?topic=29503.0</url>
<targetVersion>1.0.2059</targetVersion>
<description>Current Version: v1.1.4 (22nd November 2018)\n\nV.A.T.S for RimWorld! Allow your colonists, obedient animals and even some raiders to prioritize targeting certain body part groups of their enemies. Shoot those heads off in style!</description>
<targetVersion>1.0.2096</targetVersion>
<description>Current Version: v1.1.5 (27th November 2018)\n\nV.A.T.S for RimWorld! Allow your colonists, obedient animals and even some raiders to prioritize targeting certain body part groups of their enemies. Shoot those heads off in style!</description>
</ModMetaData>
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Manifest>
<identifier>TargetingModes</identifier>
<version>1.1.4</version>
<version>1.1.5</version>
<manifestUri>https://rawgit.com/XeoNovaDan/TargetingModes/master/About/Manifest.xml</manifestUri>
<downloadUri>https://github.com/XeoNovaDan/TargetingModes/releases</downloadUri>
</Manifest>
Binary file modified Assemblies/TargetingModes.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Patches/Bodies/Bodies_Humanlike.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Patch>

<Operation Class="PatchOperationAddModExtension">
<xpath>*/BodyDef[defName="Human"]</xpath>
<xpath>Defs/BodyDef[defName="Human"]</xpath>
<value>
<li Class="TargetingModes.TargetModeRerollFactors">
<!-- Humans have a much lower coverageAbs % for neck + children than any other body type in the base game -->
Expand Down
2 changes: 1 addition & 1 deletion Patches/ThingDefs_Races/Races_Animal_Base.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Patch>

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[thingClass="Pawn"]/comps</xpath>
<xpath>Defs/ThingDef[thingClass="Pawn"]/comps</xpath>
<value>
<li>
<compClass>TargetingModes.CompTargetingMode</compClass>
Expand Down
Binary file modified Source/TargetingModes/.vs/TargetingModes/v15/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/TargetingModes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.4.0")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyVersion("1.1.5.0")]
[assembly: AssemblyFileVersion("1.1.5.0")]
16 changes: 12 additions & 4 deletions Source/TargetingModes/TargetingModeDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ public bool TagsListContains(List<BodyPartTagDef> partTags)

public int RerollCount(Pawn pawn)
{
var extensionValues = pawn.RaceProps.body.GetModExtension<TargetModeRerollFactors>();
return GenMath.RoundRandom(rerollCount *
((extensionValues != null && extensionValues.targetModeRerollCountFactors.ContainsKey(this)) ?
extensionValues.targetModeRerollCountFactors[this] : 1f));
float finalizedRerollCount = rerollCount;

// Whether or not a reroll modifier is applied based on the target's BodyDef
if (pawn.RaceProps.body.GetModExtension<TargetModeRerollFactors>() is TargetModeRerollFactors extensionValues &&
extensionValues.targetModeRerollCountFactors.ContainsKey(this))
finalizedRerollCount *= extensionValues.targetModeRerollCountFactors[this];

// Whether or not a reroll bonus is applied for the target being downed
if (pawn.Downed)
finalizedRerollCount *= ShootTuning.ExecutionAccuracyFactor;

return GenMath.RoundRandom(finalizedRerollCount);
}

public override void PostLoad()
Expand Down
Binary file not shown.
Binary file modified Source/TargetingModes/obj/Debug/TargetingModes.dll
Binary file not shown.

0 comments on commit 7e109c7

Please sign in to comment.