Ressurection spell code
Posted: Sun Dec 04, 2016 9:37 pm
Here is code for a ressurection spell.
I will heal dead champions for 25 health
and do nothing for champions that are alive.
defineSpell{
name = "rez",
uiName = "Ressurection",
skill = "water_magic",
requirements = { "water_magic", 5, "earth_magic", 5 },
icon = 71,
spellIcon = 4,
gesture = 2365478,
manaCost = 150,
description = "Conjures a Light of Life that ressurects dead champions.",
onCast = function(champion, x, y, direction, elevation, skillLevel)
local dX,dY = getForward(party.facing) --Directional offsets
if party.map:isWall(party.x+dX, party.y+dY, party.elevation) then
dX,dY = 0,0 --Targets Party's cell if cast on a wall
end
--spell cast and tagged for the champion who cast it.
spawn("earthheal", party.level, party.x, party.y, party.facing, party.elevation)
local heal_amount = math.random(125,175)
hudPrint(champion:getName() .. " Casted Ressurection.")
for i=1,4 do
local c = party.party:getChampion(i)
if (c:getBaseStat("health") == 0) then
party.party:getChampion(i):modifyBaseStat("health", 25)
else
party.party:getChampion(i):modifyBaseStat("health", 0)
end
playSound("heal_party")
end
end
}
defineObject{
name = "earthheal",
baseObject = "base_spell",
components = {
{
class = "Particle",
particleSystem = "teleport_screen",
offset = vec(0, 1.5, 0),
},
{
class = "Light",
offset = vec(1.5, 1.0, 0),
color = vec(0.5, 0.5, 0.25),
brightness = 7,
range = 5,
fadeOut = 13,
disableSelf = true,
},
{
class = "CloudSpell",
attackPower = 0,
damageInterval = 2,
damageType = "fire",
duration = 1,
},
},
}
I will heal dead champions for 25 health
and do nothing for champions that are alive.
defineSpell{
name = "rez",
uiName = "Ressurection",
skill = "water_magic",
requirements = { "water_magic", 5, "earth_magic", 5 },
icon = 71,
spellIcon = 4,
gesture = 2365478,
manaCost = 150,
description = "Conjures a Light of Life that ressurects dead champions.",
onCast = function(champion, x, y, direction, elevation, skillLevel)
local dX,dY = getForward(party.facing) --Directional offsets
if party.map:isWall(party.x+dX, party.y+dY, party.elevation) then
dX,dY = 0,0 --Targets Party's cell if cast on a wall
end
--spell cast and tagged for the champion who cast it.
spawn("earthheal", party.level, party.x, party.y, party.facing, party.elevation)
local heal_amount = math.random(125,175)
hudPrint(champion:getName() .. " Casted Ressurection.")
for i=1,4 do
local c = party.party:getChampion(i)
if (c:getBaseStat("health") == 0) then
party.party:getChampion(i):modifyBaseStat("health", 25)
else
party.party:getChampion(i):modifyBaseStat("health", 0)
end
playSound("heal_party")
end
end
}
defineObject{
name = "earthheal",
baseObject = "base_spell",
components = {
{
class = "Particle",
particleSystem = "teleport_screen",
offset = vec(0, 1.5, 0),
},
{
class = "Light",
offset = vec(1.5, 1.0, 0),
color = vec(0.5, 0.5, 0.25),
brightness = 7,
range = 5,
fadeOut = 13,
disableSelf = true,
},
{
class = "CloudSpell",
attackPower = 0,
damageInterval = 2,
damageType = "fire",
duration = 1,
},
},
}