summaryrefslogtreecommitdiff
path: root/apps/openmw/mwmechanics/spellcasting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/openmw/mwmechanics/spellcasting.cpp')
-rw-r--r--apps/openmw/mwmechanics/spellcasting.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp
index 5a367b5020..0011515baf 100644
--- a/apps/openmw/mwmechanics/spellcasting.cpp
+++ b/apps/openmw/mwmechanics/spellcasting.cpp
@@ -119,8 +119,7 @@ namespace MWMechanics
// throughout the iteration of this spell's
// effects, we display a "can't re-cast" message
- // Try absorbing the spell. Some handling must still happen for absorbed effects.
- bool absorbed = absorbSpell(mId, caster, target);
+ int absorbChance = getAbsorbChance(caster, target);
int currentEffectIndex = 0;
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (effects.mList.begin());
@@ -142,6 +141,13 @@ namespace MWMechanics
}
canCastAnEffect = true;
+ // Try absorbing the effect
+ if(absorbChance && Misc::Rng::roll0to99() < absorbChance)
+ {
+ absorbSpell(mId, caster, target);
+ continue;
+ }
+
if (!checkEffectTarget(effectIt->mEffectID, target, caster, castByPlayer))
continue;
@@ -155,10 +161,6 @@ namespace MWMechanics
if (target.getClass().isActor() && target != caster && !caster.isEmpty() && isHarmful)
target.getClass().onHit(target, 0.0f, true, MWWorld::Ptr(), caster, osg::Vec3f(), true);
- // Avoid proceeding further for absorbed spells.
- if (absorbed)
- continue;
-
// Reflect harmful effects
if (!reflected && reflectEffect(*effectIt, magicEffect, caster, target, reflectedEffects))
continue;