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
@@ -41,8 +40,8 @@
import EventShell
import NPCCommon
import PetControl
import QuestCommon
#GameWorld.ImportAll("Script\\Skill\\", "SkillBoosts")
GameWorld.ImportAll("Script\\Skill\\", "PassiveBuff")
@@ -95,6 +94,17 @@
                    return
            if key == "MountLv":
                if PlayerHorse.GetHorseSumLV(curPlayer) < value:
                    return
            # 多加一种任务判断
            if key == "OpenSkillSlots":
                # 主线任务完成时会设置标志可进地图标志
                mission_1 = QuestCommon.GetCommonMission(curPlayer)
                if not mission_1:
                    return
                if (pow(2, int(strIndex)) & mission_1.GetProperty("OpenSkillSlots")) == 0:
                    return
                
    PlayerControl.NomalDictSetProperty(curPlayer, 
@@ -248,6 +258,8 @@
    
    GetPassiveEffManager().RegistPassiveBuff(curPlayer)
    # 助战神兽技能
    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
#-被动逻辑处理--------------------------------------------------------------------------------------------------
##离开地图处理
@@ -314,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)
    #===========================================================================
@@ -344,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,  # 血盾
@@ -363,7 +378,7 @@
        self.AffectBuffDict = {}    # 当前正受影响的效果buff, key为触发点
        self.AffectSkillDict = {}    # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectPassiveSkillSetDict = {}    # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectDogzSkillDict = {}   # 神兽助战技能
    
    #记录会影响其他技能或者被动触发释放技能的BUFF
    def AddBuffInfoByEffect(self, effect, skillID):
@@ -418,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 = {}
@@ -462,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()
@@ -523,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的被动效果管理
@@ -586,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
        
        
@@ -1053,3 +1115,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