From a698c28aa414ed5e91dbadb883cc38ff56be12bf Mon Sep 17 00:00:00 2001 From: jmd Date: Fri, 29 Nov 2024 19:40:50 -0800 Subject: [PATCH] [kernel] fix: add missing save effect limits --- lib/nw/kernel/EffectSystem.hpp | 1 + lib/nw/profiles/nwn1/functions.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nw/kernel/EffectSystem.hpp b/lib/nw/kernel/EffectSystem.hpp index 44ca3f083..aabb14fb8 100644 --- a/lib/nw/kernel/EffectSystem.hpp +++ b/lib/nw/kernel/EffectSystem.hpp @@ -22,6 +22,7 @@ struct EffectLimits { std::pair ability{-12, 12}; std::pair armor_class{-20, 20}; std::pair attack{-20, 20}; + std::pair saves{-20, 20}; std::pair skill{-50, 50}; }; diff --git a/lib/nw/profiles/nwn1/functions.cpp b/lib/nw/profiles/nwn1/functions.cpp index 70f08609c..f5102bd02 100644 --- a/lib/nw/profiles/nwn1/functions.cpp +++ b/lib/nw/profiles/nwn1/functions.cpp @@ -1455,7 +1455,8 @@ int saving_throw(const nw::ObjectBase* obj, nw::Save type, nw::SaveVersus type_v ++it; } - return result + std::clamp(inc - dec, -20, 20); + auto [smin, smax] = nw::kernel::effects().limits.saves; + return result + std::clamp(inc - dec, smin, smax); } bool resolve_saving_throw(const nw::ObjectBase* obj, nw::Save type, int dc,