From fede5c7c022f858623e2cd8a574fbf82708e01bb Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Fri, 29 Jul 2022 18:24:02 +0300 Subject: [PATCH] Fix invisibility handling in awareness checks --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 1f953898c8..9ea2121003 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1524,10 +1524,6 @@ namespace MWMechanics CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); - float invisibility = stats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude(); - if (invisibility > 0) - return false; - float sneakTerm = 0; if (isSneaking(ptr)) { @@ -1555,7 +1551,10 @@ namespace MWMechanics float distTerm = fSneakDistBase + fSneakDistMult * (pos1 - pos2).length(); float chameleon = stats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude(); - float x = sneakTerm * distTerm * stats.getFatigueTerm() + chameleon + invisibility; + float invisibility = stats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude(); + float x = sneakTerm * distTerm * stats.getFatigueTerm() + chameleon; + if (invisibility > 0.f) + x += 100.f; CreatureStats& observerStats = observer.getClass().getCreatureStats(observer); float obsAgility = observerStats.getAttribute(ESM::Attribute::Agility).getModified();