forgottenserver/data/scripts/spells/support/creature_illusion.lua
Ranieri Althoff 25df9cfd38
Move spells to scripts folder (#4755)
* Move runes to dedicated folder
* Redirect old XML and lib folder to new location
* Drop unused custom spells
2024-09-20 00:13:59 +02:00

38 lines
1.1 KiB
Lua

local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(180000)
local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant)
local returnValue = RETURNVALUE_NOERROR
local monsterType = MonsterType(variant:getString())
if not monsterType then
returnValue = RETURNVALUE_CREATUREDOESNOTEXIST
elseif not creature:hasFlag(PlayerFlag_CanIllusionAll) and not monsterType:isIllusionable() then
returnValue = RETURNVALUE_NOTPOSSIBLE
end
if returnValue ~= RETURNVALUE_NOERROR then
creature:sendCancelMessage(returnValue)
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
condition:setOutfit(monsterType:getOutfit())
creature:addCondition(condition)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
return true
end
spell:group("support")
spell:id(38)
spell:name("Creature Illusion")
spell:words("utevo res ina")
spell:level(23)
spell:mana(100)
spell:isAggressive(false)
spell:hasParams(true)
spell:cooldown(2000)
spell:groupCooldown(2000)
spell:vocation("sorcerer;true", "druid;true", "master sorcerer;true", "elder druid;true")
spell:register()