神将修改提交

dev_chengFeng
jiaoyangna 2021-05-18 11:44:17 +08:00
parent 00497c7071
commit 1bf7f53661
4 changed files with 136 additions and 121 deletions

View File

@ -576,7 +576,7 @@ function this.SortHeroDatas(_heroDatas)
return not dieHeros[a.dynamicId] and dieHeros[b.dynamicId]
end
else
return notExisted[a.dynamicId] and not notExisted[b.dynamicId]
return not notExisted[a.dynamicId] and notExisted[b.dynamicId]
end
else
return choosed[a.dynamicId] and not choosed[b.dynamicId]
@ -679,7 +679,12 @@ function this.SingleHeroDataShow(_go, _heroData)
if curHeroHpVal <= 0 then
Util.SetGray(go,true)
else
Util.SetGray(go,false)
LogGreen("heroData.exist:"..tostring(heroData.exist))
if heroData.exist and heroData.exist == 0 then
Util.SetGray(go,true)
else
Util.SetGray(go,false)
end
end
end
choosedObj:SetActive(false)
@ -695,6 +700,10 @@ function this.SingleHeroDataShow(_go, _heroData)
PopupTipPanel.ShowTip(Language[10688])
return
end
if heroData.exist and heroData.exist == 0 then
PopupTipPanel.ShowTip("激活神将图鉴后才可使用!")
return
end
for k, v in ipairs(this.choosedList) do
if v.heroId == heroData.dynamicId then
choosedObj:SetActive(false)

View File

@ -64,13 +64,11 @@ end
function this.RrefreshFormation()
local tempList = {}
local curFormation = FormationManager.GetFormationByID(index)
LogGreen("curFormation.teamHeroInfos:"..#curFormation.teamHeroInfos)
for k,v in pairs(curFormation.teamHeroInfos) do
if EndLessMapManager.GetSingleHeroData(v.heroId) then
if EndLessMapManager.GetSingleCanUseHeroData(v.heroId) then
table.insert(tempList,v)
end
end
LogGreen("#tempList:"..#tempList)
FormationManager.formationList[index].teamHeroInfos = tempList
end

View File

@ -11,8 +11,7 @@ local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
this.limiteLevel = gameSetting[1].EndlessMinLevel
-- 所有妖灵师的血量数据
this.allHeroBlood = {}
function this.Initialize()
this.isCanNote = false -- 是否进入可标记状态
@ -43,29 +42,8 @@ function this.Initialize()
end
function this.InitHeroHp(msg, func)
Log("请求一次神将血量")
this.allHeroBlood = {}
if msg and #msg.heroInfo > 0 then
for i = 1, #msg.heroInfo do
local heroData = msg.heroInfo[i]
local allEquipAddProVal= HeroManager.CalculateWarAllProVal(heroData.heroId)
local maxHp = allEquipAddProVal[3]
local hp = heroData.hp / 10000
local data = {}
data.percentHp = hp
data.curHp = math.ceil(hp * maxHp)
data.heroId = heroData.heroId
this.allHeroBlood[heroData.heroId] = data
--Log("当前英雄血量" .. heroData.hp)
end
end
-- 请求完妖灵师数据后才打开编队刷新队伍
if func then func() end
end
-- 在地图中更换编队后,更新上阵编队的最大血量值
function this.UpDateTeamMaxHp(info)
-- 不是无尽副本,直接返回
@ -151,23 +129,6 @@ function this.InitMapInfoData(mapInfo)
end
-- ================================== 妖灵师状态刷新 ========================================
-- 换人后刷新队伍血量
function this.RefreshTeamInfo()
Log("换人后刷新队伍血量")
local mapTeam = {}
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
for i = 1, #curTeam.teamHeroInfos do
local roleData = curTeam.teamHeroInfos[i]
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
allProp[2] = this.allHeroBlood[roleData.heroId].curHp
mapTeam[i] = {
heroId = roleData.heroId,
allProVal = allProp,
}
end
return mapTeam
end
-- 刷新地图中的队伍数据
function this.RefershMapTeam()
@ -176,17 +137,7 @@ function this.RefershMapTeam()
end
end
-- 无尽副本中得到某一个妖灵师的血量值, 传入动态ID
function this.GetHeroLeftBlood(heroId)
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then Log(Language[11224]) return end
if this.allHeroBlood[heroId] then
return this.allHeroBlood[heroId].curHp
else
Log("神将血量值不存在,默认是满血")
local allProp = HeroManager.CalculateWarAllProVal(heroId)
return allProp[3]
end
end
-- 无尽副本删除编队中某一个成员的数据
function this.DeleteDeadRole()
@ -225,40 +176,7 @@ function this.DeleteDeadRole()
end
return newFormation, newMapTeam
end
--编队界面有死亡猎妖师重组编队数据
function this.RoleListFormationNewMapTeam()
local newMapTeam = {} -- 地图中的编队数据
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
-- 成员数据
if curTeam.teamHeroInfos and #curTeam.teamHeroInfos > 0 then
for i = 1, #curTeam.teamHeroInfos do
local roleData = curTeam.teamHeroInfos[i]
local curRoleHp = 0
if this.allHeroBlood[roleData.heroId] then
curRoleHp = this.allHeroBlood[roleData.heroId].curHp
else
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
curRoleHp = allProp[3]
end
if curRoleHp > 0 then
local info = {}
info.position = #newMapTeam+1--curTeam.teamHeroInfos[i].position
info.heroId = roleData.heroId
table.insert(newMapTeam,info)
end
end
end
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ENDLESS_MAP, newMapTeam, curTeam.teamPokemonInfos)
return newMapTeam
end
-- 角色战斗失败,删除相应的地图队伍
function this.DeleteMapTeam()
for i = 1, #MapManager.formationList do
MapManager.formationList[i].allProVal[2] = 0
local heroId = MapManager.formationList[i].heroId
this.allHeroBlood[heroId].curHp = 0
end
end
-- 判断队伍是否还有活着的人
function this.IsMapTeamAlive()
@ -271,15 +189,7 @@ function this.IsMapTeamAlive()
return false
end
-- 是否所有都死翘翘
function this.IsAllDead()
for i, v in pairs(this.allHeroBlood) do
if v.curHp > 0 then
return false
end
end
return true
end
-- 刷新编队界面得到的编队以及地图中的编队数据, 只有打开编队界面才刷新地图编队
function this.RrefreshFormation()
@ -457,6 +367,9 @@ function this.InitAllEndlessHero(heroList,isClear)
for i = 1 ,#heroList do
this.InitSingleEndlessHero(heroList[i])
end
for k,v in pairs(this.heroDataLists) do
this.InitHeroHp(v)
end
end
function this.InitSingleEndlessHero(_msgHeroData)
@ -570,16 +483,13 @@ function this.InitSingleTreasureData(_singleData,_fourTotal,_treeLevel)
single.id=staticId
single.idDyn=_singleData.id
single.lv=_singleData.exp
LogGreen("single.lv:"..single.lv)
single.refineLv=_singleData.rebuildLevel
LogGreen("single.refineLv:"..single.refineLv)
single.maxLv=currJewel.Max[1]
single.maxRefineLv=currJewel.Max[2]
single.upHeroDid=""
single.maxTreeLv = currJewel.GodHoodMaxlv
single.treeLv = _treeLevel
single.fourTotal = _fourTotal
LogGreen("_treeLevel:"..single.treeLv.." single.fourTotal:"..single.fourTotal)
local quantity=currJewel.Level
single.quantity=quantity
single.frame=GetQuantityImageByquality(quantity)
@ -670,6 +580,15 @@ function this.SetHeroFormationList(heroDid,teamId,isAddOrDel)
end
function this.GetSingleCanUseHeroData(heroDid)
if not this.canUseHeroDatas then
this.GetCanUseHeroDatas()
end
if this.canUseHeroDatas[heroDid] then
return this.canUseHeroDatas[heroDid]
end
end
function this.GetSingleHeroData(heroDid)
if this.heroDataLists[heroDid] then
return this.heroDataLists[heroDid]
@ -707,7 +626,6 @@ end
function this.GetHeroDataByProperty1(_proId, limitLevel,_heros)
local index = 0
local heros = {}
for i, v in pairs(this.heroDataLists) do
local isExist = false
for j, k in pairs(this.canUseHeroDatas) do
@ -717,17 +635,104 @@ function this.GetHeroDataByProperty1(_proId, limitLevel,_heros)
end
end
if not isExist then
index = #heros + 1
heros[index] = v
heros[index].exist = 0
index = #_heros + 1
_heros[index] = v
_heros[index].exist = 0
end
end
return heros
return _heros
end
function this.SortHeroData(herolist)
table.sort(herolist,function(a,b)
end)
-- 所有妖灵师的血量数据
this.allHeroBlood = {}
function this.InitHeroHp(heroData)
if not this.allHeroBlood then
this.allHeroBlood = {}
end
local allEquipAddProVal= HeroManager.CalculateWarAllProVal(heroData.dynamicId)
local maxHp = allEquipAddProVal[3]
local hp = heroData.hp / 10000
local data = {}
data.percentHp = hp
data.curHp = math.ceil(hp * maxHp)
data.dynamicId = heroData.dynamicId
this.allHeroBlood[heroData.dynamicId] = data
end
-- 换人后刷新队伍血量
function this.RefreshTeamInfo()
Log("换人后刷新队伍血量")
local mapTeam = {}
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
for i = 1, #curTeam.teamHeroInfos do
local roleData = curTeam.teamHeroInfos[i]
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
allProp[2] = this.allHeroBlood[roleData.heroId].curHp
mapTeam[i] = {
heroId = roleData.heroId,
allProVal = allProp,
}
end
return mapTeam
end
-- 无尽副本中得到某一个妖灵师的血量值, 传入动态ID
function this.GetHeroLeftBlood(heroId)
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then Log(Language[11224]) return end
if this.allHeroBlood[heroId] then
return this.allHeroBlood[heroId].curHp
else
Log("神将血量值不存在,默认是满血")
local allProp = HeroManager.CalculateWarAllProVal(heroId)
return allProp[3]
end
end
--编队界面有死亡猎妖师重组编队数据
function this.RoleListFormationNewMapTeam()
local newMapTeam = {} -- 地图中的编队数据
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
-- 成员数据
if curTeam.teamHeroInfos and #curTeam.teamHeroInfos > 0 then
for i = 1, #curTeam.teamHeroInfos do
local roleData = curTeam.teamHeroInfos[i]
local curRoleHp = 0
if this.allHeroBlood[roleData.heroId] then
curRoleHp = this.allHeroBlood[roleData.heroId].curHp
else
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
curRoleHp = allProp[3]
end
if curRoleHp > 0 then
local info = {}
info.position = #newMapTeam+1--curTeam.teamHeroInfos[i].position
info.heroId = roleData.heroId
table.insert(newMapTeam,info)
end
end
end
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ENDLESS_MAP, newMapTeam, curTeam.teamPokemonInfos)
return newMapTeam
end
-- 角色战斗失败,删除相应的地图队伍
function this.DeleteMapTeam()
for i = 1, #MapManager.formationList do
MapManager.formationList[i].allProVal[2] = 0
local heroId = MapManager.formationList[i].heroId
this.allHeroBlood[heroId].curHp = 0
end
end
-- 是否所有都死翘翘
function this.IsAllDead()
for i, v in pairs(this.allHeroBlood) do
if v.curHp > 0 then
return false
end
end
return true
end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -2219,16 +2219,16 @@ end
-- 请求获取所有药灵师血量
function this.RequestAllHeroHp(func)
Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_REQUEST, MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_RESPONSE, nil, function(buffer)
local data = buffer:DataByte()
local msg = MapInfoProto_pb.GetEndlessHeroResponse()
msg:ParseFromString(data)
EndLessMapManager.InitHeroHp(msg, function()
if func then
func()
end
end)
end)
-- Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_REQUEST, MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_RESPONSE, nil, function(buffer)
-- local data = buffer:DataByte()
-- local msg = MapInfoProto_pb.GetEndlessHeroResponse()
-- msg:ParseFromString(data)
-- EndLessMapManager.InitHeroHp(msg, function()
-- if func then
-- func()
-- end
-- end)
-- end)
end
-- 请求复位
@ -5001,6 +5001,9 @@ function this.AllEndLessHeroDataResponse(_index,func)
local msg = HeroInfoProto_pb.GetEndlessHeroListInfoResponse()
msg:ParseFromString(data)
EndLessMapManager.InitAllEndlessHero(msg.heroList,true)
for i = 1 ,#msg.heroList do
LogGreen(msg.heroList[i].id.." "..msg.heroList[i].heroId)
end
if msg.isSendFinish then
if func then
func(msg)