From 228bf96ecfe191044158ce2cf7ecdb42a54acb95 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 28 Jul 2023 16:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/userdata/hero/hero_entity.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index b9aad3ae..bb62c403 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -8,13 +8,13 @@ function HeroEntity:ctor(cfgId, lv, collectionLevel) self.data.collectionLevel = collectionLevel self.config = ConfigManager:getConfig("hero")[self.cfgId] self.beginLv = self.config.begin_lv -- 初始等级 -end -function HeroEntity:initAttr() self.baseAttrOriginal = {} self.equipAttr = {} self.allAttr = {} +end +function HeroEntity:initAttr() self:setTotalAttrValue(ATTR_NAME.HP, 0) self:setTotalAttrValue(ATTR_NAME.ATK, 0) self:setTotalAttrValue(ATTR_NAME.ATK_RED, 0) @@ -168,7 +168,7 @@ function HeroEntity:addTotalAttrValue(name, add) end function HeroEntity:getTotalAttrValue(name) - if self.allAttr == nil then + if #table.keys(self.allAttr) == 0 then self:initAttr() end if not self.allAttr[name] then