From cf396e94646f9db5c4277ba69c8868196b2735ec Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 19 Sep 2020 11:10:20 +0200 Subject: [PATCH] feat: add effect description Fix #58 --- .../game/loot/effectManager.lua | 4 +-- .../game/loot/effects/blockstatus.lua | 17 +++++++++++ .../game/loot/effects/heal.lua | 28 +++++++++++++++++ .../game/loot/effects/init.lua | 5 +++- .../game/loot/effects/parent.lua | 3 +- .../game/loot/effects/protectelem.lua | 19 ++++++++++++ .../game/loot/effects/setstatus.lua | 30 +++++++++++++++++++ 7 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 sonic-radiance.love/game/loot/effects/blockstatus.lua create mode 100644 sonic-radiance.love/game/loot/effects/heal.lua create mode 100644 sonic-radiance.love/game/loot/effects/protectelem.lua create mode 100644 sonic-radiance.love/game/loot/effects/setstatus.lua diff --git a/sonic-radiance.love/game/loot/effectManager.lua b/sonic-radiance.love/game/loot/effectManager.lua index d3a9d99..1ee0672 100644 --- a/sonic-radiance.love/game/loot/effectManager.lua +++ b/sonic-radiance.love/game/loot/effectManager.lua @@ -23,13 +23,13 @@ function EffectManager:getEffectStrings(character) if (#self.itemdata.effects >= 1) then local effectInstance = self:getEffectObject(self.itemdata.effects[1], character) if (effectInstance ~= nil) then - returnString = effectInstance:applyEffect() .. "\n" + returnString = effectInstance:getText() .. "\n" end end if (#self.itemdata.effects >= 2) then local effectInstance = self:getEffectObject(self.itemdata.effects[2], character) if (effectInstance ~= nil) then - returnString = effectInstance:applyEffect() + returnString = returnString .. effectInstance:getText() end end return returnString diff --git a/sonic-radiance.love/game/loot/effects/blockstatus.lua b/sonic-radiance.love/game/loot/effects/blockstatus.lua new file mode 100644 index 0000000..0248224 --- /dev/null +++ b/sonic-radiance.love/game/loot/effects/blockstatus.lua @@ -0,0 +1,17 @@ +local ParentEffect = require "game.loot.effects.parent" +local BlockStatusEffect = ParentEffect:extend() + +function BlockStatusEffect:new(effect, character) + self.effect = effect + self.character = character +end + +function BlockStatusEffect:applyEffect() + +end + +function BlockStatusEffect:getText() + return "Block " .. self.effect.blockWhat .. " " .. "effects" +end + +return BlockStatusEffect \ No newline at end of file diff --git a/sonic-radiance.love/game/loot/effects/heal.lua b/sonic-radiance.love/game/loot/effects/heal.lua new file mode 100644 index 0000000..b7e2c91 --- /dev/null +++ b/sonic-radiance.love/game/loot/effects/heal.lua @@ -0,0 +1,28 @@ +local ParentEffect = require "game.loot.effects.parent" +local HealEffect = ParentEffect:extend() + +function HealEffect:new(effect, character) + self.effect = effect + self.character = character +end + +function HealEffect:applyEffect() + +end + +function HealEffect:getText() + local num = self.effect.value + if (self.effect.computationMode == "percent") then + num = num .. "%" + end + local type = "" + if (self.effect.healType == "hp") then + type = "HP" + end + if (self.effect.healType == "mp") then + type = "MP" + end + return "Heal " .. num .. " " .. type; +end + +return HealEffect \ No newline at end of file diff --git a/sonic-radiance.love/game/loot/effects/init.lua b/sonic-radiance.love/game/loot/effects/init.lua index a210b28..177e9b7 100644 --- a/sonic-radiance.love/game/loot/effects/init.lua +++ b/sonic-radiance.love/game/loot/effects/init.lua @@ -1,3 +1,6 @@ return { - + heal = require "game.loot.effects.heal", + setStatus = require "game.loot.effects.setstatus", + protectElement = require "game.loot.effects.protectelem", + blockStatus = require "game.loot.effects.blockstatus" } \ No newline at end of file diff --git a/sonic-radiance.love/game/loot/effects/parent.lua b/sonic-radiance.love/game/loot/effects/parent.lua index f055836..d3c85b2 100644 --- a/sonic-radiance.love/game/loot/effects/parent.lua +++ b/sonic-radiance.love/game/loot/effects/parent.lua @@ -1,7 +1,8 @@ local EffectParent = Object:extend() function EffectParent:new(effect, character) - + self.effect = effect + self.character = character end function EffectParent:applyEffect() diff --git a/sonic-radiance.love/game/loot/effects/protectelem.lua b/sonic-radiance.love/game/loot/effects/protectelem.lua new file mode 100644 index 0000000..f509c7a --- /dev/null +++ b/sonic-radiance.love/game/loot/effects/protectelem.lua @@ -0,0 +1,19 @@ +local ParentEffect = require "game.loot.effects.parent" +local ProtectElemEffect = ParentEffect:extend() + +function ProtectElemEffect:new(effect, character) + self.effect = effect + self.character = character +end + +function ProtectElemEffect:applyEffect() + +end + +function ProtectElemEffect:getText() + local returnString = "Protect from " .. self.effect.element + + return returnString +end + +return ProtectElemEffect \ No newline at end of file diff --git a/sonic-radiance.love/game/loot/effects/setstatus.lua b/sonic-radiance.love/game/loot/effects/setstatus.lua new file mode 100644 index 0000000..72f9cea --- /dev/null +++ b/sonic-radiance.love/game/loot/effects/setstatus.lua @@ -0,0 +1,30 @@ +local ParentEffect = require "game.loot.effects.parent" +local StatusEffect = ParentEffect:extend() + +function StatusEffect:new(effect, character) + self.effect = effect + self.character = character +end + +function StatusEffect:applyEffect() + +end + +function StatusEffect:getText() + local returnString = "" + if (self.effect.set) then + returnString = returnString .. "Give " + else + returnString = returnString .. "Remove " + end + + if (self.effect.status == "allNegative") then + returnString = returnString .. "all negative effects" + else + returnString = returnString .. self.effect.status .. " " .. "effect" + end + + return returnString +end + +return StatusEffect \ No newline at end of file