From b83b30f0dc3b2827feea09841239455267dd37b8 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Mon, 22 Jan 2024 19:06:51 +0300 Subject: [PATCH] Editor: Reset effect arguments when the effect ID changes (#7785) --- CHANGELOG.md | 1 + .../model/world/nestedcoladapterimp.hpp | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa220717d..7f92c39052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,7 @@ Bug #7765: OpenMW-CS: Touch Record option is broken Bug #7770: Sword of the Perithia: Script execution failure Bug #7780: Non-ASCII texture paths in NIF files don't work + Bug #7785: OpenMW-CS initialising Skill and Attribute fields to 0 instead of -1 on non-FortifyStat spells Bug #7796: Absorbed enchantments don't restore magicka Feature #2566: Handle NAM9 records for manual cell references Feature #3537: Shader-based water ripples diff --git a/apps/opencs/model/world/nestedcoladapterimp.hpp b/apps/opencs/model/world/nestedcoladapterimp.hpp index 235396c650..46928973fe 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.hpp +++ b/apps/opencs/model/world/nestedcoladapterimp.hpp @@ -385,6 +385,26 @@ namespace CSMWorld case 0: { effect.mEffectID = static_cast(value.toInt()); + switch (effect.mEffectID) + { + case ESM::MagicEffect::DrainSkill: + case ESM::MagicEffect::DamageSkill: + case ESM::MagicEffect::RestoreSkill: + case ESM::MagicEffect::FortifySkill: + case ESM::MagicEffect::AbsorbSkill: + effect.mAttribute = -1; + break; + case ESM::MagicEffect::DrainAttribute: + case ESM::MagicEffect::DamageAttribute: + case ESM::MagicEffect::RestoreAttribute: + case ESM::MagicEffect::FortifyAttribute: + case ESM::MagicEffect::AbsorbAttribute: + effect.mSkill = -1; + break; + default: + effect.mSkill = -1; + effect.mAttribute = -1; + } break; } case 1: