Rogue poison

This commit is contained in:
Yunfan Li
2024-03-05 17:52:30 +08:00
parent 2c17ac1442
commit fdf1e2ec1c
8 changed files with 79 additions and 12 deletions

View File

@@ -2125,7 +2125,7 @@ bool PlayerbotAI::CanCastSpell(std::string const name, Unit* target, Item* itemT
return CanCastSpell(aiObjectContext->GetValue<uint32>("spell id", name)->Get(), target, true, itemTarget);
}
bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, Item* itemTarget)
bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, Item* itemTarget, Item* castItem)
{
if (!spellid) {
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
@@ -2249,9 +2249,11 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
Spell* spell = new Spell(bot, spellInfo, TRIGGERED_NONE);
spell->m_targets.SetUnitTarget(target);
spell->m_CastItem = itemTarget ? itemTarget : aiObjectContext->GetValue<Item*>("item for spell", spellid)->Get();
spell->m_targets.SetItemTarget(spell->m_CastItem);
spell->m_CastItem = castItem;
if (itemTarget == nullptr) {
itemTarget = aiObjectContext->GetValue<Item*>("item for spell", spellid)->Get();;
}
spell->m_targets.SetItemTarget(itemTarget);
SpellCastResult result = spell->CheckCast(true);
delete spell;