1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 11:53:53 +00:00

Preserve the original caster if classic reflected absorb spells behaviour is on

This commit is contained in:
Evil Eye 2021-12-21 10:50:28 +01:00
parent ef60f2d191
commit 55b066d2bd

View file

@ -9,6 +9,8 @@
#include <components/esm/loadmgef.hpp> #include <components/esm/loadmgef.hpp>
#include <components/settings/settings.hpp>
#include "creaturestats.hpp" #include "creaturestats.hpp"
#include "spellcasting.hpp" #include "spellcasting.hpp"
#include "spelleffects.hpp" #include "spelleffects.hpp"
@ -236,7 +238,13 @@ namespace MWMechanics
if(result == MagicApplicationResult::REFLECTED) if(result == MagicApplicationResult::REFLECTED)
{ {
if(!reflected) if(!reflected)
reflected = {*spellIt, ptr}; {
static const bool keepOriginalCaster = Settings::Manager::getBool("classic reflected absorb spells behavior", "Game");
if(keepOriginalCaster)
reflected = {*spellIt, caster};
else
reflected = {*spellIt, ptr};
}
auto& reflectedEffect = reflected->mEffects.emplace_back(*it); auto& reflectedEffect = reflected->mEffects.emplace_back(*it);
reflectedEffect.mFlags = ESM::ActiveEffect::Flag_Ignore_Reflect | ESM::ActiveEffect::Flag_Ignore_SpellAbsorption; reflectedEffect.mFlags = ESM::ActiveEffect::Flag_Ignore_Reflect | ESM::ActiveEffect::Flag_Ignore_SpellAbsorption;
it = spellIt->mEffects.erase(it); it = spellIt->mEffects.erase(it);