From 9ad8274fe883b02c1980d1d715a05e4465e22139 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 5 Sep 2023 22:11:04 +0800 Subject: [PATCH] druid caster form --- src/PlayerbotAI.cpp | 7 +++++++ src/PlayerbotFactory.cpp | 3 +++ src/strategy/actions/ListSpellsAction.cpp | 14 +++++++------- src/strategy/druid/DruidShapeshiftActions.cpp | 2 +- .../druid/GenericDruidNonCombatStrategy.cpp | 4 ++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 8e738d58..82f2373a 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -2206,8 +2206,15 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, case SPELL_FAILED_MOVING: case SPELL_FAILED_TRY_AGAIN: case SPELL_CAST_OK: + case SPELL_FAILED_NOT_SHAPESHIFT: return true; default: + // if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { + // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { + // LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}", + // target->GetName(), spellid, bot->GetName(), result); + // } + // } return false; } } diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 3bf9534b..75606d47 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -1188,6 +1188,9 @@ void PlayerbotFactory::InitEquipment(bool incremental) for (uint32 requiredLevel = bot->GetLevel(); requiredLevel > std::max((int32)bot->GetLevel() - delta, 0); requiredLevel--) { for (InventoryType inventoryType : GetPossibleInventoryTypeListBySlot((EquipmentSlots)slot)) { for (uint32 itemId : sRandomItemMgr->GetCachedEquipments(requiredLevel, inventoryType)) { + if (itemId == 46978) { // shaman earth ring totem + continue; + } ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId); if (!proto) continue; diff --git a/src/strategy/actions/ListSpellsAction.cpp b/src/strategy/actions/ListSpellsAction.cpp index 0be9474c..36f61997 100644 --- a/src/strategy/actions/ListSpellsAction.cpp +++ b/src/strategy/actions/ListSpellsAction.cpp @@ -292,13 +292,13 @@ bool ListSpellsAction::Execute(Event event) { botAI->TellMasterNoFacing(i->second); - if (++count >= 50) - { - std::ostringstream msg; - msg << (spells.size() - 50) << " more..."; - botAI->TellMasterNoFacing(msg.str()); - break; - } + // if (++count >= 50) + // { + // std::ostringstream msg; + // msg << (spells.size() - 50) << " more..."; + // botAI->TellMasterNoFacing(msg.str()); + // break; + // } } return true; diff --git a/src/strategy/druid/DruidShapeshiftActions.cpp b/src/strategy/druid/DruidShapeshiftActions.cpp index 9f197e2b..c609d42a 100644 --- a/src/strategy/druid/DruidShapeshiftActions.cpp +++ b/src/strategy/druid/DruidShapeshiftActions.cpp @@ -31,7 +31,7 @@ bool CastTravelFormAction::isUseful() bool CastCasterFormAction::isUseful() { return botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form", - "flight form", "swift flight form", "moonkin form", nullptr); + "flight form", "swift flight form", "moonkin form", nullptr) && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig->mediumHealth; } bool CastCasterFormAction::Execute(Event event) diff --git a/src/strategy/druid/GenericDruidNonCombatStrategy.cpp b/src/strategy/druid/GenericDruidNonCombatStrategy.cpp index 92039976..495f6dc4 100644 --- a/src/strategy/druid/GenericDruidNonCombatStrategy.cpp +++ b/src/strategy/druid/GenericDruidNonCombatStrategy.cpp @@ -54,14 +54,14 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory static ActionNode* regrowth_on_party(PlayerbotAI* ai) { return new ActionNode ("regrowth on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), NULL), + /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), /*A*/ NULL, /*C*/ NULL); } static ActionNode* rejuvenation_on_party(PlayerbotAI* ai) { return new ActionNode ("rejuvenation on party", - /*P*/ NextAction::array(0, new NextAction("caster form"), NULL), + /*P*/ NextAction::array(0, new NextAction("caster form"), nullptr), /*A*/ NULL, /*C*/ NULL); }