mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-15 08:06:11 +00:00
Flee action, factory setting
This commit is contained in:
@@ -15,33 +15,37 @@ static float GetSpeedInMotion(Unit* target)
|
||||
bool EnemyTooCloseForSpellTrigger::IsActive()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (target)
|
||||
{
|
||||
if (target->GetTarget() == bot->GetGUID() && !bot->GetGroup() && !target->HasUnitState(UNIT_STATE_ROOT) && GetSpeedInMotion(target) > GetSpeedInMotion(bot) * 0.65f)
|
||||
return false;
|
||||
return target && target->GetVictim() != bot &&
|
||||
target->GetObjectSize() <= 10.0f &&
|
||||
AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->tooCloseDistance;
|
||||
// Unit* target = AI_VALUE(Unit*, "current target");
|
||||
// if (!target) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
bool isBoss = false;
|
||||
bool isRaid = false;
|
||||
float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach;
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Creature* creature = botAI->GetCreature(target->GetGUID());
|
||||
if (creature)
|
||||
{
|
||||
isBoss = creature->isWorldBoss();
|
||||
}
|
||||
}
|
||||
// if (target->GetTarget() == bot->GetGUID() && !bot->GetGroup() && !target->HasUnitState(UNIT_STATE_ROOT) && GetSpeedInMotion(target) > GetSpeedInMotion(bot) * 0.65f)
|
||||
// return false;
|
||||
|
||||
if (bot->GetMap() && bot->GetMap()->IsRaid())
|
||||
isRaid = true;
|
||||
// bool isBoss = false;
|
||||
// bool isRaid = false;
|
||||
// float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
// float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach;
|
||||
// if (target->GetTypeId() == TYPEID_UNIT)
|
||||
// {
|
||||
// Creature* creature = botAI->GetCreature(target->GetGUID());
|
||||
// if (creature)
|
||||
// {
|
||||
// isBoss = creature->isWorldBoss();
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (isBoss || isRaid)
|
||||
// return sServerFacade->IsDistanceLessThan(targetDistance, (botAI->GetRange("spell") + combatReach) / 2);
|
||||
// if (bot->GetMap() && bot->GetMap()->IsRaid())
|
||||
// isRaid = true;
|
||||
|
||||
return sServerFacade->IsDistanceLessOrEqualThan(targetDistance, (botAI->GetRange("spell") + combatReach / 2));
|
||||
}
|
||||
return false;
|
||||
// // if (isBoss || isRaid)
|
||||
// // return sServerFacade->IsDistanceLessThan(targetDistance, (sPlayerbotAIConfig->tooCloseDistance + combatReach) / 2);
|
||||
|
||||
// return sServerFacade->IsDistanceLessOrEqualThan(targetDistance, (sPlayerbotAIConfig->tooCloseDistance + combatReach / 2));
|
||||
}
|
||||
|
||||
bool EnemyTooCloseForAutoShotTrigger::IsActive()
|
||||
@@ -75,32 +79,35 @@ bool EnemyTooCloseForAutoShotTrigger::IsActive()
|
||||
bool EnemyTooCloseForShootTrigger::IsActive()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (!target)
|
||||
return false;
|
||||
return target && target->GetVictim() != bot && AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->shootDistance;
|
||||
|
||||
if (target->GetTarget() == bot->GetGUID() && !bot->GetGroup() && !target->HasUnitState(UNIT_STATE_ROOT) && GetSpeedInMotion(target) > GetSpeedInMotion(bot) * 0.65f)
|
||||
return false;
|
||||
// Unit* target = AI_VALUE(Unit*, "current target");
|
||||
// if (!target)
|
||||
// return false;
|
||||
|
||||
bool isBoss = false;
|
||||
bool isRaid = false;
|
||||
float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach;
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Creature* creature = botAI->GetCreature(target->GetGUID());
|
||||
if (creature)
|
||||
{
|
||||
isBoss = creature->isWorldBoss();
|
||||
}
|
||||
}
|
||||
// if (target->GetTarget() == bot->GetGUID() && !bot->GetGroup() && !target->HasUnitState(UNIT_STATE_ROOT) && GetSpeedInMotion(target) > GetSpeedInMotion(bot) * 0.65f)
|
||||
// return false;
|
||||
|
||||
if (bot->GetMap() && bot->GetMap()->IsRaid())
|
||||
isRaid = true;
|
||||
// bool isBoss = false;
|
||||
// bool isRaid = false;
|
||||
// float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
// float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach;
|
||||
// if (target->GetTypeId() == TYPEID_UNIT)
|
||||
// {
|
||||
// Creature* creature = botAI->GetCreature(target->GetGUID());
|
||||
// if (creature)
|
||||
// {
|
||||
// isBoss = creature->isWorldBoss();
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (isBoss || isRaid)
|
||||
// return sServerFacade->IsDistanceLessThan(targetDistance, botAI->GetRange("shoot") + combatReach);
|
||||
// if (bot->GetMap() && bot->GetMap()->IsRaid())
|
||||
// isRaid = true;
|
||||
|
||||
return sServerFacade->IsDistanceLessOrEqualThan(targetDistance, (botAI->GetRange("shoot") + combatReach / 2));
|
||||
// // if (isBoss || isRaid)
|
||||
// // return sServerFacade->IsDistanceLessThan(targetDistance, botAI->GetRange("shoot") + combatReach);
|
||||
|
||||
// return sServerFacade->IsDistanceLessOrEqualThan(targetDistance, (botAI->GetRange("shoot") + combatReach / 2));
|
||||
}
|
||||
|
||||
bool EnemyTooCloseForMeleeTrigger::IsActive()
|
||||
|
||||
Reference in New Issue
Block a user