[Bots] Fix IsValidSpellTypeBySpellID to account for all types (#4764)

* [Bots] Fix IsValidSpellTypeBySpellID to account for all types

* Formatting
This commit is contained in:
nytmyr
2025-03-19 17:43:15 -05:00
committed by GitHub
parent ef945e6e99
commit 1af29bd7b1
10 changed files with 489 additions and 498 deletions
+49 -37
View File
@@ -1456,41 +1456,42 @@ bool IsCompleteHealSpell(uint16 spell_id)
}
bool IsFastHealSpell(uint16 spell_id) {
spell_id = (
IsEffectInSpell(spell_id, SE_CurrentHP) ?
spell_id :
GetSpellTriggerSpellID(spell_id, SE_CurrentHP)
);
spell_id = (
IsEffectInSpell(spell_id, SE_CurrentHP) ?
spell_id :
GetSpellTriggerSpellID(spell_id, SE_CurrentHP)
);
if (!spell_id) {
spell_id = (
IsEffectInSpell(spell_id, SE_CurrentHPOnce) ?
spell_id :
GetSpellTriggerSpellID(spell_id, SE_CurrentHPOnce)
);
}
if (!spell_id) {
spell_id = (
IsEffectInSpell(spell_id, SE_CurrentHPOnce) ?
spell_id :
GetSpellTriggerSpellID(spell_id, SE_CurrentHPOnce)
);
}
if (spell_id && IsValidSpell(spell_id)) {
if (
spells[spell_id].cast_time <= MAX_FAST_HEAL_CASTING_TIME &&
spells[spell_id].good_effect &&
!IsGroupSpell(spell_id)
) {
for (int i = 0; i < EFFECT_COUNT; i++) {
if (
spells[spell_id].base_value[i] > 0 &&
(
spells[spell_id].effect_id[i] == SE_CurrentHP ||
spells[spell_id].effect_id[i] == SE_CurrentHPOnce
)
) {
return true;
}
}
}
}
if (IsValidSpell(spell_id)) {
if (
spell_id != SPELL_MINOR_HEALING &&
(spells[spell_id].cast_time > MAX_VERY_FAST_HEAL_CASTING_TIME && spells[spell_id].cast_time <= MAX_FAST_HEAL_CASTING_TIME) &&
spells[spell_id].good_effect &&
!IsGroupSpell(spell_id)
) {
for (int i = 0; i < EFFECT_COUNT; i++) {
if (
spells[spell_id].base_value[i] > 0 &&
(
spells[spell_id].effect_id[i] == SE_CurrentHP ||
spells[spell_id].effect_id[i] == SE_CurrentHPOnce
)
) {
return true;
}
}
}
}
return false;
return false;
}
bool IsVeryFastHealSpell(uint16 spell_id)
@@ -1509,8 +1510,9 @@ bool IsVeryFastHealSpell(uint16 spell_id)
);
}
if (spell_id) {
if (IsValidSpell(spell_id)) {
if (
spell_id != SPELL_MINOR_HEALING &&
spells[spell_id].cast_time <= MAX_VERY_FAST_HEAL_CASTING_TIME &&
spells[spell_id].good_effect &&
!IsGroupSpell(spell_id)
@@ -1548,8 +1550,13 @@ bool IsRegularSingleTargetHealSpell(uint16 spell_id)
);
}
if (spell_id) {
if (IsValidSpell(spell_id)) {
if (spell_id == SPELL_MINOR_HEALING) {
return true;
}
if (
spells[spell_id].cast_time > MAX_FAST_HEAL_CASTING_TIME &&
spells[spell_id].target_type == ST_Target &&
!IsCompleteHealSpell(spell_id) &&
!IsHealOverTimeSpell(spell_id) &&
@@ -1589,9 +1596,14 @@ bool IsRegularPetHealSpell(uint16 spell_id)
);
}
if (spell_id && IsValidSpell(spell_id)) {
if (IsValidSpell(spell_id)) {
if (spell_id == SPELL_MINOR_HEALING) {
return true;
}
if (
(spells[spell_id].target_type == ST_Pet || spells[spell_id].target_type == ST_Undead) &&
spells[spell_id].cast_time > MAX_FAST_HEAL_CASTING_TIME &&
(spells[spell_id].target_type == ST_Pet || spells[spell_id].target_type == ST_SummonedPet) &&
!IsCompleteHealSpell(spell_id) &&
!IsHealOverTimeSpell(spell_id) &&
!IsGroupSpell(spell_id)
@@ -1630,7 +1642,7 @@ bool IsRegularGroupHealSpell(uint16 spell_id)
);
}
if (spell_id) {
if (IsValidSpell(spell_id)) {
if (
IsGroupSpell(spell_id) &&
!IsCompleteHealSpell(spell_id) &&