Skip to content

Commit

Permalink
[Bug Fix] NPC not breaking charm correctly
Browse files Browse the repository at this point in the history
EQEmu#947 and EQEmu#905
fixes the issue with charm breaking and spells being cast after to cause a faction war. this removes dots to stop faction wars also.

dot removal part needs better testing to ensure it works as intended
  • Loading branch information
dencelle authored and RoT-PvP committed May 18, 2021
1 parent 47d544d commit 3ef1923
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions zone/spell_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,6 +4041,33 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if (IsAIControlled())
{
// clear the hate list of the mobs
for (auto pMob : this->hate_list.GetHateList()) {
auto tar = pMob->entity_on_hatelist;
if (tar->IsCasting()) {
tar->InterruptSpell(tar->CastingSpellID());
}
uint32 buff_count = tar->GetMaxTotalSlots();
for (unsigned int j = 0; j < buff_count; j++) {
if (tar->GetBuffs()[j].spellid != SPELL_UNKNOWN) {
auto spell = spells[tar->GetBuffs()[j].spellid];
if (spell.goodEffect == 0 && IsEffectInSpell(spell.id, SE_CurrentHP) && tar->GetBuffs()[j].casterid == this->GetID()) {
tar->BuffFadeBySpellID(spell.id);
}
}
}
}
if (this->IsCasting()) {
this->InterruptSpell(this->CastingSpellID());
}
uint32 buff_count = this->GetMaxTotalSlots();
for (unsigned int j = 0; j < buff_count; j++) {
if (this->GetBuffs()[j].spellid != SPELL_UNKNOWN) {
auto spell = spells[this->GetBuffs()[j].spellid];
if (spell.goodEffect == 0 && IsEffectInSpell(spell.id, SE_CurrentHP)) {
this->BuffFadeBySpellID(spell.id);
}
}
}
entity_list.ReplaceWithTarget(this, tempmob);
WipeHateList();
if(tempmob)
Expand Down

0 comments on commit 3ef1923

Please sign in to comment.