mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-05 00:03:52 +00:00
[Bug Fix] NPC not breaking charm correctly (#1363)
* [Bug Fix] NPC not breaking charm correctly #947 and #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 * Remove this-> since it is implied * Update spell_effects.cpp * clear all this-> * pMob to mob * Added rule Spells:PreventFactionWarOnCharmBreak Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
parent
d9d6a64941
commit
f0bf3826bd
@ -372,6 +372,7 @@ RULE_BOOL(Spells, OldRainTargets, false, "Use old incorrectly implemented maximu
|
||||
RULE_BOOL(Spells, NPCSpellPush, false, "Enable spell push on NPCs")
|
||||
RULE_BOOL(Spells, July242002PetResists, true, "Enable Pets using PCs resist change from July 24 2002")
|
||||
RULE_INT(Spells, AOEMaxTargets, 0, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
||||
RULE_BOOL(Spells, PreventFactionWarOnCharmBreak, false, "Enable spell interupts and dot removal on charm break to prevent faction wars.")
|
||||
RULE_BOOL(Spells, AllowDoubleInvis, false, "Allows you to cast invisibility spells on a player that is already invisible")
|
||||
RULE_BOOL(Spells, AllowSpellMemorizeFromItem, false, "Allows players to memorize spells by right-clicking spell scrolls")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
@ -4011,6 +4011,35 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
if (IsAIControlled())
|
||||
{
|
||||
// clear the hate list of the mobs
|
||||
if (RuleB(Spells, PreventFactionWarOnCharmBreak)) {
|
||||
for (auto mob : hate_list.GetHateList()) {
|
||||
auto tar = mob->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 == GetID()) {
|
||||
tar->BuffFadeBySpellID(spell.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IsCasting()) {
|
||||
InterruptSpell(CastingSpellID());
|
||||
}
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if (GetBuffs()[j].spellid != SPELL_UNKNOWN) {
|
||||
auto spell = spells[this->GetBuffs()[j].spellid];
|
||||
if (spell.goodEffect == 0 && IsEffectInSpell(spell.id, SE_CurrentHP)) {
|
||||
BuffFadeBySpellID(spell.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entity_list.ReplaceWithTarget(this, tempmob);
|
||||
WipeHateList();
|
||||
if(tempmob)
|
||||
@ -4022,7 +4051,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
|
||||
Charm_Struct *ps = (Charm_Struct*)app->pBuffer;
|
||||
ps->owner_id = tempmob->GetID();
|
||||
ps->pet_id = this->GetID();
|
||||
ps->pet_id = GetID();
|
||||
ps->command = 0;
|
||||
entity_list.QueueClients(this, app);
|
||||
safe_delete(app);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user