|
|
|
@ -716,13 +716,12 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
void Actors::updateCrimePersuit(const MWWorld::Ptr& ptr, float duration)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
|
if (ptr != playerPtr)
|
|
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
|
if (ptr != player && ptr.getClass().isNpc())
|
|
|
|
|
{
|
|
|
|
|
// get stats of witness
|
|
|
|
|
CreatureStats& creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
|
|
|
|
|
NpcStats& npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
|
|
|
|
MWWorld::Player player = MWBase::Environment::get().getWorld()->getPlayer();
|
|
|
|
|
|
|
|
|
|
// If I'm a guard and I'm not hostile
|
|
|
|
|
if (ptr.getClass().isClass(ptr, "Guard") && !creatureStats.isHostile())
|
|
|
|
@ -733,13 +732,13 @@ namespace MWMechanics
|
|
|
|
|
float(esmStore.get<ESM::GameSetting>().find("iCrimeThresholdMultiplier")->getInt()) *
|
|
|
|
|
esmStore.get<ESM::GameSetting>().find("fCrimeGoldDiscountMult")->getFloat();
|
|
|
|
|
// Attack on sight if bounty is greater than the cutoff
|
|
|
|
|
if ( playerPtr.getClass().getNpcStats(playerPtr).getBounty() >= cutoff
|
|
|
|
|
&& MWBase::Environment::get().getWorld()->getLOS(ptr, playerPtr)
|
|
|
|
|
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(playerPtr, ptr))
|
|
|
|
|
if ( player.getClass().getNpcStats(player).getBounty() >= cutoff
|
|
|
|
|
&& MWBase::Environment::get().getWorld()->getLOS(ptr, player)
|
|
|
|
|
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, ptr))
|
|
|
|
|
{
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(playerPtr));
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(player));
|
|
|
|
|
creatureStats.setHostile(true);
|
|
|
|
|
npcStats.setCrimeId(player.getNewCrimeId());
|
|
|
|
|
npcStats.setCrimeId( MWBase::Environment::get().getWorld()->getPlayer().getCrimeId() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -747,7 +746,7 @@ namespace MWMechanics
|
|
|
|
|
if (npcStats.getCrimeId() != -1)
|
|
|
|
|
{
|
|
|
|
|
// if you've payed for your crimes and I havent noticed
|
|
|
|
|
if(npcStats.getCrimeId() < player.getCrimeId() )
|
|
|
|
|
if( npcStats.getCrimeId() <= MWBase::Environment::get().getWorld()->getPlayer().getCrimeId() )
|
|
|
|
|
{
|
|
|
|
|
// Calm witness down
|
|
|
|
|
if (ptr.getClass().isClass(ptr, "Guard"))
|
|
|
|
@ -765,9 +764,9 @@ namespace MWMechanics
|
|
|
|
|
else if (!creatureStats.isHostile())
|
|
|
|
|
{
|
|
|
|
|
if (ptr.getClass().isClass(ptr, "Guard"))
|
|
|
|
|
creatureStats.getAiSequence().stack(AiPersue(playerPtr.getClass().getId(playerPtr)));
|
|
|
|
|
creatureStats.getAiSequence().stack(AiPersue(player.getClass().getId(player)));
|
|
|
|
|
else
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(playerPtr));
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(player));
|
|
|
|
|
creatureStats.setHostile(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -775,7 +774,7 @@ namespace MWMechanics
|
|
|
|
|
// if I didn't report a crime was I attacked?
|
|
|
|
|
else if (creatureStats.getAttacked() && !creatureStats.isHostile())
|
|
|
|
|
{
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(playerPtr));
|
|
|
|
|
creatureStats.getAiSequence().stack(AiCombat(player));
|
|
|
|
|
creatureStats.setHostile(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|