Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MortarAccuracy/Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<OptionSkills>Which skill(s) affect accuracy. If multiple skills are selected, they are averaged together.</OptionSkills>
<OptionSkillIntellectual>Intellectual skill affects accuracy</OptionSkillIntellectual>
<OptionSkillShooting>Shooting skill affects accuracy</OptionSkillShooting>
<OptionSkillsBest>Highest skill affects accuracy</OptionSkillsBest>
<OptionSkillsBestTooltip>Choose whether to use the highest between intellectual or shooting for mortar accuracy or an average of the two skills.</OptionSkillsBestTooltip>
<OptionBestAccuracy>Best accuracy\nPawns with maximum skill have their mortar accuracy improved to {0}% (vanilla is 0%, mod default is 75%, perfect accuracy is 100%)</OptionBestAccuracy>
<OptionWorstAccuracy>Worst accuracy\nPawns with no skill have their mortar accuracy {0} by {1}% (vanilla is 0%, mod default is -50%)</OptionWorstAccuracy>
<Improved>improved</Improved>
Expand Down
5 changes: 5 additions & 0 deletions Source/PatsMortarAccuracy/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ static float GetAdjustedForcedMissRadius(Verb_LaunchProjectile shootVerb, LocalT
totalSkill += shooterPawn.skills.GetSkill(SkillDefOf.Shooting).Level;
skillsTotaled++;
}
if (Settings.bestSkillAffectsMotarAccuracy)
{
totalSkill = Math.Max(shooterPawn.skills.GetSkill(SkillDefOf.Intellectual).Level, shooterPawn.skills.GetSkill(SkillDefOf.Shooting).Level);
skillsTotaled = 1;
}
if (skillsTotaled > 0)
{
// get average skill
Expand Down
7 changes: 7 additions & 0 deletions Source/PatsMortarAccuracy/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class Settings : ModSettings
{
public static bool intellectualAffectsMortarAccuracy = true;
public static bool shootingAffectsMortarAccuracy = false;
public static bool bestSkillAffectsMotarAccuracy = false;
public static bool weatherAffectsMortarAccuracy = true;
public static float maxSkillSpreadReduction = 0.75f;
public static float minSkillSpreadReduction = -0.4f;
Expand All @@ -17,6 +18,7 @@ public override void ExposeData()
{
Scribe_Values.Look(ref intellectualAffectsMortarAccuracy, "intellectualAffectsMortarAccuracy", true);
Scribe_Values.Look(ref shootingAffectsMortarAccuracy, "shootingAffectsMortarAccuracy", false);
Scribe_Values.Look(ref bestSkillAffectsMotarAccuracy, "bestSkillAffectsMortarAccuracy", false);
Scribe_Values.Look(ref weatherAffectsMortarAccuracy, "weatherAffectsMortarAccuracy", true);
Scribe_Values.Look(ref showExplosionRadius, "showExplosionRadius", true);
Scribe_Values.Look(ref maxSkillSpreadReduction, "maxSkillSpreadReduction", 0.75f);
Expand All @@ -42,6 +44,11 @@ public override void DoSettingsWindowContents(Rect inRect)
listingStandard.Label(Translator.Translate("OptionSkills"));
listingStandard.CheckboxLabeled(Translator.Translate("OptionSkillIntellectual"), ref Settings.intellectualAffectsMortarAccuracy);
listingStandard.CheckboxLabeled(Translator.Translate("OptionSkillShooting"), ref Settings.shootingAffectsMortarAccuracy);

if (Settings.intellectualAffectsMortarAccuracy && Settings.shootingAffectsMortarAccuracy)
listingStandard.CheckboxLabeled(Translator.Translate("OptionSkillsBest"), ref Settings.bestSkillAffectsMotarAccuracy, Translator.Translate("OptionSkillsBestTooltip"));
else
Settings.bestSkillAffectsMotarAccuracy = false;

listingStandard.Label(TranslatorFormattedStringExtensions.Translate("OptionBestAccuracy", (int)(Settings.maxSkillSpreadReduction * 100)));
Settings.maxSkillSpreadReduction = listingStandard.Slider(Settings.maxSkillSpreadReduction, 0f, 1f);
Expand Down