mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-07 09:02:26 +00:00
Tweaked bot caster combat range code a little (they shouldn't pile up unless there are los issues...)
This commit is contained in:
parent
7ac597270b
commit
12d7f242b4
54
zone/bot.cpp
54
zone/bot.cpp
@ -2156,7 +2156,7 @@ void Bot::AI_Process() {
|
|||||||
if(GetHasBeenSummoned()) {
|
if(GetHasBeenSummoned()) {
|
||||||
if(IsBotCaster() || IsBotArcher()) {
|
if(IsBotCaster() || IsBotArcher()) {
|
||||||
if (AI_movement_timer->Check()) {
|
if (AI_movement_timer->Check()) {
|
||||||
if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistanceSquaredNoZ(static_cast<glm::vec3>(m_Position), m_PreSummonLocation) < 10)) {
|
if(!GetTarget() || (IsBotCaster() && !IsBotCasterAtCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistanceSquaredNoZ(static_cast<glm::vec3>(m_Position), m_PreSummonLocation) < 10)) {
|
||||||
if(GetTarget())
|
if(GetTarget())
|
||||||
FaceTarget(GetTarget());
|
FaceTarget(GetTarget());
|
||||||
|
|
||||||
@ -2293,23 +2293,24 @@ void Bot::AI_Process() {
|
|||||||
ChangeBotArcherWeapons(IsBotArcher());
|
ChangeBotArcherWeapons(IsBotArcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsBotArcher() && atArcheryRange) {
|
if (IsBotArcher() && atArcheryRange) {
|
||||||
if(IsMoving()) {
|
if (IsMoving()) {
|
||||||
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
||||||
SetRunAnimSpeed(0);
|
SetRunAnimSpeed(0);
|
||||||
SetCurrentSpeed(0);
|
SetCurrentSpeed(0);
|
||||||
if(moved) {
|
if (moved) {
|
||||||
moved = false;
|
moved = false;
|
||||||
SetCurrentSpeed(0);
|
SetCurrentSpeed(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
} else if(IsBotCaster() && GetLevel() >= RuleI(Bots, CasterStopMeleeLevel)) {
|
|
||||||
if(IsBotCasterCombatRange(GetTarget()))
|
|
||||||
atCombatRange = true;
|
|
||||||
}
|
}
|
||||||
else if(DistanceSquared(m_Position, GetTarget()->GetPosition()) <= meleeDistance)
|
else if (GetLevel() >= RuleI(Bots, CasterStopMeleeLevel) && IsBotCasterAtCombatRange(GetTarget())) {
|
||||||
atCombatRange = true;
|
atCombatRange = true;
|
||||||
|
}
|
||||||
|
else if (DistanceSquared(m_Position, GetTarget()->GetPosition()) <= meleeDistance) {
|
||||||
|
atCombatRange = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(atCombatRange) {
|
if(atCombatRange) {
|
||||||
if(IsMoving()) {
|
if(IsMoving()) {
|
||||||
@ -6856,20 +6857,31 @@ bool Bot::IsArcheryRange(Mob *target) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bot::IsBotCasterCombatRange(Mob *target) {
|
bool Bot::IsBotCasterAtCombatRange(Mob *target)
|
||||||
bool result = false;
|
{
|
||||||
if(target) {
|
static const float local[PLAYER_CLASS_COUNT] = {
|
||||||
float range = BotAISpellRange;
|
0.0f, // WARRIOR
|
||||||
range *= range;
|
1156.0f, // CLERIC as DSq value (34 units)
|
||||||
range *= .5;
|
0.0f, 0.0f, 0.0f, // PALADIN, RANGER, SHADOWKNIGHT
|
||||||
float targetDistance = DistanceSquaredNoZ(m_Position, target->GetPosition());
|
1764.0f, // DRUID as DSq value (42 units)
|
||||||
if(targetDistance > range)
|
0.0f, 0.0f, 0.0f, // MONK, BARD, ROGUE
|
||||||
result = false;
|
1444.0f, // SHAMAN as DSq value (38 units)
|
||||||
else
|
2916.0f, // NECROMANCER as DSq value (54 units)
|
||||||
result = true;
|
2304.0f, // WIZARD as DSq value (48 units)
|
||||||
}
|
2704.0f, // MAGICIAN as DSq value (52 units)
|
||||||
|
2500.0f, // ENCHANTER as DSq value (50 units)
|
||||||
|
0.0f, 0.0f // BEASTLORD, BERSERKER
|
||||||
|
};
|
||||||
|
|
||||||
return result;
|
if (!target)
|
||||||
|
return false;
|
||||||
|
if (GetClass() < WARRIOR || GetClass() > BERSERKER)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
float targetDistance = DistanceSquaredNoZ(m_Position, target->GetPosition());
|
||||||
|
if (targetDistance < local[GetClass() - 1])
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::UpdateGroupCastingRoles(const Group* group, bool disband)
|
void Bot::UpdateGroupCastingRoles(const Group* group, bool disband)
|
||||||
|
|||||||
@ -337,7 +337,7 @@ public:
|
|||||||
bool IsStanding();
|
bool IsStanding();
|
||||||
int GetBotWalkspeed() const { return (int)((float)_GetWalkSpeed() * 1.786f); } // 1.25 / 0.7 = 1.7857142857142857142857142857143
|
int GetBotWalkspeed() const { return (int)((float)_GetWalkSpeed() * 1.786f); } // 1.25 / 0.7 = 1.7857142857142857142857142857143
|
||||||
int GetBotRunspeed() const { return (int)((float)_GetRunSpeed() * 1.786f); }
|
int GetBotRunspeed() const { return (int)((float)_GetRunSpeed() * 1.786f); }
|
||||||
bool IsBotCasterCombatRange(Mob *target);
|
bool IsBotCasterAtCombatRange(Mob *target);
|
||||||
bool UseDiscipline(uint32 spell_id, uint32 target);
|
bool UseDiscipline(uint32 spell_id, uint32 target);
|
||||||
uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets);
|
uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets);
|
||||||
bool GetNeedsCured(Mob *tar);
|
bool GetNeedsCured(Mob *tar);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user