|
|
|
@ -538,19 +538,19 @@ namespace MWMechanics
|
|
|
|
|
if (!creature || ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Creatures)
|
|
|
|
|
{
|
|
|
|
|
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Fight);
|
|
|
|
|
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::FrenzyHumanoid + creature).getMagnitude()
|
|
|
|
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid+creature).getMagnitude()));
|
|
|
|
|
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::FrenzyHumanoid + creature).getMagnitude()
|
|
|
|
|
- effects.get(ESM::MagicEffect::CalmHumanoid+creature).getMagnitude()));
|
|
|
|
|
creatureStats.setAiSetting(CreatureStats::AI_Fight, stat);
|
|
|
|
|
|
|
|
|
|
stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
|
|
|
|
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::DemoralizeHumanoid + creature).getMagnitude()
|
|
|
|
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::RallyHumanoid+creature).getMagnitude()));
|
|
|
|
|
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::DemoralizeHumanoid + creature).getMagnitude()
|
|
|
|
|
- effects.get(ESM::MagicEffect::RallyHumanoid+creature).getMagnitude()));
|
|
|
|
|
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
|
|
|
|
}
|
|
|
|
|
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Undead)
|
|
|
|
|
{
|
|
|
|
|
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
|
|
|
|
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::TurnUndead).getMagnitude()));
|
|
|
|
|
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::TurnUndead).getMagnitude()));
|
|
|
|
|
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -596,8 +596,8 @@ namespace MWMechanics
|
|
|
|
|
// TODO: dirty flag for magic effects to avoid some unnecessary work below?
|
|
|
|
|
|
|
|
|
|
// any value of calm > 0 will stop the actor from fighting
|
|
|
|
|
if ((creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc())
|
|
|
|
|
|| (creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc()))
|
|
|
|
|
if ((effects.get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc())
|
|
|
|
|
|| (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc()))
|
|
|
|
|
{
|
|
|
|
|
for (std::list<AiPackage*>::const_iterator it = creatureStats.getAiSequence().begin(); it != creatureStats.getAiSequence().end(); )
|
|
|
|
|
{
|
|
|
|
@ -630,7 +630,7 @@ namespace MWMechanics
|
|
|
|
|
for (std::map<int, std::string>::iterator it = boundItemsMap.begin(); it != boundItemsMap.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
bool found = creatureStats.mBoundItems.find(it->first) != creatureStats.mBoundItems.end();
|
|
|
|
|
float magnitude = creatureStats.getMagicEffects().get(it->first).getMagnitude();
|
|
|
|
|
float magnitude = effects.get(it->first).getMagnitude();
|
|
|
|
|
if (found != (magnitude > 0))
|
|
|
|
|
{
|
|
|
|
|
std::string itemGmst = it->second;
|
|
|
|
|