[Bots] Prevent interrupt spam when OOM (#3011)

Notes:

Bots currently do not do a mana check until the spell cast has already been started which results in an interrupt immediately after. If it is the last spell for a bot to cast, it tends to result in interrupt spam until the bot has enough mana. This will block the interrupt spam if the spell is invalid.
This commit is contained in:
nytmyr 2023-03-07 17:17:09 -06:00 committed by GitHub
parent f030461bc7
commit 412eb5deaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1161,7 +1161,13 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
if (bardsong) {
spellid = bardsong;
bard_song_mode = true;
} else {
}
else {
if (IsBot() && !message && !color && !spellid) { // this is to prevent bots from spamming interrupts messages when trying to cast while OOM
ZeroCastingVars(); // resets all the state keeping stuff
LogSpells("Spell [{}] has been interrupted - Bot [{}] doesn't have enough mana", spellid, GetCleanName());
return;
}
spellid = casting_spell_id;
}
}