1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-14 06:40:40 +00:00

Fix AI not using F_Always spells, for example "vampire touch"

This commit is contained in:
scrawl 2014-10-12 17:17:52 +02:00
parent 9323f96211
commit d51daf5875

View File

@ -166,10 +166,18 @@ namespace MWMechanics
{
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
// Never casting racial spells (ST_Power and F_Always)
if (spell->mData.mType != ESM::Spell::ST_Spell || spell->mData.mFlags & ESM::Spell::F_Always)
if (spell->mData.mType != ESM::Spell::ST_Spell)
return 0.f;
// Don't make use of racial bonus spells, like MW. Can be made optional later
if (actor.getClass().isNpc())
{
std::string raceid = actor.get<ESM::NPC>()->mBase->mRace;
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceid);
if (race->mPowers.exists(spell->mId))
return 0.f;
}
if (spell->mData.mCost > stats.getMagicka().getCurrent())
return 0.f;