[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:
Fryguy
2024-01-07 15:27:12 -05:00
committed by GitHub
parent fc8ace91cb
commit 84b8bdd2b4
6 changed files with 68 additions and 9 deletions
+37 -1
View File
@@ -778,6 +778,7 @@ void Client::AI_Process()
if (GetTarget()->IsCorpse()) {
RemoveFromHateList(this);
RemoveFromRampageList(this);
return;
}
@@ -1089,6 +1090,7 @@ void Mob::AI_Process() {
if (target->IsCorpse()) {
RemoveFromHateList(this);
RemoveFromRampageList(this);
return;
}
@@ -2062,6 +2064,32 @@ void Mob::ClearRampage()
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)
{
int index_hit = 0;
@@ -2083,8 +2111,16 @@ bool Mob::Rampage(ExtraAttackOptions *opts)
// range is important
Mob *m_target = entity_list.GetMob(RampageArray[i]);
if (m_target) {
if (m_target == GetTarget())
if (m_target == GetTarget()) {
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) {
ProcessAttackRounds(m_target, opts);
index_hit++;