mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
Port more AE functions to use flexible GetCloseMobList call
This commit is contained in:
parent
e531e68b6d
commit
0f9c34cf3c
104
zone/effects.cpp
104
zone/effects.cpp
@ -673,27 +673,42 @@ void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityList::AETaunt(Client* taunter, float range, int32 bonus_hate)
|
/**
|
||||||
|
* @param taunter
|
||||||
|
* @param range
|
||||||
|
* @param bonus_hate
|
||||||
|
*/
|
||||||
|
void EntityList::AETaunt(Client *taunter, float range, int32 bonus_hate)
|
||||||
{
|
{
|
||||||
if (range == 0)
|
|
||||||
range = 40; //Live AE taunt range - Hardcoded.
|
|
||||||
|
|
||||||
range = range * range;
|
/**
|
||||||
|
* Live AE taunt range - Hardcoded.
|
||||||
|
*/
|
||||||
|
if (range == 0) {
|
||||||
|
range = 40;
|
||||||
|
}
|
||||||
|
|
||||||
auto it = npc_list.begin();
|
float range_squared = range * range;
|
||||||
while (it != npc_list.end()) {
|
|
||||||
NPC *them = it->second;
|
for (auto &it : entity_list.GetCloseMobList(taunter, range)) {
|
||||||
float zdiff = taunter->GetZ() - them->GetZ();
|
Mob *them = it.second;
|
||||||
if (zdiff < 0)
|
|
||||||
zdiff *= -1;
|
if (!them->IsNPC()) {
|
||||||
if (zdiff < 10
|
continue;
|
||||||
&& taunter->IsAttackAllowed(them)
|
}
|
||||||
&& DistanceSquaredNoZ(taunter->GetPosition(), them->GetPosition()) <= range) {
|
|
||||||
|
float z_difference = taunter->GetZ() - them->GetZ();
|
||||||
|
if (z_difference < 0) {
|
||||||
|
z_difference *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (z_difference < 10
|
||||||
|
&& taunter->IsAttackAllowed(them)
|
||||||
|
&& DistanceSquaredNoZ(taunter->GetPosition(), them->GetPosition()) <= range_squared) {
|
||||||
if (taunter->CheckLosFN(them)) {
|
if (taunter->CheckLosFN(them)) {
|
||||||
taunter->Taunt(them, true,0,true,bonus_hate);
|
taunter->Taunt(them, true, 0, true, bonus_hate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,31 +1029,48 @@ void EntityList::AEBardPulse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rampage and stuff for clients. Normal and Duration rampages
|
/**
|
||||||
//NPCs handle it differently in Mob::Rampage
|
* Rampage - Normal and Duration rampages
|
||||||
void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count, bool IsFromSpell) {
|
* NPCs handle it differently in Mob::Rampage
|
||||||
//Dook- Will need tweaking, currently no pets or players or horses
|
*
|
||||||
Mob *curmob = nullptr;
|
* @param attacker
|
||||||
|
* @param distance
|
||||||
|
* @param Hand
|
||||||
|
* @param count
|
||||||
|
* @param is_from_spell
|
||||||
|
*/
|
||||||
|
void EntityList::AEAttack(
|
||||||
|
Mob *attacker,
|
||||||
|
float distance,
|
||||||
|
int Hand,
|
||||||
|
int count,
|
||||||
|
bool is_from_spell)
|
||||||
|
{
|
||||||
|
Mob *current_mob = nullptr;
|
||||||
|
float distance_squared = distance * distance;
|
||||||
|
int hit_count = 0;
|
||||||
|
|
||||||
float dist2 = dist * dist;
|
for (auto &it : entity_list.GetCloseMobList(attacker, distance)) {
|
||||||
|
current_mob = it.second;
|
||||||
|
|
||||||
int hit = 0;
|
if (current_mob->IsNPC()
|
||||||
|
&& current_mob != attacker //this is not needed unless NPCs can use this
|
||||||
|
&& (attacker->IsAttackAllowed(current_mob))
|
||||||
|
&& current_mob->GetRace() != 216 && current_mob->GetRace() != 472 /* dont attack horses */
|
||||||
|
&& (DistanceSquared(current_mob->GetPosition(), attacker->GetPosition()) <= distance_squared)
|
||||||
|
) {
|
||||||
|
|
||||||
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
if (!attacker->IsClient() || attacker->GetClass() == MONK || attacker->GetClass() == RANGER) {
|
||||||
curmob = it->second;
|
attacker->Attack(current_mob, Hand, false, false, is_from_spell);
|
||||||
if (curmob->IsNPC()
|
}
|
||||||
&& curmob != attacker //this is not needed unless NPCs can use this
|
else {
|
||||||
&&(attacker->IsAttackAllowed(curmob))
|
attacker->CastToClient()->DoAttackRounds(current_mob, Hand, is_from_spell);
|
||||||
&& curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */
|
}
|
||||||
&& (DistanceSquared(curmob->GetPosition(), attacker->GetPosition()) <= dist2)
|
|
||||||
) {
|
hit_count++;
|
||||||
if (!attacker->IsClient() || attacker->GetClass() == MONK || attacker->GetClass() == RANGER)
|
if (count != 0 && hit_count >= count) {
|
||||||
attacker->Attack(curmob, Hand, false, false, IsFromSpell);
|
|
||||||
else
|
|
||||||
attacker->CastToClient()->DoAttackRounds(curmob, Hand, IsFromSpell);
|
|
||||||
hit++;
|
|
||||||
if (count != 0 && hit >= count)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -398,10 +398,10 @@ public:
|
|||||||
|
|
||||||
void AEAttack(
|
void AEAttack(
|
||||||
Mob *attacker,
|
Mob *attacker,
|
||||||
float dist,
|
float distance,
|
||||||
int Hand = EQEmu::invslot::slotPrimary,
|
int Hand = EQEmu::invslot::slotPrimary,
|
||||||
int count = 0,
|
int count = 0,
|
||||||
bool IsFromSpell = false
|
bool is_from_spell = false
|
||||||
);
|
);
|
||||||
void AETaunt(Client *caster, float range = 0, int32 bonus_hate = 0);
|
void AETaunt(Client *caster, float range = 0, int32 bonus_hate = 0);
|
||||||
void AESpell(
|
void AESpell(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user