From ae7e52d6ea1e50d6e17f524483699f344340befa Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 13 Sep 2023 17:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=8A=A0=E6=88=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/userdata/hero/hero_entity.lua | 13 ++++++++----- lua/app/userdata/runes/runes_entity.lua | 7 ++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 55fd2317..5e262400 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -211,9 +211,10 @@ function HeroEntity:updateRunesAttr() local skillHurt = self:getRunes():getAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()]) local critPer = self:getRunes():getAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()]) local critHurtPer = self:getRunes():getAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]) - local normalHurtPer = self:getRunes():getAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]) - local skillHurtPer = self:getRunes():getAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]) + local normalHurtPer = self:getRunes():getAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], true) + local skillHurtPer = self:getRunes():getAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], true) local healPer = self:getRunes():getAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()]) + local allHurtp = self:getRunes():getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()]) self.runesAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp self.runesAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk @@ -224,6 +225,7 @@ function HeroEntity:updateRunesAttr() self.runesAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] = normalHurtPer self.runesAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] = skillHurtPer self.runesAttr[GConst.MATCH_CURED_NAME[self:getMatchType()]] = healPer + self.runesAttr[GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()]] = allHurtp if EDITOR_MODE then local printStr = "" @@ -237,6 +239,7 @@ function HeroEntity:updateRunesAttr() printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n" printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n" printStr = printStr .. "治疗加成百分比:".. healPer .. "\n" + printStr = printStr .. "所有伤害百分比:".. allHurtp .. "\n" Logger.logHighlight(printStr) end end @@ -551,7 +554,7 @@ function HeroEntity:getTotalBaseHp() end end result = result + DataManager.SkinData:getBaseHp(self) - result = result + self:getRunes():getAttrValue(GConst.MATCH_HP_FIX_NAME, true) + result = result + self:getRunes():getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()], true) return result end @@ -569,8 +572,8 @@ function HeroEntity:getTotalBaseAtk() end -- logStr = logStr .. "\nSKIN:" .. DataManager.SkinData:getBaseAttack(self) result = result + DataManager.SkinData:getBaseAttack(self) - -- logStr = logStr .. "\nRUNES:" .. self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME, true) - result = result + self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME, true) + -- logStr = logStr .. "\nRUNES:" .. self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], true) + result = result + self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], true) -- Logger.logHighlight(logStr) return result end diff --git a/lua/app/userdata/runes/runes_entity.lua b/lua/app/userdata/runes/runes_entity.lua index fffb0d18..c3270c9a 100644 --- a/lua/app/userdata/runes/runes_entity.lua +++ b/lua/app/userdata/runes/runes_entity.lua @@ -199,6 +199,11 @@ end -- 获取属性 , isBase是否是基础配置的属性 function RunesEntity:getAttrValue(attrType, isBase) + if type(attrType) ~= "string" then + Logger.logError("获取符文属性传入格式错误") + return 0 + end + local result if not isBase and attrType == GConst.MATCH_HP_FIX_NAME[self:getHeroEntity():getMatchType()] then result = self:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getHeroEntity():getMatchType()], true) @@ -210,7 +215,7 @@ function RunesEntity:getAttrValue(attrType, isBase) return result elseif not isBase and (attrType == GConst.MATCH_NORMAL_HURTP_NAME[self:getHeroEntity():getMatchType()] or attrType == GConst.MATCH_SKILL_HURTP_NAME[self:getHeroEntity():getMatchType()]) then result = self:getAttrValue(attrType, true) - result = result + self:getAttrValue(GConst.MATCH_ALL_HURTP_NAME, true) + result = result + self:getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getHeroEntity():getMatchType()], true) return result else local all = self:getAllAttr()