adjust spell hold checks to rely on caster and

Implement pet resist buffs and pet damage shields
This commit is contained in:
nytmyr
2024-11-10 23:10:13 -06:00
parent ec89a65aeb
commit b0768454c1
6 changed files with 55 additions and 17 deletions
+8 -2
View File
@@ -2874,14 +2874,16 @@ bool BOT_SPELL_TYPES_BENEFICIAL(uint16 spellType, uint8 cls) {
case BotSpellTypes::Buff:
case BotSpellTypes::Cure:
case BotSpellTypes::GroupCures:
case BotSpellTypes::DamageShields:
case BotSpellTypes::DamageShields:
case BotSpellTypes::InCombatBuffSong:
case BotSpellTypes::OutOfCombatBuffSong:
case BotSpellTypes::Pet:
case BotSpellTypes::PetBuffs:
case BotSpellTypes::PreCombatBuff:
case BotSpellTypes::PreCombatBuffSong:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::PetResistBuffs:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::Resurrect:
return true;
case BotSpellTypes::InCombatBuff:
@@ -2916,8 +2918,10 @@ bool BOT_SPELL_TYPES_OTHER_BENEFICIAL(uint16 spellType) {
case BotSpellTypes::Cure:
case BotSpellTypes::GroupCures:
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::PetBuffs:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
return true;
default:
return false;
@@ -3050,8 +3054,10 @@ bool IsClientBotSpellType(uint16 spellType) {
case BotSpellTypes::Cure:
case BotSpellTypes::GroupCures:
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::PetBuffs:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
return true;
default:
return false;
+5 -3
View File
@@ -705,10 +705,12 @@ namespace BotSpellTypes
constexpr uint16 PetVeryFastHeals = 49;
constexpr uint16 PetHoTHeals = 50;
constexpr uint16 DamageShields = 51;
constexpr uint16 ResistBuffs = 52;
constexpr uint16 ResistBuffs = 52;
constexpr uint16 PetDamageShields = 53;
constexpr uint16 PetResistBuffs = 54;
constexpr uint16 START = BotSpellTypes::Nuke; // Do not remove or change this
constexpr uint16 END = BotSpellTypes::ResistBuffs; // Do not remove this, increment as needed
constexpr uint16 START = BotSpellTypes::Nuke; // Do not remove or change this
constexpr uint16 END = BotSpellTypes::PetResistBuffs; // Do not remove this, increment as needed
}
const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow);
+17 -2
View File
@@ -9505,7 +9505,9 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
case BotSpellTypes::PetBuffs:
case BotSpellTypes::PreCombatBuff:
case BotSpellTypes::DamageShields:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
if (
!(
spells[spellid].target_type == ST_Target ||
@@ -10400,6 +10402,14 @@ uint16 Bot::GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, ui
case BotSpellTypes::PreCombatBuffSong:
priority = 23;
break;
case BotSpellTypes::PetResistBuffs:
priority = 24;
break;
case BotSpellTypes::PetDamageShields:
priority = 25;
break;
default:
priority = 0; //unused
@@ -10861,7 +10871,9 @@ uint16 Bot::GetSpellListSpellType(uint16 spellType) {
case BotSpellTypes::Buff:
case BotSpellTypes::PetBuffs:
case BotSpellTypes::DamageShields:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
return BotSpellTypes::Buff;
case BotSpellTypes::AEMez:
case BotSpellTypes::Mez:
@@ -10921,18 +10933,21 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spellid) {
switch (spellType) {
case BotSpellTypes::Buff:
case BotSpellTypes::PetBuffs:
if (IsResistanceOnlySpell(spellid) || IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) {
return false;
}
return true;
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
if (IsResistanceOnlySpell(spellid)) {
return true;
}
return false;
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
if (IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) {
return true;
}
+2 -5
View File
@@ -9,15 +9,12 @@ void bot_command_spell_holds(Client* c, const Seperator* sep)
if (helper_is_help_or_usage(sep->arg[1])) {
std::vector<std::string> description =
{
"Toggles whether or not bots can cast or receive certain spell types"
"Toggles whether or not bots can cast certain spell types"
};
std::vector<std::string> notes =
{
"- All pet types are based off the pet's owner's setting",
"- Any remaining types use the owner's setting when a pet is the target",
"- All Heals, Cures, Buffs (DS and resists included) are based off the target's setting, not the caster",
"- e.g., BotA is healing BotB using BotB's settings",
"- All pet types are based off the pet owner's setting when a pet is the target"
};
std::vector<std::string> example_format =
+4
View File
@@ -125,7 +125,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType) {
case BotSpellTypes::PetBuffs:
case BotSpellTypes::PreCombatBuff:
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
if (!tar->IsOfClientBot() && !(tar->IsPet() && tar->GetOwner() && tar->GetOwner()->IsOfClientBot())) {
return false;
}
@@ -2039,7 +2041,9 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) //TODO bot rewrite - adj
case BotSpellTypes::Buff:
case BotSpellTypes::PetBuffs:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs:
case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields:
return RuleI(Bots, PercentChanceToCastBuff);
case BotSpellTypes::Escape:
return RuleI(Bots, PercentChanceToCastEscape);
+19 -5
View File
@@ -8869,6 +8869,12 @@ std::string Mob::GetSpellTypeNameByID(uint16 spellType) {
case BotSpellTypes::ResistBuffs:
spellTypeName = "Resist Buff";
break;
case BotSpellTypes::PetDamageShields:
spellTypeName = "Pet Damage Shield";
break;
case BotSpellTypes::PetResistBuffs:
spellTypeName = "Pet Resist Buff";
break;
default:
break;
}
@@ -9039,6 +9045,12 @@ std::string Mob::GetSpellTypeShortNameByID(uint16 spellType) {
case BotSpellTypes::ResistBuffs:
spellTypeName = "resistbuffs";
break;
case BotSpellTypes::PetDamageShields:
spellTypeName = "petdamageshields";
break;
case BotSpellTypes::PetResistBuffs:
spellTypeName = "petresistbuffs";
break;
default:
break;
}
@@ -9318,7 +9330,7 @@ uint8 Mob::GetDefaultSpellMaxThreshold(uint16 spellType, uint8 stance) {
case BotSpellTypes::Buff:
case BotSpellTypes::Charm:
case BotSpellTypes::Cure:
case BotSpellTypes::DamageShields:
case BotSpellTypes::DamageShields:
case BotSpellTypes::HateRedux:
case BotSpellTypes::InCombatBuff:
case BotSpellTypes::InCombatBuffSong:
@@ -9329,6 +9341,8 @@ uint8 Mob::GetDefaultSpellMaxThreshold(uint16 spellType, uint8 stance) {
case BotSpellTypes::PetBuffs:
case BotSpellTypes::PreCombatBuff:
case BotSpellTypes::PreCombatBuffSong:
case BotSpellTypes::PetDamageShields:
case BotSpellTypes::PetResistBuffs:
case BotSpellTypes::ResistBuffs:
case BotSpellTypes::Resurrect:
return 100;
@@ -9401,10 +9415,6 @@ bool Mob::GetUltimateSpellHold(uint16 spellType, Mob* tar) {
return tar->GetOwner()->GetSpellHold(GetPetSpellType(spellType));
}
if (BOT_SPELL_TYPES_OTHER_BENEFICIAL(spellType) && tar->IsOfClientBot()) {
return tar->GetSpellHold(spellType);
}
return GetSpellHold(spellType);
}
@@ -9486,6 +9496,10 @@ uint16 Mob::GetPetSpellType(uint16 spellType) {
return BotSpellTypes::PetHoTHeals;
case BotSpellTypes::Buff:
return BotSpellTypes::PetBuffs;
case BotSpellTypes::DamageShields:
return BotSpellTypes::PetDamageShields;
case BotSpellTypes::ResistBuffs:
return BotSpellTypes::PetResistBuffs;
default:
break;
}