forked from teamnwah/openmw-tes3coop
Fix ShouldAttack filter
This makes NPCs exit dialogue properly when they should attack as a result of taunting actions.
This commit is contained in:
parent
c6c254d279
commit
3380e1e1c5
2 changed files with 1 additions and 3 deletions
|
@ -539,7 +539,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
||||||
|
|
||||||
case SelectWrapper::Function_ShouldAttack:
|
case SelectWrapper::Function_ShouldAttack:
|
||||||
|
|
||||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).isHostile();
|
return mActor.getClass().getCreatureStats(mActor).getAiSetting(MWMechanics::CreatureStats::AI_Fight).getModified() >= 80;
|
||||||
|
|
||||||
case SelectWrapper::Function_CreatureTargetted:
|
case SelectWrapper::Function_CreatureTargetted:
|
||||||
|
|
||||||
|
|
|
@ -666,8 +666,6 @@ namespace MWMechanics
|
||||||
int fight = npcStats.getAiSetting(MWMechanics::CreatureStats::AI_Fight).getBase();
|
int fight = npcStats.getAiSetting(MWMechanics::CreatureStats::AI_Fight).getBase();
|
||||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee,
|
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee,
|
||||||
std::max(0, std::min(100, flee + int(std::max(iPerMinChange, s)))));
|
std::max(0, std::min(100, flee + int(std::max(iPerMinChange, s)))));
|
||||||
// TODO: initiate combat and quit dialogue if fight rating is too high
|
|
||||||
// or should setAiSetting handle this?
|
|
||||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight,
|
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight,
|
||||||
std::max(0, std::min(100, fight + int(std::min(-iPerMinChange, -s)))));
|
std::max(0, std::min(100, fight + int(std::min(-iPerMinChange, -s)))));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue