c1_lua/lua/app/userdata/battle/skill/battle_buff_entity.lua
2023-06-14 15:34:21 +08:00

146 lines
3.1 KiB
Lua

local BattleConst = require "app/module/battle/battle_const"
local BattleBuffEntity = class("BattleBuffEntity", BaseData)
local BUFF_TYPE_DIRECT_HURT = BattleConst.BUFF_TYPE.DIRECT_HURT
function BattleBuffEntity:ctor()
end
function BattleBuffEntity:init(effectParams, owner, hostSkill)
self.name = effectParams.type
self.effectNum = effectParams.num
self.round = effectParams.round
self.ratio = effectParams.ratio
self.owner = owner
self.hostSkill = hostSkill
self.targetSide = nil
self.buffInfo = ConfigManager:getConfigWithOtherKey("buff", "name")[self.name]
self.buffType = self.buffInfo.buff_type
self.cantRemove = false
self.notShowIcon = false
self.showNameStr = nil
self.showNameRedColor = nil
end
function BattleBuffEntity:setOwner(owner)
self.owner = owner
end
function BattleBuffEntity:getName()
return self.name
end
function BattleBuffEntity:getHostSkill()
return self.hostSkill
end
function BattleBuffEntity:getDesc()
return GFunc.getBuffDesc(self:getName(), self:getEffectNum())
end
function BattleBuffEntity:getBuffType()
return self.buffType
end
function BattleBuffEntity:getIsHurtType()
return self.buffType == BUFF_TYPE_DIRECT_HURT
end
function BattleBuffEntity:getEffectNum()
return self.effectNum
end
function BattleBuffEntity:setEffectNum(num)
self.effectNum = num
end
function BattleBuffEntity:getFormula()
return self.buffInfo.formula
end
function BattleBuffEntity:getRatio()
return self.ratio
end
function BattleBuffEntity:setRatio(ratio)
self.ratio = ratio
end
function BattleBuffEntity:getRound()
return self.round
end
function BattleBuffEntity:setRound(num)
self.round = num
end
function BattleBuffEntity:getTargetSide()
return self.targetSide
end
function BattleBuffEntity:setTargetSide(side)
self.targetSide = side
end
function BattleBuffEntity:getStack()
return self.buffInfo.stack
end
function BattleBuffEntity:getDecr()
return self.buffInfo.decr
end
function BattleBuffEntity:getIcon()
return self.buffInfo.icon
end
function BattleBuffEntity:getFxContinued()
return self.buffInfo.fx_continued
end
function BattleBuffEntity:getFxGet()
return self.buffInfo.fx_get
end
function BattleBuffEntity:getFxTake()
return self.buffInfo.fx_take
end
function BattleBuffEntity:getFxDisappear()
return self.buffInfo.fx_disappear
end
function BattleBuffEntity:getShowName(needRedColor)
if not self.showNameStr then
self.showNameStr = I18N:getTextWithOtherKey("buff", "name", self:getName(), "show_name")
end
if not self.showNameRedColor and self.showNameStr then
self.showNameRedColor = "<color=#E35F6A>" .. self.showNameStr .. "</color>"
end
if needRedColor then
return self.showNameRedColor
end
return self.showNameStr
end
function BattleBuffEntity:needShowName()
return self.buffInfo.show_name
end
function BattleBuffEntity:isCantRemove()
return self.cantRemove
end
function BattleBuffEntity:setIsCantRemove(cantRemove)
self.cantRemove = cantRemove
end
function BattleBuffEntity:getNotShowIcon()
return self.notShowIcon
end
function BattleBuffEntity:setNotShowIcon(notShow)
self.notShowIcon = notShow
end
return BattleBuffEntity