OK FrostfangSea and some other huge exceptions for NPCs, restrict the attackable flag to bot, client and their pets

This commit is contained in:
Emagi 2023-12-11 06:32:10 -05:00
parent 3a256b21cc
commit 72a43fdbb4

View file

@ -96,11 +96,6 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: no target, mezzed, stunned or dazed");
return false;
}
if(!target->IsPlayer() && !target->GetAttackable()) {
return false;
}
if (IsPlayer())
client = ((Player*)this)->GetClient();
@ -111,6 +106,10 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
target = ((NPC*)target)->GetOwner();
}
if((IsBot() || (client || (attacker && (attacker->IsPlayer() || attacker->IsBot())))) && !target->IsPlayer() && !target->GetAttackable()) {
return false;
}
if (attacker == target) {
LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: attacker tried to attack himself or his pet.");
return false;