|
|
@@ -178,10 +178,13 @@ function zhihuanQuery(human, heroID, heroIndex)
|
|
|
BagLogic.delItem(human, needItemID, needItemCnt, "xianzhi_zhihuan")
|
|
|
|
|
|
-- 生成新ID
|
|
|
- local nextHero = zhihuanHero(star, camp)
|
|
|
+ local nextHero = zhihuanHero(star, camp,heroGrid.id)
|
|
|
+ if not nextHero then
|
|
|
+ -- 没有置换目标
|
|
|
+ return
|
|
|
+ end
|
|
|
-- 新ID不等于旧ID
|
|
|
|
|
|
-
|
|
|
human.tempZhihuanID = nextHero
|
|
|
human.tempZhihuanHeroID = heroID
|
|
|
human.tempZhihuanHeroIndex = heroIndex
|
|
|
@@ -329,7 +332,7 @@ function zhaohuanHero(human,camp, cnt)
|
|
|
return getID, getCnt
|
|
|
end
|
|
|
|
|
|
-function zhihuanHero(star, camp)
|
|
|
+function zhihuanHero(star, camp,heroId)
|
|
|
local xianzhiConfig = XianzhiExcel.xianzhi[camp]
|
|
|
if not xianzhiConfig then return end
|
|
|
|
|
|
@@ -350,11 +353,14 @@ function zhihuanHero(star, camp)
|
|
|
local chipId = { }
|
|
|
local index = 0
|
|
|
for heroID, heroConfig in pairs(HeroExcel.hero) do
|
|
|
- if heroConfig.camp == camp and heroConfig.zhihuanLv == rate then
|
|
|
+ if heroID ~= heroId and heroConfig.camp == camp and heroConfig.zhihuanLv == rate then
|
|
|
index = index + 1
|
|
|
chipId[index] = heroID
|
|
|
end
|
|
|
end
|
|
|
+ if index == 0 then
|
|
|
+ return
|
|
|
+ end
|
|
|
local randomNum = math.random(1, index)
|
|
|
nextHero = chipId[randomNum]
|
|
|
break
|