bool IsBeneficialSpell(uint16 spell_id) { if(!IsValidSpell(spell_id)) return false; if(spells[spell_id].goodEffect == 1){ SpellTargetType tt = spells[spell_id].targettype; if(tt != ST_Self && tt != ST_Pet){ if(IsEffectInSpell(spell_id, SE_CancelMagic)) return false; } if(tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead || tt == ST_Pet) { uint16 sai = spells[spell_id].SpellAffectIndex; if(spells[spell_id].resisttype == RESIST_MAGIC){ if(sai == SAI_Calm || sai == SAI_Dispell_Sight || sai == SAI_Memory_Blur || sai == SAI_Calm_Song) return false; }else{ // Bind Sight and Cast Sight if(sai == SAI_Dispell_Sight && spells[spell_id].skill == 18 && !IsEffectInSpell(spell_id, SE_VoiceGraft)) return false; } } } return spells[spell_id].goodEffect != 0 || IsGroupSpell(spell_id); }
bool IsSummonPetSpell(uint16 spell_id) { return ( IsEffectInSpell(spell_id, SE_SummonPet) || IsEffectInSpell(spell_id, SE_SummonBSTPet) ); }
bool IsMaloSpell(int16 spell_id) { if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_ResistFire) && IsEffectInSpell(spell_id, SE_ResistCold) && IsEffectInSpell(spell_id, SE_ResistPoison) && IsEffectInSpell(spell_id, SE_ResistMagic)){ return true; } else { return false; } }
bool IsSummonPetSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_SummonPet) || IsEffectInSpell(spell_id, SE_SummonBSTPet)) return true; return false; }
bool IsLDoNObjectSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_AppraiseLDonChest) || IsEffectInSpell(spell_id, SE_DisarmLDoNTrap) || IsEffectInSpell(spell_id, SE_UnlockLDoNChest)) return true; return false; }
bool IsSelfConversionSpell(uint16 spell_id) { if (GetSpellTargetType(spell_id) == ST_Self && IsEffectInSpell(spell_id, SE_CurrentMana) && IsEffectInSpell(spell_id, SE_CurrentHP) && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentMana)] > 0 && spells[spell_id].base[GetSpellEffectIndex(spell_id, SE_CurrentHP)] < 0) return true; else return false; }
bool IsDebuffSpell(uint16 spell_id) { if(IsBeneficialSpell(spell_id) || IsEffectHitpointsSpell(spell_id) || IsStunSpell(spell_id) || IsMezSpell(spell_id) || IsCharmSpell(spell_id) || IsSlowSpell(spell_id) || IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_CancelMagic) || IsEffectInSpell(spell_id, SE_MovementSpeed) || IsFearSpell(spell_id) || IsEffectInSpell(spell_id, SE_Calm)) return false; else return true; }
bool IsResistDebuffSpell(uint16 spell_id) { if((IsEffectInSpell(spell_id, SE_ResistFire) || IsEffectInSpell(spell_id, SE_ResistCold) || IsEffectInSpell(spell_id, SE_ResistPoison) || IsEffectInSpell(spell_id, SE_ResistDisease) || IsEffectInSpell(spell_id, SE_ResistMagic) || IsEffectInSpell(spell_id, SE_ResistAll) || IsEffectInSpell(spell_id, SE_ResistCorruption)) && !IsBeneficialSpell(spell_id)) return true; else return false; }
bool IsPartialCapableSpell(uint16 spell_id) { if(IsPureNukeSpell(spell_id) || IsFearSpell(spell_id) || IsEffectInSpell(spell_id, SE_Root) || IsEffectInSpell(spell_id, SE_Charm)) { return true; } return false; }
bool IsSuccorSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_Succor)) return true; return false; }
bool IsHealOverTimeSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_HealOverTime) && !IsGroupSpell(spell_id)) return true; return false; }
// seveian 2008-09-23 bool IsPlayerIllusionSpell(uint16 spell_id) { if(IsEffectInSpell(spell_id, SE_Illusion) && spells[spell_id].targettype == ST_Self) return true; else return false; }
bool IsGateSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_Gate)) return true; return false; }
bool IsCompleteHealSpell(uint16 spell_id) { if(spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) || IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)) return true; else return false; }
bool IsShadowStepSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_ShadowStep)) return true; return false; }
bool IsTeleportSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_Teleport)) return true; return false; }
bool IsDeathSaveSpell(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_DeathSave)) return true; return false; }
bool IsAllianceSpellLine(uint16 spell_id) { if (IsEffectInSpell(spell_id, SE_AddFaction)) return true; return false; }
bool IsAllianceSpellLine(uint16 spell_id) { bool Result = false; if(IsValidSpell(spell_id)) Result = IsEffectInSpell(spell_id, SE_AddFaction); return Result; }
bool IsDispellSpell(int16 spell_id) { if (IsEffectInSpell(spell_id, SE_CancelMagic)){ return true; } else { return false; } }
bool IsSuccorSpell(int16 spell_id) { if (IsEffectInSpell(spell_id, SE_Succor)){ return true; } else { return false; } }
bool IsTeleportSpell(int16 spell_id) { if (IsEffectInSpell(spell_id, SE_Teleport)){ return true; } else { return false; } }
bool IsSnareSpell(int16 spell_id) { if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)){ return true; } else { return false; } }
bool IsDeathSaveSpell(uint16 spell_id) { bool Result = false; if(IsValidSpell(spell_id)) Result = IsEffectInSpell(spell_id, SE_DeathSave); return Result; }
bool IsGateSpell(int16 spell_id) { if (IsEffectInSpell(spell_id, SE_Gate)){ return true; } else { return false; } }
bool IsRootSpell(int16 spell_id) { if (IsEffectInSpell(spell_id, SE_Root)){ return true; } else { return false; } }
bool IsPoisonSpell(int16 spell_id) { if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_PoisonCounter)){ return true; } else { return false; } }
// checks if this spell can be targeted bool IsTGBCompatibleSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (!IsDetrimentalSpell(spell_id) && spells[spell_id].buffduration != 0 && !IsBardSong(spell_id) && !IsEffectInSpell(spell_id, SE_Illusion))) return true; return false; }
bool IsBeneficialSpell(uint16 spell_id) { if (!IsValidSpell(spell_id)) return false; // You'd think just checking goodEffect flag would be enough? if (spells[spell_id].goodEffect == 1) { // If the target type is ST_Self or ST_Pet and is a SE_CancleMagic spell // it is not Beneficial SpellTargetType tt = spells[spell_id].targettype; if (tt != ST_Self && tt != ST_Pet && IsEffectInSpell(spell_id, SE_CancelMagic)) return false; // When our targettype is ST_Target, ST_AETarget, ST_Aniaml, ST_Undead, or ST_Pet // We need to check more things! if (tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead || tt == ST_Pet) { uint16 sai = spells[spell_id].SpellAffectIndex; // If the resisttype is magic and SpellAffectIndex is Calm/memblur/dispell sight // it's not beneficial if (spells[spell_id].resisttype == RESIST_MAGIC) { if (sai == SAI_Calm || sai == SAI_Dispell_Sight || sai == SAI_Memory_Blur || sai == SAI_Calm_Song) return false; } else { // If the resisttype is not magic and spell is Bind Sight or Cast Sight // It's not beneficial if (sai == SAI_Dispell_Sight && spells[spell_id].skill == 18 && !IsEffectInSpell(spell_id, SE_VoiceGraft)) return false; } } } // And finally, if goodEffect is not 0 or if it's a group spell it's beneficial return spells[spell_id].goodEffect != 0 || IsGroupSpell(spell_id); }
bool IsPureNukeSpell(uint16 spell_id) { int i, effect_count = 0; if (!IsValidSpell(spell_id)) return false; for (i = 0; i < EFFECT_COUNT; i++) if (!IsBlankSpellEffect(spell_id, i)) effect_count++; if (effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && spells[spell_id].buffduration == 0 && IsDamageSpell(spell_id)) return true; return false; }