More fixes

TGB, ^cast, group/ae checks, in group/raid checks, inviting others bots to group, group disband fix, prevent rogue bs spam, ^follow fixes and cleanup, follow owner only by default when joining raid/group, group buff fixes for bots, range fixes for group buffs
This commit is contained in:
nytmyr
2024-10-31 07:32:16 -05:00
parent 32e37660d8
commit 4aa7a18b4f
17 changed files with 1053 additions and 670 deletions
+61 -12
View File
@@ -994,11 +994,28 @@ std::list<BotSpell_wPriority> Bot::GetPrioritizedBotSpellsBySpellType(Bot* botCa
continue;
}
if (
!RuleB(Bots, EnableBotTGB) &&
IsGroupSpell(botSpellList[i].spellid) &&
!IsTGBCompatibleSpell(botSpellList[i].spellid) &&
!botCaster->IsInGroupOrRaid(tar, true)
) {
continue;
}
if (
(
!botCaster->IsCommandedSpell() || (botCaster->IsCommandedSpell() && (spellType != BotSpellTypes::Mez && spellType != BotSpellTypes::AEMez))
!botCaster->IsCommandedSpell() ||
(
botCaster->IsCommandedSpell() &&
(spellType != BotSpellTypes::Mez && spellType != BotSpellTypes::AEMez)
)
)
&&
(
!IsPBAESpell(botSpellList[i].spellid) &&
!botCaster->CastChecks(botSpellList[i].spellid, tar, spellType, false, IsAEBotSpellType(spellType))
)
&& (!IsPBAESpell(botSpellList[i].spellid) && !botCaster->CastChecks(botSpellList[i].spellid, tar, spellType, false, IsGroupBotSpellType(spellType))) // TODO bot rewrite - needed for ae spells?
) {
continue;
}
@@ -1232,7 +1249,15 @@ BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spell
if (botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP);
const std::vector<Mob*> v = botCaster->GatherSpellTargets();
std::vector<Mob*> v;
if (RuleB(Bots, CrossRaidBuffingAndHealing)) {
v = botCaster->GatherSpellTargets(true);
}
else {
v = botCaster->GatherGroupSpellTargets();
}
int targetCount = 0;
for (std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) {
@@ -1273,7 +1298,15 @@ BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster, Mob* tar, uint
if (botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_HealOverTime);
const std::vector<Mob*> v = botCaster->GatherSpellTargets();
std::vector<Mob*> v;
if (RuleB(Bots, CrossRaidBuffingAndHealing)) {
v = botCaster->GatherSpellTargets(true);
}
else {
v = botCaster->GatherGroupSpellTargets();
}
int targetCount = 0;
for (std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) {
@@ -1314,7 +1347,15 @@ BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint
if (botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CompleteHeal);
const std::vector<Mob*> v = botCaster->GatherSpellTargets();
std::vector<Mob*> v;
if (RuleB(Bots, CrossRaidBuffingAndHealing)) {
v = botCaster->GatherSpellTargets(true);
}
else {
v = botCaster->GatherGroupSpellTargets();
}
int targetCount = 0;
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) {
@@ -1629,7 +1670,7 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType
continue;
}
if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsGroupBotSpellType(spellType))) {
if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsAEBotSpellType(spellType))) {
continue;
}
@@ -1679,7 +1720,7 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType
continue;
}
if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsGroupBotSpellType(spellType))) {
if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsAEBotSpellType(spellType))) {
continue;
}
@@ -2583,19 +2624,27 @@ bool Bot::HasBotSpellEntry(uint16 spellid) {
return false;
}
bool Bot::IsValidSpellRange(uint16 spell_id, Mob const* tar) {
bool Bot::IsValidSpellRange(uint16 spell_id, Mob* tar) {
if (!IsValidSpell(spell_id)) {
return false;
}
if (tar) {
int spellrange = (GetActSpellRange(spell_id, spells[spell_id].range) * GetActSpellRange(spell_id, spells[spell_id].range));
if (spellrange >= DistanceSquared(m_Position, tar->GetPosition())) {
float range = spells[spell_id].range;
if (tar != this) {
range += GetRangeDistTargetSizeMod(tar);
}
range = GetActSpellRange(spell_id, range);
if (range >= Distance(m_Position, tar->GetPosition())) {
return true;
}
spellrange = (GetActSpellRange(spell_id, spells[spell_id].aoe_range) * GetActSpellRange(spell_id, spells[spell_id].aoe_range));
if (spellrange >= DistanceSquared(m_Position, tar->GetPosition())) {
range = GetActSpellRange(spell_id, spells[spell_id].aoe_range);
if (range >= Distance(m_Position, tar->GetPosition())) {
return true;
}
}