竞技场皮肤属性完善
This commit is contained in:
parent
c515a8be09
commit
2f59d74b96
@ -1797,7 +1797,7 @@ function GFunc.formatPlayerName(name)
|
|||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|
||||||
-- info = {array_heroes, heroes_equips} -- 服务器返回的数据
|
-- info = {array_heroes, heroes_equips, skins} -- 服务器返回的数据
|
||||||
function GFunc.formatPlayerFormationInfo(info)
|
function GFunc.formatPlayerFormationInfo(info)
|
||||||
local formation = {}
|
local formation = {}
|
||||||
if not info.array_heroes then
|
if not info.array_heroes then
|
||||||
@ -1810,13 +1810,17 @@ function GFunc.formatPlayerFormationInfo(info)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 处理装备
|
|
||||||
if not info.heroes_equips then
|
if not info.heroes_equips then
|
||||||
info.heroes_equips = {}
|
info.heroes_equips = {}
|
||||||
end
|
end
|
||||||
|
if not info.skins then
|
||||||
|
info.skins = {}
|
||||||
|
end
|
||||||
|
|
||||||
for matchType, heroEntity in pairs(formation) do
|
for matchType, heroEntity in pairs(formation) do
|
||||||
local heroId = heroEntity:getCfgId()
|
local heroId = heroEntity:getCfgId()
|
||||||
|
|
||||||
|
-- 处理装备
|
||||||
local equipInfo = info.heroes_equips[heroId]
|
local equipInfo = info.heroes_equips[heroId]
|
||||||
local equips = {}
|
local equips = {}
|
||||||
if not equipInfo then
|
if not equipInfo then
|
||||||
@ -1829,6 +1833,17 @@ function GFunc.formatPlayerFormationInfo(info)
|
|||||||
equipEntity:setHeroEntity(heroEntity)
|
equipEntity:setHeroEntity(heroEntity)
|
||||||
end
|
end
|
||||||
heroEntity:setEquips(equips)
|
heroEntity:setEquips(equips)
|
||||||
|
|
||||||
|
-- 处理皮肤
|
||||||
|
local skinIds = {}
|
||||||
|
for idx, skinId in pairs(info.skins) do
|
||||||
|
if DataManager.SkinData:getOriginSkinId(heroId) ~= skinId and DataManager.SkinData:getHeroIdBySkinId(skinId) == heroId then
|
||||||
|
table.insert(skinIds, skinId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #skinIds > 0 then
|
||||||
|
heroEntity:setSkins(skinIds)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return formation
|
return formation
|
||||||
|
|||||||
@ -62,7 +62,7 @@ function AttrCell:showHp()
|
|||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getHp()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getHp()
|
||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getHp()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getHp()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getHp(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // DEFAULT_FACTOR)
|
self.txValue:setText(value // DEFAULT_FACTOR)
|
||||||
@ -94,7 +94,7 @@ function AttrCell:showAtk()
|
|||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getAttack()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getAttack()
|
||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getAttack()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getAttack()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getAttack(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // DEFAULT_FACTOR)
|
self.txValue:setText(value // DEFAULT_FACTOR)
|
||||||
@ -116,7 +116,7 @@ function AttrCell:showNormalHurt()
|
|||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getNormalHurt()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getNormalHurt()
|
||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getNormalHurt()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getNormalHurt()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // DEFAULT_FACTOR)
|
self.txValue:setText(value // DEFAULT_FACTOR)
|
||||||
@ -138,7 +138,7 @@ function AttrCell:showSkillHurt()
|
|||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getSkillHurt()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getSkillHurt()
|
||||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getSkillHurt()
|
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getSkillHurt()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // DEFAULT_FACTOR)
|
self.txValue:setText(value // DEFAULT_FACTOR)
|
||||||
@ -157,7 +157,7 @@ function AttrCell:showCrit()
|
|||||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritPercent()
|
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritPercent()
|
||||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
||||||
@ -176,7 +176,7 @@ function AttrCell:showCritAtk()
|
|||||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritHurtPercent()
|
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritHurtPercent()
|
||||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
||||||
@ -199,7 +199,7 @@ function AttrCell:showNormalHurtp()
|
|||||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getNormalHurtPercent()
|
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getNormalHurtPercent()
|
||||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getNormalHurtPercent()
|
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getNormalHurtPercent()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
||||||
@ -222,7 +222,7 @@ function AttrCell:showSkillHurtp()
|
|||||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getSkillHurtPercent()
|
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT):getSkillHurtPercent()
|
||||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getSkillHurtPercent()
|
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD):getSkillHurtPercent()
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
||||||
@ -241,7 +241,7 @@ function AttrCell:showCured()
|
|||||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getHealPercent()
|
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getHealPercent()
|
||||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||||
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:getCfgId())
|
value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
self.txValue:setText(value // PERCENT_FACTOR .. "%")
|
||||||
|
|||||||
@ -24,7 +24,7 @@ function AttrNodeCell:refresh(heroEntity, node)
|
|||||||
|
|
||||||
self.attrCount = 0
|
self.attrCount = 0
|
||||||
for index, attr in ipairs(node) do
|
for index, attr in ipairs(node) do
|
||||||
if node ~= GConst.HeroConst.ATTR_SHOW_SKIN or DataManager.SkinData:hasAttr(heroEntity:getCfgId(), attr[heroEntity:getMatchType()]) then
|
if node ~= GConst.HeroConst.ATTR_SHOW_SKIN or DataManager.SkinData:hasAttr(heroEntity, attr[heroEntity:getMatchType()]) then
|
||||||
self.attrCount = self.attrCount + 1
|
self.attrCount = self.attrCount + 1
|
||||||
CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
|
CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
|
||||||
cell:refresh(heroEntity, node, attr)
|
cell:refresh(heroEntity, node, attr)
|
||||||
|
|||||||
@ -44,7 +44,7 @@ function HeroAttrUI:onRefresh()
|
|||||||
local totalHeight = 0
|
local totalHeight = 0
|
||||||
for index, node in ipairs(GConst.HeroConst.SHOW_NODE) do
|
for index, node in ipairs(GConst.HeroConst.SHOW_NODE) do
|
||||||
-- 有皮肤属性时才显示皮肤
|
-- 有皮肤属性时才显示皮肤
|
||||||
if node ~= GConst.HeroConst.ATTR_SHOW_SKIN or #DataManager.SkinData:getOwnAllAttr(self.heroEntity:getCfgId()) > 0 then
|
if node ~= GConst.HeroConst.ATTR_SHOW_SKIN or #DataManager.SkinData:getOwnAllAttr(self.heroEntity) > 0 then
|
||||||
CellManager:loadCellAsync(ATTR_NODE_CELL_PATH, ATTR_NODE_CELL, self.rootNodes, function(cell)
|
CellManager:loadCellAsync(ATTR_NODE_CELL_PATH, ATTR_NODE_CELL, self.rootNodes, function(cell)
|
||||||
cell:refresh(self.heroEntity, node)
|
cell:refresh(self.heroEntity, node)
|
||||||
|
|
||||||
|
|||||||
@ -124,20 +124,20 @@ function HeroEntity:updateEquipAttr()
|
|||||||
self:addEquipAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], skillHurtPer)
|
self:addEquipAttrValue(GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()], skillHurtPer)
|
||||||
self:addEquipAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()], healPer)
|
self:addEquipAttrValue(GConst.MATCH_CURED_NAME[self:getMatchType()], healPer)
|
||||||
|
|
||||||
if EDITOR_MODE then
|
-- if EDITOR_MODE then
|
||||||
local printStr = ""
|
-- local printStr = ""
|
||||||
printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "-" .. equipEntity:getLevel() .. "\n"
|
-- printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "-" .. equipEntity:getLevel() .. "\n"
|
||||||
printStr = printStr .. "生命:".. hp .. "\n"
|
-- printStr = printStr .. "生命:".. hp .. "\n"
|
||||||
printStr = printStr .. "攻击力:".. atk .. "\n"
|
-- printStr = printStr .. "攻击力:".. atk .. "\n"
|
||||||
printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
-- printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
||||||
printStr = printStr .. "技能增伤:".. skillHurt .. "\n"
|
-- printStr = printStr .. "技能增伤:".. skillHurt .. "\n"
|
||||||
printStr = printStr .. "暴击率:".. critPer .. "\n"
|
-- printStr = printStr .. "暴击率:".. critPer .. "\n"
|
||||||
printStr = printStr .. "暴击伤害百分比:".. critHurtPer .. "\n"
|
-- printStr = printStr .. "暴击伤害百分比:".. critHurtPer .. "\n"
|
||||||
printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n"
|
-- printStr = printStr .. "普攻增伤百分比:".. normalHurtPer .. "\n"
|
||||||
printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n"
|
-- printStr = printStr .. "技能增伤百分比:".. skillHurtPer .. "\n"
|
||||||
printStr = printStr .. "治疗加成百分比:".. healPer .. "\n"
|
-- printStr = printStr .. "治疗加成百分比:".. healPer .. "\n"
|
||||||
Logger.logHighlight(printStr)
|
-- Logger.logHighlight(printStr)
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -156,19 +156,16 @@ end
|
|||||||
-- 更新皮肤属性
|
-- 更新皮肤属性
|
||||||
function HeroEntity:updateSkinAttr()
|
function HeroEntity:updateSkinAttr()
|
||||||
self.skinAttr = {}
|
self.skinAttr = {}
|
||||||
if #DataManager.SkinData:getOwnAllAttr(self:getCfgId()) <= 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local hp = DataManager.SkinData:getHp(self:getCfgId())
|
local hp = DataManager.SkinData:getHp(self)
|
||||||
local atk = DataManager.SkinData:getAttack(self:getCfgId())
|
local atk = DataManager.SkinData:getAttack(self)
|
||||||
local normalHurt = DataManager.SkinData:getNormalHurt(self:getCfgId())
|
local normalHurt = DataManager.SkinData:getNormalHurt(self)
|
||||||
local skillHurt = DataManager.SkinData:getSkillHurt(self:getCfgId())
|
local skillHurt = DataManager.SkinData:getSkillHurt(self)
|
||||||
local critPer = DataManager.SkinData:getCritPercent(self:getCfgId())
|
local critPer = DataManager.SkinData:getCritPercent(self)
|
||||||
local critHurtPer = DataManager.SkinData:getCritHurtPercent(self:getCfgId())
|
local critHurtPer = DataManager.SkinData:getCritHurtPercent(self)
|
||||||
local normalHurtPer = DataManager.SkinData:getNormalHurtPercent(self:getCfgId())
|
local normalHurtPer = DataManager.SkinData:getNormalHurtPercent(self)
|
||||||
local skillHurtPer = DataManager.SkinData:getSkillHurtPercent(self:getCfgId())
|
local skillHurtPer = DataManager.SkinData:getSkillHurtPercent(self)
|
||||||
local healPer = DataManager.SkinData:getHealPercent(self:getCfgId())
|
local healPer = DataManager.SkinData:getHealPercent(self)
|
||||||
|
|
||||||
self.skinAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp
|
self.skinAttr[GConst.MATCH_HP_NAME[self:getMatchType()]] = hp
|
||||||
self.skinAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk
|
self.skinAttr[GConst.MATCH_ATTACK_NAME[self:getMatchType()]] = atk
|
||||||
@ -495,7 +492,7 @@ function HeroEntity:getTotalBaseHp()
|
|||||||
result = result + equipEntity:getBaseHp()
|
result = result + equipEntity:getBaseHp()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
result = result + DataManager.SkinData:getBaseHp(self:getCfgId())
|
result = result + DataManager.SkinData:getBaseHp(self)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -512,7 +509,7 @@ function HeroEntity:getTotalBaseAtk()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Logger.logHighlight(logStr)
|
-- Logger.logHighlight(logStr)
|
||||||
result = result + DataManager.SkinData:getBaseAttack(self:getCfgId())
|
result = result + DataManager.SkinData:getBaseAttack(self)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -531,4 +528,14 @@ function HeroEntity:getEquips(partType)
|
|||||||
return DataManager.EquipData:getEquip(self:getCfgId(), partType)
|
return DataManager.EquipData:getEquip(self:getCfgId(), partType)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroEntity:setSkins(skinIds)
|
||||||
|
self.unlockSkins = skinIds
|
||||||
|
self:getTotalAttrValue() -- 防止报错
|
||||||
|
self:onSkinAttrChange()
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getSkins()
|
||||||
|
return self.unlockSkins
|
||||||
|
end
|
||||||
|
|
||||||
return HeroEntity
|
return HeroEntity
|
||||||
@ -30,6 +30,11 @@ function SkinData:isOpen(showToast)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取英雄已解锁的id
|
||||||
|
function SkinData:getUnlockList()
|
||||||
|
return table.keys(self.unlockList)
|
||||||
|
end
|
||||||
|
|
||||||
-- 是否解锁
|
-- 是否解锁
|
||||||
function SkinData:isUnlock(skinId)
|
function SkinData:isUnlock(skinId)
|
||||||
return self.unlockList[skinId] or self:getSkinCfg(skinId).qlt == DEFAULT_SKIN_QLT
|
return self.unlockList[skinId] or self:getSkinCfg(skinId).qlt == DEFAULT_SKIN_QLT
|
||||||
@ -141,25 +146,26 @@ end
|
|||||||
-- 皮肤属性相关接口start------------------------------------------------------------------------------------
|
-- 皮肤属性相关接口start------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- 英雄是否拥有某属性
|
-- 英雄是否拥有某属性
|
||||||
function SkinData:hasAttr(heroId, attrType)
|
function SkinData:hasAttr(heroEntity, attrType)
|
||||||
if table.containValue(GConst.MATCH_HP_FIX_NAME, attrType) then
|
if table.containValue(GConst.MATCH_HP_FIX_NAME, attrType) then
|
||||||
return self:getHp(heroId) > 0
|
return self:getHp(heroEntity) > 0
|
||||||
end
|
end
|
||||||
if table.containValue(GConst.MATCH_ATTACK_NAME, attrType) then
|
if table.containValue(GConst.MATCH_ATTACK_NAME, attrType) then
|
||||||
return self:getAttack(heroId) > 0
|
return self:getAttack(heroEntity) > 0
|
||||||
end
|
end
|
||||||
return table.find(self:getOwnAllAttr(heroId), function(value)
|
return table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return value.type == attrType
|
return value.type == attrType
|
||||||
end) ~= nil
|
end) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取英雄已拥有的所有皮肤属性(未计算,仅配置的属性数据)
|
-- 获取该英雄已拥有的所有皮肤属性(未经过计算,仅配置的属性数据)
|
||||||
function SkinData:getOwnAllAttr(heroId)
|
function SkinData:getOwnAllAttr(heroEntity)
|
||||||
local result = {}
|
local result = {}
|
||||||
for skinId, value in pairs(self.unlockList) do
|
local unlockList = heroEntity:getSkins() or self:getUnlockList()
|
||||||
|
for idx, skinId in pairs(unlockList) do
|
||||||
local hero = self:getHeroIdBySkinId(skinId)
|
local hero = self:getHeroIdBySkinId(skinId)
|
||||||
local attrs = self:getAttr(skinId)
|
local attrs = self:getAttr(skinId)
|
||||||
if attrs and hero == heroId then
|
if attrs and hero == heroEntity:getCfgId() then
|
||||||
for index, attr in ipairs(attrs) do
|
for index, attr in ipairs(attrs) do
|
||||||
local temp = table.find(result, function(value)
|
local temp = table.find(result, function(value)
|
||||||
return value.type == attr.type
|
return value.type == attr.type
|
||||||
@ -177,104 +183,102 @@ function SkinData:getOwnAllAttr(heroId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取基础生命值
|
-- 获取基础生命值
|
||||||
function SkinData:getBaseHp(heroId)
|
function SkinData:getBaseHp(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_HP_FIX_NAME, value.type)
|
return table.containValue(GConst.MATCH_HP_FIX_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取加成后生命值
|
-- 获取加成后生命值
|
||||||
function SkinData:getHp(heroId)
|
function SkinData:getHp(heroEntity)
|
||||||
local result = self:getBaseHp(heroId)
|
local result = self:getBaseHp(heroEntity)
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(heroId)
|
result = result + heroEntity:getTotalBaseHp() * self:getHpPercent(heroEntity) // DEFAULT_FACTOR
|
||||||
result = result + heroEntity:getTotalBaseHp() * self:getHpPercent(heroId) // DEFAULT_FACTOR
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取基础攻击力
|
-- 获取基础攻击力
|
||||||
function SkinData:getBaseAttack(heroId)
|
function SkinData:getBaseAttack(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_ATTACK_NAME, value.type)
|
return table.containValue(GConst.MATCH_ATTACK_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取加成后攻击力
|
-- 获取加成后攻击力
|
||||||
function SkinData:getAttack(heroId)
|
function SkinData:getAttack(heroEntity)
|
||||||
local result = self:getBaseAttack(heroId)
|
local result = self:getBaseAttack(heroEntity)
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(heroId)
|
result = result + heroEntity:getTotalBaseAtk() * self:getAtkPercent(heroEntity) // DEFAULT_FACTOR
|
||||||
result = result + heroEntity:getTotalBaseAtk() * self:getAtkPercent(heroId) // DEFAULT_FACTOR
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取攻击加成百分比
|
-- 获取攻击加成百分比
|
||||||
function SkinData:getAtkPercent(heroId)
|
function SkinData:getAtkPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_ATTACK_ADD_NAME, value.type)
|
return table.containValue(GConst.MATCH_ATTACK_ADD_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取生命值加成百分比
|
-- 获取生命值加成百分比
|
||||||
function SkinData:getHpPercent(heroId)
|
function SkinData:getHpPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_HP_ADD_NAME, value.type)
|
return table.containValue(GConst.MATCH_HP_ADD_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取普攻伤害
|
-- 获取普攻伤害
|
||||||
function SkinData:getNormalHurt(heroId)
|
function SkinData:getNormalHurt(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_NORMAL_HURT_NAME, value.type)
|
return table.containValue(GConst.MATCH_NORMAL_HURT_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取皮肤技能伤害
|
-- 获取皮肤技能伤害
|
||||||
function SkinData:getSkillHurt(heroId)
|
function SkinData:getSkillHurt(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_SKILL_HURT_NAME, value.type)
|
return table.containValue(GConst.MATCH_SKILL_HURT_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取暴击率百分比
|
-- 获取暴击率百分比
|
||||||
function SkinData:getCritPercent(heroId)
|
function SkinData:getCritPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_CRIT_NAME, value.type)
|
return table.containValue(GConst.MATCH_CRIT_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--获取暴击伤害百分比
|
--获取暴击伤害百分比
|
||||||
function SkinData:getCritHurtPercent(heroId)
|
function SkinData:getCritHurtPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_CRIT_TIME_NAME, value.type)
|
return table.containValue(GConst.MATCH_CRIT_TIME_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取治疗百分比
|
-- 获取治疗百分比
|
||||||
function SkinData:getHealPercent(heroId)
|
function SkinData:getHealPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_CURED_NAME, value.type)
|
return table.containValue(GConst.MATCH_CURED_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取普攻增伤百分比
|
-- 获取普攻增伤百分比
|
||||||
function SkinData:getNormalHurtPercent(heroId)
|
function SkinData:getNormalHurtPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_NORMAL_HURTP_NAME, value.type)
|
return table.containValue(GConst.MATCH_NORMAL_HURTP_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取技能增伤百分比
|
-- 获取技能增伤百分比
|
||||||
function SkinData:getSkillHurtPercent(heroId)
|
function SkinData:getSkillHurtPercent(heroEntity)
|
||||||
local result = table.find(self:getOwnAllAttr(heroId), function(value)
|
local result = table.find(self:getOwnAllAttr(heroEntity), function(value)
|
||||||
return table.containValue(GConst.MATCH_SKILL_HURTP_NAME, value.type)
|
return table.containValue(GConst.MATCH_SKILL_HURTP_NAME, value.type)
|
||||||
end)
|
end)
|
||||||
return result and result.num or 0
|
return result and result.num or 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user