mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
[Spells] Swarm pet aggro logic fix (#1956)
* temp commit * swarm pet logic fix * [Spells] Swarm pet aggro logic fix
This commit is contained in:
parent
4e297f3d96
commit
cc0371c16e
@ -2869,7 +2869,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
|
|||||||
}
|
}
|
||||||
} //MERC
|
} //MERC
|
||||||
|
|
||||||
// then add pet owner if there's one
|
//if I am a pet, then add pet owner if there's one
|
||||||
if (owner) { // Other is a pet, add him and it
|
if (owner) { // Other is a pet, add him and it
|
||||||
// EverHood 6/12/06
|
// EverHood 6/12/06
|
||||||
// Can't add a feigned owner to hate list
|
// Can't add a feigned owner to hate list
|
||||||
@ -2884,8 +2884,9 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
|
|||||||
!(this->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && owner->IsClient()) &&
|
!(this->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && owner->IsClient()) &&
|
||||||
!(this->GetSpecialAbility(IMMUNE_AGGRO_NPC) && owner->IsNPC())
|
!(this->GetSpecialAbility(IMMUNE_AGGRO_NPC) && owner->IsNPC())
|
||||||
) {
|
) {
|
||||||
if (owner->IsClient() && !CheckAggro(owner))
|
if (owner->IsClient() && !CheckAggro(owner)) {
|
||||||
owner->CastToClient()->AddAutoXTarget(this);
|
owner->CastToClient()->AddAutoXTarget(this);
|
||||||
|
}
|
||||||
hate_list.AddEntToHateList(owner, 0, 0, false, !iBuffTic);
|
hate_list.AddEntToHateList(owner, 0, 0, false, !iBuffTic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2912,8 +2913,9 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other->GetTempPetCount()) {
|
//I have a swarm pet, add other to it.
|
||||||
entity_list.AddTempPetsToHateList(other, this, bFrenzy);
|
if (GetTempPetCount()) {
|
||||||
|
entity_list.AddTempPetsToHateList(this, other, bFrenzy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasengaged) {
|
if (!wasengaged) {
|
||||||
@ -3697,6 +3699,10 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetTempPetCount()) {
|
||||||
|
entity_list.AddTempPetsToHateListOnOwnerDamage(this, attacker, spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
//see if any runes want to reduce this damage
|
//see if any runes want to reduce this damage
|
||||||
if (spell_id == SPELL_UNKNOWN) {
|
if (spell_id == SPELL_UNKNOWN) {
|
||||||
damage = ReduceDamage(damage);
|
damage = ReduceDamage(damage);
|
||||||
|
|||||||
@ -4208,7 +4208,7 @@ void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy)
|
|||||||
auto it = npc_list.begin();
|
auto it = npc_list.begin();
|
||||||
while (it != npc_list.end()) {
|
while (it != npc_list.end()) {
|
||||||
NPC* n = it->second;
|
NPC* n = it->second;
|
||||||
if (n->GetSwarmInfo()) {
|
if (n && n->GetSwarmInfo()) {
|
||||||
if (n->GetSwarmInfo()->owner_id == owner->GetID()) {
|
if (n->GetSwarmInfo()->owner_id == owner->GetID()) {
|
||||||
if (
|
if (
|
||||||
!n->GetSpecialAbility(IMMUNE_AGGRO) &&
|
!n->GetSpecialAbility(IMMUNE_AGGRO) &&
|
||||||
@ -4223,6 +4223,35 @@ void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityList::AddTempPetsToHateListOnOwnerDamage(Mob *owner, Mob* attacker, int32 spell_id)
|
||||||
|
{
|
||||||
|
if (!attacker || !owner)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto it = npc_list.begin();
|
||||||
|
while (it != npc_list.end()) {
|
||||||
|
NPC* n = it->second;
|
||||||
|
if (n && n->GetSwarmInfo()) {
|
||||||
|
if (n->GetSwarmInfo()->owner_id == owner->GetID()) {
|
||||||
|
if (
|
||||||
|
attacker &&
|
||||||
|
attacker != n &&
|
||||||
|
!n->IsEngaged() &&
|
||||||
|
!n->GetSpecialAbility(IMMUNE_AGGRO) &&
|
||||||
|
!(n->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && attacker->IsClient()) &&
|
||||||
|
!(n->GetSpecialAbility(IMMUNE_AGGRO_NPC) && attacker->IsNPC()) &&
|
||||||
|
!attacker->IsTrap() &&
|
||||||
|
!attacker->IsCorpse()
|
||||||
|
) {
|
||||||
|
n->AddToHateList(attacker, 1, 0, true, false, false, spell_id);
|
||||||
|
n->SetTarget(attacker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z,
|
bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z,
|
||||||
float trg_x, float trg_y, float trg_z, float perwalk)
|
float trg_x, float trg_y, float trg_z, float perwalk)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -315,6 +315,7 @@ public:
|
|||||||
void DestroyTempPets(Mob *owner);
|
void DestroyTempPets(Mob *owner);
|
||||||
int16 CountTempPets(Mob *owner);
|
int16 CountTempPets(Mob *owner);
|
||||||
void AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy = false);
|
void AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy = false);
|
||||||
|
void AddTempPetsToHateListOnOwnerDamage(Mob *owner, Mob* attacker, int32 spell_id);
|
||||||
Entity *GetEntityMob(uint16 id);
|
Entity *GetEntityMob(uint16 id);
|
||||||
Entity *GetEntityMerc(uint16 id);
|
Entity *GetEntityMerc(uint16 id);
|
||||||
Entity *GetEntityDoor(uint16 id);
|
Entity *GetEntityDoor(uint16 id);
|
||||||
|
|||||||
@ -1349,7 +1349,7 @@ void Mob::AI_Process() {
|
|||||||
}
|
}
|
||||||
// mob/npc waits until call for help complete, others can move
|
// mob/npc waits until call for help complete, others can move
|
||||||
else if (AI_movement_timer->Check() && target &&
|
else if (AI_movement_timer->Check() && target &&
|
||||||
(GetOwnerID() || IsBot() ||
|
(GetOwnerID() || IsBot() || IsTempPet() ||
|
||||||
CastToNPC()->GetCombatEvent())) {
|
CastToNPC()->GetCombatEvent())) {
|
||||||
if (!IsRooted()) {
|
if (!IsRooted()) {
|
||||||
LogAI("Pursuing [{}] while engaged", target->GetName());
|
LogAI("Pursuing [{}] while engaged", target->GetName());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user