1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +00:00

Function_CreatureTargetted should return '2' for werewolfs

This makes NPCs say the correct attack voice files when fighting a werewolf.
This commit is contained in:
scrawl 2014-12-18 18:33:14 +01:00
parent efa9ff3a76
commit cc9af9562b
4 changed files with 16 additions and 17 deletions

View file

@ -417,6 +417,21 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
return value;
}
case SelectWrapper::Function_CreatureTargetted:
{
MWWorld::Ptr target;
mActor.getClass().getCreatureStats(mActor).getAiSequence().getCombatTarget(target);
if (target)
{
if (target.getClass().isNpc() && target.getClass().getNpcStats(target).isWerewolf())
return 2;
if (target.getTypeName() == typeid(ESM::Creature).name())
return 1;
}
}
return 0;
default:
throw std::runtime_error ("unknown integer select function");
@ -532,10 +547,6 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
return MWBase::Environment::get().getMechanicsManager()->isAggressive(mActor,
MWBase::Environment::get().getWorld()->getPlayerPtr());
case SelectWrapper::Function_CreatureTargetted:
return mActor.getClass().getCreatureStats (mActor).getCreatureTargetted();
case SelectWrapper::Function_Werewolf:
return mActor.getClass().getNpcStats (mActor).isWerewolf();

View file

@ -205,6 +205,7 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
Function_Reputation, Function_FactionRankDiff,
Function_WerewolfKills,
Function_RankLow, Function_RankHigh,
Function_CreatureTargetted,
Function_None // end marker
};
@ -225,7 +226,6 @@ MWDialogue::SelectWrapper::Type MWDialogue::SelectWrapper::getType() const
Function_PcVampire, Function_TalkedToPc,
Function_Alarmed, Function_Detected,
Function_Attacked, Function_ShouldAttack,
Function_CreatureTargetted,
Function_Werewolf,
Function_None // end marker
};

View file

@ -329,16 +329,6 @@ namespace MWMechanics
mAttacked = attacked;
}
bool CreatureStats::getCreatureTargetted() const
{
MWWorld::Ptr targetPtr;
if (mAiSequence.getCombatTarget(targetPtr))
{
return targetPtr.getTypeName() == typeid(ESM::Creature).name();
}
return false;
}
float CreatureStats::getEvasion() const
{
float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +

View file

@ -199,8 +199,6 @@ namespace MWMechanics
bool getAttacked() const;
void setAttacked (bool attacked);
bool getCreatureTargetted() const;
float getEvasion() const;
void setKnockedDown(bool value);