mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 11:28:25 +00:00
[Bots] Add Caster Range Command, and IsValidSpellRange Checks (#2942)
* [Bots] Add Caster Range Command, and IsValidSpellRange Checks * remove/add exceptions where makes sense like buffs * fixes * fixes
This commit is contained in:
+22
-22
@@ -71,6 +71,7 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
|
||||
m_enforce_spell_settings = 0;
|
||||
m_bot_archery_setting = 0;
|
||||
m_expansion_bitmask = -1;
|
||||
m_bot_caster_range = 0;
|
||||
SetBotID(0);
|
||||
SetBotSpellID(0);
|
||||
SetSpawnStatus(false);
|
||||
@@ -3115,26 +3116,7 @@ void Bot::AI_Process()
|
||||
}
|
||||
}
|
||||
float melee_distance_min = melee_distance / 2.0f;
|
||||
|
||||
// Calculate caster distances
|
||||
float caster_distance_max = 0.0f;
|
||||
float caster_distance_min = 0.0f;
|
||||
float caster_distance = 0.0f;
|
||||
{
|
||||
if (GetLevel() >= GetStopMeleeLevel() && GetClass() >= WARRIOR && GetClass() <= BERSERKER) {
|
||||
caster_distance_max = MAX_CASTER_DISTANCE[(GetClass() - 1)];
|
||||
}
|
||||
|
||||
if (caster_distance_max) {
|
||||
|
||||
caster_distance_min = melee_distance_max;
|
||||
if (caster_distance_max <= caster_distance_min) {
|
||||
caster_distance_max = caster_distance_min * 1.25f;
|
||||
}
|
||||
|
||||
caster_distance = ((caster_distance_max + caster_distance_min) / 2);
|
||||
}
|
||||
}
|
||||
float caster_distance_max = GetBotCasterMaxRange(melee_distance_max);
|
||||
|
||||
bool atArcheryRange = IsArcheryRange(tar);
|
||||
|
||||
@@ -3157,11 +3139,11 @@ void Bot::AI_Process()
|
||||
ChangeBotArcherWeapons(IsBotArcher());
|
||||
}
|
||||
}
|
||||
|
||||
bool stop_melee_level = GetLevel() >= GetStopMeleeLevel();
|
||||
if (IsBotArcher() && atArcheryRange) {
|
||||
atCombatRange = true;
|
||||
}
|
||||
else if (caster_distance_max && tar_distance <= caster_distance_max) {
|
||||
else if (caster_distance_max && tar_distance <= caster_distance_max && stop_melee_level) {
|
||||
atCombatRange = true;
|
||||
}
|
||||
else if (tar_distance <= melee_distance) {
|
||||
@@ -9825,4 +9807,22 @@ void Bot::SendSpellAnim(uint16 target_id, uint16 spell_id)
|
||||
entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles));
|
||||
}
|
||||
|
||||
float Bot::GetBotCasterMaxRange(float melee_distance_max) {// Calculate caster distances
|
||||
float caster_distance_max = 0.0f;
|
||||
float caster_distance_min = 0.0f;
|
||||
float caster_distance = 0.0f;
|
||||
|
||||
caster_distance_max = GetBotCasterRange() * GetBotCasterRange();
|
||||
if (!GetBotCasterRange() && GetLevel() >= GetStopMeleeLevel() && GetClass() >= WARRIOR && GetClass() <= BERSERKER) {
|
||||
caster_distance_max = MAX_CASTER_DISTANCE[GetClass() - 1];
|
||||
}
|
||||
if (caster_distance_max) {
|
||||
caster_distance_min = melee_distance_max;
|
||||
if (caster_distance_max <= caster_distance_min) {
|
||||
caster_distance_max = caster_distance_min * 1.25f;
|
||||
}
|
||||
}
|
||||
return caster_distance_max;
|
||||
}
|
||||
|
||||
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
|
||||
|
||||
Reference in New Issue
Block a user