mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-27 12:22:27 +00:00
Fix: skip suppressed slots in DispelMagic instead of removing them
Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>
This commit is contained in:
parent
8b7fbe7f9a
commit
a36002dbed
@ -452,7 +452,6 @@ public:
|
|||||||
void BuffFadeNonPersistDeath();
|
void BuffFadeNonPersistDeath();
|
||||||
void BuffFadeDetrimental();
|
void BuffFadeDetrimental();
|
||||||
void BuffFadeBySlot(int slot, bool iRecalcBonuses = true, bool suppress = false, uint32 suppresstics = 0);
|
void BuffFadeBySlot(int slot, bool iRecalcBonuses = true, bool suppress = false, uint32 suppresstics = 0);
|
||||||
void RemoveSuppressedBuffBySlot(int slot, bool iRecalcBonuses = true);
|
|
||||||
void BuffFadeDetrimentalByCaster(Mob *caster);
|
void BuffFadeDetrimentalByCaster(Mob *caster);
|
||||||
void BuffFadeBySitModifier();
|
void BuffFadeBySitModifier();
|
||||||
void BuffFadeSongs();
|
void BuffFadeSongs();
|
||||||
|
|||||||
@ -4785,67 +4785,6 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses, bool suppress, uint32 su
|
|||||||
CalcBonuses();
|
CalcBonuses();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Permanently removes a suppressed buff without restoring the original spell.
|
|
||||||
// Use this instead of BuffFadeBySlot when you want to truly dispel a buff that
|
|
||||||
// is currently suppressed (spellid == SPELL_SUPPRESSED). BuffFadeBySlot would
|
|
||||||
// unsuppress/reapply the original buff in that situation.
|
|
||||||
void Mob::RemoveSuppressedBuffBySlot(int slot, bool iRecalcBonuses)
|
|
||||||
{
|
|
||||||
if (slot < 0 || slot >= GetMaxTotalSlots())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (buffs[slot].spellid != SPELL_SUPPRESSED)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Send the client a buff-fade packet for the visible suppression placeholder.
|
|
||||||
if (IsClient()) {
|
|
||||||
auto client = CastToClient();
|
|
||||||
if (!client->IsDead()) {
|
|
||||||
client->MakeBuffFadePacket(RuleI(Spells, SuppressDebuffSpellID), slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogSpells("Removing suppressed buff (suppressedid [{}]) from slot [{}]", buffs[slot].suppressedid, slot);
|
|
||||||
|
|
||||||
// The spell's effects were already removed when the buff was suppressed,
|
|
||||||
// so we only need to clear the slot bookkeeping.
|
|
||||||
buffs[slot].spellid = SPELL_UNKNOWN;
|
|
||||||
buffs[slot].suppressedid = 0;
|
|
||||||
buffs[slot].suppressedticsremaining = -1;
|
|
||||||
|
|
||||||
if (IsPet() && GetOwner() && GetOwner()->IsClient()) {
|
|
||||||
SendPetBuffsToClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((IsClient() && !CastToClient()->GetPVP()) ||
|
|
||||||
(IsPet() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
|
|
||||||
(IsBot() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
|
|
||||||
(IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()))
|
|
||||||
{
|
|
||||||
EQApplicationPacket *outapp = MakeBuffsPacket();
|
|
||||||
entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, EQ::versions::maskSoDAndLater);
|
|
||||||
if (IsClient() && GetTarget() == this) {
|
|
||||||
CastToClient()->QueuePacket(outapp);
|
|
||||||
}
|
|
||||||
safe_delete(outapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsNPC()) {
|
|
||||||
EQApplicationPacket *outapp = MakeBuffsPacket();
|
|
||||||
entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, EQ::versions::maskSoDAndLater, true);
|
|
||||||
safe_delete(outapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsClient() && CastToClient()->ClientVersionBit() & EQ::versions::maskUFAndLater) {
|
|
||||||
EQApplicationPacket *outapp = MakeBuffsPacket(false);
|
|
||||||
CastToClient()->FastQueuePacket(&outapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
degenerating_effects = false;
|
|
||||||
if (iRecalcBonuses)
|
|
||||||
CalcBonuses();
|
|
||||||
}
|
|
||||||
|
|
||||||
int64 Mob::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
|
int64 Mob::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
|
||||||
{
|
{
|
||||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||||
@ -7597,19 +7536,21 @@ void Mob::DispelMagic(Mob* caster, uint16 spell_id, int effect_value, int chance
|
|||||||
|
|
||||||
for (int slot = 0; slot < GetMaxTotalSlots(); ++slot) {
|
for (int slot = 0; slot < GetMaxTotalSlots(); ++slot) {
|
||||||
auto s = buffs[slot].spellid;
|
auto s = buffs[slot].spellid;
|
||||||
// Suppressed slots store a sentinel in spellid, so use the underlying spell
|
|
||||||
// for any lookup into the spell data table.
|
|
||||||
auto dispel_spell_id = s == SPELL_SUPPRESSED ? buffs[slot].suppressedid : s;
|
|
||||||
|
|
||||||
if (!IsValidSpell(dispel_spell_id) || spells[dispel_spell_id].dispel_flag != 0 || IsDiscipline(dispel_spell_id)) {
|
// Suppressed buffs always return when suppression ends; they cannot be dispelled.
|
||||||
|
if (s == SPELL_SUPPRESSED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detrimental_only && !IsDetrimentalSpell(dispel_spell_id)) {
|
if (!IsValidSpell(s) || spells[s].dispel_flag != 0 || IsDiscipline(s)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beneficial_only && IsDetrimentalSpell(dispel_spell_id)) {
|
if (detrimental_only && !IsDetrimentalSpell(s)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beneficial_only && IsDetrimentalSpell(s)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7627,17 +7568,11 @@ void Mob::DispelMagic(Mob* caster, uint16 spell_id, int effect_value, int chance
|
|||||||
|
|
||||||
bool perma_remove = caster_is_client || !target_is_client;
|
bool perma_remove = caster_is_client || !target_is_client;
|
||||||
if (perma_remove || !RuleB(Spells, SuppressDispels)) {
|
if (perma_remove || !RuleB(Spells, SuppressDispels)) {
|
||||||
if (s == SPELL_SUPPRESSED) {
|
BuffFadeBySlot(slot);
|
||||||
// Truly remove a suppressed buff. BuffFadeBySlot would unsuppress/reapply
|
|
||||||
// the original spell rather than clearing the slot.
|
|
||||||
RemoveSuppressedBuffBySlot(slot);
|
|
||||||
} else {
|
|
||||||
BuffFadeBySlot(slot);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
//Additional restrictions on which buffs can be suppressed
|
//Additional restrictions on which buffs can be suppressed
|
||||||
if (spells[dispel_spell_id].short_buff_box) {
|
if (spells[s].short_buff_box) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user