From 0c96af08f55d05ab40eae9f940467dd8eafae44c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 九月 2025 14:07:53 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(增加属性ID技能增伤65、技能减伤66;曹轶技能;被动触发增加属性支持;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
index d7a77ea..eaaabdb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
@@ -442,10 +442,13 @@
         return 0
     InitStarUpper = qualityIpyData.GetInitStarUpper()
     
+    awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
+    if not awakeLV:
+        return InitStarUpper
+    
     addStarUpper = 0
     heroAwakeIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("HeroAwake", heroID)
     if heroAwakeIpyDataList:
-        awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
         for ipyData in heroAwakeIpyDataList:
             if ipyData.GetAwakeLV() > awakeLV:
                 break
@@ -478,12 +481,25 @@
 def __DoHeroStarTalentUp(singleItem, addLV):
     ## 执行武将星级天赋等级提升
     
+    heroID = singleItem.GetItemTypeID()
     commTalentSlot = IpyGameDataPY.GetFuncCfg("HeroStarTalent", 1) # 常规天赋槽个数
     talentMaxLV = IpyGameDataPY.GetFuncCfg("HeroStarTalent", 2) # 每个天赋最大等级
+    
+    maxUnlockSlot = commTalentSlot # 最大有效的已解锁槽位
+    awakeIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("HeroAwake", heroID)
+    if awakeIpyDataList:
+        awakeLV = singleItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
+        for ipyData in awakeIpyDataList[:awakeLV][::-1]: # 倒序遍历,第一个命中的就是最大的
+            unlockTalentSlot = ipyData.GetUnlockTalentSlot()
+            if unlockTalentSlot and unlockTalentSlot :
+                maxUnlockSlot = unlockTalentSlot
+                break
+        
     idCount = singleItem.GetUserAttrCount(ShareDefine.Def_IudetHeroTalentID)
     lvCount = singleItem.GetUserAttrCount(ShareDefine.Def_IudetHeroTalentIDLV)
     idList, lvList = [], [] # 记录在物品上的值,有顺序
     unfullLVIDList = [] # 未满级的天赋ID
+    unfullLVIDListUnlock = [] # 未满级的天赋ID,仅已解锁槽位,重生可能导致觉醒已解锁槽位暂时被锁住
     haveUp = False
     for index in range(min(idCount, lvCount)):
         talentID = singleItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroTalentID, index)
@@ -492,14 +508,16 @@
         lvList.append(talentLV)
         if talentLV < talentMaxLV:
             unfullLVIDList.append(talentID)
-            
+            if index < maxUnlockSlot:
+                unfullLVIDListUnlock.append(talentID)
+                
     if len(idList) < commTalentSlot:
         idList += [0] * (commTalentSlot - len(idList))
         lvList += [0] * (commTalentSlot - len(lvList))
         
     GameWorld.DebugLog("执行武将星级天赋等级提升: addLV=%s" % addLV)
-    GameWorld.DebugLog("当前星级天赋: idList=%s,lvList=%s" % (idList, lvList))
-    GameWorld.DebugLog("未满级星级天赋ID: %s" % unfullLVIDList)
+    GameWorld.DebugLog("当前星级天赋: idList=%s,lvList=%s,maxUnlockSlot=%s" % (idList, lvList, maxUnlockSlot))
+    GameWorld.DebugLog("未满级星级天赋ID: %s,unfullLVIDListUnlock=%s" % (unfullLVIDList, unfullLVIDListUnlock))
     
     # 有空余槽位,优先给空余槽位天赋,额外解锁的槽位是需要先选择的,所以一定不为空,故这里只判断常规槽位即可
     if 0 in idList:
@@ -531,6 +549,7 @@
             idList[zeroIndex] = randTalentID
             lvList[zeroIndex] = 1
             unfullLVIDList.append(randTalentID)
+            unfullLVIDListUnlock.append(randTalentID)
             GameWorld.DebugLog("新增星级天赋ID: %s" % (randTalentID))
             addLV -= 1
             haveUp = True
@@ -540,9 +559,9 @@
         for _ in range(addLV):
             if not unfullLVIDList:
                 break
-            randID = random.choice(unfullLVIDList)
+            # 优先随机已解锁的
+            randID = random.choice(unfullLVIDListUnlock) if unfullLVIDListUnlock else random.choice(unfullLVIDList)
             if randID not in idList:
-                unfullLVIDList.remove(randID)
                 continue
             randIndex = idList.index(randID)
             idLV = lvList[randIndex]
@@ -553,8 +572,11 @@
                 GameWorld.DebugLog("升级星级天赋ID: %s,idLV=%s,index=%s" % (randID, idLV, randIndex))
                 
             if idLV >= talentMaxLV:
-                unfullLVIDList.remove(randID)
-                GameWorld.DebugLog("    移除未满级ID: %s,unfullLVIDList=%s" % (randID, unfullLVIDList))
+                if randID in unfullLVIDList:
+                    unfullLVIDList.remove(randID)
+                if randID in unfullLVIDListUnlock:
+                    unfullLVIDListUnlock.remove(randID)
+                GameWorld.DebugLog("    移除满级ID: %s,unfullLVIDList=%s,unfullLVIDListUnlock=%s" % (randID, unfullLVIDList, unfullLVIDListUnlock))
                 
             haveUp = True
             
@@ -1054,7 +1076,7 @@
     if awardMoneyInfo and len(awardMoneyInfo) == 2:
         moneyType, moneyValue = awardMoneyInfo
         if moneyType and moneyValue:
-            PlayerControl.GiveMoney(curPlayer, moneyType, moneyValue, "HeroBookAct")
+            PlayerControl.GiveMoney(curPlayer, moneyType, moneyValue, "HeroBookAct", notifyAward=True)
                     
     Sync_HeroInfo(curPlayer, [heroID])
     
@@ -1183,6 +1205,7 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HeroAwakeRebirthCnt, rebirthCnt + 1)
         Sync_PlayerHeroInfo(curPlayer)
         
+    PlayerOnline.GetOnlinePlayer(curPlayer).OnHeroItemUpate([itemIndex])
     return
 
 def __calcHeroLVReturnitem(quality, heroLV, returnItemDict, ratio):

--
Gitblit v1.8.0