From 14c6ecd88980b439a34b6d6b6bdd21ea4286af79 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 14 Dec 2024 15:39:47 +0300 Subject: [PATCH] Fix non-player ingredient casting Always use the first effect Don't show a message --- apps/openmw/mwmechanics/spellcasting.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index dd3892e2d9..59e7e29a38 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -454,11 +454,15 @@ namespace MWMechanics ESM::ActiveSpells::Flag_Temporary | ESM::ActiveSpells::Flag_Stackable); mSourceName = ingredient->mName; - auto effect = rollIngredientEffect(mCaster, ingredient, mCaster != getPlayer()); + std::optional effect = rollIngredientEffect(mCaster, ingredient, 0); if (effect) + { inflict(mCaster, *effect, ESM::RT_Self); - else + return true; + } + + if (mCaster == getPlayer()) { // "X has no effect on you" std::string message = MWBase::Environment::get() @@ -468,10 +472,9 @@ namespace MWMechanics ->mValue.getString(); message = Misc::StringUtils::format(message, ingredient->mName); MWBase::Environment::get().getWindowManager()->messageBox(message); - return false; } - return true; + return false; } void CastSpell::playSpellCastingEffects(const ESM::Enchantment* enchantment) const