Added bot command 'BotStopMeleeLevel'

This commit is contained in:
Uleat
2018-04-12 20:14:02 -04:00
parent 714f8172ec
commit fb7362c092
9 changed files with 139 additions and 11 deletions
+31 -1
View File
@@ -78,6 +78,11 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm
SetPauseAI(false);
rest_timer.Disable();
SetFollowDistance(BOT_FOLLOW_DISTANCE_DEFAULT);
if (IsCasterClass(GetClass()))
SetStopMeleeLevel((uint8)RuleI(Bots, CasterStopMeleeLevel));
else
SetStopMeleeLevel(255);
// Do this once and only in this constructor
GenerateAppearance();
GenerateBaseStats();
@@ -151,6 +156,11 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
rest_timer.Disable();
SetFollowDistance(BOT_FOLLOW_DISTANCE_DEFAULT);
if (IsCasterClass(GetClass()))
SetStopMeleeLevel((uint8)RuleI(Bots, CasterStopMeleeLevel));
else
SetStopMeleeLevel(255);
strcpy(this->name, this->GetCleanName());
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
@@ -2041,6 +2051,13 @@ void Bot::SetTarget(Mob* mob) {
}
}
void Bot::SetStopMeleeLevel(uint8 level) {
if (IsCasterClass(GetClass()) || IsSpellFighterClass(GetClass()))
_stopMeleeLevel = level;
else
_stopMeleeLevel = 255;
}
void Bot::SetGuardMode() {
WipeHateList();
SetTarget(nullptr);
@@ -2386,11 +2403,20 @@ void Bot::AI_Process() {
// Calculate casting distance
float caster_distance_max = 0.0f;
{
if (GetLevel() >= RuleI(Bots, CasterStopMeleeLevel)) {
if (GetLevel() >= GetStopMeleeLevel()) {
switch (GetClass()) {
case CLERIC:
caster_distance_max = 1156.0f; // as DSq value (34 units)
break;
case PALADIN:
caster_distance_max = 576.0f; // as DSq value (24 units)
break;
case RANGER:
caster_distance_max = 784.0f; // as DSq value (28 units)
break;
case SHADOWKNIGHT:
caster_distance_max = 676.0f; // as DSq value (26 units)
break;
case DRUID:
caster_distance_max = 1764.0f; // as DSq value (42 units)
break;
@@ -2409,7 +2435,11 @@ void Bot::AI_Process() {
case ENCHANTER:
caster_distance_max = 2500.0f; // as DSq value (50 units)
break;
case BEASTLORD:
caster_distance_max = 900.0f; // as DSq value (30 units)
break;
default:
// pure melee classes (and BARD) do not get this option
break;
}
}