From 7d7519b6cf498839c284881c702b378b5196cd5d Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 20 Jul 2023 19:34:09 +0800 Subject: [PATCH] review --- lua/app/userdata/hero/hero_entity.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index db119246..1bdfaa6e 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -48,14 +48,20 @@ function HeroEntity:getAllAttr() if self.allAttr == nil then self:initAttr() end + local needUpdate = false + if self.baseAttrDirty == true then + needUpdate = true self.baseAttrDirty = false self:updateBaseAttr() - self:updateTotalAttr() end if self.equipAttrDirty == true then + needUpdate = true self.equipAttrDirty = false self:updateEquipAttr() + end + + if needUpdate then self:updateTotalAttr() end return self.allAttr