| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858 |
- -------------------------------------------------
- -- 队伍上阵
- -- db.combatHero 上阵信息
- -- getTeamType 根据战斗类型获取出战队伍类型
- -- getCombatHeros 根据出战类型获取出战队伍下标列表
- -- getCombatHeroZDL 根据战斗类型获取出战战力
- -- cleanCombatHeros 清空出战信息
- -- updatePos 设置上阵信息
- -------------------------------------------------
- local CombatExcel = require("excel.combat")
- local HeroExcel = require("excel.hero")
- local MonsterExcel = require("excel.monster").monster
- local MonsterOutExcel = require("excel.monster").monsterOut
- local CombatPosExcel = require("excel.combatPos")
- local FormationExcel = CombatPosExcel.formation
- local DefineExcel = CombatPosExcel.define[1]
- local Util = require("common.Util")
- local Lang = require("common.Lang")
- local Msg = require("core.Msg")
- local ObjHuman = require("core.ObjHuman")
- local Broadcast = require("broadcast.Broadcast")
- local CombatDefine = require("combat.CombatDefine")
- local CombatLogic = require("combat.CombatLogic")
- local CombatImpl = require("combat.CombatImpl")
- -- local DrillLogic = require("drill.DrillLogic")
- -- local JjcLogic = require("jjc.JjcLogic")
- -- local UnionWarLogic = require("union.UnionWarLogic")
- -- local UnionLogic = require("union.UnionLogic")
- -- local RoleDefine = require("role.RoleDefine")
- local MoshouLogic = require("moshou.MoshouLogic")
- local HeroLogic = require("hero.HeroLogic")
- -- local Grid = require("bag.Grid")
- -- local BagLogic = require("bag.BagLogic")
- -- local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
- local RoleHeadLogic = require("role.RoleHeadLogic")
- local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
- local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
- local JibanLogic = require("combat.JibanLogic")
- local JjcGodWarLogic = require("jjcGodWar.JjcGodWarLogic")
- local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
- local ChengjiuDefine = require("chengjiu.ChengjiuDefine")
- local SkillExcel = require("excel.skill")
- local RoleAttr = require("role.RoleAttr")
- local LostTempleCombatLogic = require("lostTemple.lostTempleCombatLogic")
- local RecommendLineup = require("drawCard.RecommendLineup")
- local TalismanLogic = require("talisman.TalismanLogic")
- local NewFirstChargeLogic = require("present.NewFirstChargeLogic")
- --秘宝的加成
- local function getTalismanAdd(human)
- local res = TalismanLogic.getTalismanAdd(human, TalismanLogic.OTHER_EFFECT_TBL.BATTLE_ISQUICKTIME)
- if res == 0 then
- return
- end
- return res
- end
- -- 根据战斗类型获取出战队伍类型
- function getTeamType(combatType)
- if not CombatExcel.combat[combatType] then
- -- print("[getTeamType] 不存在对应的 combatType = "..combatType)
- return
- end
- return CombatExcel.combat[combatType].teamType
- end
- function getCombatHeroDB(human,combatType)
- local teamType = getTeamType(combatType)
- if not human.db.combatHero[teamType] then
- human.db.combatHero[teamType] = {list = {},helpList = {},formation = 1,jiban = {}}
- end
- return human.db.combatHero[teamType],teamType
- end
- --根据阵法id返回可用站位
- function getPosList(formation)
- local formationConf = FormationExcel[formation]
- if not formationConf.posList then
- for k,v in pairs(FormationExcel) do
- v.posList = {}
- for _,v1 in ipairs(v.pos) do
- v.posList[v1] = 1
- end
- end
- end
- return formationConf.posList
- end
- function getCombatHeros(human, combatType)
- local combatHeroDB = getCombatHeroDB(human,combatType)
- return combatHeroDB.list,combatHeroDB.helpList,combatHeroDB.formation or 1,combatHeroDB
- end
- -- 清空出战信息
- function cleanCombatHeros(human, combatType)
- local teamType = getTeamType(combatType)
- human.db.combatHero[teamType] = nil
- end
- -- 拷贝上阵
- function copyCombatHeros(human, sourceType, targetType)
- local sTeamType = getTeamType(sourceType)
- local tTeamType = getTeamType(targetType)
- if sTeamType == tTeamType then return end
- local combatHeroDB = human.db.combatHero[sTeamType]
- human.db.combatHero[tTeamType] = Util.copyTable(combatHeroDB)
- end
- local function table_find(tbl, val)
- for _, v in pairs(tbl) do
- if v == val then
- return true
- end
- end
- return false
- end
- -- 检查当前上阵的英雄是否在目标阵容里上阵了
- local function heroExclusionCheck(human, exclusionTypeList, nowHeroLlist)
- for _, combatType in ipairs(exclusionTypeList) do
- local combatHeroDB = getCombatHeroDB(human, combatType)
- if combatHeroDB and combatHeroDB.herolistList then
- for _, heroUuid in pairs(nowHeroLlist)do
- if heroUuid ~= "0" and heroUuid ~= "" then
- if table_find(combatHeroDB.herolistList, heroUuid) then
- return false
- end
- end
- end
- end
- end
- return true
- end
- -- 可否更新阵容
- local function checkUpdatePos(human, msg)
- if msg.type == CombatDefine.COMBAT_TYPE4 then
- if not JjcGodWarLogic.checkCanPos(human) then return end
- end
- if msg.type == CombatDefine.COMBAT_TYPE24 then
- local moduleFn = CombatLogic.getModule(msg.type)
- if moduleFn and moduleFn.checkUpdatePos then
- return moduleFn.checkUpdatePos(human, msg)
- end
- return
- end
- if msg.type == CombatDefine.COMBAT_TYPE25 or msg.type == CombatDefine.COMBAT_TYPE26 or
- msg.type == CombatDefine.COMBAT_TYPE27 or msg.type == CombatDefine.COMBAT_TYPE28 then
- local moduleFn = CombatLogic.getModule(msg.type)
- if moduleFn and moduleFn.checkUpdatePos then
- if not moduleFn.checkUpdatePos(human, msg) then
- return false
- end
- end
- end
- local posList = getPosList(msg.formation)
- local heroList = Util.split(msg.heroList, ",")
- local helpList = Util.split(msg.helpList, ",", true)
- local exclusionTypeList = CombatDefine.COMBAT_EXCLUSION_LIST[msg.type]
- if exclusionTypeList then
- if not heroExclusionCheck(human, exclusionTypeList, heroList) then
- return Broadcast.sendErr(human, Lang.COMMON_HERO_UPPOS)
- end
- end
- local cnt = 0
- local useList = { }
- local fatherList = { }
- -- 确定英雄存不存在
- for i = 1, CombatDefine.COMBAT_HERO_CNT do
- local uuid = heroList[i] or ""
- if uuid ~= "0" and uuid ~= "" then
- if i == CombatDefine.COMBAT_HERO_CNT and canBackup(human) == 0 then
- -- 援军未激活
- return Broadcast.sendErr(human, Lang.HELP_HERO_NOT_ACTIVATE)
- end
- if posList[i] == nil and i ~= CombatDefine.COMBAT_HERO_CNT then
- -- 站位不可用 POS_ERROR
- return Broadcast.sendErr(human, Lang.POS_ERROR)
- end
- local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
- if not heroGrid then
- return Broadcast.sendErr(human, Lang.DRILL_CHOOSE_FRIEND_ERR_INFO)
- end
- local heroConfig = HeroExcel.hero[heroGrid.id]
- if useList[uuid] or fatherList[heroGrid.id] then
- -- 同父类英雄重复
- return Broadcast.sendErr(human, Lang.HERO_SAME)
- else
- cnt = cnt + 1
- useList[uuid] = true
- fatherList[heroGrid.id] = true
- end
- end
- end
- if cnt == 0 then
- -- 上阵英雄空
- return Broadcast.sendErr(human, Lang.NO_HERO)
- end
- -- 检查辅助对象是否激活 todo
- return true, heroList, helpList
- end
- -- 上阵成功处理
- function onUpdatePos(human, teamType)
- for combatType, config in pairs(CombatExcel.combat) do
- if config.teamType == teamType then
- CombatLogic.onUpdatePos(human, combatType)
- if combatType == CombatDefine.COMBAT_TYPE1 then
- ObjHuman.doCalc(human)
- local heroListZDL = getCombatHeroZDL(human, CombatDefine.COMBAT_TYPE1)
- ChengjiuLogic.onCallback(human,ChengjiuDefine.CJ_TASK_TYPE_8,heroListZDL)
- RecommendLineup.RecommendLineup_UpDate(human)
- end
- end
- end
- end
- -- 更新上阵信息
- function updatePos(human, msg)
- local combatType = msg.type
- local canUpdate,heroList,helpList = checkUpdatePos(human,msg)
- if not canUpdate then
- return
- end
- local combatHeroDB, teamType = getCombatHeroDB(human,combatType)
- combatHeroDB.formation = msg.formation
- combatHeroDB.list = heroList
- combatHeroDB.helpList = helpList
- local msgRet = Msg.gc.GC_COMBAT_POS_UPDATE
- msgRet.type = combatType
- msgRet.teamType = teamType
- Msg.send(msgRet,human.fd)
- if combatType == CombatDefine.COMBAT_TYPE1 then
- HeroLogic.sendBagDots(human)
- end
- RoleHeadLogic.CG_ROLE_COMBATHERO_QUERY(human, msg.type)
- onUpdatePos(human, teamType)
- end
- -- 设置能否跳过
- function setQuick(human, combatType, isQuick)
- local combatConfig = CombatExcel.combat[combatType]
- if combatConfig.isQuick == 1 then
- human.db.combatQuick[combatType] = isQuick
- end
- end
- -- 升级检测
- function onLvUp(human, oldLv, newLv)
- local heroListZDL = getCombatHeroZDL(human, CombatDefine.COMBAT_TYPE1)
- if heroListZDL <= 0 then return end
- local jjcDenType = CombatDefine.COMBAT_TYPE3
- local jjcGodType = CombatDefine.COMBAT_TYPE4
- local jjcDenLv = RoleSystemLogic.getOpenLv(CombatExcel.combat[jjcDenType].systemID)
- local jjcGodLv = RoleSystemLogic.getOpenLv(CombatExcel.combat[jjcGodType].systemID)
- local change = false
- -- 同步 战役阵容 到 竞技场防守阵容
- if oldLv < jjcDenLv and newLv >= jjcDenLv then
- local heroListJjc = getCombatHeroZDL(human, jjcDenType)
- if heroListJjc <= 0 then
- copyCombatHeros(human, CombatDefine.COMBAT_TYPE1, jjcDenType)
- change = true
- end
-
- end
- -- 同步 战役阵容 到 众神之战/王者争霸
- if oldLv < jjcGodLv and newLv >= jjcGodLv then
- local heroListJjc = getCombatHeroZDL(human, jjcGodType)
- if heroListJjc <= 0 then
- copyCombatHeros(human, CombatDefine.COMBAT_TYPE1, jjcGodType)
- change = true
- end
- end
- if change then
- ObjHuman.save(human)
- end
- end
- -- 获取上阵战力
- function getCombatHeroZDL(human, combatType)
- local zhandouli = 0
- local teamType = getTeamType(combatType)
- if teamType then
- local heroList = getCombatHeros(human, combatType)
- if heroList then
- for pos = 1, CombatDefine.COMBAT_HERO_CNT do
- local uuid = heroList[pos]
- local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
-
- if heroGrid and type(heroGrid) == "table" then
- if human.heroAttrs and not human.heroAttrs[heroGrid.bagIndex] then
- RoleAttr.doCalcHero(human, heroGrid.bagIndex)
- end
- zhandouli = zhandouli + (heroGrid.zhandouli or 0)
- end
- end
- end
- end
- return zhandouli
- end
- local function getSinglePosAttr(net, attrCfg)
- for k ,v in ipairs(attrCfg) do
- net[k].key = v[1]
- net[k].value = v[2]
- net[0] = k
- end
- end
- -- 发送阵型信息
- FormationInitFlag = nil
- function formationQuery(human)
- local msgRet = Msg.gc.GC_COMBAT_FORMATION_QUERY
- if not FormationInitFlag then
- FormationInitFlag = true
- local len = 0
- for k,v in ipairs(FormationExcel) do
- len = len + 1
- local net = msgRet.list[len]
- local len1 = 0
- for k1,v1 in ipairs(v.pos) do
- len1 = len1 + 1
- net.list[len1] = v1
- end
- net.list[0] = len1
- --阵法属性加成
- for k2,v2 in ipairs(v.attr) do
- getSinglePosAttr(net.posAttrLit[k2].posAttr, v2)
- net.posAttrLit[0] = k2
- end
- net.id = k
- net.lv = v.lv
- net.icon = v.icon
- net.name = v.name
- end
- msgRet.list[0] = len
- end
- msgRet.lv = human.db.lv
- Msg.send(msgRet,human.fd)
- end
- -- 去掉所有阵容中的数据
- function updateAllPos(human, uuid)
- heroIndexByDelForPos(human, uuid)
- local msgRet = Msg.gc.GC_HERO_UPDATE_ALL_POS
- Msg.send(msgRet,human.fd)
- end
- -- 英雄被分解 从默认出战中 去除
- function heroIndexByDelForPos(human, uuid)
- if not uuid or uuid == "0" or uuid == "" then return end
- for teamType, combatHero in pairs(human.db.combatHero) do
- if teamType ~= CombatDefine.COMBAT_TYPE10 then
- local isChange = nil
- for k, v in pairs(combatHero.list) do
- if v == uuid then
- combatHero.list[k] = nil
- isChange = true
- end
- end
- if isChange then
- onUpdatePos(human, teamType)
- posQuery(human, teamType)
- end
- end
- end
- end
- function caclCampAttr(attr, camp, cnt)
- -- 计算基础属性
- local conf = CombatPosExcel[camp]
- if basicsAttrExcel then
- for _, v in ipairs(conf) do
- if cnt == v.cnt then
- for k1,v1 in ipairs(v.attrs) do
- attr[v1[1]] = attr[v1[1]] or 0
- attr[v1[1]] = attr[v1[1]] + v1[2]
- end
- end
- end
- end
- end
- PosAttrInitFlag = nil
- function posAttrQuery(human)
- local msgRet = Msg.gc.GC_COMBAT_POS_ATTR_QUERY
- if not PosAttrInitFlag then
- PosAttrInitFlag = true
- local len = 0
- for k,v in ipairs(DefineExcel.attrs) do
- len = len + 1
- msgRet.attrs[len].key = v[1]
- msgRet.attrs[len].value = v[2]
- end
- msgRet.attrs[0] = len
- len = 0
- for camp = 1,CombatDefine.CAMP_ALL do
- local conf = CombatPosExcel[camp]
- len = len + 1
- local net = msgRet.list[len]
- net.camp = camp
- net.name = conf[1].name
- local len1 = 0
- for k,v in ipairs(conf) do
- len1 = len1 + 1
- local subNet = net.list[len1]
- subNet.cnt = v.cnt
- local len2 = 0
- for k,v in ipairs(v.attrs) do
- len2 = len2 + 1
- subNet.attrs[len2].key = v[1]
- subNet.attrs[len2].value = v[2]
- end
- subNet.attrs[0] = len2
- end
- net.list[0] = len1
- end
- msgRet.list[0] = len
- end
- Msg.send(msgRet,human.fd)
- end
- function getPosAttr(objList)
- local campList = {}
- for i = 1,CombatDefine.COMBAT_HERO_CNT do
- local obj = objList[i]
- local config = CombatLogic.getConfigByObj(obj)
- if not config then return end
- campList[config.camp] = campList[config.camp] or 0
- campList[config.camp] = campList[config.camp] + 1
- end
-
- local attr = {}
- for k, v in pairs(campList) do
- local camp = k
- local cnt = v
- caclCampAttr(attr, camp, cnt)
- end
- return attr
- end
- local function calcSinglePosAttr(posCfg, pos, obj)
- local idx = 0
- for k, v in ipairs(posCfg.pos) do
- if v == obj.formationPos then
- idx = k
- break
- end
- end
- local posAttr = posCfg.attr[idx]
- for _, v in ipairs(posAttr or {}) do
- local attrType = v[1]
- local attrValue = v[2]
- obj.sysAttr[attrType] = (obj.sysAttr[attrType] or 0) + attrValue
- obj.isSysAttrChange = true
- end
- end
- local function posAttrAdd(formation, posList)
- --阵法中单个位置的属性加成
- local posCfg = getFormationConfig(formation)
- if posCfg then
- for _,pos in ipairs(posList) do
- local obj = CombatImpl.objList[pos]
- if obj then
- calcSinglePosAttr(posCfg, pos, obj)
- end
- end
- end
- end
- function onFightBegin(human)
- -- 获取进攻方种族属性
- local attrs1 = human.combat.posAttr[1]
- if attrs1 then
- for k,v in pairs(attrs1) do
- for _,pos in ipairs(CombatDefine.SIDE2POS[CombatDefine.ATTACK_SIDE]) do
- local obj = CombatImpl.objList[pos]
- if obj then
- obj.sysAttr[k] = obj.sysAttr[k] + v
- obj.isSysAttrChange = true
- end
- end
- end
- end
- -- 获取防御方种族属性
- local attrs2 = human.combat.posAttr[2]
- if attrs2 then
- for k, v in pairs(attrs2) do
- for _,pos in ipairs(CombatDefine.SIDE2POS[CombatDefine.DEFEND_SIDE]) do
- local obj = CombatImpl.objList[pos]
- if obj then
- obj.sysAttr[k] = obj.sysAttr[k] + v
- obj.isSysAttrChange = true
- end
- end
- end
- end
- --阵法中位置的属性加成
- posAttrAdd(human.combat.atkFormation, CombatDefine.SIDE2POS[CombatDefine.ATTACK_SIDE])
- posAttrAdd(human.combat.defFormation, CombatDefine.SIDE2POS[CombatDefine.DEFEND_SIDE])
- end
- -- 获得 怪物组的 光环 血量加成
- function getCombatHpMaxJiaCheng(monsterOutID)
- local config = MonsterOutExcel[monsterOutID]
- local jobList = {}
- if config and #config.member > 5 then
- for i,member in ipairs(config.member) do
- local monsterID = member[1]
- local monsterConfig = MonsterExcel[monsterID]
- jobList[monsterConfig.job] = jobList[monsterConfig.job] or 0
- jobList[monsterConfig.job] = jobList[monsterConfig.job] + 1
- end
- end
- local attr = {}
- for k, v in pairs(jobList) do
- local camp = k
- local cnt = v
- caclCampAttr(attr, camp, cnt)
- end
-
- local buff = 0
- for k, v in pairs(attr) do
- if k == 203 then
- buff = v
- break
- end
- end
- return buff
- end
- function onLogin(human)
- posAttrQuery(human)
- formationQuery(human)
- sendAllCombatPos(human)
- end
- --获得type类型的战斗 上阵的魔兽id index 是指 冠军试炼场 有三个队列才用
- function getCombatMoshou(human,combatType)
- local _,helpList = getCombatHeros(human,combatType)
- return helpList[1]
- end
- function fontHelpNet(net,type,id,icon)
- net.type = type
- net.id = id or 0
- net.icon = icon or 0
- end
- function posQuery(human, combatType, group, param, flag)
- local combatConfig = CombatExcel.combat[combatType]
- if not combatConfig then return end
- local msgRet = Msg.gc.GC_COMBAT_POS_QUERY
- local len = 0
- local newIsQuickTime
- if combatType == CombatDefine.COMBAT_TYPE1 then
- newIsQuickTime = getTalismanAdd(human)
- end
- -- 购买新首充所有礼包后, 所有战斗都可以第一回合跳过
- local isAllQuick = NewFirstChargeLogic.IsBuyAllgift(human)
- if group and group ~= 0 then
- for k,v in ipairs(CombatExcel.combat) do
- if v.group == group then
- len = len + 1
- msgRet.list[len].type = k
- msgRet.list[len].name = v.name
- -- msgRet.list[len].isQuickTime = v.isQuickTime
- if isAllQuick then
- msgRet.list[len].isQuickTime = v.isQuickTime2
- else
- msgRet.list[len].isQuickTime = newIsQuickTime and newIsQuickTime or v.isQuickTime
- end
- msgRet.list[len].needLv = RoleSystemLogic.getOpenLv(v.systemID)
- end
- end
- else
- len = len + 1
- msgRet.list[len].type = combatType
- msgRet.list[len].name = combatConfig.name
- -- msgRet.list[len].isQuickTime = combatConfig.isQuickTime
- if isAllQuick then
- msgRet.list[len].isQuickTime = combatConfig.isQuickTime2
- else
- msgRet.list[len].isQuickTime = newIsQuickTime and newIsQuickTime or combatConfig.isQuickTime
- end
- msgRet.list[len].needLv = RoleSystemLogic.getOpenLv(combatConfig.systemID)
- end
- msgRet.type = combatType
- msgRet.teamType = combatConfig.teamType
- msgRet.list[0] = len
- local heroList,helpList,formation,combatHeroDB = getCombatHeros(human,combatType)
- local formationConf = FormationExcel[formation]
- msgRet.formation = formation
- len = 0
- local totalZdl = 0
- for i = 1,CombatDefine.COMBAT_HERO_CNT do
- local uuid = heroList[i] or "0"
- local heroGrid = nil
- if combatType == CombatDefine.COMBAT_TYPE24 then
- heroGrid = LostTempleCombatLogic.getHeroGridByUuid(human, uuid)
- else
- heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
- end
-
- if heroGrid then
- len = len + 1
- msgRet.heroList[len].pos = i
- msgRet.heroList[len].bagIndex = heroGrid.bagIndex
- msgRet.heroList[len].uuid = heroGrid.uuid
- --重新计算战力 缓存的情况下
- if not heroGrid.isLostTemple then
- if not human.heroAttrs[heroGrid.bagIndex] then
- RoleAttr.doCalcHero(human, heroGrid.bagIndex)
- end
- else
- LostTempleCombatLogic.getHeroAttrs(human, heroGrid.bagIndex)
- end
- totalZdl = totalZdl + heroGrid.zhandouli
- end
- end
- msgRet.totalZdl = totalZdl
- msgRet.heroList[0] = len
- len = 0
- if helpList[1] and helpList[1] > 0 then
- len = len + 1
- MoshouLogic.setPosHelp(msgRet.helpList[len],helpList[1])
- end
- msgRet.helpList[0] = len
- msgRet.backUpLock = canBackup(human)
- local mapID = nil
- if param ~= nil then
- local args = Util.split(param, "|")
- mapID = CombatLogic.getMapID(human, combatType, args)
- end
- msgRet.mapID = mapID or 0
- msgRet.jibanLv = RoleSystemLogic.getOpenLv(RoleSystemDefine.ROLE_SYS_ID_207)
- msgRet.flag = flag or 0
- local cjPrivilege = ChengjiuLogic.checkPrivilege(human, ChengjiuDefine.PRIVILEGE_TYPE_8)
- msgRet.moshouLock = cjPrivilege and 1 or 0
- local skillID = MoshouLogic.getPutMoshouSkillID(human, combatType) or 0
- local skillConfig = SkillExcel.skill[skillID]
- msgRet.moshouSkill = skillConfig and skillConfig.icon or ""
- Msg.send(msgRet,human.fd)
- end
- function canBackup(human)
- local backupDB = human.db.combatBackup or 0
- return backupDB
- end
- function activeBackup(human)
- human.db.combatBackup = 1
- end
- function checkPos(formation,pos)
- local ret
- if pos == CombatDefine.COMBAT_BACKUP_POS then
- ret = 1
- else
- local posList = getPosList(formation)
- if posList[pos] then
- ret = 1
- end
- end
- return ret
- end
- function getFormationConfig(formation)
- return FormationExcel[formation]
- end
- function sendAllCombatPos(human)
- for k, v in pairs(CombatExcel.combat) do
- posQuery(human, k, v.group)
- JibanLogic.sendQuery(human, k, v.teamType)
- end
- end
- -- 是否是阵容中最后一个英雄
- function isLastInCombat(human,heroIndex)
- if not heroIndex or heroIndex == "" then return end
- local combatTb = Util.copyTable(human.db.combatHero)
- for teamType, combatHero in pairs(combatTb) do
- local isChange = nil
- for k, v in pairs(combatHero.list) do
- if type(v) == "table" then
- for k2, v2 in pairs(v) do
- if v2 == heroIndex then
- v[k2] = nil
- isChange = true
- end
- end
- elseif v == heroIndex then
- combatHero[k] = nil
- isChange = true
- end
- end
- if isChange then
- local heroCnt = 0
- for k, v in pairs(combatHero) do
- if type(v) == "table" then
- for k2, v2 in pairs(v) do
- if v2 ~= 0 then
- heroCnt = heroCnt + 1
- end
- end
- elseif v ~= 0 then
- heroCnt = heroCnt + 1
- end
- end
- if heroCnt == 0 then
- return true
- end
- end
- end
- end
- local restrict = nil
- function getRestrict(attacker,defender,key)
- if not restrict then
- restrict = {}
- for k,v in ipairs(DefineExcel.attrs) do
- restrict[v[1]] = v[2]
- end
- end
- if restrict[key] and DefineExcel.restrict[attacker.camp] == defender.camp then
- return restrict[key]
- end
- return 0
- end
- function setCombatByUnionWarGm(human, combatType)
- local heroList = {}
- local cnt = 0
- local useList = { }
- local fatherList = { }
- local helpList = {}
- -- 确定英雄存不存在
- for i = 1, 6 do
- local uuid
- for k, v in pairs(human.db.heroBag) do
- if k and k > 0 and v and v.uuid then
- uuid = v.uuid
- break
- end
- end
- if uuid then
- cnt = cnt + 1
- heroList[cnt] = uuid
- end
- end
- local combatHeroDB, teamType = getCombatHeroDB(human,combatType)
- combatHeroDB.formation = 1
- combatHeroDB.list = heroList
- combatHeroDB.helpList = helpList
- end
- -- 更新战力
- function updateZdl(human, uuidList)
- local list = Util.split(uuidList, "|")
- local msgRet = Msg.gc.GC_HERO_UPDATE_ZDL
- local len = 0
- for i = 1, CombatDefine.COMBAT_HERO_CNT do
- local uuid = list[i]
- if uuid then
- local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
- if not heroGrid then return end
-
- if not human.heroAttrs[heroGrid.bagIndex] then
- RoleAttr.doCalcHero(human, heroGrid.bagIndex)
- len = len + 1
- msgRet.list[len].uuid = uuid
- msgRet.list[len].zdl = heroGrid.zhandouli
- end
- end
- end
- if len > 0 then
- msgRet.list[0] = len
- Msg.send(msgRet,human.fd)
- end
- end
|