From 96c9cf8c18fca4da46fa62d799caf9e187f83624 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 28 Jul 2023 18:51:03 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/userdata/hero/hero_entity.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index b9aad3ae..adc57940 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -8,6 +8,10 @@ function HeroEntity:ctor(cfgId, lv, collectionLevel) self.data.collectionLevel = collectionLevel self.config = ConfigManager:getConfig("hero")[self.cfgId] self.beginLv = self.config.begin_lv -- 初始等级 + + self.baseAttrOriginal = {} + self.equipAttr = {} + self.allAttr = {} end function HeroEntity:initAttr() @@ -168,9 +172,10 @@ function HeroEntity:addTotalAttrValue(name, add) end function HeroEntity:getTotalAttrValue(name) - if self.allAttr == nil then + if table.nums(self.allAttr) <= 0 then self:initAttr() end + if not self.allAttr[name] then return 0 end