[6885] In dungeons even fighting creatures are supposed to put nearby players in combat. 3rd party scripting libraries might have to be updated

This commit is contained in:
arrai 2008-12-07 21:26:47 +01:00
parent 2e08a63da7
commit a3a57a5390
3 changed files with 15 additions and 7 deletions

View file

@ -47,15 +47,23 @@ AggressorAI::MoveInLineOfSight(Unit *u)
if( !i_creature.canFly() && i_creature.GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return;
if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() &&
if( !i_creature.hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() &&
( i_creature.IsHostileTo( u ) /*|| u->getVictim() && i_creature.IsFriendlyTo( u->getVictim() )*/ ) &&
u->isInAccessablePlaceFor(&i_creature) )
{
float attackRadius = i_creature.GetAttackDistance(u);
if(i_creature.IsWithinDistInMap(u, attackRadius) && i_creature.IsWithinLOSInMap(u) )
{
AttackStart(u);
u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
if(!i_creature.getVictim())
{
AttackStart(u);
u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
}
else if(sMapStore.LookupEntry(i_creature.GetMapId())->IsDungeon())
{
u->SetInCombatWith(&i_creature);
i_creature.AddThreat(u, 0.0f);
}
}
}
}

View file

@ -70,7 +70,7 @@ inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c)
pl->UpdateVisibilityOf(c);
// Creature AI reaction
if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
if(!c->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
{
if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() )
c->AI()->MoveInLineOfSight(pl);
@ -79,13 +79,13 @@ inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c)
inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
{
if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
if(!c1->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
{
if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() )
c1->AI()->MoveInLineOfSight(c2);
}
if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
if(!c2->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
{
if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() )
c2->AI()->MoveInLineOfSight(c1);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6884"
#define REVISION_NR "6885"
#endif // __REVISION_NR_H__