【无尽副本】战斗失败自动复位时,自动进行一次一键上阵

dev_chengFeng
ZhangBiao 2020-12-24 14:13:58 +08:00
parent df79f56b72
commit 8376d74230
2 changed files with 28 additions and 5 deletions

View File

@ -500,4 +500,31 @@ function this.GetCurFormationElementAddByType(type,heroDid)
return data
end
--自动一键上阵没有前端显示
function this.SetOneKeyGoWithoutUI(formationType,limitLevel)
local heros = HeroManager.GetAllHeroDatas(limitLevel)
--按战力从大到小排序
table.sort(heros,function(a,b)
if a.warPower == b.warPower then
return a.id>b.id
else
return a.warPower > b.warPower
end
end)
--修改 upHeroSidTable 静态id 存储 有则跳过
local upHeroSidTable = {}
local choosedList = {}
for i = 1, 6 do
if heros[i] then
local curSingleherodata = HeroManager.GetSingleHeroData(heros[i].dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(choosedList, {heroId = heros[i].dynamicId, position=i})
end
end
end
--保存编队
FormationManager.RefreshFormation(formationType, choosedList,FormationManager.formationList[formationType].teamPokemonInfos)
end
return this

View File

@ -254,7 +254,6 @@ end
-- 复位设置
function this.ResetRoleState()
--if not this.CanClick() then return end
-- 重置角色位置(目前没有表现,做一下延迟)
Timer.New(function ()
-- 通信一次
@ -263,21 +262,18 @@ function this.ResetRoleState()
-- 初始位置
local position = challengeMapConfig[MapManager.curMapId].Position
local initPos = position[1] * 256 + position[2]
-- 前端同步位置
MapManager.curPos = initPos
-- 重置队伍以及妖灵师的血量, 同时重置位置
Game.GlobalEvent:DispatchEvent(GameEvent.Formation.OnResetFormationHp, initPos)
-- 请求一次血量, 复位之后请求一次血量
NetManager.RequestAllHeroHp(function ()
--Log("复位之后请求一次血量数据")
end)
-- 刷新迷雾
local u,v = Map_Pos2UV(initPos)
TileMapView.UpdateWarFog(u, v, MapManager.fogSize)
FormationManager.SetOneKeyGoWithoutUI(FormationTypeDef.FORMATION_ENDLESS_MAP,20)
end)
end, 0.2):Start()