属性调整
This commit is contained in:
parent
2a62f2a94e
commit
8650d1b340
@ -1898,17 +1898,16 @@ function GFunc.formatPlayerFormationInfo(info)
|
||||
|
||||
-- 处理装备
|
||||
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)
|
||||
heroEntity:setEquips(partType, equipEntity)
|
||||
end
|
||||
heroEntity:setEquips(equips)
|
||||
|
||||
-- 处理皮肤
|
||||
local skinIds = {}
|
||||
|
||||
@ -11,6 +11,12 @@ end
|
||||
function AttrCell:refresh(heroEntity, nodeType, attrType)
|
||||
self.heroEntity = heroEntity
|
||||
self.runesEntity = self.heroEntity:getRunes()
|
||||
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()]
|
||||
|
||||
@ -54,12 +60,12 @@ function AttrCell:showHp()
|
||||
value = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
|
||||
end
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getHp()
|
||||
value = (self.weaponEntity and self.weaponEntity:getHp() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getHp()
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getHp() or 0)
|
||||
value = value + (self.clothesEntity and self.clothesEntity:getHp() or 0)
|
||||
value = value + (self.beltEntity and self.beltEntity:getHp() or 0)
|
||||
value = value + (self.handguardEntity and self.handguardEntity:getHp() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getHp(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -88,12 +94,12 @@ function AttrCell:showAtk()
|
||||
value = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
|
||||
end
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getAttack()
|
||||
value = (self.weaponEntity and self.weaponEntity:getAttack() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getAttack()
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getAttack() or 0)
|
||||
value = value + (self.clothesEntity and self.clothesEntity:getAttack() or 0)
|
||||
value = value + (self.beltEntity and self.beltEntity:getAttack() or 0)
|
||||
value = value + (self.handguardEntity and self.handguardEntity:getAttack() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getAttack(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -114,10 +120,10 @@ function AttrCell:showNormalHurt()
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getNormalHurt()
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getNormalHurt() or 0)
|
||||
value = value + (self.clothesEntity and self.clothesEntity:getNormalHurt() or 0)
|
||||
value = value + (self.beltEntity and self.beltEntity:getNormalHurt() or 0)
|
||||
value = value + (self.handguardEntity and self.handguardEntity:getNormalHurt() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -138,10 +144,10 @@ function AttrCell:showSkillHurt()
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getSkillHurt()
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getSkillHurt() or 0)
|
||||
value = value + (self.clothesEntity and self.clothesEntity:getSkillHurt() or 0)
|
||||
value = value + (self.beltEntity and self.beltEntity:getSkillHurt() or 0)
|
||||
value = value + (self.handguardEntity and self.handguardEntity:getSkillHurt() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -161,7 +167,7 @@ function AttrCell:showCrit()
|
||||
value = self.heroEntity:getTotalAttrValue(self.attrName)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritPercent()
|
||||
value = (self.weaponEntity and self.weaponEntity:getCritPercent() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
|
||||
@ -182,7 +188,7 @@ function AttrCell:showCritAtk()
|
||||
value = self.heroEntity:getTotalAttrValue(self.attrName)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getCritHurtPercent()
|
||||
value = (self.weaponEntity and self.weaponEntity:getCritHurtPercent() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
|
||||
@ -207,10 +213,7 @@ function AttrCell:showNormalHurtp()
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
-- 套装属性,防具只用计算一次
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getNormalHurtPercent()
|
||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getNormalHurtPercent() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -234,10 +237,7 @@ function AttrCell:showSkillHurtp()
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
-- 套装属性,防具只用计算一次
|
||||
value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT):getSkillHurtPercent()
|
||||
-- value = value + self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES):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.hatEntity and self.hatEntity:getSkillHurtPercent() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
|
||||
@ -257,7 +257,7 @@ function AttrCell:showCured()
|
||||
value = self.heroEntity:getTotalAttrValue(self.attrName)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
|
||||
value = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON):getHealPercent()
|
||||
value = (self.weaponEntity and self.weaponEntity:getHealPercent() or 0)
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
|
||||
elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
|
||||
value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
|
||||
|
||||
@ -84,10 +84,28 @@ function HeroData:addHero(heroStruct)
|
||||
if self.heroes[heroStruct.id] then
|
||||
return
|
||||
end
|
||||
self.heroes[heroStruct.id] = self:getEntity(heroStruct)
|
||||
local entity = self:getEntity(heroStruct)
|
||||
|
||||
self:updateSelfHeroEquipsAndRunes(entity)
|
||||
self.heroes[heroStruct.id] = entity
|
||||
|
||||
self.data.activeCount = self.data.activeCount + 1
|
||||
end
|
||||
|
||||
-- 更新装备、符文数据
|
||||
function HeroData:updateSelfHeroEquipsAndRunes(entity)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("更新英雄属性:" .. entity:getCfgId())
|
||||
end
|
||||
|
||||
entity:setEquips(GConst.EquipConst.PART_TYPE.WEAPON, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.WEAPON))
|
||||
entity:setEquips(GConst.EquipConst.PART_TYPE.HAT, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.HAT))
|
||||
entity:setEquips(GConst.EquipConst.PART_TYPE.CLOTHES, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.CLOTHES))
|
||||
entity:setEquips(GConst.EquipConst.PART_TYPE.BELT, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.BELT))
|
||||
entity:setEquips(GConst.EquipConst.PART_TYPE.HANDGUARD, DataManager.EquipData:getEquip(entity:getCfgId(), GConst.EquipConst.PART_TYPE.HANDGUARD))
|
||||
entity:setRunes(DataManager.RunesData:getRunes(entity:getCfgId()))
|
||||
end
|
||||
|
||||
function HeroData:getEntity(heroStruct)
|
||||
return HeroEntity:create(heroStruct.id, heroStruct.level, heroStruct.skin)
|
||||
end
|
||||
@ -142,6 +160,7 @@ function HeroData:setHeroLv(id, lv)
|
||||
local activeBefore = true
|
||||
if not entity:isActived() then
|
||||
self.data.activeCount = self.data.activeCount + 1
|
||||
self:updateSelfHeroEquipsAndRunes(entity)
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT)
|
||||
ModuleManager.PlayerManager:checkUnlockAvatar(id)
|
||||
activeBefore = false
|
||||
|
||||
@ -594,8 +594,12 @@ function HeroEntity:getTotalBaseAtk()
|
||||
end
|
||||
|
||||
-- {partType = EquipEntity}
|
||||
function HeroEntity:setEquips(equipEntities)
|
||||
self.equipEntities = equipEntities
|
||||
function HeroEntity:setEquips(partType, equipEntities)
|
||||
if self.equipEntities == nil then
|
||||
self.equipEntities = {}
|
||||
end
|
||||
self.equipEntities[partType] = equipEntities
|
||||
|
||||
self:getTotalAttrValue() -- 防止报错
|
||||
self:onEquipAttrChange()
|
||||
end
|
||||
@ -604,8 +608,7 @@ function HeroEntity:getEquips(partType)
|
||||
if self.equipEntities then
|
||||
return self.equipEntities[partType]
|
||||
end
|
||||
|
||||
return DataManager.EquipData:getEquip(self:getCfgId(), partType)
|
||||
return nil
|
||||
end
|
||||
|
||||
function HeroEntity:setSkins(skinIds)
|
||||
|
||||
@ -20,7 +20,7 @@ function RunesData:init(data)
|
||||
self.exp = data.exp or 0
|
||||
if data.heroes_grids then
|
||||
for heroId, grids in pairs(data.heroes_grids) do
|
||||
self:addEquip(heroId, grids.grids)
|
||||
self:addRunes(heroId, grids.grids)
|
||||
end
|
||||
|
||||
-- 处理上报
|
||||
@ -53,7 +53,7 @@ function RunesData:isOpen(showToast)
|
||||
return true
|
||||
end
|
||||
|
||||
function RunesData:addEquip(heroId, grids)
|
||||
function RunesData:addRunes(heroId, grids)
|
||||
if self.runes == nil then
|
||||
self.runes = {}
|
||||
end
|
||||
|
||||
@ -3,7 +3,7 @@ local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR
|
||||
|
||||
function RunesEntity:ctor(heroId, grids)
|
||||
self.heroId = heroId
|
||||
self.grids = grids or GConst.EMPTY_TABLE
|
||||
self:updateGrids(grids)
|
||||
end
|
||||
|
||||
function RunesEntity:setDirty()
|
||||
@ -12,7 +12,6 @@ end
|
||||
|
||||
function RunesEntity:updateGrids(grids)
|
||||
self.grids = grids or GConst.EMPTY_TABLE
|
||||
self:getHeroEntity():setRunes(self)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
|
||||
@ -32,9 +32,13 @@ end
|
||||
|
||||
-- 获取英雄已解锁的id
|
||||
function SkinData:getUnlockList()
|
||||
if self.unlockList then
|
||||
return table.keys(self.unlockList)
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 是否解锁
|
||||
function SkinData:isUnlock(skinId)
|
||||
return self.unlockList[skinId] or self:getSkinCfg(skinId).qlt == DEFAULT_SKIN_QLT
|
||||
@ -181,6 +185,7 @@ end
|
||||
function SkinData:getOwnAllAttr(heroEntity)
|
||||
local result = {}
|
||||
local unlockList = heroEntity:getSkins() or self:getUnlockList()
|
||||
if unlockList then
|
||||
for idx, skinId in pairs(unlockList) do
|
||||
local hero = self:getHeroIdBySkinId(skinId)
|
||||
local attrs = self:getAttr(skinId)
|
||||
@ -198,6 +203,8 @@ function SkinData:getOwnAllAttr(heroEntity)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user