From dfef43adce546cc3d8578811f8b82689246d227c Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 11 五月 2019 18:24:03 +0800
Subject: [PATCH] 6603 【后端】【2.0】增加新版的sp和被动技能 - 消耗印记问题

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
index 2d2ee46..8dc357f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -717,9 +717,27 @@
             continue
         npcObj.StopMove()
         npcObj.ChangePos(npcPos.PosX, npcPos.PosY)
-
+        BeatBackMove(curPlayer, npcObj)
     return
 
+# 针对NPC被推出远距离一直卡墙角问题,法宝挑战副本特殊处理为超过4米 NPC自动回退一些
+def BeatBackMove(curPlayer, npcObj):
+    if GameWorld.GetMap().GetMapID() != ChConfig.Def_FBMapID_MagicWeapon:
+        return
+    if npcObj.GetCurAction() == IPY_GameWorld.laNPCSkillWarning:
+        return
+    
+    posMap = npcObj.GetRefreshPosAt(npcObj.GetCurRefreshPointIndex())
+    #范围校验
+    posMapX = posMap.GetPosX()
+    posMapY = posMap.GetPosY()
+    if GameWorld.GetDist(npcObj.GetPosX(), npcObj.GetPosY(), posMapX, posMapY) < 8:
+        # 单次位移不超过5米
+        return
+    npcControl = NPCCommon.NPCControl(npcObj)
+    moveDestX, moveDestY = npcControl.GetMoveNearPosEx(posMapX, posMapY, 5)
+    npcObj.Move(moveDestX, moveDestY)
+    return
 
 #===============================================================================
 # //B4 03 吸引NPC仇恨 #tagNPCAttention
@@ -1848,7 +1866,7 @@
     #获得技能等级
     curSkillLV = curSkill.GetSkillLV()
     DataRecordPack.DR_LearnORUPSkill(curPlayer, curSkillID, curSkillLV)
-    EventShell.EventRespons_SkillUp(curPlayer, curSkill.GetFuncType())
+    EventShell.EventRespons_SkillUp(curPlayer, curSkill.GetFuncType(), curSkillLV)
     GameWorld.Log("升级技能名 = %s 成功, 当前等级 = %s"%(curSkill.GetSkillName(), curSkill.GetSkillLV()), curPlayer.GetPlayerID())
     return True
 
@@ -2077,6 +2095,7 @@
     isChangeSkill = False #是否变更生效的技能
     if updSelectSkillLV != activeSkillLV:
         #可升级则激活升一级
+        EventShell.EventRespons_ElementSkill(curPlayer, mainSkillID, updSelectSkillLV)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementLV % selectSkillID, updSelectSkillLV)
         if curElementSkillID == selectSkillID:
             #正在使用的专精技能,则立即生效
@@ -2095,18 +2114,19 @@
             if curElementSkillID != selectSkillID:
                 #原技能删除
                 skillManager.DeleteSkillBySkillTypeID(curElementSkillID)
-        else:
-            EventShell.EventRespons_ElementSkill(curPlayer)
+        
     
         # 重刷被动技能
         PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)
         # 重刷技能战力
-        PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+        curControl = PlayerControl.PlayerControl(curPlayer)
+        curControl.RefreshAllSkill()
+        curControl.RefreshPlayerAttrState()
        
     NotifyElementSkillInfo(curPlayer, mainSkillID, selectSkillID if updSelectSkillLV != activeSkillLV else 0)
     return
 
-def RefreshElementSkill(curPlayer, skillTypeID):
+def RefreshElementSkill(curPlayer, skillTypeID, isChangeLV=True):
     ##更新专精技能生效的等级
     __InitElementSkillInfo()
     if skillTypeID not in PyGameData.g_elemntSkillDict:
@@ -2135,6 +2155,8 @@
     curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)
     curSkillLV = curSkill.GetSkillLV() if curSkill else 0
     #GameWorld.DebugLog('更新专精技能生效的等级 skillTypeID=%s,curSkillLV=%s,activeSkillLV=%s,updSkillLV=%s'%(skillTypeID, curSkillLV, activeSkillLV, updSkillLV))
+    if not isChangeLV:
+        return
     if updSkillLV == curSkillLV:
         return
     elif updSkillLV < curSkillLV:
@@ -2154,7 +2176,7 @@
     #加点、丹药、境界、洗点 会影响灵根点
     __InitElementSkillInfo()
     
-    needRefreshSkillIDList = []
+    needRefreshSkillIDDict = {} #{skillid:是否变更技能等级}
     skillManager = curPlayer.GetSkillManager()
     for i in xrange(skillManager.GetSkillCount()):
         hasSkill = skillManager.GetSkillByIndex(i)
@@ -2162,6 +2184,7 @@
         ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, True, False)
         if not ipyDataList:
             continue
+        curSelectSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % hasSkillID)
         for ipyData in ipyDataList:
             curElementSkillID = ipyData.GetElementSkillID()
             if curElementSkillID not in PyGameData.g_elemntSkillDict:
@@ -2169,34 +2192,40 @@
             attrID = GetSkillUpNeedAttr(PyGameData.g_elemntSkillDict[curElementSkillID][0])[0]
             if attrID not in attrIDList:
                 continue
-            needRefreshSkillIDList.append(curElementSkillID)
+            needRefreshSkillIDDict[curElementSkillID] = curSelectSkillID == curElementSkillID
+    
     #GameWorld.DebugLog('属性点变更 刷新专精attrIDList=%s,needRefreshSkillIDList=%s'%(attrIDList,needRefreshSkillIDList))
     isRefresh = False
-    for skillID in needRefreshSkillIDList:
-        if RefreshElementSkill(curPlayer, skillID):
+    for skillID, isChangeLV in needRefreshSkillIDDict.items():
+        if RefreshElementSkill(curPlayer, skillID, isChangeLV):
             isRefresh = True
     if isRefresh:
         # 重刷被动技能
         PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)    
         # 重刷技能战力
-        PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+        curControl = PlayerControl.PlayerControl(curPlayer)
+        curControl.RefreshAllSkill()
+        curControl.RefreshPlayerAttrState()
     NotifyElementSkillInfo(curPlayer)
     return
 
-def GetElementSkillCnt(curPlayer):
+def GetElementSkillCnt(curPlayer, mainSkillIDList, activeLV):
     ##获取已选择的专精技能数量
     cnt = 0
     skillManager = curPlayer.GetSkillManager()
     for i in xrange(skillManager.GetSkillCount()):
         hasSkill = skillManager.GetSkillByIndex(i)
         hasSkillID = hasSkill.GetSkillTypeID()
-        ipyData = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, False, False)
-        if not ipyData:
+        if hasSkillID not in mainSkillIDList:
             continue
-        curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % hasSkillID)
-        if not curElementSkillID:
+        ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, True, False)
+        if not ipyDataList:
             continue
-        cnt +=1
+        for ipyData in ipyDataList:
+            elementSkillID = ipyData.GetElementSkillID()
+            curActiveLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementLV % elementSkillID)
+            if curActiveLV >= activeLV:
+                cnt += 1
     return cnt
 
 def __InitElementSkillInfo():
@@ -2719,10 +2748,12 @@
         if callFunc:
             callFunc(objDetel, curEffect, allAttrList[index], curBuff)
     
-    # 持续性属性变化的buff,目前只有持续减益
-    callFunc = GameWorld.GetExecFunc(GameBuffs, "BuffProcess_%s.%s"%(moduleSuffix, "OnCalcBuffEx"))
-    if callFunc:
-        callFunc(objDetel, curEffect, allAttrList[index], curBuff)
+    #是否持续性技能
+    if curBuff and curBuff.GetSkill().GetSkillType() in ChConfig.Def_LstBuff_List:
+        # 持续性属性变化的buff,目前只有持续减益
+        callFunc = GameWorld.GetExecFunc(GameBuffs, "BuffProcess_%s.%s"%(moduleSuffix, "OnCalcBuffEx"))
+        if callFunc:
+            callFunc(objDetel, curEffect, allAttrList[index], curBuff)
     return
 
 ## 获得buff效果的计算模块文件后缀
@@ -3750,6 +3781,23 @@
 
 
 
+## 获取某类型技能达到X等级的个数
+#  @param curPlayer
+#  @return
+def GetSkillCntByFunc(curPlayer, funcType, skilllv=0):
+    allSkillCnt = 0
+    skillManager = curPlayer.GetSkillManager()
+    for i in xrange(skillManager.GetSkillCount()):
+        curPlayerSkill = skillManager.GetSkillByIndex(i)
+        if curPlayerSkill == None:
+            continue
+        if curPlayerSkill.GetFuncType() != funcType:
+            continue
+        if curPlayerSkill.GetSkillLV() >= skilllv:
+            allSkillCnt += 1
+        
+    return allSkillCnt
+
 ## 获取技能总等级
 #  @param curPlayer
 #  @return allSkillLV:总技能等级
@@ -3764,7 +3812,4 @@
             continue
         skillLV = curPlayerSkill.GetSkillLV()
         allSkillLV += skillLV
-        
     return allSkillLV
-
-

--
Gitblit v1.8.0