| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- ----------------------------------------------------------------
- -- 巅峰战场战斗模块
- -- 用于注册到 CombatLogic 的战斗模块系统
- ----------------------------------------------------------------
- local CombatDefine = require("combat.CombatDefine")
- local CombatLogic = require("combat.CombatLogic")
- local ServerCommerceActPeakBettle = require("serverCommerce.ServerCommerceActPeakBettle")
- local RoleDBLogic = require("role.RoleDBLogic")
- local CombatPosLogic = require("combat.CombatPosLogic")
- -- 战斗类型(需要在 CombatDefine 中添加,或使用 Excel 配置)
- local COMBAT_TYPE_PEAK_BATTLEFIELD = CombatDefine.COMBAT_TYPE35 or 35
- local module = {}
- -- 获取对手的战斗对象列表(防守方)
- function module.getCombatObjList(human, side, args, combatType)
- if side ~= CombatDefine.DEFEND_SIDE then return end
- if combatType ~= COMBAT_TYPE_PEAK_BATTLEFIELD then return end
-
- local opponentUuid = args.opponentUuid
- if not opponentUuid then return end
-
- -- 获取对手数据(通过 serverCommerce 模块)
- -- 注意:这里需要访问 ServerCommerceActPeakBettle 的内部函数
- -- 由于是 local 函数,可能需要添加公共接口或使用其他方式
-
- -- 如果是玩家,使用玩家的防守阵容
- local target = CombatLogic.createCombatFakeHuman(opponentUuid)
- if target then
- return CombatLogic.getHumanObjList(target, COMBAT_TYPE_PEAK_BATTLEFIELD)
- end
-
- -- 如果是NPC或系统数据,使用系统提供的英雄数据
- -- 这里需要根据实际需求实现系统英雄数据的创建
- -- 暂时返回 nil,需要后续实现
- return nil
- end
- -- 获取地图ID
- function module.getMapID(human, param)
- -- 巅峰战场使用固定地图,或从配置读取
- return nil -- 使用默认地图
- end
- -- 检查是否可以打开上阵界面
- function module.checkCombatPos(human, args, combatType)
- if combatType ~= COMBAT_TYPE_PEAK_BATTLEFIELD then return true end
-
- -- 检查对手是否存在
- local opponentUuid = args.opponentUuid
- if not opponentUuid then return false end
-
- -- 使用公共接口检查对手
- if not ServerCommerceActPeakBettle.CheckOpponent(opponentUuid) then
- return false
- end
-
- return true, {opponentUuid = opponentUuid}
- end
- -- 战斗开始前的处理
- function module.fight(human, args, combatType)
- if combatType ~= COMBAT_TYPE_PEAK_BATTLEFIELD then return end
-
- -- 战斗已经在 ServerCommerceActPeakBettle.CommerceActPeakBettle_Challenge 中启动
- -- 这里可以做额外的处理
- end
- -- 战斗结束回调
- function module.onFightEnd(human, result, combatType, cbParam, combatInfo, param, isSaodang)
- if combatType ~= COMBAT_TYPE_PEAK_BATTLEFIELD then return end
-
- ServerCommerceActPeakBettle.CommerceActPeakBettle_OnFightEnd(human, result, combatType, cbParam, combatInfo, param)
- end
- -- 获取战斗名称
- function module.getCombatName(human, args, combatType)
- if combatType ~= COMBAT_TYPE_PEAK_BATTLEFIELD then return "" end
- return "巅峰战场"
- end
- return module
|