feat: add effect description

Fix #58
This commit is contained in:
Kazhnuz 2020-09-19 11:10:20 +02:00
parent 94e384ee27
commit cf396e9464
7 changed files with 102 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"
}

View file

@ -1,7 +1,8 @@
local EffectParent = Object:extend()
function EffectParent:new(effect, character)
self.effect = effect
self.character = character
end
function EffectParent:applyEffect()

View file

@ -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

View file

@ -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