BattleWillLogic.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. ------------------------------------------------------
  2. -- 战意逻辑
  3. ------------------------------------------------------
  4. local Lang = require("common.Lang")
  5. local Util = require("common.Util")
  6. local Msg = require("core.Msg")
  7. local ObjHuman = require("core.ObjHuman")
  8. local Broadcast = require("broadcast.Broadcast")
  9. local Grid = require("bag.Grid")
  10. local BagLogic = require("bag.BagLogic")
  11. local ItemDefine = require("bag.ItemDefine")
  12. local HeroLogic = require("hero.HeroLogic")
  13. local Log = require("common.Log")
  14. local BingshuGrid = require("fuwen.BingshuGrid")
  15. local FuwenExcel = require("excel.fuwen")
  16. local BingshuLogic = require("fuwen.BingshuLogic")
  17. -- 战意回退配置
  18. local BATTLE_WILL_ROLLBACK_CONFIG = {
  19. [1] = { -- 初级
  20. needItemID = 1050, -- 消耗道具ID
  21. needItemCnt = 1, -- 消耗数量:1个
  22. returnBattleWillCnt = 1, -- 返还战意:1个
  23. returnFragmentID = 177, -- 返还战意碎片道具ID
  24. returnFragmentCnt = 0, -- 返还战意碎片:0
  25. returnAncientSpiritID = 135, -- 返还远古之灵道具ID
  26. returnAncientSpiritCnt = 0 -- 返还远古之灵:0
  27. },
  28. [2] = { -- 中级
  29. needItemID = 1050,
  30. needItemCnt = 1, -- 消耗数量:1个(按钮显示)
  31. returnBattleWillCnt = 4, -- 返还战意:4个
  32. returnFragmentID = 177,
  33. returnFragmentCnt = 10000, -- 返还战意碎片:10,000
  34. returnAncientSpiritID = 135,
  35. returnAncientSpiritCnt = 0
  36. },
  37. [3] = { -- 高级
  38. needItemID = 1050,
  39. needItemCnt = 1, -- 消耗数量:1个(按钮显示)
  40. returnBattleWillCnt = 9, -- 返还战意:9个
  41. returnFragmentID = 177,
  42. returnFragmentCnt = 40000, -- 返还战意碎片:40,000
  43. returnAncientSpiritID = 135,
  44. returnAncientSpiritCnt = 0
  45. },
  46. [4] = { -- 超级
  47. needItemID = 1050,
  48. needItemCnt = 1, -- 消耗数量:1个(按钮显示)
  49. returnBattleWillCnt = 19, -- 返还战意:19个
  50. returnFragmentID = 177,
  51. returnFragmentCnt = 90000, -- 返还战意碎片:90,000
  52. returnAncientSpiritID = 135,
  53. returnAncientSpiritCnt = 100 -- 返还远古之灵:100
  54. }
  55. }
  56. -- 从配置表中动态获取战意技能组ID
  57. -- 配置表中 skill 表的所有技能都是战意技能
  58. local function getBattleWillGroupIDs()
  59. local groupIDs = {}
  60. local groupIDSet = {}
  61. -- 遍历所有兵书技能(isBingshuSkill=1),收集所有 groupID
  62. -- 因为整个 skill 表都是战意,所以所有兵书技能的 groupID 都是战意技能组ID
  63. for skillID, skillConfig in pairs(FuwenExcel.skill) do
  64. if skillConfig and skillConfig.isBingshuSkill == 1 then
  65. local groupID = skillConfig.groupID
  66. if groupID and not groupIDSet[groupID] then
  67. table.insert(groupIDs, groupID)
  68. groupIDSet[groupID] = true
  69. end
  70. end
  71. end
  72. -- 如果没有找到,使用默认值(兼容性处理)
  73. if #groupIDs == 0 then
  74. Log.write(Log.LOGID_DEBUG, "[getBattleWillGroupIDs] 未找到战意技能,使用默认值: {1001, 1002}")
  75. return {1001, 1002}
  76. end
  77. -- 排序以确保一致性
  78. table.sort(groupIDs)
  79. Log.write(Log.LOGID_DEBUG, "[getBattleWillGroupIDs] 找到战意技能组ID: "..table.concat(groupIDs, ","))
  80. return groupIDs
  81. end
  82. -- 缓存战意技能组ID列表(在模块加载时初始化)
  83. local BATTLE_WILL_GROUP_IDS = getBattleWillGroupIDs()
  84. -- 判断是否是战意技能
  85. local function isBattleWillSkill(skillConfig)
  86. if not skillConfig or not skillConfig.groupID then
  87. return false
  88. end
  89. for _, groupID in ipairs(BATTLE_WILL_GROUP_IDS) do
  90. if skillConfig.groupID == groupID then
  91. return true
  92. end
  93. end
  94. return false
  95. end
  96. ----------------------------------------- 工具函数 -----------------------------------------
  97. -- 获取战意格子数据(通过索引)
  98. -- 战意数据存储在 heroGrid.bingshu[index] 中,需要判断 groupID == 1002
  99. function getBattleWillGrid(heroGrid, index)
  100. if not heroGrid then
  101. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] heroGrid为nil")
  102. return
  103. end
  104. if not index then
  105. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] index为nil")
  106. return
  107. end
  108. -- 从bingshu中获取战意数据
  109. if not heroGrid.bingshu then
  110. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] heroGrid.bingshu为nil")
  111. return
  112. end
  113. local bingshuGrid = heroGrid.bingshu[index]
  114. if not bingshuGrid then
  115. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] heroGrid.bingshu["..index.."]为nil")
  116. return
  117. end
  118. local skillID = bingshuGrid.skillID
  119. if not skillID then
  120. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] skillID为nil, index="..index)
  121. return
  122. end
  123. -- 检查是否是战意技能(groupID=1001"狂暴"或groupID=1002"战意")
  124. local skillConfig = FuwenExcel.skill[skillID]
  125. if not skillConfig then
  126. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] skillConfig为nil, skillID="..skillID)
  127. return
  128. end
  129. if not isBattleWillSkill(skillConfig) then
  130. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] 不是战意技能, groupID="..(skillConfig.groupID or "nil")..", skillID="..skillID..", index="..index)
  131. return
  132. end
  133. Log.write(Log.LOGID_DEBUG, "[getBattleWillGrid] 找到战意技能: index="..index..", skillID="..skillID..", level="..(skillConfig.lv or "nil"))
  134. return bingshuGrid, index
  135. end
  136. -- 查找战意所在的索引(遍历所有bingshu格子)
  137. function findBattleWillIndex(heroGrid)
  138. if not heroGrid or not heroGrid.bingshu then
  139. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] heroGrid或heroGrid.bingshu为nil")
  140. return nil
  141. end
  142. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] 开始遍历所有bingshu格子,查找战意技能(groupID=1001或1002)")
  143. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] BINGSHU_MAXCNT="..BingshuLogic.BINGSHU_MAXCNT)
  144. -- 遍历所有bingshu格子,查找groupID=1001或1002的技能
  145. for i = 1, BingshuLogic.BINGSHU_MAXCNT do
  146. local bingshuGrid = heroGrid.bingshu[i]
  147. if bingshuGrid then
  148. local skillID = bingshuGrid.skillID
  149. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."]存在, skillID="..(skillID or "nil"))
  150. if skillID then
  151. local skillConfig = FuwenExcel.skill[skillID]
  152. if skillConfig then
  153. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."] skillConfig存在, skillID="..skillID..", groupID="..(skillConfig.groupID or "nil")..", lv="..(skillConfig.lv or "nil")..", name="..(skillConfig.name or "nil"))
  154. if isBattleWillSkill(skillConfig) then
  155. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] ✓ 找到战意: index="..i..", skillID="..skillID..", level="..(skillConfig.lv or "nil")..", name="..(skillConfig.name or "nil")..", groupID="..(skillConfig.groupID or "nil"))
  156. return i
  157. else
  158. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."]不是战意, groupID="..(skillConfig.groupID or "nil"))
  159. end
  160. else
  161. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."] skillConfig为nil, skillID="..skillID)
  162. end
  163. else
  164. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."] skillID为nil")
  165. end
  166. else
  167. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] bingshu["..i.."]不存在")
  168. end
  169. end
  170. Log.write(Log.LOGID_DEBUG, "[findBattleWillIndex] ✗ 未找到战意技能(groupID=1001或1002),已遍历所有"..BingshuLogic.BINGSHU_MAXCNT.."个格子")
  171. return nil
  172. end
  173. -- 获取战意等级
  174. -- 根据skillID判断等级:1002=1级, 2002=2级, 3002=3级, 4002=4级
  175. function getBattleWillLevel(heroGrid, index)
  176. local grid, actualIndex = getBattleWillGrid(heroGrid, index)
  177. if not grid then
  178. Log.write(Log.LOGID_DEBUG, "[getBattleWillLevel] grid为nil, index="..(index or "nil"))
  179. return 0
  180. end
  181. local skillID = grid.skillID
  182. if not skillID then
  183. Log.write(Log.LOGID_DEBUG, "[getBattleWillLevel] skillID为nil")
  184. return 0
  185. end
  186. -- 通过配置表获取等级
  187. local skillConfig = FuwenExcel.skill[skillID]
  188. if skillConfig and isBattleWillSkill(skillConfig) then
  189. local level = skillConfig.lv or 0
  190. Log.write(Log.LOGID_DEBUG, "[getBattleWillLevel] 获取到等级: level="..level..", skillID="..skillID..", index="..(index or "nil"))
  191. return level
  192. end
  193. Log.write(Log.LOGID_DEBUG, "[getBattleWillLevel] 不是战意技能, skillID="..skillID)
  194. return 0
  195. end
  196. -- 获取下一级战意技能ID(参考兵书的getNextSkillID)
  197. function getNextBattleWillSkillID(skillID)
  198. local tconfig = FuwenExcel.skill[skillID]
  199. if not tconfig then return end
  200. if not isBattleWillSkill(tconfig) then return end
  201. for id, config in pairs(FuwenExcel.skill) do
  202. if (config.isBingshuSkill == 1) and
  203. isBattleWillSkill(config) and
  204. (config.groupID == tconfig.groupID) and -- 保持相同的groupID(1001或1002)
  205. (config.lv == tconfig.lv + 1) and
  206. (#config.bingshuUpNeed > 0) then
  207. return id
  208. end
  209. end
  210. end
  211. ----------------------------------------- 协议处理 -----------------------------------------
  212. -- 查询回退信息
  213. function sendRollbackQuery(human, heroID, heroIndex, index)
  214. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 收到查询请求: heroID="..(heroID or "nil")..", heroIndex="..(heroIndex or "nil")..", index="..(index or "nil"))
  215. local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
  216. if not heroGrid then
  217. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 英雄不存在: heroID="..(heroID or "nil")..", heroIndex="..(heroIndex or "nil"))
  218. return Broadcast.sendErr(human, Lang.COMMON_ARGUMENT_ERROR)
  219. end
  220. -- 如果传入的index不是战意,尝试查找战意所在的索引
  221. local battleWillIndex = index
  222. local grid = getBattleWillGrid(heroGrid, index)
  223. if not grid then
  224. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] index="..index.."不是战意,尝试查找战意所在位置")
  225. battleWillIndex = findBattleWillIndex(heroGrid)
  226. if not battleWillIndex then
  227. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 未找到战意技能")
  228. return Broadcast.sendErr(human, "当前战意格子为空,无法回退")
  229. end
  230. grid = heroGrid.bingshu[battleWillIndex]
  231. end
  232. local currentLevel = getBattleWillLevel(heroGrid, battleWillIndex)
  233. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 当前战意等级: "..currentLevel..", index="..battleWillIndex)
  234. -- 检查等级是否可回退(等级0为空,不可回退)
  235. if currentLevel == 0 or currentLevel < 1 or currentLevel > 4 then
  236. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 当前等级不可回退: level="..currentLevel)
  237. return Broadcast.sendErr(human, "当前战意格子为空,无法回退")
  238. end
  239. local config = BATTLE_WILL_ROLLBACK_CONFIG[currentLevel]
  240. if not config then
  241. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 配置不存在: level="..currentLevel)
  242. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  243. end
  244. local msgRet = Msg.gc.GC_BATTLE_WILL_ROLLBACK_QUERY
  245. msgRet.heroID = heroID
  246. msgRet.heroIndex = heroIndex
  247. msgRet.index = battleWillIndex -- 使用实际找到的索引
  248. msgRet.currentLevel = currentLevel
  249. msgRet.targetLevel = 0 -- 回退后等级固定为0(空)
  250. -- 消耗道具
  251. Grid.makeItem(msgRet.needItem, config.needItemID, config.needItemCnt)
  252. -- 获取当前技能的groupID,确定返还的战意ID
  253. -- groupID=1001(狂暴)对应itemID=301,groupID=1002(战意)对应itemID=302
  254. local currentSkillID = grid.skillID
  255. local currentSkillConfig = FuwenExcel.skill[currentSkillID]
  256. local returnBattleWillID = nil
  257. if currentSkillConfig then
  258. if currentSkillConfig.groupID == 1001 then
  259. returnBattleWillID = 301 -- 狂暴战意
  260. elseif currentSkillConfig.groupID == 1002 then
  261. returnBattleWillID = 302 -- 战意战意
  262. end
  263. end
  264. -- 返还物品列表
  265. msgRet.returnItems[0] = 0
  266. local itemCnt = 0
  267. -- 返还战意
  268. if config.returnBattleWillCnt > 0 and returnBattleWillID then
  269. itemCnt = itemCnt + 1
  270. if itemCnt <= #msgRet.returnItems then
  271. Grid.makeItem(msgRet.returnItems[itemCnt], returnBattleWillID, config.returnBattleWillCnt)
  272. end
  273. end
  274. -- 返还战意碎片
  275. if config.returnFragmentCnt > 0 and config.returnFragmentID > 0 then
  276. itemCnt = itemCnt + 1
  277. if itemCnt <= #msgRet.returnItems then
  278. Grid.makeItem(msgRet.returnItems[itemCnt], config.returnFragmentID, config.returnFragmentCnt)
  279. end
  280. end
  281. -- 返还远古之灵
  282. if config.returnAncientSpiritCnt > 0 and config.returnAncientSpiritID > 0 then
  283. itemCnt = itemCnt + 1
  284. if itemCnt <= #msgRet.returnItems then
  285. Grid.makeItem(msgRet.returnItems[itemCnt], config.returnAncientSpiritID, config.returnAncientSpiritCnt)
  286. end
  287. end
  288. msgRet.returnItems[0] = itemCnt
  289. Log.write(Log.LOGID_DEBUG, "[sendRollbackQuery] 发送查询结果: currentLevel="..currentLevel..", index="..battleWillIndex..", needItemCnt="..config.needItemCnt..", returnItemsCount="..itemCnt)
  290. Msg.send(msgRet, human.fd)
  291. end
  292. -- 执行回退
  293. function rollback(human, heroID, heroIndex, index)
  294. Log.write(Log.LOGID_DEBUG, "[rollback] 收到回退请求: heroID="..(heroID or "nil")..", heroIndex="..(heroIndex or "nil")..", index="..(index or "nil"))
  295. local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
  296. if not heroGrid then
  297. Log.write(Log.LOGID_DEBUG, "[rollback] 英雄不存在")
  298. return Broadcast.sendErr(human, Lang.COMMON_ARGUMENT_ERROR)
  299. end
  300. -- 检查index范围(1-BINGSHU_MAXCNT)
  301. if index and (index < 1 or index > BingshuLogic.BINGSHU_MAXCNT) then
  302. Log.write(Log.LOGID_DEBUG, "[rollback] index超出范围: index="..(index or "nil")..", 有效范围: 1-"..BingshuLogic.BINGSHU_MAXCNT)
  303. return Broadcast.sendErr(human, Lang.COMMON_ARGUMENT_ERROR)
  304. end
  305. -- 如果传入的index不是战意,尝试查找战意所在的索引
  306. local battleWillIndex = index
  307. local grid = nil
  308. if index then
  309. grid = getBattleWillGrid(heroGrid, index)
  310. end
  311. if not grid then
  312. if index then
  313. Log.write(Log.LOGID_DEBUG, "[rollback] index="..index.."不是战意或为空,尝试查找战意所在位置")
  314. else
  315. Log.write(Log.LOGID_DEBUG, "[rollback] index为nil,尝试查找战意所在位置")
  316. end
  317. battleWillIndex = findBattleWillIndex(heroGrid)
  318. if not battleWillIndex then
  319. Log.write(Log.LOGID_DEBUG, "[rollback] 未找到战意技能")
  320. return Broadcast.sendErr(human, "当前战意格子为空,无法回退")
  321. end
  322. grid = heroGrid.bingshu[battleWillIndex]
  323. end
  324. -- 获取当前技能配置,确定返还的战意ID和等级
  325. local currentSkillID = grid.skillID
  326. local currentSkillConfig = FuwenExcel.skill[currentSkillID]
  327. if not currentSkillConfig then
  328. Log.write(Log.LOGID_DEBUG, "[rollback] 技能配置不存在: skillID="..currentSkillID)
  329. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  330. end
  331. -- 检查是否是战意技能
  332. if not isBattleWillSkill(currentSkillConfig) then
  333. Log.write(Log.LOGID_DEBUG, "[rollback] 不是战意技能: skillID="..currentSkillID..", groupID="..(currentSkillConfig.groupID or "nil"))
  334. return Broadcast.sendErr(human, "当前格子不是战意技能,无法回退")
  335. end
  336. -- 从技能配置中获取等级(更可靠)
  337. local currentLevel = currentSkillConfig.lv or 0
  338. Log.write(Log.LOGID_DEBUG, "[rollback] 当前战意等级: "..currentLevel..", index="..battleWillIndex..", skillID="..currentSkillID)
  339. -- 检查等级是否可回退
  340. if currentLevel == 0 or currentLevel < 1 or currentLevel > 4 then
  341. Log.write(Log.LOGID_DEBUG, "[rollback] 当前等级不可回退: level="..currentLevel)
  342. return Broadcast.sendErr(human, "当前战意格子为空,无法回退")
  343. end
  344. -- 根据groupID确定返还的战意ID
  345. -- groupID=1001(狂暴)对应itemID=301,groupID=1002(战意)对应itemID=302
  346. local returnBattleWillID = nil
  347. if currentSkillConfig.groupID == 1001 then
  348. returnBattleWillID = 301 -- 狂暴战意
  349. elseif currentSkillConfig.groupID == 1002 then
  350. returnBattleWillID = 302 -- 战意战意
  351. end
  352. if not returnBattleWillID then
  353. Log.write(Log.LOGID_DEBUG, "[rollback] 无法确定返还战意ID: groupID="..(currentSkillConfig.groupID or "nil"))
  354. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  355. end
  356. -- 检查消耗道具(回退消耗)
  357. local config = BATTLE_WILL_ROLLBACK_CONFIG[currentLevel]
  358. if not config then
  359. Log.write(Log.LOGID_DEBUG, "[rollback] 回退配置不存在: level="..currentLevel)
  360. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  361. end
  362. if not BagLogic.checkItemCnt(human, config.needItemID, config.needItemCnt) then
  363. Log.write(Log.LOGID_DEBUG, "[rollback] 消耗道具不足: needItemID="..config.needItemID..", needItemCnt="..config.needItemCnt)
  364. return Broadcast.sendErr(human, Lang.COMMON_NO_ITEM)
  365. end
  366. -- 扣除消耗道具
  367. BagLogic.delItem(human, config.needItemID, config.needItemCnt, "battleWill_rollback")
  368. Log.write(Log.LOGID_DEBUG, "[rollback] 扣除消耗道具: needItemID="..config.needItemID..", needItemCnt="..config.needItemCnt)
  369. -- 收集返还物品(根据配置)
  370. local returnItemList = {}
  371. -- 返还战意
  372. if config.returnBattleWillCnt > 0 and returnBattleWillID then
  373. returnItemList[returnBattleWillID] = config.returnBattleWillCnt
  374. end
  375. -- 返还战意碎片
  376. if config.returnFragmentCnt > 0 and config.returnFragmentID > 0 then
  377. returnItemList[config.returnFragmentID] = config.returnFragmentCnt
  378. end
  379. -- 返还远古之灵
  380. if config.returnAncientSpiritCnt > 0 and config.returnAncientSpiritID > 0 then
  381. returnItemList[config.returnAncientSpiritID] = config.returnAncientSpiritCnt
  382. end
  383. -- 发放返还物品(使用通用道具发放逻辑)
  384. if next(returnItemList) then
  385. BagLogic.addItemList(human, returnItemList, "battleWill_rollback")
  386. Log.write(Log.LOGID_DEBUG, "[rollback] 发放返还物品")
  387. for itemID, cnt in pairs(returnItemList) do
  388. Log.write(Log.LOGID_DEBUG, "[rollback] 返还道具: itemID="..itemID..", cnt="..cnt)
  389. end
  390. end
  391. -- 更新战意等级为0(清空)- 删除bingshu中的战意技能
  392. if not heroGrid.bingshu then
  393. heroGrid.bingshu = {}
  394. end
  395. local bingshuGrid = heroGrid.bingshu[battleWillIndex]
  396. if bingshuGrid then
  397. local skillConfig = FuwenExcel.skill[bingshuGrid.skillID]
  398. if skillConfig and isBattleWillSkill(skillConfig) then
  399. -- 这是战意技能,删除它
  400. heroGrid.bingshu[battleWillIndex] = nil
  401. Log.write(Log.LOGID_DEBUG, "[rollback] 删除战意技能: index="..battleWillIndex..", skillID="..bingshuGrid.skillID..", groupID="..(skillConfig.groupID or "nil"))
  402. else
  403. Log.write(Log.LOGID_DEBUG, "[rollback] WARNING: bingshu["..battleWillIndex.."]不是战意技能, skillID="..(bingshuGrid.skillID or "nil"))
  404. end
  405. else
  406. Log.write(Log.LOGID_DEBUG, "[rollback] bingshu["..battleWillIndex.."]不存在")
  407. end
  408. Log.write(Log.LOGID_DEBUG, "[rollback] 回退完成: 等级从 "..currentLevel.." 变为 0")
  409. -- 重新计算英雄属性
  410. ObjHuman.doCalcHero(human, heroIndex)
  411. -- 发送英雄数据更新(如果需要)
  412. HeroLogic.sendHeroBagDynamic(human, heroID, heroIndex)
  413. end