sonic-radiance/sonic-radiance.love/scenes/battlesystem/actors/systems/actions/sendDamage.lua

39 lines
1.1 KiB
Lua

local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent"
local SendDamage = ChoregraphyActionParent:extend()
local maputils = require "scenes.battlesystem.utils"
function SendDamage:new(system, args, effectArea)
SendDamage.super.new(self, system, args, effectArea)
end
function SendDamage:start()
local power = self.args.power
local accuracy = self.args.accuracy
local isSpecial = self.args.isSpecial
local isAerial = self.args.isAerial
local dx = self.effectArea[1]
if self.effectArea[5] then
dx = dx * self.controller.direction
end
local ox = self.controller.startx + dx
local oy = self.controller.starty + self.effectArea[2]
local grid = maputils.maskToMap(ox, oy, self.effectArea[3], self.effectArea[4], self.controller.direction)
local test = false
for i, line in ipairs(grid) do
for j, case in ipairs(line) do
if grid[i][j] == 1 then
test = self.actor:sendDamage(j, i, power, accuracy, isSpecial, isAerial)
end
end
end
self.controller.haveSentDamage = test
self:finish()
end
return SendDamage