spells do everything you are asking about. Here is an example of how to implement a burst spell similar to Fireburst/Shockburst, which seems to be what you want:
Code: Select all
-- Disrupt: Burst spell. Severely damages undead, elementals, and constructs. Water 4.
-- Also destroys goromorg shields.
defineSpell{
name = "disrupt",
uiName = "Disrupt",
gesture = 4569,
manaCost = 50,
skill = "water_magic",
requirements = { "water_magic", 4 },
iconAtlas = "mod_assets/MinAssets/spells/spells_large.tga",
icon = 0,
spellIconAtlas = "mod_assets/MinAssets/spells/spells_small.tga",
spellIcon = 0,
description = "Disrupts magical fields directly in front of you. This shatters magical shields and severely damages undead, elementals, and constructs, but has no effect on living flesh.",
onCast = function(champion,x,y,direction,elevation,skill)
local nx = x
local ny = y
local obs = party.map:checkObstacle(party,direction)
if (not obs) or obs == "dynamic_obstacle" or obs == "obstacle" then
local dx,dy = getForward(direction)
nx = x+dx
ny = y+dy
end
local burst = spawn("disrupt_burst",party.level,nx,ny,direction,elevation)
burst.tiledamager:setAttackPower(80*(1+skill*0.2)) -- meteor storm is 150 total attack power
burst.tiledamager:setCastByChampion(champion:getOrdinal())
end,
}
defineObject{
name = "disrupt_burst",
baseObject = "base_spell",
components = {
{
class = "Particle",
particleSystem = "disrupt",
offset = vec(0, 1.2, 0),
destroyObject = true,
},
{
class = "Light",
color = vec(0.8, 0.2, 1),
brightness = 40,
range = 4,
offset = vec(0, 1.2, 0),
fadeOut = 1.5,
disableSelf = true,
},
{
class = "TileDamager",
attackPower = 80,
damageType = "disruption", -- custom damage type that wont be affected by resistances
sound = "dispel_hit",
onHitMonster = function(self, monster)
if monster:isAlive() then
-- kill shields
for _,c in monster.go:componentIterator() do
if c:getClass() == "GoromorgShieldComponent" and c:getEnergy() > 0 then
c:setEnergy(1)
return true
end
end
-- only damage undead, elementals, constructs
return monster:hasTrait("undead") or monster:hasTrait("construct") or monster:hasTrait("elemental") or false
end
end,
onHitChampion = function(self, champion)
-- champions aren't undead, elementals, or constructs
return false
end,
onHitObstacle = function(self, obstacle)
-- obstacles aren't undead, elementals, or constructs either
-- (well, I guess you could say barrels are constructs...not magical ones though)
return false
end,
},
{
class = "Sound",
sound = "light",
pitch = 1.6,
},
},
}
I am not sure why you are spawning 11 wall_fire objects on the same square, however. Surely it would be better to just spawn 1 with more attack power.