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

deque
scrawl 10 years ago
parent 9323f96211
commit d51daf5875

@ -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;

Loading…
Cancel
Save