符文数据修改

This commit is contained in:
Fang 2023-09-19 14:50:00 +08:00
parent 7e292c16de
commit 1b66ce7d16
5 changed files with 42 additions and 31 deletions

View File

@ -10,6 +10,7 @@ end
function AttrCell:refresh(heroEntity, nodeType, attrType) function AttrCell:refresh(heroEntity, nodeType, attrType)
self.heroEntity = heroEntity self.heroEntity = heroEntity
self.runesEntity = self.heroEntity:getRunes()
self.nodeType = nodeType self.nodeType = nodeType
self.attrName = attrType[self.heroEntity:getMatchType()] self.attrName = attrType[self.heroEntity:getMatchType()]
@ -62,7 +63,7 @@ function AttrCell:showHp()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getHp(self.heroEntity) value = value + DataManager.SkinData:getHp(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -96,7 +97,7 @@ function AttrCell:showAtk()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getAttack(self.heroEntity) value = value + DataManager.SkinData:getAttack(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -120,7 +121,7 @@ function AttrCell:showNormalHurt()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getNormalHurt(self.heroEntity) value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -144,7 +145,7 @@ function AttrCell:showSkillHurt()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getSkillHurt(self.heroEntity) value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -165,7 +166,7 @@ function AttrCell:showCrit()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getCritPercent(self.heroEntity) value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -186,7 +187,7 @@ function AttrCell:showCritAtk()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -213,7 +214,7 @@ function AttrCell:showNormalHurtp()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -240,7 +241,7 @@ function AttrCell:showSkillHurtp()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
@ -261,7 +262,7 @@ function AttrCell:showCured()
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
value = value + DataManager.SkinData:getHealPercent(self.heroEntity) value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
value = value + self.heroEntity:getRunes():getAttrValue(self.attrName) value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))

View File

@ -41,7 +41,8 @@ function AttrNodeCell:isShowAttr(heroEntity, node, attr)
return DataManager.SkinData:hasAttr(heroEntity, attr[heroEntity:getMatchType()]) return DataManager.SkinData:hasAttr(heroEntity, attr[heroEntity:getMatchType()])
end end
if node == GConst.HeroConst.ATTR_SHOW_RUNES then if node == GConst.HeroConst.ATTR_SHOW_RUNES then
return heroEntity:getRunes():hasAttr(attr[heroEntity:getMatchType()]) local runesEntity = heroEntity:getRunes()
return runesEntity and runesEntity:hasAttr(attr[heroEntity:getMatchType()]) or false
end end
return true return true

View File

@ -66,8 +66,8 @@ function HeroAttrUI:isShowAttr(node)
return #DataManager.SkinData:getOwnAllAttr(self.heroEntity) > 0 return #DataManager.SkinData:getOwnAllAttr(self.heroEntity) > 0
end end
if node == GConst.HeroConst.ATTR_SHOW_RUNES then if node == GConst.HeroConst.ATTR_SHOW_RUNES then
local all = self.heroEntity:getRunes():getAllAttr() local runesEntity = self.heroEntity:getRunes()
return all and #all > 0 return runesEntity and runesEntity:getAllAttr() and #runesEntity:getAllAttr() > 0 or false
end end
return true return true

View File

@ -205,16 +205,21 @@ end
function HeroEntity:updateRunesAttr() function HeroEntity:updateRunesAttr()
self.runesAttr = {} self.runesAttr = {}
local hp = self:getRunes():getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()]) local runesEntity = self:getRunes()
local atk = self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()]) if runesEntity == nil then
local normalHurt = self:getRunes():getAttrValue(GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()]) return
local skillHurt = self:getRunes():getAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()]) end
local critPer = self:getRunes():getAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()])
local critHurtPer = self:getRunes():getAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]) local hp = runesEntity:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()])
local normalHurtPer = self:getRunes():getAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], true) local atk = runesEntity:getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()])
local skillHurtPer = self:getRunes():getAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], true) local normalHurt = runesEntity:getAttrValue(GConst.MATCH_NORMAL_HURT_NAME[self:getMatchType()])
local healPer = self:getRunes():getAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()]) local skillHurt = runesEntity:getAttrValue(GConst.MATCH_SKILL_HURT_NAME[self:getMatchType()])
local allHurtp = self:getRunes():getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()]) local critPer = runesEntity:getAttrValue(GConst.MATCH_CRIT_NAME[self:getMatchType()])
local critHurtPer = runesEntity:getAttrValue(GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()])
local normalHurtPer = runesEntity:getAttrValue(GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()], true)
local skillHurtPer = runesEntity:getAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], true)
local healPer = runesEntity:getAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()])
local allHurtp = runesEntity:getAttrValue(GConst.MATCH_ALL_HURTP_NAME[self:getMatchType()])
self.runesAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp self.runesAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp
self.runesAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk self.runesAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk
@ -556,7 +561,12 @@ function HeroEntity:getTotalBaseHp()
end end
end end
result = result + DataManager.SkinData:getBaseHp(self) result = result + DataManager.SkinData:getBaseHp(self)
result = result + self:getRunes():getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()], true)
local runesEntity = self:getRunes()
if runesEntity then
result = result + runesEntity:getAttrValue(GConst.MATCH_HP_FIX_NAME[self:getMatchType()], true)
end
return result return result
end end
@ -574,8 +584,11 @@ function HeroEntity:getTotalBaseAtk()
end end
-- logStr = logStr .. "\nSKIN" .. DataManager.SkinData:getBaseAttack(self) -- logStr = logStr .. "\nSKIN" .. DataManager.SkinData:getBaseAttack(self)
result = result + DataManager.SkinData:getBaseAttack(self) result = result + DataManager.SkinData:getBaseAttack(self)
local runesEntity = self:getRunes()
if runesEntity then
-- logStr = logStr .. "\nRUNES" .. self:getRunes():getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], 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) result = result + runesEntity:getAttrValue(GConst.MATCH_ATTACK_NAME[self:getMatchType()], true)
end
-- Logger.logHighlight(logStr) -- Logger.logHighlight(logStr)
return result return result
end end
@ -612,11 +625,7 @@ function HeroEntity:setRunes(runesEntity)
end end
function HeroEntity:getRunes() function HeroEntity:getRunes()
if self.runesEntity then
return self.runesEntity return self.runesEntity
end end
return DataManager.RunesData:getRunes(self:getCfgId())
end
return HeroEntity return HeroEntity

View File

@ -12,7 +12,7 @@ end
function RunesEntity:updateGrids(grids) function RunesEntity:updateGrids(grids)
self.grids = grids or GConst.EMPTY_TABLE self.grids = grids or GConst.EMPTY_TABLE
self:getHeroEntity():onRunesAttrChange() self:getHeroEntity():setRunes(self)
self:setDirty() self:setDirty()
end end