mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
facing to & reach party member to resurrect
This commit is contained in:
@@ -504,7 +504,7 @@ AiPlayerbot.TooCloseDistance = 5.0
|
|||||||
AiPlayerbot.MeleeDistance = 0.01
|
AiPlayerbot.MeleeDistance = 0.01
|
||||||
AiPlayerbot.FollowDistance = 1.5
|
AiPlayerbot.FollowDistance = 1.5
|
||||||
AiPlayerbot.WhisperDistance = 6000.0
|
AiPlayerbot.WhisperDistance = 6000.0
|
||||||
AiPlayerbot.ContactDistance = 0.01
|
AiPlayerbot.ContactDistance = 0.45
|
||||||
AiPlayerbot.AoeRadius = 10
|
AiPlayerbot.AoeRadius = 10
|
||||||
AiPlayerbot.RpgDistance = 200
|
AiPlayerbot.RpgDistance = 200
|
||||||
AiPlayerbot.AggroDistance = 22
|
AiPlayerbot.AggroDistance = 22
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class ActionContext : public NamedObjectContext<Action>
|
|||||||
creators["reach spell"] = &ActionContext::ReachSpell;
|
creators["reach spell"] = &ActionContext::ReachSpell;
|
||||||
creators["reach melee"] = &ActionContext::ReachMelee;
|
creators["reach melee"] = &ActionContext::ReachMelee;
|
||||||
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
|
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"] = &ActionContext::flee;
|
||||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||||
@@ -259,6 +260,7 @@ class ActionContext : public NamedObjectContext<Action>
|
|||||||
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
||||||
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(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_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(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
context->GetValue<Unit*>("current target")->Set(target);
|
context->GetValue<Unit*>("current target")->Set(target);
|
||||||
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
context->GetValue<LootObjectStack*>("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 (Pet* pet = bot->GetPet())
|
||||||
{
|
{
|
||||||
if (with_pet) {
|
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))
|
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) {
|
||||||
bot->SetFacingToObject(target);
|
sServerFacade->SetFacingTo(bot, target);
|
||||||
|
}
|
||||||
|
// bot->SetFacingToObject(target);
|
||||||
|
|
||||||
bool attacked = bot->Attack(target, true);
|
bool attacked = bot->Attack(target, true);
|
||||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemUsageValue.h"
|
#include "ItemUsageValue.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
uint32 FindLastSeparator(std::string const text, std::string const sep)
|
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))
|
if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance))
|
||||||
{
|
{
|
||||||
bot->SetFacingToObject(target);
|
sServerFacade->SetFacingTo(bot, target);
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
||||||
|
|
||||||
msg << "cast " << text;
|
msg << "cast " << text;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ bool CastEnchantItemAction::isPossible()
|
|||||||
|
|
||||||
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell, true), estAmount(estAmount)
|
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()
|
bool CastHealingSpellAction::isUseful()
|
||||||
@@ -168,7 +168,7 @@ bool CastAoeHealSpellAction::isUseful()
|
|||||||
|
|
||||||
CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||||
{
|
{
|
||||||
range = botAI->GetRange("spell");
|
range = botAI->GetRange("heal");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value<Unit*>* CurePartyMemberAction::GetTargetValue()
|
Value<Unit*>* CurePartyMemberAction::GetTargetValue()
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#define _PLAYERBOT_GENERICSPELLACTIONS_H
|
#define _PLAYERBOT_GENERICSPELLACTIONS_H
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
@@ -150,9 +152,14 @@ class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberA
|
|||||||
class ResurrectPartyMemberAction : public CastSpellAction
|
class ResurrectPartyMemberAction : public CastSpellAction
|
||||||
{
|
{
|
||||||
public:
|
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"; }
|
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
|
class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ bool DrinkAction::Execute(Event event)
|
|||||||
|
|
||||||
if (bot->isMoving())
|
if (bot->isMoving())
|
||||||
{
|
{
|
||||||
bot->StopMoving();
|
// bot->StopMoving();
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bot->SetStandState(UNIT_STAND_STATE_SIT);
|
bot->SetStandState(UNIT_STAND_STATE_SIT);
|
||||||
@@ -78,8 +78,8 @@ bool EatAction::Execute(Event event)
|
|||||||
|
|
||||||
if (bot->isMoving())
|
if (bot->isMoving())
|
||||||
{
|
{
|
||||||
bot->StopMoving();
|
// bot->StopMoving();
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,3 +45,12 @@ std::string const ReachPartyMemberToHealAction::GetTargetName()
|
|||||||
{
|
{
|
||||||
return "party member to heal";
|
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";
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,4 +54,13 @@ class ReachPartyMemberToHealAction : public ReachTargetAction
|
|||||||
std::string const GetTargetName() override;
|
std::string const GetTargetName() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ReachPartyMemberToResurrectAction : public ReachTargetAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ReachPartyMemberToResurrectAction(PlayerbotAI* botAI);
|
||||||
|
|
||||||
|
std::string const GetTargetName() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ bool SummonAction::Execute(Event event)
|
|||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (Pet* pet = bot->GetPet()) {
|
||||||
|
pet->SetReactState(REACT_PASSIVE);
|
||||||
|
pet->GetCharmInfo()->SetIsCommandFollow(true);
|
||||||
|
pet->GetCharmInfo()->IsReturning();
|
||||||
|
}
|
||||||
|
|
||||||
if (master->GetSession()->GetSecurity() >= SEC_PLAYER)
|
if (master->GetSession()->GetSecurity() >= SEC_PLAYER)
|
||||||
return Teleport(master, bot);
|
return Teleport(master, bot);
|
||||||
|
|||||||
@@ -100,5 +100,5 @@ void FrostDKStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|||||||
|
|
||||||
void FrostDKAoeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void FrostDKAoeStrategy::InitTriggers(std::vector<TriggerNode*>& 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)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,5 @@ NextAction** CastRebirthAction::getPrerequisites()
|
|||||||
|
|
||||||
bool CastRebirthAction::isUseful()
|
bool CastRebirthAction::isUseful()
|
||||||
{
|
{
|
||||||
return AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance;
|
return CastSpellAction::isUseful() && AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance;
|
||||||
}
|
}
|
||||||
@@ -234,19 +234,19 @@ class NoDrinkTrigger : public Trigger
|
|||||||
class LightAoeTrigger : public AoeTrigger
|
class LightAoeTrigger : public AoeTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 10.0f) { }
|
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 8.0f) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MediumAoeTrigger : public AoeTrigger
|
class MediumAoeTrigger : public AoeTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 10.0f) { }
|
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 8.0f) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class HighAoeTrigger : public AoeTrigger
|
class HighAoeTrigger : public AoeTrigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 10.0f) { }
|
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 8.0f) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuffTrigger : public SpellTrigger
|
class BuffTrigger : public SpellTrigger
|
||||||
@@ -523,7 +523,7 @@ class TankAssistTrigger : public NoAttackersTrigger
|
|||||||
class IsBehindTargetTrigger : public Trigger
|
class IsBehindTargetTrigger : public Trigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { }
|
IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "behind target") { }
|
||||||
|
|
||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
@@ -531,7 +531,7 @@ class IsBehindTargetTrigger : public Trigger
|
|||||||
class IsNotBehindTargetTrigger : public Trigger
|
class IsNotBehindTargetTrigger : public Trigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { }
|
IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "is not behind target") { }
|
||||||
|
|
||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
@@ -539,7 +539,7 @@ class IsNotBehindTargetTrigger : public Trigger
|
|||||||
class IsNotFacingTargetTrigger : public Trigger
|
class IsNotFacingTargetTrigger : public Trigger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { }
|
IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not facing target") { }
|
||||||
|
|
||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class TargetCriticalHealthTrigger : public TargetLowHealthTrigger
|
|||||||
class PartyMemberDeadTrigger : public Trigger
|
class PartyMemberDeadTrigger : public Trigger
|
||||||
{
|
{
|
||||||
public:
|
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"; }
|
std::string const GetTargetName() override { return "party member to resurrect"; }
|
||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user