local condition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_SUBID, 88888)
condition:setParameter(CONDITION_PARAM_TICKS, 5 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 0.01)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 5 * 1000)

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setFormula(COMBAT_FORMULA_DAMAGE, -7000, 0, -10000, 0)

 arr1 = {
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area1 = createCombatArea(arr1)
combat:setArea(area1)

-----------------------------------------------------------------------------

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat2:setFormula(COMBAT_FORMULA_DAMAGE, -7000, 0, -10000, 0)

 arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area2 = createCombatArea(arr2)
combat2:setArea(area2)

--------------------------------------------------------------------------

local combat3 = Combat()
combat3:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat3:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat3:setFormula(COMBAT_FORMULA_DAMAGE, -7000, 0, -10000, 0)

 arr3 = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area3 = createCombatArea(arr3)
combat3:setArea(area3)

--------------------------------------------------------------------------

local combat4 = Combat()
combat4:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat4:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat4:setFormula(COMBAT_FORMULA_DAMAGE, -7000, 0, -10000, 0)

 arr4 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area4 = createCombatArea(arr4)
combat4:setArea(area4)

--------------------------------------------------------------

local spell = Spell("instant")

function spell.onCastSpell(creature, var)
	if not creature:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, 88888) then
		creature:say("OMRAFIR INHALES DEEPLY!", TALKTYPE_ORANGE_2)
		creature:addCondition(condition)
		addEvent(function(cid, var)
		local creature = Creature(cid)
		if not creature then
			return
		end
		if creature:getDirection() == 0 then
			combat:execute(creature, positionToVariant(creature:getPosition()))
		elseif creature:getDirection() == 1 then
			combat2:execute(creature, positionToVariant(creature:getPosition()))
		elseif creature:getDirection() == 2 then
			combat3:execute(creature, positionToVariant(creature:getPosition()))
		elseif creature:getDirection() == 3 then
			combat4:execute(creature, positionToVariant(creature:getPosition()))
		end
	creature:say("OMRAFIR BREATHES INFERNAL FIRE", TALKTYPE_ORANGE_2)
end, 4000, creature:getId(), var)
	else
		return
	end
    return true
end

spell:name("omrafir beam")
spell:words("###331")
spell:isAggressive(true)
spell:blockWalls(true)
spell:needLearn(true)
spell:register()