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

29 lines
881 B
Lua

local ChoregraphyActionParent = require "scenes.battlesystem.actors.systems.actions.parent"
local SendDamage = ChoregraphyActionParent:extend()
function SendDamage:new(system, args, effectArea)
SendDamage.super.new(self, system, args, effectArea)
end
function SendDamage:start()
local xx, yy
if self.args.name == "sendDamageFromCursor" then
xx = self.controller.dx
yy = self.controller.dy
elseif self.args.name == "sendDamageFromPos" then
xx = utils.math.round(self.actor.x)
yy = utils.math.round(self.actor.y)
end
local dx = self.args.dx
if (self.args.affectedByDirection) then
dx = dx * self.controller.direction
end
xx = xx + dx
yy = yy + self.args.dy
self.controller.haveSentDamage = self.actor:sendDamage(xx, yy, self.args.power, self.args.accuracy, self.args.isSpecial, self.args.isAerial)
self:finish()
end
return SendDamage