diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index bf20e63a..44ac72c1 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -504,7 +504,7 @@ AiPlayerbot.TooCloseDistance = 5.0 AiPlayerbot.MeleeDistance = 0.01 AiPlayerbot.FollowDistance = 1.5 AiPlayerbot.WhisperDistance = 6000.0 -AiPlayerbot.ContactDistance = 0.01 +AiPlayerbot.ContactDistance = 0.45 AiPlayerbot.AoeRadius = 10 AiPlayerbot.RpgDistance = 200 AiPlayerbot.AggroDistance = 22 diff --git a/src/strategy/actions/ActionContext.h b/src/strategy/actions/ActionContext.h index 4d77159c..7573225e 100644 --- a/src/strategy/actions/ActionContext.h +++ b/src/strategy/actions/ActionContext.h @@ -85,6 +85,7 @@ class ActionContext : public NamedObjectContext creators["reach spell"] = &ActionContext::ReachSpell; creators["reach melee"] = &ActionContext::ReachMelee; creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal; + creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect; creators["flee"] = &ActionContext::flee; creators["flee with pet"] = &ActionContext::flee_with_pet; creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru; @@ -259,6 +260,7 @@ class ActionContext : public NamedObjectContext static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); } static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); } static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); } + static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); } static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); } static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); } static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); } diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 3034c7a7..9c905f17 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -102,6 +102,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) context->GetValue("current target")->Set(target); context->GetValue("available loot")->Get()->Add(guid); + /* prevent pet dead immediately in group */ + if (bot->GetGroup() && !target->IsInCombat()) { + with_pet = false; + } if (Pet* pet = bot->GetPet()) { if (with_pet) { @@ -118,8 +122,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) } } - if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) - bot->SetFacingToObject(target); + if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) { + sServerFacade->SetFacingTo(bot, target); + } + // bot->SetFacingToObject(target); bool attacked = bot->Attack(target, true); botAI->ChangeEngine(BOT_STATE_COMBAT); diff --git a/src/strategy/actions/CastCustomSpellAction.cpp b/src/strategy/actions/CastCustomSpellAction.cpp index 3dbeeced..9f674c6c 100644 --- a/src/strategy/actions/CastCustomSpellAction.cpp +++ b/src/strategy/actions/CastCustomSpellAction.cpp @@ -7,6 +7,7 @@ #include "Event.h" #include "ItemUsageValue.h" #include "Playerbots.h" +#include "ServerFacade.h" uint32 FindLastSeparator(std::string const text, std::string const sep) { @@ -99,7 +100,7 @@ bool CastCustomSpellAction::Execute(Event event) if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance)) { - bot->SetFacingToObject(target); + sServerFacade->SetFacingTo(bot, target); botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); msg << "cast " << text; diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index aa51841a..c5223882 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -153,7 +153,7 @@ bool CastEnchantItemAction::isPossible() CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell, true), estAmount(estAmount) { - range = botAI->GetRange("spell"); + range = botAI->GetRange("heal"); } bool CastHealingSpellAction::isUseful() @@ -168,7 +168,7 @@ bool CastAoeHealSpellAction::isUseful() CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { - range = botAI->GetRange("spell"); + range = botAI->GetRange("heal"); } Value* CurePartyMemberAction::GetTargetValue() diff --git a/src/strategy/actions/GenericSpellActions.h b/src/strategy/actions/GenericSpellActions.h index cda5afc6..3d8e887e 100644 --- a/src/strategy/actions/GenericSpellActions.h +++ b/src/strategy/actions/GenericSpellActions.h @@ -6,6 +6,8 @@ #define _PLAYERBOT_GENERICSPELLACTIONS_H #include "Action.h" +#include "PlayerbotAI.h" +#include "PlayerbotAIConfig.h" #include "Value.h" class PlayerbotAI; @@ -150,9 +152,14 @@ class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberA class ResurrectPartyMemberAction : public CastSpellAction { public: - ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { } + ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { + } std::string const GetTargetName() override { return "party member to resurrect"; } + NextAction** getPrerequisites() override + { + return NextAction::merge( NextAction::array(0, new NextAction("reach party member to resurrect"), NULL), Action::getPrerequisites()); + } }; class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport diff --git a/src/strategy/actions/NonCombatActions.cpp b/src/strategy/actions/NonCombatActions.cpp index ab0882d2..d94a8adc 100644 --- a/src/strategy/actions/NonCombatActions.cpp +++ b/src/strategy/actions/NonCombatActions.cpp @@ -26,8 +26,8 @@ bool DrinkAction::Execute(Event event) if (bot->isMoving()) { - bot->StopMoving(); - botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); + // bot->StopMoving(); + // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); return false; } bot->SetStandState(UNIT_STAND_STATE_SIT); @@ -78,8 +78,8 @@ bool EatAction::Execute(Event event) if (bot->isMoving()) { - bot->StopMoving(); - botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); + // bot->StopMoving(); + // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); return false; } diff --git a/src/strategy/actions/ReachTargetActions.cpp b/src/strategy/actions/ReachTargetActions.cpp index 77cc17a4..919cbff8 100644 --- a/src/strategy/actions/ReachTargetActions.cpp +++ b/src/strategy/actions/ReachTargetActions.cpp @@ -45,3 +45,12 @@ std::string const ReachPartyMemberToHealAction::GetTargetName() { return "party member to heal"; } + +ReachPartyMemberToResurrectAction::ReachPartyMemberToResurrectAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach party member to resurrect", botAI->GetRange("spell")) +{ +} + +std::string const ReachPartyMemberToResurrectAction::GetTargetName() +{ + return "party member to resurrect"; +} diff --git a/src/strategy/actions/ReachTargetActions.h b/src/strategy/actions/ReachTargetActions.h index 9d42f256..372aa8ba 100644 --- a/src/strategy/actions/ReachTargetActions.h +++ b/src/strategy/actions/ReachTargetActions.h @@ -54,4 +54,13 @@ class ReachPartyMemberToHealAction : public ReachTargetAction std::string const GetTargetName() override; }; +class ReachPartyMemberToResurrectAction : public ReachTargetAction +{ + public: + ReachPartyMemberToResurrectAction(PlayerbotAI* botAI); + + std::string const GetTargetName() override; +}; + + #endif diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index 5406e93e..c00fd503 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -73,6 +73,12 @@ bool SummonAction::Execute(Event event) Player* master = GetMaster(); if (!master) return false; + + if (Pet* pet = bot->GetPet()) { + pet->SetReactState(REACT_PASSIVE); + pet->GetCharmInfo()->SetIsCommandFollow(true); + pet->GetCharmInfo()->IsReturning(); + } if (master->GetSession()->GetSecurity() >= SEC_PLAYER) return Teleport(master, bot); diff --git a/src/strategy/deathknight/FrostDKStrategy.cpp b/src/strategy/deathknight/FrostDKStrategy.cpp index 1383a468..8966fa69 100644 --- a/src/strategy/deathknight/FrostDKStrategy.cpp +++ b/src/strategy/deathknight/FrostDKStrategy.cpp @@ -100,5 +100,5 @@ void FrostDKStrategy::InitTriggers(std::vector& triggers) void FrostDKAoeStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("howling blast", ACTION_NORMAL + 4), nullptr))); + triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("howling blast", ACTION_HIGH + 4), nullptr))); } diff --git a/src/strategy/druid/DruidActions.cpp b/src/strategy/druid/DruidActions.cpp index d379cf1a..aee2a145 100644 --- a/src/strategy/druid/DruidActions.cpp +++ b/src/strategy/druid/DruidActions.cpp @@ -48,5 +48,5 @@ NextAction** CastRebirthAction::getPrerequisites() bool CastRebirthAction::isUseful() { - return AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance; + return CastSpellAction::isUseful() && AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance; } \ No newline at end of file diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index f46a3c35..a6377e0b 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -234,19 +234,19 @@ class NoDrinkTrigger : public Trigger class LightAoeTrigger : public AoeTrigger { public: - LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 10.0f) { } + LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 8.0f) { } }; class MediumAoeTrigger : public AoeTrigger { public: - MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 10.0f) { } + MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 8.0f) { } }; class HighAoeTrigger : public AoeTrigger { public: - HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 10.0f) { } + HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 8.0f) { } }; class BuffTrigger : public SpellTrigger @@ -523,7 +523,7 @@ class TankAssistTrigger : public NoAttackersTrigger class IsBehindTargetTrigger : public Trigger { public: - IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } + IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "behind target") { } bool IsActive() override; }; @@ -531,7 +531,7 @@ class IsBehindTargetTrigger : public Trigger class IsNotBehindTargetTrigger : public Trigger { public: - IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } + IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "is not behind target") { } bool IsActive() override; }; @@ -539,7 +539,7 @@ class IsNotBehindTargetTrigger : public Trigger class IsNotFacingTargetTrigger : public Trigger { public: - IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } + IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not facing target") { } bool IsActive() override; }; diff --git a/src/strategy/triggers/HealthTriggers.h b/src/strategy/triggers/HealthTriggers.h index 54c7956c..3c6549e8 100644 --- a/src/strategy/triggers/HealthTriggers.h +++ b/src/strategy/triggers/HealthTriggers.h @@ -107,7 +107,7 @@ class TargetCriticalHealthTrigger : public TargetLowHealthTrigger class PartyMemberDeadTrigger : public Trigger { public: - PartyMemberDeadTrigger(PlayerbotAI* botAI) : Trigger(botAI, "resurrect", 3) { } + PartyMemberDeadTrigger(PlayerbotAI* botAI) : Trigger(botAI, "resurrect", 1 * 1000) { } std::string const GetTargetName() override { return "party member to resurrect"; } bool IsActive() override;