Returns whether a spell can be used against hostile units


See also Spell functions.

Signature:

isHarmful = IsHarmfulSpell(index, "bookType") or IsHarmfulSpell("name")

Arguments:

  • index - Index of a spell in the spellbook (number, spellbookID)

  • bookType - Type of spellbook (string)

    • pet - The pet's spellbook
    • spell - The player's spellbook

  • name - Name of a spell (string)

Returns:

  • isHarmful - 1 if the spell can be used against hostile units; otherwise nil (1nil)

Examples:

-- print a list of harmful spells
local numTabs = GetNumSpellTabs()
for i = 1, numTabs do
  local name, texture, offset, numSpells = GetSpellTabInfo(i)
  for j = 1, numSpells do
    local spellId = j + offset
    local harmful = IsHarmfulSpell(spellId, "spell")
    if harmful then
      local name, rank = GetSpellName(spellId, "spell")
      print(name .. " is a harmful spell")
    end
  end
end