Skip to content

Commit

Permalink
Merge pull request #25 from gefallenersoldat/GefVarietyFixes
Browse files Browse the repository at this point in the history
Fixed a bug that caused damageTypesToExclude rules to be ignored
  • Loading branch information
jecrell authored Aug 8, 2022
2 parents 61f737c + 3b0d078 commit 78a658f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
Binary file modified 1.3/Assemblies/0JecsTools.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/AbilityUser.dll
Binary file not shown.
7 changes: 4 additions & 3 deletions 1.3/Languages/English/Keyed/Grapple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<JTGrapple_Failed>Grapple Failed</JTGrapple_Failed>
<JTGrapple_DownedGrapple>Downed Attack: Grapple Success</JTGrapple_DownedGrapple>
<JTGrapple_SneakGrapple>Sneak Attack: Grapple Success</JTGrapple_SneakGrapple>
<JTGrapple_PrisonerGrapple>Restrained Victim: Grapple Success</JTGrapple_PrisonerGrapple>
<JTGrapple_SleepingGrapple>Sleeping Victim: Grapple Success</JTGrapple_SleepingGrapple>

<JTGrapple_PrisonerGrapple>Restrained Victim: Grapple Success</JTGrapple_PrisonerGrapple>
<JTGrapple_SleepingGrapple>Sleeping Victim: Grapple Success</JTGrapple_SleepingGrapple>
<JTGrapple_PetGrapple>Pet Victim: Grapple Success</JTGrapple_PetGrapple>

</LanguageData>
3 changes: 2 additions & 1 deletion 1.3/Languages/French/Keyed/Grapple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<JTGrapple_DownedGrapple>Attaque abattue: succès du grappin</JTGrapple_DownedGrapple>
<JTGrapple_SneakGrapple>Attaque furtive: succès du grappin</JTGrapple_SneakGrapple>
<JTGrapple_PrisonerGrapple>Victime retenue: succès du grappin</JTGrapple_PrisonerGrapple>
<JTGrapple_SleepingGrapple>Victime endormie: succès du grappin</JTGrapple_SleepingGrapple>
<JTGrapple_SleepingGrapple>Victime endormie: succès du grappin</JTGrapple_SleepingGrapple>
<JTGrapple_PetGrapple>Victime animal de compagnie: succès du grappin</JTGrapple_PetGrapple>

</LanguageData>
9 changes: 9 additions & 0 deletions Source/AllModdingComponents/JecsTools/GrappleUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ public static bool CanGrappleNoContest(Pawn grappler, Pawn victim, bool throwTex
MoteMaker.ThrowText(grappler.DrawPos, grappler.Map, "JTGrapple_PrisonerGrapple".Translate());
return true;
}

// If grappler attempts to grapple an animal from the same faction as him, grapple always succeeds
if (victim.Faction != null && victim.Faction == grappler.Faction && victim.RaceProps.Animal)
{
if (throwText)
MoteMaker.ThrowText(grappler.DrawPos, grappler.Map, "JTGrapple_PetGrapple".Translate());
return true;
}

return false;
}

Expand Down
8 changes: 7 additions & 1 deletion Source/AllModdingComponents/JecsTools/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ private static bool PreApplyDamage_ApplyDamageSoakers(ref DamageInfo dinfo, Hedi
continue;
}

// This variable tracks whether the damage should be excluded by a damageTypesToExclude
// rule for breaking out of a nested for loop without using goto
bool damageExcluded = false;
if (!soakSettings.damageTypesToExclude.NullOrEmpty())
{
DebugMessage($"c6c:: Damage Soak Exlusions: ");
Expand All @@ -630,9 +633,12 @@ private static bool PreApplyDamage_ApplyDamageSoakers(ref DamageInfo dinfo, Hedi
if (exclusion == damageDef)
{
DebugMessage($"c6c:: Exclusion match. Damage soak aborted.");
continue;
damageExcluded = true;
break;
}
}
if (damageExcluded)
continue;
}

var dmgAmount = dinfo.Amount;
Expand Down

0 comments on commit 78a658f

Please sign in to comment.