|
|
@@ -692,6 +692,33 @@ local function BattleLogic_GetBattleAdopt(human, nBattleType)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+-- 获取额外增加扫荡次数
|
|
|
+local function BattleLogic_GetAddFreeMopupNum(human)
|
|
|
+ if not human then
|
|
|
+ return -1
|
|
|
+ end
|
|
|
+
|
|
|
+ if not human.db.mopupAddFreeCnt then
|
|
|
+ human.db.mopupAddFreeCnt = 0
|
|
|
+ end
|
|
|
+
|
|
|
+ return human.db.mopupAddFreeCnt
|
|
|
+end
|
|
|
+
|
|
|
+-- 设置额外增加扫荡次数
|
|
|
+local function BattleLogic_SetAddFreeMopupNum(human, nValue)
|
|
|
+ if not human then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ print("[BattleLogic_SetAddFreeMopupNum] 消耗的额外次数 nValue = "..nValue)
|
|
|
+ human.db.mopupAddFreeCnt = human.db.mopupAddFreeCnt + nValue
|
|
|
+
|
|
|
+ if 0 > human.db.mopupAddFreeCnt then
|
|
|
+ human.db.mopupAddFreeCnt = 0
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
function getBattleRoleList(nBattleType, worldMapId)
|
|
|
if not BATTLE_LEVEL_PLAYER_LIST then
|
|
|
BATTLE_LEVEL_PLAYER_LIST = {}
|
|
|
@@ -1370,6 +1397,11 @@ function query(human)
|
|
|
msgRet.canMopup = human.db.mopupDoCnt < BATTLE_MOPUP_CNT and 1 or 0
|
|
|
end
|
|
|
|
|
|
+ -- 判断额外增加的扫荡次数
|
|
|
+ if 0 < BattleLogic_GetAddFreeMopupNum(human) and 0 == msgRet.canMopup then
|
|
|
+ msgRet.canMopup = 1
|
|
|
+ end
|
|
|
+
|
|
|
local monsterOutId = nowNodeConfig.monsterOutID
|
|
|
if not monsterOutId then
|
|
|
print("[BattleLogic query] monsterOutId 为空")
|
|
|
@@ -2619,6 +2651,7 @@ function mopupQuery(human)
|
|
|
|
|
|
human.db.mopupDoCnt = human.db.mopupDoCnt or 0
|
|
|
local nextDoCnt = human.db.mopupDoCnt + 1
|
|
|
+ nextDoCnt = nextDoCnt >= EliteDefine.BATTLE_MOPUP_MAX_LEN and EliteDefine.BATTLE_MOPUP_MAX_LEN or nextDoCnt
|
|
|
-- local nodeConfig = BattleExcel.node[guajiID]
|
|
|
local nodeConfig = tBattleConfig.node[guajiID]
|
|
|
local dropID = nodeConfig.dropID
|
|
|
@@ -2650,11 +2683,18 @@ function mopupQuery(human)
|
|
|
local mapConfig = tBattleConfig.map[nodeConfig.mapID]
|
|
|
msgRet.name = mapConfig.name
|
|
|
msgRet.item[0] = dropCnt
|
|
|
+ local nNowAddFreeCnt = BattleLogic_GetAddFreeMopupNum(human)
|
|
|
if TequanShopLogic.isActiveMopup(human) then
|
|
|
msgRet.leftCnt = BATTLE_MOPUP_CNT_VIP - human.db.mopupDoCnt
|
|
|
else
|
|
|
msgRet.leftCnt = BATTLE_MOPUP_CNT - human.db.mopupDoCnt
|
|
|
end
|
|
|
+
|
|
|
+ -- 剩余次数小于0则为0,再加额外的
|
|
|
+ msgRet.leftCnt = msgRet.leftCnt < 0 and 0 or msgRet.leftCnt
|
|
|
+
|
|
|
+ -- 增加额外次数
|
|
|
+ msgRet.leftCnt = msgRet.leftCnt + nNowAddFreeCnt
|
|
|
|
|
|
-- local mupopExcel = BattleExcel.mupop[nextDoCnt]
|
|
|
local mupopExcel = tBattleConfig.mupop[nextDoCnt]
|
|
|
@@ -2673,12 +2713,19 @@ function mopupQuery(human)
|
|
|
else
|
|
|
msgRet.need = 0
|
|
|
end
|
|
|
+
|
|
|
+ -- 如果有额外增加次数则需要为0
|
|
|
+ if 0 < nNowAddFreeCnt then
|
|
|
+ msgRet.need = 0
|
|
|
+ end
|
|
|
+
|
|
|
msgRet.vip = TequanShopLogic.isActiveMopup(human) and 1 or 0
|
|
|
msgRet.nowCnt = human.db.mopupDoCnt
|
|
|
msgRet.exp = nodeConfig.hangExp
|
|
|
msgRet.jinbi = nodeConfig.hangJinbi
|
|
|
msgRet.greenExp = nodeConfig.hangGreenExp
|
|
|
msgRet.qingbao = nodeConfig.hangQingbao
|
|
|
+ print("[mopupQuery] nowCnt = "..msgRet.nowCnt.." leftCnt = "..msgRet.leftCnt.." nNowAddFreeCnt = "..nNowAddFreeCnt)
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
@@ -2698,27 +2745,34 @@ function mopupFight(human)
|
|
|
human.db.mopupDoCnt = human.db.mopupDoCnt or 0
|
|
|
human.db.mopupFreeCnt = human.db.mopupFreeCnt or 0
|
|
|
local nextDoCnt = human.db.mopupDoCnt + 1
|
|
|
+ nextDoCnt = nextDoCnt >= EliteDefine.BATTLE_MOPUP_MAX_LEN and EliteDefine.BATTLE_MOPUP_MAX_LEN or nextDoCnt
|
|
|
-- local mupopExcel = BattleExcel.mupop[nextDoCnt]
|
|
|
local mupopExcel = tBattleConfig.mupop[nextDoCnt]
|
|
|
+ local nNowAddFreeCnt = BattleLogic_GetAddFreeMopupNum(human)
|
|
|
+
|
|
|
if not mupopExcel then
|
|
|
return Broadcast.sendErr(human, Lang.BATTLE_MOPUP_CNT_OVER)
|
|
|
end
|
|
|
+
|
|
|
+ local bUseFree = false
|
|
|
if not TequanShopLogic.isActiveMopup(human) then
|
|
|
- if human.db.mopupDoCnt >= BATTLE_MOPUP_CNT then
|
|
|
+ if human.db.mopupDoCnt >= BATTLE_MOPUP_CNT and 0 >= nNowAddFreeCnt then
|
|
|
return Broadcast.sendErr(human, Lang.BATTLE_MOPUP_CNT_OVER)
|
|
|
end
|
|
|
need = mupopExcel.cost
|
|
|
-- 如果免费次数小于1次,则按免费算
|
|
|
if human.db.mopupFreeCnt < BATTLE_MOPUP_FREE_CNT then
|
|
|
+ bUseFree = true
|
|
|
need = 0
|
|
|
end
|
|
|
else
|
|
|
- if human.db.mopupDoCnt >= BATTLE_MOPUP_CNT_VIP then
|
|
|
+ if human.db.mopupDoCnt >= BATTLE_MOPUP_CNT_VIP and 0 >= nNowAddFreeCnt then
|
|
|
return Broadcast.sendErr(human, Lang.BATTLE_MOPUP_CNT_OVER)
|
|
|
end
|
|
|
need = mupopExcel.vipCost
|
|
|
-- 如果免费次数小于3次,则按免费算
|
|
|
if human.db.mopupFreeCnt < BATTLE_MOPUP_FREE_CNT_VIP then
|
|
|
+ bUseFree = true
|
|
|
need = 0
|
|
|
end
|
|
|
end
|
|
|
@@ -2727,13 +2781,20 @@ function mopupFight(human)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
- if need <= 0 then
|
|
|
+ local bUseAddFree = false
|
|
|
+ if need <= 0 and bUseFree == true then
|
|
|
human.db.mopupFreeCnt = human.db.mopupFreeCnt + 1
|
|
|
+ else
|
|
|
+ if nNowAddFreeCnt > 0 then
|
|
|
+ need = 0
|
|
|
+ BattleLogic_SetAddFreeMopupNum(human, -1)
|
|
|
+ bUseAddFree = true
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
ObjHuman.decZuanshi(human, - need, "battleMopup")
|
|
|
|
|
|
- human.db.mopupDoCnt = human.db.mopupDoCnt + 1
|
|
|
+ human.db.mopupDoCnt = bUseAddFree == true and human.db.mopupDoCnt or human.db.mopupDoCnt + 1
|
|
|
|
|
|
-- local guajiID = human.db.guajiID > #BattleExcel.node and #BattleExcel.node or human.db.guajiID
|
|
|
local guajiID = nNowGuaJiID > #tBattleConfig.node and #tBattleConfig.node or nNowGuaJiID
|
|
|
@@ -2816,6 +2877,7 @@ end
|
|
|
function updateDaily(human)
|
|
|
human.db.mopupFreeCnt = 0
|
|
|
human.db.mopupDoCnt = 0
|
|
|
+ human.db.mopupAddFreeCnt = 0
|
|
|
end
|
|
|
|
|
|
function getTongGuanReward(human, id)
|
|
|
@@ -3598,4 +3660,32 @@ function BattleLogic_IsLastLevels(human, nBattleType)
|
|
|
|
|
|
local nValue = BattleLogic_GetBattleAdopt(human, nBattleType)
|
|
|
return nValue == 1
|
|
|
+end
|
|
|
+
|
|
|
+-- 增加扫荡次数
|
|
|
+function BattleLogic_AddMopup(human, nGoodsID, nGoodsNum)
|
|
|
+ if not human or 0 >= nGoodsID or 0 >= nGoodsNum then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ if EliteDefine.BATTLE_ADD_MOPUP_GOODID ~= nGoodsID then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 检测数量
|
|
|
+ if false == BagLogic.checkItemCnt(human, nGoodsID, nGoodsNum) then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 消耗物品
|
|
|
+ BagLogic.delItem(human, nGoodsID, nGoodsNum, "battle")
|
|
|
+
|
|
|
+ -- 增加次数
|
|
|
+ BattleLogic_SetAddFreeMopupNum(human, nGoodsNum)
|
|
|
+
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "[BattleLogic_AddMopup] 增加扫荡次数 name = "
|
|
|
+ ..human.db.name.." nAddNum ="..nGoodsNum)
|
|
|
+
|
|
|
+ print("[BattleLogic_AddMopup] 玩家增加扫荡次数 name = "
|
|
|
+ ..human.db.name.." nAddNum ="..nGoodsNum)
|
|
|
end
|