Skip to content

Commit

Permalink
Handle perfect immunity in saving throws
Browse files Browse the repository at this point in the history
  • Loading branch information
Interkarma committed Aug 1, 2019
1 parent 2defb50 commit 315f069
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Scripts/Game/Formulas/FormulaHelper.cs
Expand Up @@ -1135,6 +1135,12 @@ public static int SavingThrow(DFCareer.Elements elementType, DFCareer.EffectFlag
else if (elementType == DFCareer.Elements.Magic && target == playerEntity && playerEntity.Race == Races.Breton)
savingThrow += 30;

// Handle perfect immunity of 100% or greater
// Otherwise clamping to 5-95 allows a perfectly immune character to sometimes receive incoming payload
// This doesn't seem to match immunity intent or player expectations from classic
if (savingThrow >= 100)
return 0;

savingThrow = Mathf.Clamp(savingThrow, 5, 95);

int percentDamageOrDuration = 0;
Expand Down

0 comments on commit 315f069

Please sign in to comment.