Skip to content

Commit

Permalink
Merge branch 'rollingredienteffect' into 'master'
Browse files Browse the repository at this point in the history
Fix non-player ingredient casting

See merge request OpenMW/openmw!4480
  • Loading branch information
jvoisin committed Dec 16, 2024
2 parents 03f1702 + 14c6ecd commit 95764a9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/openmw/mwmechanics/spellcasting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ESM::EffectList> 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()
Expand All @@ -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
Expand Down

0 comments on commit 95764a9

Please sign in to comment.