From a648e4cc11dbf11e5029d567044e75bd3ca4e120 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Wed, 23 Nov 2022 20:59:37 +0100 Subject: [PATCH 1/2] Add option to restore non-MCP Calm spell behaviour --- apps/launcher/advancedpage.cpp | 2 ++ apps/openmw/mwmechanics/activespells.cpp | 11 +++++++- files/settings-default.cfg | 3 +++ files/ui/advancedpage.ui | 32 ++++++++++++++++-------- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index d017d3aebe..79530855bb 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -91,6 +91,7 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(enchantedWeaponsMagicalCheckBox, "enchanted weapons are magical", "Game"); loadSettingBool(permanentBarterDispositionChangeCheckBox, "barter disposition change is permanent", "Game"); loadSettingBool(classicReflectedAbsorbSpellsCheckBox, "classic reflected absorb spells behavior", "Game"); + loadSettingBool(classicCalmSpellsCheckBox, "classic calm spells behavior", "Game"); loadSettingBool( requireAppropriateAmmunitionCheckBox, "only appropriate ammunition bypasses resistance", "Game"); loadSettingBool(uncappedDamageFatigueCheckBox, "uncapped damage fatigue", "Game"); @@ -258,6 +259,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(enchantedWeaponsMagicalCheckBox, "enchanted weapons are magical", "Game"); saveSettingBool(permanentBarterDispositionChangeCheckBox, "barter disposition change is permanent", "Game"); saveSettingBool(classicReflectedAbsorbSpellsCheckBox, "classic reflected absorb spells behavior", "Game"); + saveSettingBool(classicCalmSpellsCheckBox, "classic calm spells behavior", "Game"); saveSettingBool( requireAppropriateAmmunitionCheckBox, "only appropriate ammunition bypasses resistance", "Game"); saveSettingBool(uncappedDamageFatigueCheckBox, "uncapped damage fatigue", "Game"); diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 138747e9d4..9cef5142a8 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -184,7 +184,7 @@ namespace MWMechanics { if (mIterating) return; - const auto& creatureStats = ptr.getClass().getCreatureStats(ptr); + auto& creatureStats = ptr.getClass().getCreatureStats(ptr); assert(&creatureStats.getActiveSpells() == this); IterationGuard guard{ *this }; // Erase no longer active spells and effects @@ -369,6 +369,15 @@ namespace MWMechanics } ++spellIt; } + + static const bool keepCalm = Settings::Manager::getBool("classic calm spells behavior", "Game"); + if (keepCalm) + { + ESM::MagicEffect::Effects effect + = ptr.getClass().isNpc() ? ESM::MagicEffect::CalmHumanoid : ESM::MagicEffect::CalmCreature; + if (creatureStats.getMagicEffects().get(effect).getMagnitude() > 0.f) + creatureStats.getAiSequence().stopCombat(); + } } void ActiveSpells::addToSpells(const MWWorld::Ptr& ptr, const ActiveSpellParams& spell) diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 3fc46ca981..d82b4a8f7d 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -263,6 +263,9 @@ actors processing range = 7168 # Make reflected Absorb spells have no practical effect, like in Morrowind. classic reflected absorb spells behavior = true +# Make Calm spells stop combat on every frame +classic calm spells behavior = true + # Show duration of magic effect and lights in the spells window. show effect duration = false diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 6a50fc8a9b..47c17aca03 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -43,7 +43,7 @@ - + <html><head/><body><p>If enabled NPCs apply evasion maneuver to avoid collisions with others.</p></body></html> @@ -83,6 +83,16 @@ + + + + <html><head/><body><p>Make stealing items from NPCs that were knocked down possible during combat.</p></body></html> + + + Always allow stealing from knocked out actors + + + @@ -143,18 +153,18 @@ + + + + <html><head/><body><p>Stops combat with NPCs affected by Calm spells every frame -- like in Morrowind without the MCP.</p></body></html> + + + Classic Calm spells behavior + + + - - - - <html><head/><body><p>Make stealing items from NPCs that were knocked down possible during combat.</p></body></html> - - - Always allow stealing from knocked out actors - - - From e37befebea5cecf23f0a0abcf7a99700bce36a72 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Fri, 2 Dec 2022 16:37:55 +0100 Subject: [PATCH 2/2] Update reference --- docs/source/reference/modding/settings/game.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 3df13904ae..73ceda63a5 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -125,6 +125,20 @@ This is how Morrowind behaves. This setting can be toggled in Advanced tab of the launcher. +classic calm spells behavior +---------------------------------------- + +:Type: boolean +:Range: True/False +:Default: True + +If this setting is true, Calm spells will take their target out of combat every frame. +This means that a Calm spell of any magnitude will always take actors out of combat for the entirety of its duration. +This is how Morrowind behaves without the Morrowind Code Patch. If this setting is off, +Calm spells will only take their target out of combat once. Allowing them to re-engage if the spell was not sufficiently strong. + +This setting can be toggled in Advanced tab of the launcher. + use magic item animations -------------------------