From a8d160566fcad719e98b6ac1ad6354fb6ddb1dc5 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 九月 2018 15:28:05 +0800
Subject: [PATCH] 3428 子 【开发】神兽技能 / 【后端】神兽技能

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py |  120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 115 insertions(+), 5 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 293d7c0..845061b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -258,6 +258,8 @@
     
     GetPassiveEffManager().RegistPassiveBuff(curPlayer)
 
+    # 助战神兽技能
+    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
 
 #-被动逻辑处理--------------------------------------------------------------------------------------------------
 ##离开地图处理
@@ -325,6 +327,7 @@
              4049:ChConfig.TriggerType_MissSuccessPer, # 闪避成功率提升
              4050:ChConfig.TriggerType_OneDamage,   # 伤害降低到1点
              4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害百分比 50
+             4052:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
              }
     return tdict.get(effectID, -1)
     #===========================================================================
@@ -355,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,  # 血盾
@@ -374,7 +378,7 @@
         self.AffectBuffDict = {}    # 当前正受影响的效果buff, key为触发点
         self.AffectSkillDict = {}    # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
         self.AffectPassiveSkillSetDict = {}    # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
-    
+        self.AffectDogzSkillDict = {}   # 神兽助战技能
     
     #记录会影响其他技能或者被动触发释放技能的BUFF
     def AddBuffInfoByEffect(self, effect, skillID):
@@ -429,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 = {}
@@ -473,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()
@@ -534,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的被动效果管理
@@ -597,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
         
         
@@ -1064,3 +1115,62 @@
             
     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()
+        if skillID in dogzSkills:
+            dogzSkills.pop(skillID)
+            continue
+        
+        delDogzSkills.append(skillID)
+        
+    GameWorld.DebugLog("PlayerDogzSkill:%s - 删除%s"%(dogzSkills, delDogzSkills))
+    
+    # 删除非助战技能
+    for skillID in delDogzSkills:
+        skillManager.DeleteSkillBySkillID(skillID, False)
+    
+    # 添加助战技能,同类技能取最高
+    dogzSkills.sort()
+    for skillID in dogzSkills:
+        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