1
0

Fix #20 Pet back off now immediate, attacks despite pet behavior of protection

This commit is contained in:
Emagi 2025-05-31 10:22:34 -04:00
parent 45f1684c7c
commit 8cd6008ba6
3 changed files with 19 additions and 7 deletions

View File

@ -1324,7 +1324,7 @@ float Entity::CalculateMitigation(int8 type, int8 damage_type, int16 effective_l
return mit_percentage;
}
void Entity::AddHate(Entity* attacker, sint32 hate) {
void Entity::AddHate(Entity* attacker, sint32 hate, bool ignore_pet_behavior) {
if(!attacker || GetHP() <= 0 || attacker->GetHP() <= 0)
return;
@ -1332,7 +1332,7 @@ void Entity::AddHate(Entity* attacker, sint32 hate) {
return; // can't aggro your own members
// If a players pet and protect self is off
if (IsPet() && ((NPC*)this)->GetOwner() && ((NPC*)this)->GetOwner()->IsPlayer() && ((((Player*)((NPC*)this)->GetOwner())->GetInfoStruct()->get_pet_behavior() & 2) == 0))
if (!ignore_pet_behavior && IsPet() && ((NPC*)this)->GetOwner() && ((NPC*)this)->GetOwner()->IsPlayer() && ((((Player*)((NPC*)this)->GetOwner())->GetInfoStruct()->get_pet_behavior() & 2) == 0))
return;
hate = attacker->CalculateHateAmount(this, hate);

View File

@ -8445,10 +8445,22 @@ void Commands::Command_Pet(Client* client, Seperator* sep)
}
else if (strcmp(sep->arg[0], "backoff") == 0) {
client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to back down.");
if (client->GetPlayer()->GetPet())
if (client->GetPlayer()->GetPet()) {
((NPC*)client->GetPlayer()->GetPet())->Brain()->ClearHate();
if (client->GetPlayer()->GetCharmedPet())
client->GetPlayer()->GetPet()->SetFollowTarget(nullptr);
client->GetPlayer()->GetZone()->movementMgr->StopNavigation(client->GetPlayer()->GetPet());
client->GetPlayer()->GetPet()->ClearRunningLocations();
client->GetPlayer()->GetPet()->StopMovement();
}
if (client->GetPlayer()->GetCharmedPet()) {
((NPC*)client->GetPlayer()->GetCharmedPet())->Brain()->ClearHate();
client->GetPlayer()->GetCharmedPet()->SetFollowTarget(nullptr);
client->GetPlayer()->GetZone()->movementMgr->StopNavigation(client->GetPlayer()->GetCharmedPet());
client->GetPlayer()->GetCharmedPet()->ClearRunningLocations();
client->GetPlayer()->GetCharmedPet()->StopMovement();
}
client->GetPlayer()->GetInfoStruct()->set_pet_behavior(0);
client->GetPlayer()->SetCharSheetChanged(true);
}
@ -8457,9 +8469,9 @@ void Commands::Command_Pet(Client* client, Seperator* sep)
if (client->GetPlayer()->AttackAllowed((Entity*)client->GetPlayer()->GetTarget())){
client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to attack your target.");
if (client->GetPlayer()->GetPet())
client->GetPlayer()->GetPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1);
client->GetPlayer()->GetPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1, true);
if (client->GetPlayer()->GetCharmedPet())
client->GetPlayer()->GetCharmedPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1);
client->GetPlayer()->GetCharmedPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1, true);
}
else
client->Message(CHANNEL_COLOR_YELLOW, "You can not attack that.");

View File

@ -1544,7 +1544,7 @@ public:
Skill* GetSkillByWeaponType(int8 type, int8 damage_type, bool update);
bool DamageSpawn(Entity* victim, int8 type, int8 damage_type, int32 low_damage, int32 high_damage, const char* spell_name, int8 crit_mod = 0, bool is_tick = false, bool no_damage_calcs = false, bool ignore_attacker = false, bool take_power = false, LuaSpell* spell = 0);
float CalculateMitigation(int8 type = DAMAGE_PACKET_TYPE_SIMPLE_DAMAGE, int8 damage_type = 0, int16 attacker_level = 0, bool for_pvp = false);
void AddHate(Entity* attacker, sint32 hate);
void AddHate(Entity* attacker, sint32 hate, bool ignore_pet_behavior = false);
bool CheckInterruptSpell(Entity* attacker);
bool CheckFizzleSpell(LuaSpell* spell);
void KillSpawn(Spawn* dead, int8 type = 0, int8 damage_type = 0, int16 kill_blow_type = 0);