From 04ae4ef65760118a590370cf3f4eaa3da295a17a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 7 Aug 2020 13:15:04 +0200 Subject: [PATCH] feat: add cheapEffect Fix #26 --- .../scenes/battlesystem/actors/ennemy.lua | 7 +++++++ .../scenes/battlesystem/actors/parent.lua | 9 +++++---- .../scenes/battlesystem/controllers/ennemy.lua | 2 +- .../scenes/battlesystem/controllers/fighters/villain.lua | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua index 33c4d71..0259c4f 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua @@ -11,6 +11,13 @@ function Ennemy:new(world, x, y, owner) self:initSprite() end +function Ennemy:setCheapEffect(cheapEffect) + if (cheapEffect) then + self.sprite.sx = 2 + self.sprite.sy = 2 + end +end + function Ennemy:draw() self:drawSprite(0, -self.z) local x, y = self.world.map:gridToPixel(self.x, self.y, true) diff --git a/sonic-radiance.love/scenes/battlesystem/actors/parent.lua b/sonic-radiance.love/scenes/battlesystem/actors/parent.lua index d2d4775..9f7bf7d 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/parent.lua @@ -166,11 +166,12 @@ function Parent:drawSprite(tx, ty) local ty = ty or 0 if (self.sprite.active) then - + local sx = self.direction * self.sprite.sx + local sy = self.sprite.sy if (self.sprite.clone ~= nil) then - self.sprite.clone:draw(x + tx, y + ty, 0, self.direction, 1, self.sprite.ox, self.sprite.oy) + self.sprite.clone:draw(x + tx, y + ty, 0, sx, sy, self.sprite.ox, self.sprite.oy) else - self.assets.sprites[self.sprite.name]:drawAnimation(x + tx, y + ty, 0, self.direction, 1, self.sprite.ox, self.sprite.oy) + self.assets.sprites[self.sprite.name]:drawAnimation(x + tx, y + ty, 0, sx, sy, self.sprite.ox, self.sprite.oy) end end end @@ -184,7 +185,7 @@ end function Parent:drawShadow() local x, y = self.world.map:gridToPixel(self.x, self.y, true) - self.assets.images["actorsShadow"]:draw(x, y, 0, 1, 1, 12, 5) + self.assets.images["actorsShadow"]:draw(x, y, 0, self.sprite.sx, self.sprite.sy, 12, 5) if (self.isSelected == true) then self.assets.sprites["cursorground"]:drawAnimation(x - 2, y - 1, 0, 1, 1, 12, 5) end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/ennemy.lua b/sonic-radiance.love/scenes/battlesystem/controllers/ennemy.lua index 6d1764f..bf3724a 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/ennemy.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/ennemy.lua @@ -33,7 +33,7 @@ function EnnemyController:addBoss(ennData) local boss = Villain(self, ennData.category, ennData.name, self:count() + 1) boss:setBonus(ennData.pvFactor, ennData.statFactor) boss.isBoss = true - boss.cheapEffect = ennData.cheapEffect + boss:setCheapEffect(ennData.cheapEffect) self:add(boss) end diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua index f635d2a..6751c1d 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/villain.lua @@ -18,6 +18,10 @@ function VillainFighter:new(owner, category, ennemy, id) self.isBoss = false end +function VillainFighter:setCheapEffect(cheapEffect) + self.actor:setCheapEffect(cheapEffect) +end + function VillainFighter:updateAssets(dt) self.hpbar:update(dt) end