mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-21 12:37:05 +00:00
Flee action, factory setting
This commit is contained in:
@@ -145,7 +145,23 @@ bool MyAttackerCountTrigger::IsActive()
|
||||
|
||||
bool AoeTrigger::IsActive()
|
||||
{
|
||||
return AI_VALUE2(bool, "combat", "self target") && AI_VALUE(uint8, "aoe count") >= amount && AI_VALUE(uint8, "attacker count") >= amount;
|
||||
Unit* current_target = AI_VALUE(Unit*, "current target");
|
||||
if (!current_target) {
|
||||
return false;
|
||||
}
|
||||
GuidVector attackers = context->GetValue<GuidVector>("attackers")->Get();
|
||||
int attackers_count = 0;
|
||||
for (ObjectGuid const guid : attackers)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(guid);
|
||||
if (!unit || !unit->IsAlive())
|
||||
continue;
|
||||
|
||||
if (unit->GetExactDist2d(current_target) <= range) {
|
||||
attackers_count++;
|
||||
}
|
||||
}
|
||||
return attackers_count >= amount;
|
||||
}
|
||||
|
||||
bool NoFoodTrigger::IsActive()
|
||||
|
||||
@@ -225,19 +225,19 @@ class NoDrinkTrigger : public Trigger
|
||||
class LightAoeTrigger : public AoeTrigger
|
||||
{
|
||||
public:
|
||||
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 15.0f) { }
|
||||
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 8.0f) { }
|
||||
};
|
||||
|
||||
class MediumAoeTrigger : public AoeTrigger
|
||||
{
|
||||
public:
|
||||
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 17.0f) { }
|
||||
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 8.0f) { }
|
||||
};
|
||||
|
||||
class HighAoeTrigger : public AoeTrigger
|
||||
{
|
||||
public:
|
||||
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 20.0f) { }
|
||||
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 8.0f) { }
|
||||
};
|
||||
|
||||
class BuffTrigger : public SpellTrigger
|
||||
@@ -413,7 +413,7 @@ END_TRIGGER()
|
||||
class NoPetTrigger : public Trigger
|
||||
{
|
||||
public:
|
||||
NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 30) { }
|
||||
NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 5) { }
|
||||
|
||||
bool IsActive() override;
|
||||
};
|
||||
|
||||
@@ -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