mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Correct pet buff type logic to catch DS/Resists with other spell effects in them
This commit is contained in:
@@ -2824,6 +2824,34 @@ bool IsResurrectSpell(uint16 spell_id)
|
|||||||
return IsEffectInSpell(spell_id, SE_Revive);
|
return IsEffectInSpell(spell_id, SE_Revive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsResistanceBuffSpell(uint16 spell_id) {
|
||||||
|
if (!IsValidSpell(spell_id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& spell = spells[spell_id];
|
||||||
|
|
||||||
|
for (int i = 0; i < EFFECT_COUNT; i++) {
|
||||||
|
if (IsBlankSpellEffect(spell_id, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
spell.effect_id[i] == SE_ResistFire ||
|
||||||
|
spell.effect_id[i] == SE_ResistCold ||
|
||||||
|
spell.effect_id[i] == SE_ResistPoison ||
|
||||||
|
spell.effect_id[i] == SE_ResistDisease ||
|
||||||
|
spell.effect_id[i] == SE_ResistMagic ||
|
||||||
|
spell.effect_id[i] == SE_ResistCorruption ||
|
||||||
|
spell.effect_id[i] == SE_ResistAll
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsResistanceOnlySpell(uint16 spell_id) {
|
bool IsResistanceOnlySpell(uint16 spell_id) {
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2876,6 +2904,35 @@ bool IsDamageShieldOnlySpell(uint16 spell_id) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsDamageShieldAndResistSpell(uint16 spell_id) {
|
||||||
|
if (!IsValidSpell(spell_id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& spell = spells[spell_id];
|
||||||
|
|
||||||
|
for (int i = 0; i < EFFECT_COUNT; i++) {
|
||||||
|
if (IsBlankSpellEffect(spell_id, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
spell.effect_id[i] != SE_DamageShield &&
|
||||||
|
spell.effect_id[i] != SE_ResistFire &&
|
||||||
|
spell.effect_id[i] != SE_ResistCold &&
|
||||||
|
spell.effect_id[i] != SE_ResistPoison &&
|
||||||
|
spell.effect_id[i] != SE_ResistDisease &&
|
||||||
|
spell.effect_id[i] != SE_ResistMagic &&
|
||||||
|
spell.effect_id[i] != SE_ResistCorruption &&
|
||||||
|
spell.effect_id[i] != SE_ResistAll
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsHateSpell(uint16 spell_id) {
|
bool IsHateSpell(uint16 spell_id) {
|
||||||
if (!IsValidSpell(spell_id)) {
|
if (!IsValidSpell(spell_id)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1908,8 +1908,10 @@ bool IsLichSpell(uint16 spell_id);
|
|||||||
bool IsInstantHealSpell(uint32 spell_id);
|
bool IsInstantHealSpell(uint32 spell_id);
|
||||||
bool IsResurrectSpell(uint16 spell_id);
|
bool IsResurrectSpell(uint16 spell_id);
|
||||||
bool RequiresStackCheck(uint16 spell_type);
|
bool RequiresStackCheck(uint16 spell_type);
|
||||||
|
bool IsResistanceBuffSpell(uint16 spell_id);
|
||||||
bool IsResistanceOnlySpell(uint16 spell_id);
|
bool IsResistanceOnlySpell(uint16 spell_id);
|
||||||
bool IsDamageShieldOnlySpell(uint16 spell_id);
|
bool IsDamageShieldOnlySpell(uint16 spell_id);
|
||||||
|
bool IsDamageShieldAndResistSpell(uint16 spell_id);
|
||||||
bool IsHateSpell(uint16 spell_id);
|
bool IsHateSpell(uint16 spell_id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-3
@@ -11572,7 +11572,8 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
|
|||||||
case BotSpellTypes::PetBuffs:
|
case BotSpellTypes::PetBuffs:
|
||||||
if (
|
if (
|
||||||
IsResistanceOnlySpell(spell_id) ||
|
IsResistanceOnlySpell(spell_id) ||
|
||||||
IsDamageShieldOnlySpell(spell_id)
|
IsDamageShieldOnlySpell(spell_id) ||
|
||||||
|
IsDamageShieldAndResistSpell(spell_id)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -11580,14 +11581,14 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) {
|
|||||||
return true;
|
return true;
|
||||||
case BotSpellTypes::ResistBuffs:
|
case BotSpellTypes::ResistBuffs:
|
||||||
case BotSpellTypes::PetResistBuffs:
|
case BotSpellTypes::PetResistBuffs:
|
||||||
if (IsResistanceOnlySpell(spell_id)) {
|
if (IsResistanceBuffSpell(spell_id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case BotSpellTypes::DamageShields:
|
case BotSpellTypes::DamageShields:
|
||||||
case BotSpellTypes::PetDamageShields:
|
case BotSpellTypes::PetDamageShields:
|
||||||
if (IsDamageShieldOnlySpell(spell_id)) {
|
if (IsEffectInSpell(spell_id, SE_DamageShield)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_targ
|
|||||||
!AI_HasSpells() ||
|
!AI_HasSpells() ||
|
||||||
(spell_type == BotSpellTypes::Pet && tar != this) ||
|
(spell_type == BotSpellTypes::Pet && tar != this) ||
|
||||||
(IsPetBotSpellType(spell_type) && !tar->IsPet()) ||
|
(IsPetBotSpellType(spell_type) && !tar->IsPet()) ||
|
||||||
(spell_type == BotSpellTypes::Buff && tar->IsPet()) ||
|
(!IsPetBotSpellType(spell_type) && tar->IsPet()) ||
|
||||||
(spell_type == BotSpellTypes::InCombatBuffSong && tar->IsPet()) ||
|
|
||||||
(spell_type == BotSpellTypes::OutOfCombatBuffSong && tar->IsPet()) ||
|
|
||||||
(spell_type == BotSpellTypes::PreCombatBuffSong && tar->IsPet()) ||
|
|
||||||
(!RuleB(Bots, AllowBuffingHealingFamiliars) && tar->IsFamiliar()) ||
|
(!RuleB(Bots, AllowBuffingHealingFamiliars) && tar->IsFamiliar()) ||
|
||||||
(tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetBuffs && !RuleB(Bots, AllowCharmedPetBuffs)) ||
|
(tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetBuffs && !RuleB(Bots, AllowCharmedPetBuffs)) ||
|
||||||
(tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetCures && !RuleB(Bots, AllowCharmedPetCures)) ||
|
(tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetCures && !RuleB(Bots, AllowCharmedPetCures)) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user