Make spells cast by scripts always succeed (Fixes #1993)

deque
scrawl 10 years ago
parent aefe8cd4ae
commit 8cb09e89ed

@ -292,6 +292,7 @@ namespace MWMechanics
, mTarget(target)
, mStack(false)
, mHitPosition(0,0,0)
, mAlwaysSucceed(false)
{
}
@ -761,7 +762,7 @@ namespace MWMechanics
int school = 0;
if (mCaster.getClass().isActor())
if (mCaster.getClass().isActor() && !mAlwaysSucceed)
{
school = getSpellSchool(spell, mCaster);

@ -68,6 +68,7 @@ namespace MWMechanics
std::string mId; // ID of spell, potion, item etc
std::string mSourceName; // Display name for spell, potion, etc
Ogre::Vector3 mHitPosition; // Used for spawning area orb
bool mAlwaysSucceed; // Always succeed spells casted by NPCs/creatures regardless of their chance (default: false)
public:
CastSpell(const MWWorld::Ptr& caster, const MWWorld::Ptr& target);

@ -854,6 +854,7 @@ namespace MWScript
MWMechanics::CastSpell cast(ptr, target);
cast.mHitPosition = Ogre::Vector3(target.getRefData().getPosition().pos);
cast.mAlwaysSucceed = true;
cast.cast(spell);
}
};
@ -871,6 +872,7 @@ namespace MWScript
MWMechanics::CastSpell cast(ptr, ptr);
cast.mHitPosition = Ogre::Vector3(ptr.getRefData().getPosition().pos);
cast.mAlwaysSucceed = true;
cast.cast(spell);
}
};

Loading…
Cancel
Save