65 lines
1.9 KiB
Lua
65 lines
1.9 KiB
Lua
------------------------------------------------
|
|
--作者: yangqf
|
|
--日期: 2021-03-18
|
|
--文件: HolyEquipSoul.lua
|
|
--模块: HolyEquipSoul
|
|
--描述: 圣魂数据
|
|
------------------------------------------------
|
|
local RedPointItemCondition = CS.Thousandto.Code.Logic.RedPointItemCondition
|
|
|
|
local HolyEquipSoul = {
|
|
--物品ID
|
|
ItemID = 0,
|
|
--当前数量
|
|
CurCount = 0,
|
|
--最大数量
|
|
MaxCount = 0,
|
|
--单个属性
|
|
SinglePros = nil,
|
|
--总属性
|
|
AllPros = nil,
|
|
}
|
|
|
|
function HolyEquipSoul:New(itemID, maxCount)
|
|
local _m = Utils.DeepCopy(self)
|
|
_m.ItemID = itemID
|
|
_m.MaxCount = maxCount
|
|
_m.SinglePros = {}
|
|
local _itemCfg = DataConfig.DataItem[itemID]
|
|
if _itemCfg ~= nil then
|
|
local _paramTable = Utils.SplitStrByTableS(_itemCfg.EffectNum, {';', '_'})
|
|
for i = 1, #_paramTable do
|
|
local _type = _paramTable[i][2]
|
|
local _value = _paramTable[i][3]
|
|
local _oriValue = _m.SinglePros[_type]
|
|
if _oriValue == nil then
|
|
_oriValue = 0
|
|
end
|
|
_m.SinglePros[_type] = _oriValue + _value
|
|
end
|
|
end
|
|
_m.CurCount = -1
|
|
_m:SetCurCount(0)
|
|
return _m
|
|
end
|
|
|
|
function HolyEquipSoul:SetCurCount(count)
|
|
if self.CurCount ~= count then
|
|
GameCenter.RedPointSystem:RemoveFuncCondition(FunctionStartIdCode.HolyEquipSoul, self.ItemID)
|
|
self.CurCount = count
|
|
if self.CurCount < self.MaxCount then
|
|
--没吃满的情况下才有红点
|
|
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.HolyEquipSoul, self.ItemID, RedPointItemCondition(self.ItemID, 1))
|
|
end
|
|
self:CalculatePros()
|
|
end
|
|
end
|
|
|
|
function HolyEquipSoul:CalculatePros()
|
|
self.AllPros = {}
|
|
for k, v in pairs(self.SinglePros) do
|
|
self.AllPros[k] = v * self.CurCount
|
|
end
|
|
end
|
|
|
|
return HolyEquipSoul |