From 3fc13c42d926d91d3183a9608b769b22b5f4c87c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 19 七月 2019 20:06:13 +0800
Subject: [PATCH] 8012 【2.0.300】【后端】升星功能调整(消耗不同阶装备概率支持根据等阶差增加或衰减概率)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
index f1f2bff..30e2de8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStar.py
@@ -27,6 +27,8 @@
 import EventShell
 import ChConfig
 import ChEquip
+
+import math
 #-------------------------------------------------------------------------------------------
 
 
@@ -126,6 +128,12 @@
         curRate = 100
     else:
         curRate = 0 #成功概率
+        diffClassChangeRatePerInfo = IpyGameDataPY.GetFuncEvalCfg("EquipStarRate", 1)
+        unSuitRateRange = IpyGameDataPY.GetFuncEvalCfg("EquipStarRate", 2)
+        suitRateRange = IpyGameDataPY.GetFuncEvalCfg("EquipStarRate", 3)
+        if len(diffClassChangeRatePerInfo) != 2 or len(unSuitRateRange) != 2 or len(suitRateRange) != 2:
+            GameWorld.ErrLog('升星不同阶概率配置错误!')
+            return result
         
         for i, index in enumerate(clientData.CostEquipIndex):
             costEquip = itemPack.GetAt(index)
@@ -143,11 +151,31 @@
                 return result
             if isJobLimit and not ItemCommon.CheckJob(curPlayer, costEquip):
                 return result
-            #if ItemCommon.GetItemClassLV(costEquip) != classLV:
-            #    return result
             
-            addRate = ipyData.GetSuitRate()  if costEquip.GetSuiteID() else ipyData.GetUnSuitRate()
+            if costEquip.GetSuiteID():
+                baseRate = ipyData.GetSuitRate()
+                minRate, maxRate = suitRateRange
+            else:
+                baseRate = ipyData.GetUnSuitRate()
+                minRate, maxRate = unSuitRateRange
+                
+            GameWorld.DebugLog("equipID=%s,baseRate=%s,minRate=%s,maxRate=%s" % (equipID, baseRate, minRate, maxRate))
+            addRate = baseRate
+            costClassLV = ItemCommon.GetItemClassLV(costEquip)
+            
+            #吞高阶
+            if costClassLV > classLV:
+                diffClassChangeRatePer = diffClassChangeRatePerInfo[0] * (costClassLV - classLV)
+                addRate = int(math.ceil(baseRate * (100 + diffClassChangeRatePer) /100.0))
+                GameWorld.DebugLog("    吞高阶 costClassLV=%s,classLV=%s,diffClassChangeRatePer=%s,addRate=%s" % (costClassLV, classLV, diffClassChangeRatePer, addRate))
+            #吞低阶
+            elif costClassLV < classLV:
+                diffClassChangeRatePer = diffClassChangeRatePerInfo[1] * (classLV - costClassLV)
+                addRate = int(math.ceil(baseRate * (100 - diffClassChangeRatePer) /100.0))
+                GameWorld.DebugLog("    吞低阶 costClassLV=%s,classLV=%s,diffClassChangeRatePer=%s,addRate=%s" % (costClassLV, classLV, diffClassChangeRatePer, addRate))
+            addRate = max(minRate, min(addRate, maxRate))
             curRate += addRate
+            GameWorld.DebugLog("    本件装备增加概率=%s,当前总概率=%s" % (addRate, curRate))
             delEquipIndexList.append(index)
     if totalEquipStars < IpyGameDataPY.GetFuncCfg('EquipStarCustomized'):
         curRate = 100
@@ -155,6 +183,7 @@
         GameWorld.Log('装备升星异常 概率为0!!equipPackIndex=%s'%equipPackIndex)
         return result
     isOK = GameWorld.CanHappen(curRate, 100)
+    GameWorld.DebugLog("装备升星最终总概率: %s, isOK=%s" % (curRate, isOK))
     #判断普通物品材料 成功才扣
     costItemDict = ipyData.GetCostItemDict()
     if isOK and costItemDict:

--
Gitblit v1.8.0