From e928754df360851a1ed6ff2fdb22ff7ea9e34b66 Mon Sep 17 00:00:00 2001 From: Aeadoin <109764533+Aeadoin@users.noreply.github.com> Date: Mon, 28 Nov 2022 16:35:51 -0500 Subject: [PATCH] [Bot] Add Buff support for Bards under AI_IdleCastChecks (#2590) * [Bot] Add Buff support for Bards under AI_IdleCastChecks * Add InCombatBuffSong to Idle Bard cast Logic * Fixes a number of Buffs that would fail to land on the Bot, causing casting loops * Accidently removed If Statement added back. * Update bot.cpp Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com> --- zone/bot.cpp | 109 +++++++++---------------------------------- zone/botspellsai.cpp | 17 +++---- 2 files changed, 32 insertions(+), 94 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 5b875e294..e9173ae30 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -7725,94 +7725,31 @@ bool Bot::CastSpell( } bool Bot::SpellOnTarget(uint16 spell_id, Mob* spelltar) { - bool Result = false; - if(!IsValidSpell(spell_id)) + if (!IsValidSpell(spell_id)) { return false; - - if(spelltar) { - if(spelltar->IsBot() && (spells[spell_id].target_type == ST_GroupTeleport)) { - switch(spell_id) { - // Paladin - case 3577: // Wave of Life - case 4065: // Blessing of Austerity - case 1455: // Wave of Healing - case 2589: // Healing Wave of Prexus - case 3427: // Wave of Marr - case 3683: // Ethereal Cleansing - case 1283: // Celestial Cleansing - case 3485: // Supernal Cleansing - case 5293: // Pious Cleansing - case 4893: // Wave of Trushar - case 5295: // Jeron's Mark - case 5296: // Wave of Piety - // Bard - case 4085: // Forpar's Aria of Affliction - case 4083: // Rizlona's Embers - case 4086: // Forpar's Psalm of Pain - case 4084: // Rizlona's Fire - case 6734: // Song of the Storm - case 3651: // Wind of Marr - case 4087: // Forpar's Verse of Venom - case 3362: // Rizlona's Call of Flame - case 4112: // Call of the Muse - case 4872: // Echo of the Trusik - case 4873: // Dark Echo - case 5377: // Cantata of Life - case 5380: // Yelhun's Mystic Call - case 5382: // Eriki's Psalm of Power - case 6666: // Storm Blade - case 5388: // Ancient Call of Power - // Cleric - case 134: // Word of Health - case 136: // Word of Healing - case 1520: // Word of Vigor - case 1521: // Word of Restoration - case 1523: // Word of Redemption - case 3471: // Word of Replenishment - case 5270: // Word of Vivification - case 2502: // Celestial Remedy - case 2175: // Celestial Health - case 1444: // Celestial Healing - case 1522: // Celestial Elixir - case 2180: // Etherial Elixir - case 3047: // Kazad's Mark - case 3475: // Supernal Elixir - case 4053: // Blessing of Temperance - case 4108: // Aura of Reverence - case 4882: // Holy Elixir - case 5259: // Pious Elixir - case 5272: // Aura of Devotion - case 5277: // Balikor's Mark - // Enchanter - case 5517: // Circle of Alendar - case 6671: // Rune of Rikkukin - case 6739: // Rune of the Scale - // Shaman - case 2521: // Talisman of the Beast - case 4055: // Pack Shrew - case 3842: // Blood of Nadox - case 5417: // Champion - // Druid - case 4058: // Feral Pack - case 2520: // Natures Recovery - break; - default: - return false; - } - } - - if(((IsDetrimentalSpell(spell_id) && spelltar->IsBot()) || (IsDetrimentalSpell(spell_id) && spelltar->IsClient())) && !IsResurrectionEffects(spell_id)) - return false; - - if(spelltar->IsPet()) { - for(int i= 0; i < EFFECT_COUNT; ++i) { - if(spells[spell_id].effect_id[i] == SE_Illusion) - return false; - } - } - Result = Mob::SpellOnTarget(spell_id, spelltar); } - return Result; + + if (spelltar) { + if ( + IsDetrimentalSpell(spell_id) && + (spelltar->IsBot() || spelltar->IsClient()) && + !IsResurrectionEffects(spell_id) + ) { + return false; + } + + if (spelltar->IsPet()) { + for (int i = 0; i < EFFECT_COUNT; ++i) { + if (spells[spell_id].effect_id[i] == SE_Illusion) { + return false; + } + } + } + + return Mob::SpellOnTarget(spell_id, spelltar); + } + + return false; } bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index b70d4e7f8..65af3aab4 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -1291,7 +1291,6 @@ bool Bot::AI_IdleCastCheck() { if (!AICastSpell(this, 100, SpellType_Buff)) { if (!AICastSpell(GetPet(), 100, SpellType_Heal)) { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Buff)) { - // } } } @@ -1313,7 +1312,6 @@ bool Bot::AI_IdleCastCheck() { if (!AICastSpell(GetPet(), 100, SpellType_Heal)) { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_PreCombatBuff)) { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Buff)) { - // } } } @@ -1331,7 +1329,6 @@ bool Bot::AI_IdleCastCheck() { if (!AICastSpell(this, 100, SpellType_Buff)) { if (!AICastSpell(GetPet(), 100, SpellType_Heal)) { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Buff)) { - // } } } @@ -1347,17 +1344,21 @@ bool Bot::AI_IdleCastCheck() { case BARD: { if (pre_combat) { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) { - if (!AICastSpell(this, 100, SpellType_PreCombatBuffSong)) { - if (!AICastSpell(this, 100, SpellType_InCombatBuffSong)) { - // + if (!AICastSpell(this, 100, SpellType_Buff)) { + if (!AICastSpell(this, 100, SpellType_PreCombatBuffSong)) { + if (!AICastSpell(this, 100, SpellType_InCombatBuffSong)) { + } } } } } else { if (!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) { - if (!AICastSpell(this, 100, SpellType_OutOfCombatBuffSong)) { - // + if (!AICastSpell(this, 100, SpellType_Buff)) { + if (!AICastSpell(this, 100, SpellType_OutOfCombatBuffSong)) { + if (!AICastSpell(this, 100, SpellType_InCombatBuffSong)) { + } + } } } }