zhanwencai 1 năm trước cách đây
mục cha
commit
47efd8e731
3 tập tin đã thay đổi với 22 bổ sung5 xóa
  1. 1 0
      script/common/Lang.lua
  2. BIN
      script/file3.tar.gz
  3. 21 5
      script/module/role/NewLogic.lua

+ 1 - 0
script/common/Lang.lua

@@ -721,4 +721,5 @@ AD_DRAW_REWARD_LIMIT_ERROR = [[超过领取上限次数!!]]
 AD_DRAW_REWARD_SUCCESS = [[观看广告领取奖励成功!!]]
 
 QUICK_HATCH_SUCCESS = [[加速孵化成功!!]]
+QUICK_HATCH_TIME_OUT = [[加速时间大于孵化时间!!]]
 MERGE_SUCCESS = [[融合成功!!]]

BIN
script/file3.tar.gz


+ 21 - 5
script/module/role/NewLogic.lua

@@ -280,11 +280,17 @@ function NewProto(human, type, param)
             -- 初始化
             initMergeInfo(human)
 
-            local remainingTime = 0
+            local remainingTime = human.db.mergeInfo.mergeTime -- 剩余时间
+            local speedTime = 0                                -- 加速时间
             if itemId == 179 then
+                speedTime = (60 * 5 * cnt)
+                if speedTime > remainingTime then
+                    Broadcast.sendErr(human, Lang.QUICK_HATCH_TIME_OUT)
+                    return
+                end
+
                 --使用道具
                 ItemLogic.use(human, itemId, cnt)
-                remainingTime = human.db.mergeInfo.mergeTime - (60 * 5 * cnt)
             else
                 -- 判断消耗
                 local needZuanshi = cnt
@@ -292,19 +298,29 @@ function NewProto(human, type, param)
                     return
                 end
 
+                speedTime = (30 * needZuanshi)
+
+                if speedTime > remainingTime then
+                    Broadcast.sendErr(human, Lang.QUICK_HATCH_TIME_OUT)
+                    return
+                end
+
                 -- 扣钻石
                 ObjHuman.decZuanshi(human, -needZuanshi, "hero_merge")
-                remainingTime = human.db.mergeInfo.mergeTime - (30 * needZuanshi)
             end
 
             Log.write(Log.LOGID_TEST, "remainingTime: " .. remainingTime)
 
+            local mergeTime = remainingTime - speedTime
+
             -- 孵化成功
-            if remainingTime <= 0 then
+            if mergeTime <= 0 then
                 -- hatchHero(human)
                 human.db.mergeInfo.mergeTime = 0
                 isHatch = 3
                 -- return
+            else
+                human.db.mergeInfo.mergeTime = mergeTime
             end
 
             Log.write(Log.LOGID_TEST, "加速后 human.db.mergeInfo : " .. Json.Encode(human.db.mergeInfo))
@@ -313,12 +329,12 @@ function NewProto(human, type, param)
 
             local mergeInfo     = {}
             local heroSimple    = {}
+            local msgRet        = Msg.gc.GC_ROLE_CHANGE_BASEINFO
             mergeInfo.mergeTime = human.db.mergeInfo.mergeTime
             mergeInfo.heroData  = heroSimple
             mergeInfo.xLv       = human.db.mergeInfo.heroInfo.xLv
             mergeInfo.isHatch   = isHatch
 
-            local msgRet        = Msg.gc.GC_ROLE_CHANGE_BASEINFO
             msgRet.ret          = QUICK_HATCH_TYPE
             msgRet.tip          = Json.Encode(mergeInfo)
             Msg.send(msgRet, human.fd)