From 6a6641252fad0ce48c255e1110122fab47623eda Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 31 十月 2018 15:17:14 +0800
Subject: [PATCH] 4453 【后端】【1.2.0】仙盟联赛天级联赛新增负方积分第一名额外奖励

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py |  144 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 132 insertions(+), 12 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
index a31bf3c..3b3543c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -13,7 +13,7 @@
 #
 # @change: "2016-11-16 15:30" hxp 增加获取衰弱效果信息列表
 #
-# 详细描述: 被动buff效果管理
+# 详细描述: 被动buff效果管理s
 #
 #---------------------------------------------------------------------
 #"""Version = 2016-11-16 15:30"""
@@ -26,7 +26,6 @@
 import GameWorld
 import ChConfig
 import IpyGameDataPY
-#import SkillBoosts
 import SkillCommon
 import BuffSkill
 import SkillShell
@@ -43,7 +42,6 @@
 import PetControl
 import QuestCommon
 
-#GameWorld.ImportAll("Script\\Skill\\", "SkillBoosts")
 GameWorld.ImportAll("Script\\Skill\\", "PassiveBuff")
 
 
@@ -97,14 +95,16 @@
             if key == "MountLv":
                 if PlayerHorse.GetHorseSumLV(curPlayer) < value:
                     return
-                
+            
+
             # 多加一种任务判断
             if key == "OpenSkillSlots":
                 # 主线任务完成时会设置标志可进地图标志
                 mission_1 = QuestCommon.GetCommonMission(curPlayer)
                 if not mission_1:
                     return
-                if strIndex > mission_1.GetProperty("OpenSkillSlots"):
+
+                if (pow(2, int(strIndex)) & mission_1.GetProperty("OpenSkillSlots")) == 0:
                     return
                 
     PlayerControl.NomalDictSetProperty(curPlayer, 
@@ -258,6 +258,8 @@
     
     GetPassiveEffManager().RegistPassiveBuff(curPlayer)
 
+    # 助战神兽技能
+    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
 
 #-被动逻辑处理--------------------------------------------------------------------------------------------------
 ##离开地图处理
@@ -324,6 +326,8 @@
              4048:ChConfig.TriggerType_MissSkill,   # 闪避后触发释放技能
              4049:ChConfig.TriggerType_MissSuccessPer, # 闪避成功率提升
              4050:ChConfig.TriggerType_OneDamage,   # 伤害降低到1点
+             4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害百分比 50
+             4052:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
              }
     return tdict.get(effectID, -1)
     #===========================================================================
@@ -354,7 +358,8 @@
              4511:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
              4512:ChConfig.TriggerType_ReduceHurtHPPer, # 百分比减少攻击计算后伤害 
              4513:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
-             4515:ChConfig.TriggerType_AddIceAtkPer,    # BUFF类:攻击附加真实伤害百分比 
+             4515:ChConfig.TriggerType_AddIceAtkPer,    # BUFF类:攻击附加真实伤害百分比
+             4516:ChConfig.TriggerType_ChangeHurtToHP,    # BUFF类:buff中把受到伤害的xx%转化为生命值
              803:ChConfig.TriggerType_BloodShield,  # 血盾
              806:ChConfig.TriggerType_BloodShield,  # 血盾
              808:ChConfig.TriggerType_BloodShield,  # 血盾
@@ -373,7 +378,7 @@
         self.AffectBuffDict = {}    # 当前正受影响的效果buff, key为触发点
         self.AffectSkillDict = {}    # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
         self.AffectPassiveSkillSetDict = {}    # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
-    
+        self.AffectDogzSkillDict = {}   # 神兽助战技能
     
     #记录会影响其他技能或者被动触发释放技能的BUFF
     def AddBuffInfoByEffect(self, effect, skillID):
@@ -428,6 +433,37 @@
         return self.AffectBuffDict.get((triggerType, 0), {})
      
     
+    # 重刷神兽助战技能
+    def RefreshDogzBattleSkill(self):
+        self.AffectDogzSkillDict = {}
+        skills = FindDogzBattleSkills(self.gameObj)
+        
+        for curSkill in skills:
+            if not SkillCommon.isPassiveTriggerSkill(curSkill):
+                continue
+            
+            skillTypeID = curSkill.GetSkillTypeID()
+            
+            connSkillID = SkillShell.GetConnectSkillID(curSkill)    # 关联技能ID, 0代表不限技能
+            for i in xrange(curSkill.GetEffectCount()):
+                curEffect = curSkill.GetEffect(i)
+                effectID = curEffect.GetEffectID()
+                if effectID == 0:
+                    continue
+                
+                triggerType = GetTriggerTypeByEffectID(effectID)
+                if triggerType == -1:
+                    continue
+                
+                key = (triggerType,connSkillID)
+                if key not in self.AffectDogzSkillDict:
+                    self.AffectDogzSkillDict[key] = []
+                    
+                self.AffectDogzSkillDict[key].append((skillTypeID, effectID))
+        
+        return self.AffectDogzSkillDict
+    
+    
     # 重刷可装备的被动技能
     def RefreshPassiveSkillSet(self):
         self.AffectPassiveSkillSetDict = {}
@@ -472,8 +508,9 @@
             if not SkillCommon.isPassiveTriggerSkill(curSkill):
                 continue
             
-            if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_FbPassiveSkill:
-                # 被动技能需装备
+            if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbPassiveSkill,
+                                          ChConfig.Def_SkillFuncType_Dogz]:
+                # 被动技能和神兽需设置才有效
                 continue
             
             skillTypeID = curSkill.GetSkillTypeID()
@@ -533,10 +570,11 @@
         ## skillList=self.AffectSkillDict.get((triggerType, connSkillID), [])再用extend会导致AffectSkillDict无限增长
         skillList.extend(self.AffectSkillDict.get((triggerType, connSkillID), []))
         skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, connSkillID), []))
+        skillList.extend(self.AffectDogzSkillDict.get((triggerType, connSkillID), []))
         if connSkillID != 0 and connSkillID != ChConfig.Def_SkillID_Somersault:
             skillList.extend(self.AffectSkillDict.get((triggerType, 0), []))
             skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, 0), []))
-            
+            skillList.extend(self.AffectDogzSkillDict.get((triggerType, 0), []))
         return skillList
         
 #所有obj的被动效果管理
@@ -596,6 +634,20 @@
             self.AddPassiveEff(gameObj, passiveEff)
         else:
             passiveEff.RefreshPassiveSkillSet()
+        return
+        
+        
+    # 人物需同步注册神兽技能
+    def RegistPassiveEffDogz(self, gameObj):
+        passiveEff = self.GetPassiveEff(gameObj)
+        if not passiveEff:
+            # 强制刷新所有被动技能
+            passiveEff = PassiveEff(gameObj)
+            if not passiveEff.RefreshDogzBattleSkill():
+                return
+            self.AddPassiveEff(gameObj, passiveEff)
+        else:
+            passiveEff.RefreshDogzBattleSkill()
         return
         
         
@@ -764,6 +816,11 @@
         
     return True
 
+
+#ntSummon:(3)普通召唤兽,可继承主人基础属性如攻击 
+#ntElf:(4)玩家替身,完全拥有玩家属性和被动功能
+#ntFairy :(7)同ntSummon,但技能可触发被动功能
+
 # ntElf 定义为人物使用对地持续性技能,并且人物可以移动,则需要ntElf做依托物的情况
 # 那么ntElf执行人物的伤害计算和被动触发效果
 # 被动技能只处理玩家,宠物,和灵
@@ -773,7 +830,7 @@
         return attacker
     
     npcType = attacker.GetType()
-    if npcType not in [IPY_GameWorld.ntPet, IPY_GameWorld.ntElf]:
+    if npcType not in [IPY_GameWorld.ntPet, IPY_GameWorld.ntElf, IPY_GameWorld.ntFairy]:
         if attacker.GetIsBoss():
             return attacker
         return
@@ -782,7 +839,7 @@
         # --宠物
         return attacker
     
-    if npcType == IPY_GameWorld.ntElf:
+    else:
         # ntElf 定义为人物使用对地持续性技能,并且人物可以移动,则需要ntElf做依托物的情况
         # 那么ntElf执行人物的伤害计算和被动触发效果
         attacker = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, attacker)
@@ -1063,3 +1120,66 @@
             
     return curValue
 
+
+# 因为要兼容低等级技能,所以技能只能是在助战的时候,先删除神兽技能再学习新的助战神兽技能
+def PlayerDogzSkill(curPlayer):
+
+    dogzSkills = [] # 需要学习的技能
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetDogzCount()):
+        ipyData = ipyDataMgr.GetDogzByIndex(i)
+        if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i):
+            continue
+        
+        dogzSkills.extend(ipyData.GetHelpBattleSkills())
+    
+    delDogzSkills = [] # 删除不在助战神兽队列的技能
+    skillManager = curPlayer.GetSkillManager()
+    for i in xrange(skillManager.GetSkillCount()):
+        curSkill = skillManager.GetSkillByIndex(i)
+        if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:
+            continue
+        skillID = curSkill.GetSkillID()
+        
+        delDogzSkills.append(skillID)
+        
+    GameWorld.DebugLog("PlayerDogzSkill:%s - 删除%s"%(dogzSkills, delDogzSkills))
+    
+    # 删除神兽技能
+    for skillID in delDogzSkills:
+        skillManager.DeleteSkillBySkillID(skillID, False)
+    
+    # 添加助战技能,同类技能取最高
+    dogzSkills.sort()
+    for skillID in dogzSkills:
+        skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
+        if not skillData:
+            continue
+        if skillData.GetSkillType() == ChConfig.Def_SkillType_AttrSkillNoLearn:
+            # 同技能可多个叠加的技能不能学,算属性时直接取表
+            continue
+        
+        skillManager.LearnSkillByID(skillID, False)
+    
+    # 刷被动效果
+    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
+    return
+
+
+# 获取助战神兽的技能列表
+def FindDogzBattleSkills(gameObj):
+    skills = []
+    if gameObj.GetGameObjType() != IPY_GameWorld.gotPlayer:
+        return skills
+    
+    skillManager = gameObj.GetSkillManager()
+    for i in xrange(skillManager.GetSkillCount()):
+        curSkill = skillManager.GetSkillByIndex(i)
+        if not curSkill:
+            continue
+        
+        if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:
+            continue
+        skills.append(curSkill)
+        
+    return skills

--
Gitblit v1.8.0