mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Bug Fix] Clear Ramp when Clearing hate (#3892)
* [Bug Fix] Clear Ramp when Clearing hate When clearing a client from the hatelist, also clear them from ramp * Add additional calls missed * requested changes * extra tabs
This commit is contained in:
parent
fc8ace91cb
commit
84b8bdd2b4
@ -2119,6 +2119,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoveFromHateList(other);
|
RemoveFromHateList(other);
|
||||||
|
RemoveFromRampageList(other);
|
||||||
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2783,10 +2783,12 @@ bool Bot::IsValidTarget(Client* bot_owner, Client* leash_owner, float lo_distanc
|
|||||||
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
|
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
|
||||||
if (HasPet()) {
|
if (HasPet()) {
|
||||||
GetPet()->RemoveFromHateList(tar);
|
GetPet()->RemoveFromHateList(tar);
|
||||||
|
GetPet()->RemoveFromRampageList(tar);
|
||||||
GetPet()->SetTarget(nullptr);
|
GetPet()->SetTarget(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveFromHateList(tar);
|
RemoveFromHateList(tar);
|
||||||
|
RemoveFromRampageList(tar);
|
||||||
SetTarget(nullptr);
|
SetTarget(nullptr);
|
||||||
|
|
||||||
SetAttackFlag(false);
|
SetAttackFlag(false);
|
||||||
|
|||||||
@ -1491,18 +1491,21 @@ void EntityList::RemoveFromTargets(Mob *mob, bool RemoveFromXTargets)
|
|||||||
Mob *m = it->second;
|
Mob *m = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
if (!m)
|
if (!m) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (RemoveFromXTargets && mob) {
|
if (RemoveFromXTargets && mob) {
|
||||||
if (m->IsClient() && (mob->CheckAggro(m) || mob->IsOnFeignMemory(m)))
|
if (m->IsClient() && (mob->CheckAggro(m) || mob->IsOnFeignMemory(m))) {
|
||||||
m->CastToClient()->RemoveXTarget(mob, false);
|
m->CastToClient()->RemoveXTarget(mob, false);
|
||||||
// FadingMemories calls this function passing the client.
|
// FadingMemories calls this function passing the client.
|
||||||
else if (mob->IsClient() && (m->CheckAggro(mob) || m->IsOnFeignMemory(mob)))
|
} else if (mob->IsClient() && (m->CheckAggro(mob) || m->IsOnFeignMemory(mob))) {
|
||||||
mob->CastToClient()->RemoveXTarget(m, false);
|
mob->CastToClient()->RemoveXTarget(m, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m->RemoveFromHateList(mob);
|
m->RemoveFromHateList(mob);
|
||||||
|
m->RemoveFromRampageList(mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1515,20 +1518,24 @@ void EntityList::RemoveFromTargetsFadingMemories(Mob *spell_target, bool RemoveF
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_level && mob->GetLevel() > max_level)
|
if (max_level && mob->GetLevel() > max_level) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mob->GetSpecialAbility(IMMUNE_FADING_MEMORIES))
|
if (mob->GetSpecialAbility(IMMUNE_FADING_MEMORIES)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (RemoveFromXTargets && spell_target) {
|
if (RemoveFromXTargets && spell_target) {
|
||||||
if (mob->IsClient() && (spell_target->CheckAggro(mob) || spell_target->IsOnFeignMemory(mob)))
|
if (mob->IsClient() && (spell_target->CheckAggro(mob) || spell_target->IsOnFeignMemory(mob))) {
|
||||||
mob->CastToClient()->RemoveXTarget(spell_target, false);
|
mob->CastToClient()->RemoveXTarget(spell_target, false);
|
||||||
else if (spell_target->IsClient() && (mob->CheckAggro(spell_target) || mob->IsOnFeignMemory(spell_target)))
|
} else if (spell_target->IsClient() && (mob->CheckAggro(spell_target) || mob->IsOnFeignMemory(spell_target))) {
|
||||||
spell_target->CastToClient()->RemoveXTarget(mob, false);
|
spell_target->CastToClient()->RemoveXTarget(mob, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mob->RemoveFromHateList(spell_target);
|
mob->RemoveFromHateList(spell_target);
|
||||||
|
mob->RemoveFromRampageList(spell_target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3188,8 +3195,10 @@ void EntityList::RemoveFromHateLists(Mob *mob, bool settoone)
|
|||||||
if (it->second->CheckAggro(mob)) {
|
if (it->second->CheckAggro(mob)) {
|
||||||
if (!settoone) {
|
if (!settoone) {
|
||||||
it->second->RemoveFromHateList(mob);
|
it->second->RemoveFromHateList(mob);
|
||||||
if (mob->IsClient())
|
it->second->RemoveFromRampageList(mob);
|
||||||
|
if (mob->IsClient()) {
|
||||||
mob->CastToClient()->RemoveXTarget(it->second, false); // gotta do book keeping
|
mob->CastToClient()->RemoveXTarget(it->second, false); // gotta do book keeping
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
it->second->SetHateAmountOnEnt(mob, 1);
|
it->second->SetHateAmountOnEnt(mob, 1);
|
||||||
}
|
}
|
||||||
@ -3548,8 +3557,11 @@ void EntityList::ClearAggro(Mob* targ)
|
|||||||
if (c) {
|
if (c) {
|
||||||
c->RemoveXTarget(it->second, false);
|
c->RemoveXTarget(it->second, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
it->second->RemoveFromHateList(targ);
|
it->second->RemoveFromHateList(targ);
|
||||||
|
it->second->RemoveFromRampageList(targ, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c && it->second->IsOnFeignMemory(c)) {
|
if (c && it->second->IsOnFeignMemory(c)) {
|
||||||
it->second->RemoveFromFeignMemory(c); //just in case we feigned
|
it->second->RemoveFromFeignMemory(c); //just in case we feigned
|
||||||
c->RemoveXTarget(it->second, false);
|
c->RemoveXTarget(it->second, false);
|
||||||
@ -3573,6 +3585,7 @@ void EntityList::ClearWaterAggro(Mob* targ)
|
|||||||
c->RemoveXTarget(it->second, false);
|
c->RemoveXTarget(it->second, false);
|
||||||
}
|
}
|
||||||
it->second->RemoveFromHateList(targ);
|
it->second->RemoveFromHateList(targ);
|
||||||
|
it->second->RemoveFromRampageList(targ);
|
||||||
}
|
}
|
||||||
if (c && it->second->IsOnFeignMemory(c)) {
|
if (c && it->second->IsOnFeignMemory(c)) {
|
||||||
it->second->RemoveFromFeignMemory(c); //just in case we feigned
|
it->second->RemoveFromFeignMemory(c); //just in case we feigned
|
||||||
@ -3618,6 +3631,11 @@ void EntityList::ClearFeignAggro(Mob *targ)
|
|||||||
}
|
}
|
||||||
|
|
||||||
it->second->RemoveFromHateList(targ);
|
it->second->RemoveFromHateList(targ);
|
||||||
|
|
||||||
|
if (it->second->GetSpecialAbility(SPECATK_RAMPAGE)) {
|
||||||
|
it->second->RemoveFromRampageList(targ, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (targ->IsClient()) {
|
if (targ->IsClient()) {
|
||||||
if (it->second->GetLevel() >= 35 && zone->random.Roll(60)) {
|
if (it->second->GetLevel() >= 35 && zone->random.Roll(60)) {
|
||||||
it->second->AddFeignMemory(targ);
|
it->second->AddFeignMemory(targ);
|
||||||
|
|||||||
@ -1137,6 +1137,7 @@ public:
|
|||||||
bool Rampage(ExtraAttackOptions *opts);
|
bool Rampage(ExtraAttackOptions *opts);
|
||||||
bool AddRampage(Mob*);
|
bool AddRampage(Mob*);
|
||||||
void ClearRampage();
|
void ClearRampage();
|
||||||
|
void RemoveFromRampageList(Mob* mob, bool remove_feigned = false);
|
||||||
void SetBottomRampageList();
|
void SetBottomRampageList();
|
||||||
void SetTopRampageList();
|
void SetTopRampageList();
|
||||||
void AreaRampage(ExtraAttackOptions *opts);
|
void AreaRampage(ExtraAttackOptions *opts);
|
||||||
|
|||||||
@ -778,6 +778,7 @@ void Client::AI_Process()
|
|||||||
|
|
||||||
if (GetTarget()->IsCorpse()) {
|
if (GetTarget()->IsCorpse()) {
|
||||||
RemoveFromHateList(this);
|
RemoveFromHateList(this);
|
||||||
|
RemoveFromRampageList(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1089,6 +1090,7 @@ void Mob::AI_Process() {
|
|||||||
|
|
||||||
if (target->IsCorpse()) {
|
if (target->IsCorpse()) {
|
||||||
RemoveFromHateList(this);
|
RemoveFromHateList(this);
|
||||||
|
RemoveFromRampageList(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2062,6 +2064,32 @@ void Mob::ClearRampage()
|
|||||||
RampageArray.clear();
|
RampageArray.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mob::RemoveFromRampageList(Mob* mob, bool remove_feigned)
|
||||||
|
{
|
||||||
|
if (!mob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
IsNPC() &&
|
||||||
|
GetSpecialAbility(SPECATK_RAMPAGE) &&
|
||||||
|
(
|
||||||
|
remove_feigned ||
|
||||||
|
mob->IsNPC() ||
|
||||||
|
(
|
||||||
|
mob->IsClient() &&
|
||||||
|
!mob->CastToClient()->GetFeigned()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
for (int i = 0; i < RampageArray.size(); i++) {
|
||||||
|
if (mob->GetID() == RampageArray[i]) {
|
||||||
|
RampageArray[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Mob::Rampage(ExtraAttackOptions *opts)
|
bool Mob::Rampage(ExtraAttackOptions *opts)
|
||||||
{
|
{
|
||||||
int index_hit = 0;
|
int index_hit = 0;
|
||||||
@ -2083,8 +2111,16 @@ bool Mob::Rampage(ExtraAttackOptions *opts)
|
|||||||
// range is important
|
// range is important
|
||||||
Mob *m_target = entity_list.GetMob(RampageArray[i]);
|
Mob *m_target = entity_list.GetMob(RampageArray[i]);
|
||||||
if (m_target) {
|
if (m_target) {
|
||||||
if (m_target == GetTarget())
|
if (m_target == GetTarget()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_target->IsCorpse()) {
|
||||||
|
LogAggroDetail("[{}] is on [{}]'s rampage list", m_target->GetCleanName(), GetCleanName());
|
||||||
|
RemoveFromRampageList(m_target, true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (DistanceSquaredNoZ(GetPosition(), m_target->GetPosition()) <= NPC_RAMPAGE_RANGE2) {
|
if (DistanceSquaredNoZ(GetPosition(), m_target->GetPosition()) <= NPC_RAMPAGE_RANGE2) {
|
||||||
ProcessAttackRounds(m_target, opts);
|
ProcessAttackRounds(m_target, opts);
|
||||||
index_hit++;
|
index_hit++;
|
||||||
|
|||||||
@ -204,6 +204,7 @@ bool Perl_NPC_IsOnHatelist(NPC* self, Mob* mob) // @categories Hate and Aggro
|
|||||||
void Perl_NPC_RemoveFromHateList(NPC* self, Mob* mob) // @categories Hate and Aggro
|
void Perl_NPC_RemoveFromHateList(NPC* self, Mob* mob) // @categories Hate and Aggro
|
||||||
{
|
{
|
||||||
self->RemoveFromHateList(mob);
|
self->RemoveFromHateList(mob);
|
||||||
|
self->RemoveFromRampageList(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl_NPC_SetNPCFactionID(NPC* self, int faction_id) // @categories Faction
|
void Perl_NPC_SetNPCFactionID(NPC* self, int faction_id) // @categories Faction
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user