1
0

CheckEncounterState behavior added

This commit is contained in:
Emagi 2024-11-27 17:17:26 -05:00
parent 0ac5658535
commit d03c86efef
3 changed files with 10 additions and 4 deletions

View File

@ -307,6 +307,7 @@ void Entity::MeleeAttack(Spawn* victim, float distance, bool primary, bool multi
SetAttackDelay(primary);
if(victim->IsNPC() && victim->EngagedInCombat() == false) {
CheckEncounterState((Entity*)victim);
((NPC*)victim)->AddHate(this, 50);
}
@ -379,6 +380,7 @@ void Entity::RangeAttack(Spawn* victim, float distance, Item* weapon, Item* ammo
}
if(victim->IsNPC() && victim->EngagedInCombat() == false) {
CheckEncounterState((Entity*)victim);
((NPC*)victim)->AddHate(this, 50);
}

View File

@ -1757,8 +1757,12 @@ bool SpellProcess::CastProcessedSpell(LuaSpell* spell, bool passive, bool in_her
continue;
// TODO: Establish actual hate per spell
if (!spell->spell->GetSpellData()->friendly_spell && target->IsNPC())
if (!spell->spell->GetSpellData()->friendly_spell && target->IsNPC()) {
if(spell->caster) {
spell->caster->CheckEncounterState((Entity*)target);
((NPC*)target)->AddHate((Entity*)spell->caster, 50);
}
}
if(spell->spell->GetSpellData()->success_message.length() > 0){
if(client){

View File

@ -941,6 +941,8 @@ bool ZoneServer::AggroVictim(NPC* npc, Spawn* victim, Client* client)
if(isEntity && !npc->AttackAllowed((Entity*)victim))
return false;
victim->CheckEncounterState((Entity*)npc, true);
if (npc->HasSpawnGroup()) {
vector<Spawn*>* groupVec = npc->GetSpawnGroup();
for (int32 i = 0; i < groupVec->size(); i++) {
@ -965,8 +967,6 @@ bool ZoneServer::AggroVictim(NPC* npc, Spawn* victim, Client* client)
else
npc->InCombat(true);
}
victim->CheckEncounterState((Entity*)npc, true);
return true;
}