英雄生命值显示fix
This commit is contained in:
parent
a1a13036c9
commit
0eebc9b6cd
@ -500,6 +500,15 @@ GConst.ENTITY_TYPE = {
|
||||
|
||||
GConst.MATCH_HP_NAME = {
|
||||
[0] = "hp",
|
||||
[1] = "hp",
|
||||
[2] = "hp",
|
||||
[3] = "hp",
|
||||
[4] = "hp",
|
||||
[5] = "hp",
|
||||
}
|
||||
|
||||
-- 英雄颜色属性生命值
|
||||
GConst.MATCH_HP_FIX_NAME = {
|
||||
[1] = "attr_hp_red",
|
||||
[2] = "attr_hp_yellow",
|
||||
[3] = "attr_hp_green",
|
||||
|
||||
@ -52,7 +52,7 @@ HeroConst.ATTR_SHOW_ARMOR = {
|
||||
}
|
||||
-- 皮肤
|
||||
HeroConst.ATTR_SHOW_SKIN = {
|
||||
GConst.MATCH_HP_NAME, -- 生命
|
||||
GConst.MATCH_HP_FIX_NAME, -- 生命
|
||||
GConst.MATCH_ATTACK_NAME, -- 攻击
|
||||
GConst.MATCH_NORMAL_HURT_NAME, -- 普攻增伤
|
||||
GConst.MATCH_SKILL_HURT_NAME, -- 技能增伤
|
||||
|
||||
@ -15,7 +15,7 @@ function AttrCell:refresh(heroEntity, nodeType, attrType)
|
||||
self.nodeType = nodeType
|
||||
self.attrName = attrType[self.heroEntity:getMatchType()]
|
||||
|
||||
if attrType == GConst.MATCH_HP_NAME then
|
||||
if attrType == GConst.MATCH_HP_NAME or attrType == GConst.MATCH_HP_FIX_NAME then
|
||||
self:showHp()
|
||||
elseif attrType == GConst.MATCH_ATTACK_NAME then
|
||||
self:showAtk()
|
||||
|
||||
@ -100,9 +100,9 @@ function SkinInfoComp:refreshSelectSkin(selectId)
|
||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
|
||||
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_ATK).."</color>")
|
||||
showValue = curAttr[index].num // PERCENT_FACTOR .. "%"
|
||||
elseif curAttr[index].type == GConst.MATCH_HP_NAME[self.heroEntity:getMatchType()] then
|
||||
elseif curAttr[index].type == GConst.MATCH_HP_FIX_NAME[self.heroEntity:getMatchType()] then
|
||||
-- 生命
|
||||
table.insert(showAttrType, GConst.MATCH_HP_NAME[self.heroEntity:getMatchType()])
|
||||
table.insert(showAttrType, GConst.MATCH_HP_FIX_NAME[self.heroEntity:getMatchType()])
|
||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
|
||||
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_HP).."</color>")
|
||||
showValue = curAttr[index].num // DEFAULT_FACTOR
|
||||
|
||||
@ -329,7 +329,7 @@ function HeroEntity:getAtk()
|
||||
end
|
||||
|
||||
function HeroEntity:getHp()
|
||||
local hpName = GConst.MATCH_HP_NAME[self:getMatchType()]
|
||||
local hpName = ATTR_NAME.HP
|
||||
local hpAddName = GConst.MATCH_HP_ADD_NAME[self:getMatchType()]
|
||||
return self:getTotalAttrValue(hpName) + self:getTotalAttrValue(hpAddName)
|
||||
end
|
||||
|
||||
@ -142,7 +142,7 @@ end
|
||||
|
||||
-- 英雄是否拥有某属性
|
||||
function SkinData:hasAttr(heroId, attrType)
|
||||
if table.containValue(GConst.MATCH_HP_NAME, attrType) then
|
||||
if table.containValue(GConst.MATCH_HP_FIX_NAME, attrType) then
|
||||
return self:getHp(heroId) > 0
|
||||
end
|
||||
if table.containValue(GConst.MATCH_ATTACK_NAME, attrType) then
|
||||
@ -179,7 +179,7 @@ end
|
||||
-- 获取基础生命值
|
||||
function SkinData:getBaseHp(heroId)
|
||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
||||
return table.containValue(GConst.MATCH_HP_NAME, value.type)
|
||||
return table.containValue(GConst.MATCH_HP_FIX_NAME, value.type)
|
||||
end)
|
||||
return result and result.num or 0
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user