mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
[10561] Avoid ask AI for direct controlled creature at attack.
Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also fix warrning double->float in recent commited code.
This commit is contained in:
parent
02b51fb976
commit
ab3de84cca
3 changed files with 11 additions and 10 deletions
|
|
@ -115,14 +115,20 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||
if (pet->getVictim())
|
||||
pet->AttackStop();
|
||||
|
||||
if(pet->GetTypeId() != TYPEID_PLAYER)
|
||||
if (pet->hasUnitState(UNIT_STAT_CONTROLLED))
|
||||
{
|
||||
pet->Attack(TargetUnit, true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pet->GetMotionMaster()->Clear();
|
||||
|
||||
if (((Creature*)pet)->AI())
|
||||
((Creature*)pet)->AI()->AttackStart(TargetUnit);
|
||||
|
||||
//10% chance to play special pet attack talk, else growl
|
||||
if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
|
||||
// 10% chance to play special pet attack talk, else growl
|
||||
if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10))
|
||||
pet->SendPetTalk((uint32)PET_TALK_ATTACK);
|
||||
else
|
||||
{
|
||||
|
|
@ -130,11 +136,6 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
}
|
||||
else // charmed player
|
||||
{
|
||||
pet->Attack(TargetUnit,true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue