英雄属性bug修复,查看其他玩家信息时带入装备信息
This commit is contained in:
parent
e429f716c7
commit
b1df62d3a4
@ -1768,4 +1768,41 @@ function GFunc.formatPlayerName(name)
|
||||
return name
|
||||
end
|
||||
|
||||
-- info = {array_heroes, heroes_equips} -- 服务器返回的数据
|
||||
function GFunc.formatPlayerFormationInfo(info)
|
||||
local formation = {}
|
||||
if not info.array_heroes then
|
||||
return formation
|
||||
end
|
||||
for index, info in ipairs(info.array_heroes) do
|
||||
if DataManager.HeroData:isExistHeroById(info.id) then
|
||||
local heroEntity = DataManager.HeroData:getEntity(info)
|
||||
formation[heroEntity:getMatchType()] = heroEntity
|
||||
end
|
||||
end
|
||||
|
||||
-- 处理装备
|
||||
if not info.heroes_equips then
|
||||
info.heroes_equips = {}
|
||||
end
|
||||
|
||||
for matchType, heroEntity in pairs(formation) do
|
||||
local heroId = heroEntity:getCfgId()
|
||||
local equipInfo = info.heroes_equips[heroId]
|
||||
local equips = {}
|
||||
if not equipInfo then
|
||||
equipInfo = {equips = {}}
|
||||
end
|
||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
||||
local level = equipInfo.equips[partType] or 0
|
||||
local equipEntity = DataManager.EquipData:createEntity(heroId, partType, level)
|
||||
equips[partType] = equipEntity
|
||||
equipEntity:setHeroEntity(heroEntity)
|
||||
end
|
||||
heroEntity:setEquips(equips)
|
||||
end
|
||||
|
||||
return formation
|
||||
end
|
||||
|
||||
return GFunc
|
||||
@ -74,35 +74,26 @@ end
|
||||
|
||||
function ArenaManager:rspChallenge(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
local atkFormation = result.array_heroes
|
||||
local atkFormation = {}
|
||||
local defFormation
|
||||
if result.reqData and result.reqData.defInfo then
|
||||
defFormation = result.reqData.defInfo.array_heroes
|
||||
defFormation = GFunc.formatPlayerFormationInfo(result.reqData.defInfo)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
for idx, id in pairs(DataManager.FormationData:getArenaAttackFormation()) do
|
||||
local hero = DataManager.HeroData:getHeroById(id)
|
||||
if hero then
|
||||
atkFormation[idx] = hero
|
||||
end
|
||||
end
|
||||
|
||||
local params = {
|
||||
defInfo = result.reqData.defInfo,
|
||||
atkFormation = {},
|
||||
defFormation = {}
|
||||
atkFormation = atkFormation,
|
||||
defFormation = defFormation
|
||||
}
|
||||
for _, heroInfo in ipairs(atkFormation) do
|
||||
if heroInfo.id > 0 then
|
||||
local heroEntity = DataManager.HeroData:getEntity(heroInfo)
|
||||
if heroEntity then
|
||||
params.atkFormation[heroEntity:getMatchType()] = heroEntity
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, heroInfo in ipairs(defFormation) do
|
||||
if heroInfo.id > 0 then
|
||||
local heroEntity = DataManager.HeroData:getEntity(heroInfo)
|
||||
if heroEntity then
|
||||
params.defFormation[heroEntity:getMatchType()] = heroEntity
|
||||
end
|
||||
end
|
||||
end
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.ARENA, params)
|
||||
|
||||
--bi上报
|
||||
@ -177,7 +168,7 @@ end
|
||||
|
||||
function ArenaManager:rspRankHeroes(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.ArenaData:onRankFormationReceived(result.reqData.rid, result.array_heroes)
|
||||
DataManager.ArenaData:onRankFormationReceived(result.reqData.rid, result)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ function TipsManager:showHeroFragmentTips(itemId)
|
||||
UIManager:showUI("app/ui/tips/hero_fragment_tips", params)
|
||||
end
|
||||
|
||||
-- formation = {{id = 000, level = 000}, {id = 000, level = 000}, ...}
|
||||
-- formation = {heroEntity, ...}
|
||||
function TipsManager:showHeroFormation(targetObj, formation)
|
||||
local tarCornerScreenPos, location = self:getCornerScreenPosition(targetObj, TipsManager.ALIGN_TYPE.BOTTOM_CENTER)
|
||||
location = TipsManager.ALIGN_TYPE.CUSTOM
|
||||
|
||||
@ -165,6 +165,7 @@ function NetManager:connect(domain, port, callback, socketName)
|
||||
|
||||
CS.BF.BFMain.Instance.NetMgr:AddLuaOnReconnectSuccess(function(name)
|
||||
Logger.log("[NetManager]reconnect succes:%s", name)
|
||||
self.isSending = false
|
||||
self:trySend()
|
||||
if name == NetManager.MAIN_SOCKET_NAME then
|
||||
if self.reconnectMainId then
|
||||
|
||||
@ -177,7 +177,7 @@ function ArenaMatchUI:showMatchResult()
|
||||
self.matchTxName:setText(name)
|
||||
self.matchTxLevel:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, matchInfo.level))
|
||||
self.matchGrading:refresh(DataManager.ArenaData:getGradingIdFromScore(matchInfo.score))
|
||||
self.matchHeroFormationComp:refreshBriefInfo(matchInfo.array_heroes)
|
||||
self.matchHeroFormationComp:refreshByEntitys(GFunc.formatPlayerFormationInfo(matchInfo))
|
||||
|
||||
self.selfAvatar:refresh()
|
||||
self.selfTxName:setText(DataManager.PlayerData:getNickname())
|
||||
@ -191,12 +191,12 @@ function ArenaMatchUI:showMatchResult()
|
||||
local hero = DataManager.HeroData:getHeroById(id)
|
||||
|
||||
if hero then
|
||||
formation[idx] = {id = id, level = hero:getLv()}
|
||||
formation[idx] = hero
|
||||
else
|
||||
formation[idx] = nil
|
||||
end
|
||||
end
|
||||
self.selfHeroFormationComp:refreshBriefInfo(formation)
|
||||
self.selfHeroFormationComp:refreshByEntitys(formation)
|
||||
|
||||
-- 对手存在倒计时
|
||||
self.matchExistCd = DataManager.ArenaData:getMatchExistRemainTime()
|
||||
|
||||
@ -83,7 +83,7 @@ function ArenaRecentBattleUI:refreshRecord(obj, info)
|
||||
local playerHeadCell = CellManager:addCellComp(uiMap["player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
|
||||
playerHeadCell:refresh(info.match_info.avatar, info.match_info.avatar_frame)
|
||||
uiMap["player_head_cell"]:addClickListener(function()
|
||||
ModuleManager.TipsManager:showHeroFormation(uiMap["player_head_cell"], info.match_info.array_heroes)
|
||||
ModuleManager.TipsManager:showHeroFormation(uiMap["player_head_cell"], GFunc.formatPlayerFormationInfo(info.match_info))
|
||||
end)
|
||||
local name = info.match_info.name
|
||||
if name == nil or #name == 0 then
|
||||
|
||||
@ -62,7 +62,8 @@ end
|
||||
|
||||
function ArenaRankCell:showHeroFormationTips()
|
||||
self.clickFormation = false
|
||||
ModuleManager.TipsManager:showHeroFormation(self.btnFormation, DataManager.ArenaData:getRankFormation(self.rankInfo.ID))
|
||||
local result = DataManager.ArenaData:getRankFormation(self.rankInfo.ID)
|
||||
ModuleManager.TipsManager:showHeroFormation(self.btnFormation, GFunc.formatPlayerFormationInfo(result))
|
||||
end
|
||||
|
||||
return ArenaRankCell
|
||||
@ -11,7 +11,7 @@ function PlayerRecordCell:refresh(info)
|
||||
uiMap["player_record_cell.tx_name"]:setText(GFunc.formatPlayerName(info.name))
|
||||
uiMap["player_record_cell.btn_formation.tx_formation"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_14))
|
||||
uiMap["player_record_cell.btn_formation"]:addClickListener(function()
|
||||
ModuleManager.TipsManager:showHeroFormation(uiMap["player_record_cell.btn_formation"], info.array_heroes)
|
||||
ModuleManager.TipsManager:showHeroFormation(uiMap["player_record_cell.btn_formation"], GFunc.formatPlayerFormationInfo(info))
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -54,16 +54,14 @@ function HeroFormationComp:refreshByFormation(formation)
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示英雄等级/名称/品级信息
|
||||
-- formation = {{id = 000, level=000},{id = 000, level=000}, ...}
|
||||
function HeroFormationComp:refreshBriefInfo(formation)
|
||||
function HeroFormationComp:refreshByEntitys(formation)
|
||||
for i, heroCell in ipairs(self.heroCells) do
|
||||
if formation[i] and DataManager.HeroData:isExistHeroById(formation[i].id) then
|
||||
local heroEntity = formation[i]
|
||||
if heroEntity then
|
||||
heroCell:setVisible(true, 1)
|
||||
heroCell:refreshBriefInfo(formation[i].id, formation[i].level)
|
||||
heroCell:refreshBriefInfo(heroEntity:getCfgId(), heroEntity:getLv())
|
||||
heroCell:addClickListener(function()
|
||||
local heroEntity = DataManager.HeroData:getEntity(formation[i])
|
||||
ModuleManager.HeroManager:showHeroDetailUI(formation[i].id, true, heroEntity)
|
||||
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId(), true, heroEntity)
|
||||
end)
|
||||
else
|
||||
heroCell:setVisible(false)
|
||||
|
||||
@ -77,14 +77,14 @@ function ArmorInfoComp:refreshSelectArmor()
|
||||
local armorEntity = DataManager.EquipData:getEquip(self.heroEntity:getCfgId(), self.selectPart)
|
||||
self.txCurName:setText(armorEntity:getName())
|
||||
self.imgCurBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. armorEntity:getStage())
|
||||
-- self.imgCurIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, armorEntity:getIconId())
|
||||
-- self.imgCurIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(armorEntity:getIconId()))
|
||||
self.txCurLevel:setText("+".. armorEntity:getLevel())
|
||||
|
||||
-- next
|
||||
local armorNextEntity = armorEntity:getNextLevelEntity()
|
||||
self.txNextName:setText(armorNextEntity:getName())
|
||||
self.imgNextBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. armorNextEntity:getStage())
|
||||
-- self.imgNextIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, armorNextEntity:getIconId())
|
||||
-- self.imgNextIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(armorNextEntity:getIconId()))
|
||||
self.txNextLevel:setText("+".. armorNextEntity:getLevel())
|
||||
|
||||
-- 基础属性
|
||||
@ -143,7 +143,7 @@ function ArmorInfoComp:refreshSelectArmor()
|
||||
else
|
||||
num:setText(haveNum .. "/" .. costNum)
|
||||
end
|
||||
-- icon:setSprite(GFunc.getIconRes(costId))
|
||||
icon:setSprite(GFunc.getIconRes(costId))
|
||||
else
|
||||
costNode:setActive(false)
|
||||
end
|
||||
@ -182,7 +182,7 @@ function ArmorInfoComp:refreshPart(index)
|
||||
imgSelect:setActive(part == self.selectPart)
|
||||
imgSelect:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_select_" .. math.floor(stage / 2) + stage % 2)
|
||||
imgBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. stage)
|
||||
-- imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, armorEntity:getIconId())
|
||||
-- imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(armorEntity:getIconId()))
|
||||
imgType:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, stage <= 1 and "frame_dec_1" or "frame_dec_2")
|
||||
txLevel:setText("+".. armorEntity:getLevel())
|
||||
end
|
||||
|
||||
@ -9,13 +9,13 @@ function AttrCell:init()
|
||||
self.txValue = uiMap["attr_cell.tx_value"]
|
||||
end
|
||||
|
||||
function AttrCell:refresh(heroId, nodeType, attrType)
|
||||
self.heroEntity = DataManager.HeroData:getHeroById(heroId)
|
||||
self.weaponEntity = DataManager.EquipData:getEquip(heroId, GConst.EquipConst.PART_TYPE.WEAPON)
|
||||
self.hatEntity = DataManager.EquipData:getEquip(heroId, GConst.EquipConst.PART_TYPE.HAT)
|
||||
self.clothesEntity = DataManager.EquipData:getEquip(heroId, GConst.EquipConst.PART_TYPE.CLOTHES)
|
||||
self.beltEntity = DataManager.EquipData:getEquip(heroId, GConst.EquipConst.PART_TYPE.BELT)
|
||||
self.handguardEntity = DataManager.EquipData:getEquip(heroId, GConst.EquipConst.PART_TYPE.HANDGUARD)
|
||||
function AttrCell:refresh(heroEntity, nodeType, attrType)
|
||||
self.heroEntity = heroEntity
|
||||
self.weaponEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON)
|
||||
self.hatEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT)
|
||||
self.clothesEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES)
|
||||
self.beltEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT)
|
||||
self.handguardEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD)
|
||||
|
||||
self.nodeType = nodeType
|
||||
self.attrName = attrType[self.heroEntity:getMatchType()]
|
||||
|
||||
@ -9,7 +9,7 @@ function AttrNodeCell:init()
|
||||
self.itemsRoot = uiMap["total_node.items"]
|
||||
end
|
||||
|
||||
function AttrNodeCell:refresh(heroId, node)
|
||||
function AttrNodeCell:refresh(heroEntity, node)
|
||||
if node == GConst.HeroConst.ATTR_SHOW_TOTAL then
|
||||
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_13))
|
||||
elseif node == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
@ -24,7 +24,7 @@ function AttrNodeCell:refresh(heroId, node)
|
||||
|
||||
for index, attr in ipairs(node) do
|
||||
CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
|
||||
cell:refresh(heroId, node, attr)
|
||||
cell:refresh(heroEntity, node, attr)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
@ -23,7 +23,7 @@ function HeroAttrUI:onClose()
|
||||
end
|
||||
|
||||
function HeroAttrUI:ctor(parmas)
|
||||
self.heroId = parmas
|
||||
self.heroEntity = parmas.heroEntity
|
||||
end
|
||||
|
||||
function HeroAttrUI:onLoadRootComplete()
|
||||
@ -47,7 +47,7 @@ function HeroAttrUI:onRefresh()
|
||||
local nodeHeight = math.ceil(#node / 2) * ATTR_CELL_HEIGHT + (math.ceil(#node / 2) - 1) * ATTR_CELL_SPACING_Y + ATTR_CELLS_PADDING
|
||||
cell.baseObject:setLocalPositionY(-totalHeight)
|
||||
cell.baseObject:setSizeDeltaY(nodeHeight)
|
||||
cell:refresh(self.heroId, node)
|
||||
cell:refresh(self.heroEntity, node)
|
||||
totalHeight = totalHeight + nodeHeight
|
||||
self.rootNodes:setSizeDeltaY(totalHeight)
|
||||
end)
|
||||
|
||||
@ -50,7 +50,7 @@ function HeroInfoComp:init()
|
||||
ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity)
|
||||
end)
|
||||
self.btnAttr:addClickListener(function()
|
||||
UIManager:showUI("app/ui/hero/hero_attr_ui", self.heroEntity:getCfgId())
|
||||
UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ function FormationTips:onLoadRootComplete()
|
||||
self.originAnchoredPosition = tipsBgTransform.anchoredPosition
|
||||
self.originLocalPosition = tipsBgTransform.localPosition
|
||||
|
||||
self.heroFormation:refreshBriefInfo(self.formation)
|
||||
self.heroFormation:refreshByEntitys(self.formation)
|
||||
end
|
||||
|
||||
function FormationTips:onRefresh()
|
||||
|
||||
@ -4,6 +4,7 @@ local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR
|
||||
function EquipEntity:ctor(heroId, part, level)
|
||||
self.level = level or 0
|
||||
|
||||
self.heroEntity = nil
|
||||
self.cfg, self.cfgId = table.find(ConfigManager:getConfig("equip"), function(value)
|
||||
return value.hero == heroId and value.part == part
|
||||
end)
|
||||
@ -39,7 +40,7 @@ end
|
||||
-- 获取部位加成后生命值
|
||||
function EquipEntity:getHp()
|
||||
local result = self:getBaseHp()
|
||||
result = result + DataManager.HeroData:getHeroById(self:getHeroId()):getTotalBaseHp() * self:getHpPercent() // DEFAULT_FACTOR
|
||||
result = result + self:getHeroEntity():getTotalBaseHp() * self:getHpPercent() // DEFAULT_FACTOR
|
||||
return result
|
||||
end
|
||||
|
||||
@ -54,7 +55,7 @@ end
|
||||
-- 获取部位加成后攻击力
|
||||
function EquipEntity:getAttack()
|
||||
local result = self:getBaseAttack()
|
||||
result = result + DataManager.HeroData:getHeroById(self:getHeroId()):getTotalBaseAtk() * self:getAtkPercent() // DEFAULT_FACTOR
|
||||
result = result + self:getHeroEntity():getTotalBaseAtk() * self:getAtkPercent() // DEFAULT_FACTOR
|
||||
return result
|
||||
end
|
||||
|
||||
@ -348,4 +349,16 @@ function EquipEntity:onLevelUp()
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function EquipEntity:setHeroEntity(heroEntity)
|
||||
self.heroEntity = heroEntity
|
||||
end
|
||||
|
||||
function EquipEntity:getHeroEntity()
|
||||
if self.heroEntity then
|
||||
return self.heroEntity
|
||||
end
|
||||
|
||||
return DataManager.HeroData:getHeroById(self:getHeroId())
|
||||
end
|
||||
|
||||
return EquipEntity
|
||||
@ -75,17 +75,17 @@ end
|
||||
|
||||
-- 更新装备属性
|
||||
function HeroEntity:updateEquipAttr()
|
||||
local equips = DataManager.EquipData:getAllEquips()[self:getCfgId()]
|
||||
if not equips then
|
||||
return
|
||||
if self.equipAttr then --更新前删除以前的,因为方法应该为覆盖数值
|
||||
for attrName, value in pairs(self.equipAttr) do
|
||||
self.equipAttr[attrName] = 0
|
||||
end
|
||||
end
|
||||
|
||||
local hp,atk,normalHurt,skillHurt,critPer,critHurtPer,normalHurtPer,skillHurtPer,healPer = 0
|
||||
for part, equipEntity in pairs(equips) do
|
||||
if equipEntity:getLevel() <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
||||
local equipEntity = self:getEquips(partType)
|
||||
if equipEntity then
|
||||
hp = equipEntity:getHp()
|
||||
atk = equipEntity:getAttack()
|
||||
normalHurt = equipEntity:getNormalHurt()
|
||||
@ -108,7 +108,7 @@ function HeroEntity:updateEquipAttr()
|
||||
|
||||
if EDITOR_MODE then
|
||||
local printStr = ""
|
||||
printStr = printStr .. "更新装备数值:"..self:getCfgId().."-"..part .. "\n"
|
||||
printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "\n"
|
||||
printStr = printStr .. "生命:".. hp .. "\n"
|
||||
printStr = printStr .. "攻击力:".. atk .. "\n"
|
||||
printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"
|
||||
@ -121,6 +121,7 @@ function HeroEntity:updateEquipAttr()
|
||||
Logger.logHighlight(printStr)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function HeroEntity:setEquipAttrValue(name, value)
|
||||
@ -404,13 +405,13 @@ end
|
||||
function HeroEntity:getTotalBaseHp()
|
||||
local result = 0
|
||||
result = result + self:getTotalAttrValue(GConst.MATCH_HP_NAME[self:getMatchType()])
|
||||
-- 武器
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.WEAPON):getBaseHp()
|
||||
-- 防具
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.HAT):getBaseHp()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.CLOTHES):getBaseHp()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.BELT):getBaseHp()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.HANDGUARD):getBaseHp()
|
||||
-- 武器 + 防具
|
||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
||||
local equipEntity = self:getEquips(partType)
|
||||
if equipEntity then
|
||||
result = result + equipEntity:getBaseHp()
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
@ -418,14 +419,29 @@ end
|
||||
function HeroEntity:getTotalBaseAtk()
|
||||
local result = 0
|
||||
result = result + self:getTotalAttrValue(GConst.MATCH_HP_NAME[self:getMatchType()])
|
||||
-- 武器
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.WEAPON):getBaseAttack()
|
||||
-- 防具
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.HAT):getBaseAttack()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.CLOTHES):getBaseAttack()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.BELT):getBaseAttack()
|
||||
result = result + DataManager.EquipData:getEquip(self:getCfgId(), GConst.EquipConst.PART_TYPE.HANDGUARD):getBaseAttack()
|
||||
-- 武器 + 防具
|
||||
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
|
||||
local equipEntity = self:getEquips(partType)
|
||||
if equipEntity then
|
||||
result = result + equipEntity:getBaseAttack()
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- {partType = EquipEntity}
|
||||
function HeroEntity:setEquips(equipEntities)
|
||||
self.equipEntities = equipEntities
|
||||
self:getTotalAttrValue() -- 防止报错
|
||||
self:onEquipAttrChange()
|
||||
end
|
||||
|
||||
function HeroEntity:getEquips(partType)
|
||||
if self.equipEntities then
|
||||
return self.equipEntities[partType]
|
||||
end
|
||||
|
||||
return DataManager.EquipData:getEquip(self:getCfgId(), partType)
|
||||
end
|
||||
|
||||
return HeroEntity
|
||||
Loading…
x
Reference in New Issue
Block a user