forked from mirror/openmw-tes3mp
Make spells cast by scripts always succeed (Fixes #1993)
This commit is contained in:
parent
aefe8cd4ae
commit
8cb09e89ed
3 changed files with 5 additions and 1 deletions
|
@ -292,6 +292,7 @@ namespace MWMechanics
|
||||||
, mTarget(target)
|
, mTarget(target)
|
||||||
, mStack(false)
|
, mStack(false)
|
||||||
, mHitPosition(0,0,0)
|
, mHitPosition(0,0,0)
|
||||||
|
, mAlwaysSucceed(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,7 +762,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
int school = 0;
|
int school = 0;
|
||||||
|
|
||||||
if (mCaster.getClass().isActor())
|
if (mCaster.getClass().isActor() && !mAlwaysSucceed)
|
||||||
{
|
{
|
||||||
school = getSpellSchool(spell, mCaster);
|
school = getSpellSchool(spell, mCaster);
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace MWMechanics
|
||||||
std::string mId; // ID of spell, potion, item etc
|
std::string mId; // ID of spell, potion, item etc
|
||||||
std::string mSourceName; // Display name for spell, potion, etc
|
std::string mSourceName; // Display name for spell, potion, etc
|
||||||
Ogre::Vector3 mHitPosition; // Used for spawning area orb
|
Ogre::Vector3 mHitPosition; // Used for spawning area orb
|
||||||
|
bool mAlwaysSucceed; // Always succeed spells casted by NPCs/creatures regardless of their chance (default: false)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CastSpell(const MWWorld::Ptr& caster, const MWWorld::Ptr& target);
|
CastSpell(const MWWorld::Ptr& caster, const MWWorld::Ptr& target);
|
||||||
|
|
|
@ -854,6 +854,7 @@ namespace MWScript
|
||||||
|
|
||||||
MWMechanics::CastSpell cast(ptr, target);
|
MWMechanics::CastSpell cast(ptr, target);
|
||||||
cast.mHitPosition = Ogre::Vector3(target.getRefData().getPosition().pos);
|
cast.mHitPosition = Ogre::Vector3(target.getRefData().getPosition().pos);
|
||||||
|
cast.mAlwaysSucceed = true;
|
||||||
cast.cast(spell);
|
cast.cast(spell);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -871,6 +872,7 @@ namespace MWScript
|
||||||
|
|
||||||
MWMechanics::CastSpell cast(ptr, ptr);
|
MWMechanics::CastSpell cast(ptr, ptr);
|
||||||
cast.mHitPosition = Ogre::Vector3(ptr.getRefData().getPosition().pos);
|
cast.mHitPosition = Ogre::Vector3(ptr.getRefData().getPosition().pos);
|
||||||
|
cast.mAlwaysSucceed = true;
|
||||||
cast.cast(spell);
|
cast.cast(spell);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue