tank target, formation arrow, mount fix, miscs

This commit is contained in:
Yunfan Li
2023-06-02 15:49:49 +08:00
parent ebfd338af0
commit 25da0af70e
12 changed files with 206 additions and 49 deletions

View File

@@ -52,6 +52,12 @@ bool CheckMountStateAction::Execute(Event event)
return Mount();
}
if (!master->IsMounted() && bot->IsMounted())
{
WorldPacket emptyPacket;
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
return true;
}
// if (!bot->IsMounted() && (chasedistance || (farFromMaster && botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))) && !bot->IsInCombat() && !dps)
// return Mount();

View File

@@ -77,18 +77,18 @@ bool DropTargetAction::Execute(Event event)
botAI->InterruptSpell();
bot->AttackStop();
if (Pet* pet = bot->GetPet())
{
if (CreatureAI* creatureAI = ((Creature*)pet)->AI())
{
pet->SetReactState(REACT_PASSIVE);
pet->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
pet->GetCharmInfo()->SetIsCommandFollow(true);
pet->AttackStop();
pet->GetCharmInfo()->IsReturning();
pet->GetMotionMaster()->MoveFollow(bot, PET_FOLLOW_DIST, pet->GetFollowAngle());
}
}
// if (Pet* pet = bot->GetPet())
// {
// if (CreatureAI* creatureAI = ((Creature*)pet)->AI())
// {
// pet->SetReactState(REACT_PASSIVE);
// pet->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
// pet->GetCharmInfo()->SetIsCommandFollow(true);
// pet->AttackStop();
// pet->GetCharmInfo()->IsReturning();
// pet->GetMotionMaster()->MoveFollow(bot, PET_FOLLOW_DIST, pet->GetFollowAngle());
// }
// }
return true;
}

View File

@@ -26,7 +26,7 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
triggers.push_back(new TriggerNode("loot response", NextAction::array(0, new NextAction("store loot", relevance), nullptr)));
triggers.push_back(new TriggerNode("item push result", NextAction::array(0, new NextAction("query item usage", relevance), new NextAction("equip upgrades", relevance), nullptr)));
triggers.push_back(new TriggerNode("ready check finished", NextAction::array(0, new NextAction("finish ready check", relevance), nullptr)));
triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("security check", relevance), new NextAction("check mail", relevance), nullptr)));
// triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("security check", relevance), new NextAction("check mail", relevance), nullptr)));
triggers.push_back(new TriggerNode("guild invite", NextAction::array(0, new NextAction("guild accept", relevance), nullptr)));
triggers.push_back(new TriggerNode("petition offer", NextAction::array(0, new NextAction("petition sign", relevance), nullptr)));
triggers.push_back(new TriggerNode("lfg proposal", NextAction::array(0, new NextAction("lfg accept", relevance), nullptr)));

View File

@@ -18,11 +18,11 @@ bool MediumManaTrigger::IsActive()
bool NoPetTrigger::IsActive()
{
return !AI_VALUE(Unit*, "pet target") && !bot->GetGuardianPet() && !AI_VALUE2(bool, "mounted", "self target");
return (!AI_VALUE(Unit*, "pet target")) && (!bot->GetGuardianPet()) && (!bot->GetFirstControlled()) && (!AI_VALUE2(bool, "mounted", "self target"));
}
bool HasPetTrigger::IsActive() {
return (AI_VALUE(Unit*, "pet target") || bot->GetGuardianPet()) && !AI_VALUE2(bool, "mounted", "self target");;
return (AI_VALUE(Unit*, "pet target")) && !AI_VALUE2(bool, "mounted", "self target");;
}
bool HighManaTrigger::IsActive()

View File

@@ -415,13 +415,13 @@ class NoPetTrigger : public Trigger
public:
NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 5) { }
bool IsActive() override;
virtual bool IsActive() override;
};
class HasPetTrigger : public Trigger
{
public:
HasPetTrigger(PlayerbotAI* ai) : Trigger(ai, "no pet", 5) {}
HasPetTrigger(PlayerbotAI* ai) : Trigger(ai, "has pet", 5) {}
virtual bool IsActive() override;
};

View File

@@ -19,6 +19,9 @@ WorldLocation ArrowFormation::GetLocationInternal()
float offset = 0.f;
Player* master = botAI->GetMaster();
if (!master) {
return Formation::NullLocation;
}
float orientation = master->GetOrientation();
MultiLineUnitPlacer placer(orientation);
@@ -29,7 +32,7 @@ WorldLocation ArrowFormation::GetLocationInternal()
melee.PlaceUnits(&placer);
melee.Move(-cos(orientation) * offset, -sin(orientation) * offset);
offset += meleeLines * sPlayerbotAIConfig->followDistance;
offset += meleeLines * sPlayerbotAIConfig->followDistance + sPlayerbotAIConfig->tooCloseDistance;
ranged.PlaceUnits(&placer);
ranged.Move(-cos(orientation) * offset, -sin(orientation) * offset);

View File

@@ -14,11 +14,20 @@ class FindTargetForTankStrategy : public FindNonCcTargetStrategy
void CheckAttacker(Unit* creature, ThreatMgr* threatMgr) override
{
Player* bot = botAI->GetBot();
if (IsCcTarget(creature))
return;
float threat = threatMgr->GetThreat(bot);
if (!result || (minThreat - threat) > 0.1f)
if (!result) {
minThreat = threat;
result = creature;
}
// neglect if victim is main tank, or no victim (for untauntable target)
if (threatMgr->getCurrentVictim()) {
// float max_threat = threatMgr->GetThreat(threatMgr->getCurrentVictim()->getTarget());
Unit* victim = threatMgr->getCurrentVictim()->getTarget();
if (victim && victim->ToPlayer() && botAI->IsMainTank(victim->ToPlayer())) {
return;
}
}
if (minThreat >= threat)
{
minThreat = threat;
result = creature;