hch
2019-05-09 bc915a9b717eccef3c8d825f9af79a7596394ac7
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -21,7 +21,6 @@
        
#导入
import IPY_GameWorld
import ReadChConfig
import PassiveBuff
import GameWorld
import ChConfig
@@ -122,7 +121,7 @@
    # 刷被动效果和属性
    page = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassivePage, 0, ChConfig.Def_PDictType_GFPassive)
    if clientData.Page == page:
        GetPassiveEffManager().RegistPassiveEffSet(curPlayer)
        GetPassiveEffManager().RegistPassiveEffSet(curPlayer, True)
        PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
        
    EventShell.EventRespons_PassiveSet(curPlayer)
@@ -158,7 +157,7 @@
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    
    # 刷被动效果和属性
    GetPassiveEffManager().RegistPassiveEffSet(curPlayer)
    GetPassiveEffManager().RegistPassiveEffSet(curPlayer, True)
    PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
    return
@@ -260,6 +259,8 @@
    # 助战神兽技能
    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
    GetPassiveEffManager().RegistSuperEquipSkillDict(curPlayer)
#-被动逻辑处理--------------------------------------------------------------------------------------------------
##离开地图处理
@@ -276,14 +277,17 @@
def GetTriggerTypeByEffectID(effectID):
    # 临时配置
    tdict = {
             2102:ChConfig.TriggerType_BeAttackOver,   # 被攻击后触发 20
             2104:ChConfig.TriggerType_LockHP, # 锁血触发技能 63
             2105:ChConfig.TriggerType_BeLuckyHit, # 被会心一击触发技能 64
             2106:ChConfig.TriggerType_BeSuperHit,  # 被暴击触发技能
             4000:ChConfig.TriggerType_BuffState,   # 进入4012的某个状态触发技能 2
             4001:ChConfig.TriggerType_TagBuffState,   # 目标进入4012的某个状态触发技能 2
             4002:ChConfig.TriggerType_AddDamagePer,   # 提高增加伤害属性值,计算时 3
             4003:ChConfig.TriggerType_AddDamagePer,   # 提高增加伤害属性值,计算时 3
             4004:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4005:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4006:ChConfig.TriggerType_SuperHit, # 暴击时 触发技能6,
             4007:ChConfig.TriggerType_SuperHitValue, # 暴击时 增加暴击值7,
             4007:ChConfig.TriggerType_SuperHitValue, # 暴击时 增加暴击值百分比7,
             4008:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4009:ChConfig.TriggerType_HurtObjAddBuff, # 击中玩家(群攻多次触发)8,
             4010:ChConfig.TriggerType_ReduceCD, # 减少CD9, #CD
@@ -291,7 +295,7 @@
             4013:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
             4014:ChConfig.TriggerType_HappenState,   #必定触发
             4015:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4016:ChConfig.TriggerType_AbsorbShield,  # 提高麒麟佑身的减少伤害效果提升20% 13
             #4016:ChConfig.TriggerType_AbsorbShield,  # 提高麒麟佑身的减少伤害效果提升20% 13
             4017:ChConfig.TriggerType_BounceHP,   # 反弹伤害固定值14,
             4018:ChConfig.TriggerType_BuffDisappear,   # buff消失后触发技能15,
             4019:ChConfig.TriggerType_BuffTime,   # 延长BUFF时间16,
@@ -299,13 +303,12 @@
             4021:ChConfig.TriggerType_AddSingleSkillPer,   # 持续性攻击的单次攻击逐次增加技能伤害18,
             4022:ChConfig.TriggerType_SkillOverNoAttack,   # 技能释放后 与TriggerType_AttackOver相反19,
             4023:ChConfig.TriggerType_BeAttackOver,   # 被攻击后触发 20
             4024:ChConfig.TriggerType_AddIceAtkPer,    # 攻击附加真实伤害百分比 21
             #4024:ChConfig.TriggerType_AddIceAtkPer,    # 攻击附加真实伤害百分比 21
             4025:ChConfig.TriggerType_AddIceAtk,    # 攻击附加真实伤害固定值 22
             4026:ChConfig.TriggerType_DebuffOff,    # 抵消一次debuff 23
             4027:ChConfig.TriggerType_AttackKill,   # նɱ 24
             4028:ChConfig.TriggerType_WillDead,   # 进入濒死状态时触发技能 25
             4029:ChConfig.TriggerType_BuffBoom,   # 中毒后爆炸 26
             4030:ChConfig.TriggerType_Success_Buff_SkillPer, # 提高4501成功概率 27
             4031:ChConfig.TriggerType_HurtObjAddBuff,   # 在算伤害时群攻1对1加buff,可用于一个伤害多次触发 28
             4032:ChConfig.TriggerType_BeBoomSeed,   # 被动引爆视野内对象的buff种子 29
             4033:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
@@ -326,7 +329,7 @@
             4048:ChConfig.TriggerType_MissSkill,   # 闪避后触发释放技能
             4049:ChConfig.TriggerType_MissSuccessPer, # 闪避成功率提升
             4050:ChConfig.TriggerType_OneDamage,   # 伤害降低到1点
             4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害百分比 50
             4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害固定值 50
             4052:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
             4053:ChConfig.TriggerType_AddLayer, # BUFF层级增加时 52
             4054:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
@@ -339,6 +342,42 @@
             4061:ChConfig.TriggerType_AttackOverPassive,  # 攻击(对敌技能)后被动技能被触发在其他被动效果处理后调用,触发顺序原因
             4062:ChConfig.TriggerType_AttackAddFinalPer, # 增加最终伤害百分比 59
             4063:ChConfig.TriggerType_SummonDie,   #自身召唤兽死亡触发技能 60
             4064:ChConfig.TriggerType_GiftReduceCD, # 天赋减少CD9, #CD
             4065:ChConfig.TriggerType_DamageReducePVP,   # PVP减少伤害
             4066:ChConfig.TriggerType_AddPVPDamagePer,   # 提高PVP增加伤害属性值,计算时 3
             4067:ChConfig.TriggerType_ProDefValue, # 神兵护盾值下降时 62
             4068:ChConfig.TriggerType_LockHP, # 锁血触发技能 63
             4069:ChConfig.TriggerType_ZhongjiZhansha, # 终极斩杀 64
             4070:ChConfig.TriggerType_DebuffOff,    # 抵消一次debuff 23
             4071:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
             4072:ChConfig.TriggerType_SuperHitSkipCD, # 暴击无冷却 68
             4073:ChConfig.TriggerType_BuffHurtCnt, # 当持续buff伤害第X次时触发技能 69
             4076:ChConfig.TriggerType_dFinalHurtReducePer, # 防守方的最终伤害减少百分比 71
             4077:ChConfig.TriggerType_AttackAddFinalPer, # 增加最终伤害百分比 59
             4078:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4079:ChConfig.TriggerType_IsDealy,  # 是否触发致命一击 72
             4080:ChConfig.TriggerType_BounceHPPer, # 反弹伤害百分比值17,
             4081:ChConfig.TriggerType_AddThumpHitRate, # 提高重击概率 73
             4082:ChConfig.TriggerType_ThumpHit, # 对第一目标重击触发技能
             4083:ChConfig.TriggerType_AddThumpHitPer, # 增加重击伤害百分比
             4084:ChConfig.TriggerType_ThumpHit, # 对第一目标重击触发技能
             4085:ChConfig.TriggerType_SkillSuccess,  # 任何技能释放成功都可触发 76    加印记
             4086:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4087:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4088:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4089:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4090:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4091:ChConfig.TriggerType_SkillOverNoAttack,   # 技能释放后 与TriggerType_AttackOver相反19,
             4092:ChConfig.TriggerType_SkillSuccess,  # 任何技能释放成功都可触发 76  减印记
             4093:ChConfig.TriggerType_NoControl,   # 使关联技能不受控制 78
             4094:ChConfig.TriggerType_Buff_AddSuperHitRate, # BUFF类:增加暴击率
             4095:ChConfig.TriggerType_SuperHitSuckBloodPer, # BUFF类: 暴击百分比吸血, 79
             4096:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4097:ChConfig.TriggerType_BurnPer, # 灼烧伤害百分比 80
             4098:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4099:ChConfig.TriggerType_WillDead,   # 进入濒死状态时触发技能 25
             4100:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4101:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             }
    return tdict.get(effectID, -1) 
    #===========================================================================
@@ -355,28 +394,46 @@
# 获得【BUFF】被动触发的方式 与GetTriggerTypeByEffectID互补
def GetBuffTriggerTypeByEffectID(effectID):
    tdict = {
             1011:ChConfig.TriggerType_Buff_AttackSubLayer,  # BUFF类:攻击减buff层,0消失
             4500:ChConfig.TriggerType_AttackOver, # BUFF类:攻击触发新技能
             4501:ChConfig.TriggerType_AttackAddSkillPer, # BUFF类:提高主动技能的技能伤害
             4502:ChConfig.TriggerType_BeAttackOver, # BUFF类:被攻击触发技能
             4503:ChConfig.TriggerType_AddDamagePer,  # BUFF类: 攻击时提高增加伤害
             4503:ChConfig.TriggerType_AttackOver, # BUFF类:攻击触发新技能
             4504:ChConfig.TriggerType_BounceHP,  # BUFF类: 反弹伤害固定值
             4506:ChConfig.TriggerType_BeAttackOver, # BUFF类:被攻击触发技能  只刷新属性 不触发技能
             4507:ChConfig.TriggerType_Buff_AddSuperHitRate, # BUFF类:增加暴击率
             4508:ChConfig.TriggerType_Buff_AttackSubLayer,  # BUFF类:攻击减buff层,0消失
             4514:ChConfig.TriggerType_Buff_BeAttackSubLayer,  # BUFF类:被攻击减buff层,0消失
             4509:ChConfig.TriggerType_Buff_SuckBloodPer,   # BUFF类: 百分比吸血, 此处非属性类
             4510:ChConfig.TriggerType_Buff_MustBeHit,   # BUFF类: 无视闪避必中
             4511:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
             4512:ChConfig.TriggerType_ReduceHurtHPPer, # 百分比减少攻击计算后伤害 
             4513:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
             4515:ChConfig.TriggerType_AddIceAtkPer,    # BUFF类:攻击附加真实伤害百分比
             4514:ChConfig.TriggerType_Buff_BeAttackSubLayer,  # BUFF类:被攻击减buff层,0消失
             #4515:ChConfig.TriggerType_AddIceAtkPer,    # BUFF类:攻击附加真实伤害百分比
             4516:ChConfig.TriggerType_ChangeHurtToHP,    # BUFF类:buff中把受到伤害的xx%转化为生命值
             4517:ChConfig.TriggerType_DebuffOff,   # BUFF类: 抵消debuff
             4518:ChConfig.TriggerType_ForbidenCure, # BUFF类: 禁止治疗 53
             4519:ChConfig.TriggerType_WillDead,   # BUFF类: 进入濒死状态 25
             4520:ChConfig.TriggerType_AddLayer, # BUFF类: 目标BUFF层级增加时 52
             4521:ChConfig.TriggerType_BeLuckyHitSubPer, # 减少受到的会心伤害 65
             4522:ChConfig.TriggerType_DebuffOff,   # BUFF类: 抵消debuff
             4523:ChConfig.TriggerType_SuperHitSkillPer, # 暴击时,增加技能伤害 10
             4524:ChConfig.TriggerType_SuperHitSubLayer, # 暴击减层 67
             4525:ChConfig.TriggerType_SuperHitSkipCD, # 暴击无冷却 68
             4526:ChConfig.TriggerType_AddThumpHitRate, # 增加重击概率
             4527:ChConfig.TriggerType_AddThumpHitRate, # 增加重击概率
             4528:ChConfig.TriggerType_AddThumpHitPer, # 重击时 增加重击百分比 75
             4529:ChConfig.TriggerType_Buff_SuckBloodPer,   # BUFF类: 百分比吸血, 此处非属性类
             4530:ChConfig.TriggerType_Buff_AttackSubLayer,  # BUFF类:攻击减buff层,0消失
             4531:ChConfig.TriggerType_BounceHPPerByAttacker,  # 反弹伤害百分比值, 由攻击方决定 77
             4532:ChConfig.TriggerType_SuperHit,    # buff中对第一目标暴击触发技能
             4533:ChConfig.TriggerType_BurnDisappear, # 灼烧消失触发 81
             4534:ChConfig.TriggerType_DebuffOff,   # BUFF类: 抵消debuff
             4535:ChConfig.TriggerType_BeAttackAddSkillPer, # buff中, 被攻击提高技能伤害
             803:ChConfig.TriggerType_BloodShield,  # 血盾
             806:ChConfig.TriggerType_BloodShield,  # 血盾
             807:ChConfig.TriggerType_BloodShield,  # 血盾
             808:ChConfig.TriggerType_BloodShield,  # 血盾
             }
    return tdict.get(effectID, -1)
@@ -394,9 +451,11 @@
        self.AffectSkillDict = {}    # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectPassiveSkillSetDict = {}    # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectDogzSkillDict = {}   # 神兽助战技能
        self.AffectSuperEquipSkillDict = {}   # 特殊装备持有技能,相同技能不重复,数值增长性衰减, 触发使用
        self.AffectSuperEquipEffectCntDict = {}  # 特殊装备技能效果对应的已计算后的数值,直接调用
    
    #记录会影响其他技能或者被动触发释放技能的BUFF
    def AddBuffInfoByEffect(self, effect, skillID):
    def AddBuffInfoByEffect(self, effect, skillID, onwerID, onwerType):
        effectID = effect.GetEffectID()
        
        #{(触发方式/点, 关联技能):{BUFFID:【效果】}}
@@ -411,7 +470,7 @@
            
        if skillID not in self.AffectBuffDict[keyTuple]:
            self.AffectBuffDict[keyTuple][skillID] = []
        self.AffectBuffDict[keyTuple][skillID].append(effect)  # 存储受影响的信息
        self.AffectBuffDict[keyTuple][skillID].append([effect, onwerID, onwerType])  # 存储受影响的信息
        return
        
@@ -479,16 +538,61 @@
        return self.AffectDogzSkillDict
    
    
    # 重刷特殊装备技能
    def RefreshSuperEquipSkillDict(self):
        self.AffectSuperEquipSkillDict = {}
        self.AffectSuperEquipEffectCntDict = {}
        skillsDict = FindSuperEquipSkills(self.gameObj)
        for skillID, value in skillsDict.items():
            curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
            if not curSkill:
                continue
            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.AffectSuperEquipSkillDict:
                    self.AffectSuperEquipSkillDict[key] = []
                self.AffectSuperEquipSkillDict[key].append((skillTypeID, effectID))
                # 效果叠加根据技能个数会衰减 = 1-pow((1-初始值),相同技能个数)
                self.AffectSuperEquipEffectCntDict[effectID] = 1 - pow((1 - curEffect.GetEffectValue(0)),value)
        GameWorld.DebugLog("RefreshSuperEquipSkillDict %s-%s"%(self.AffectSuperEquipSkillDict, self.AffectSuperEquipEffectCntDict))
        return self.AffectSuperEquipSkillDict
    # 重刷可装备的被动技能
    def RefreshPassiveSkillSet(self):
    def RefreshPassiveSkillSet(self, isCD=False):
        self.AffectPassiveSkillSetDict = {}
        skillManager = self.gameObj.GetSkillManager()
        skills = FindUsePassiveSkills(self.gameObj)
        tick = GameWorld.GetGameWorld().GetTick()
        
        for skillID in skills:
            curSkill = skillManager.FindSkillBySkillID(skillID)
            if not curSkill:
                continue
            if isCD:
                # 重切需进入CD
                SkillCommon.SetSkillRemainTime(curSkill, PlayerControl.GetReduceSkillCDPer(self.gameObj), tick, self.gameObj)
            
            skillTypeID = curSkill.GetSkillTypeID()
            connSkillID = SkillShell.GetConnectSkillID(curSkill)    # 关联技能ID, 0代表不限技能
@@ -579,17 +683,33 @@
        return self.AffectSkillDict
    
    def GetPassiveSkillsByTriggerType(self, triggerType, connSkillID=0):
    def GetPassiveSkillsByTriggerType(self, triggerType, connSkill=None):
        connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
        skillList = []
        ## bug:2018-03-15
        ## 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), []))
        skillList.extend(self.AffectSuperEquipSkillDict.get((triggerType, connSkillID), []))
        # 指定特殊类型可触发
        if connSkill and connSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbSkill, ChConfig.Def_SkillFuncType_NormalAttack]:
            funcType = connSkill.GetFuncType()
            skillList.extend(self.AffectSkillDict.get((triggerType, funcType), []))
            skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, funcType), []))
            skillList.extend(self.AffectDogzSkillDict.get((triggerType, funcType), []))
            skillList.extend(self.AffectSuperEquipSkillDict.get((triggerType, funcType), []))
        # 被动再触发被动限制为指定
        if connSkill and SkillCommon.isPassiveSkill(connSkill):
            return skillList
        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), []))
            skillList.extend(self.AffectSuperEquipSkillDict.get((triggerType, 0), []))
        return skillList
        
#所有obj的被动效果管理
@@ -639,16 +759,16 @@
        return
    
    # 人物需同步注册被动技能
    def RegistPassiveEffSet(self, gameObj):
    def RegistPassiveEffSet(self, gameObj, isCD=False):
        passiveEff = self.GetPassiveEff(gameObj)
        if not passiveEff:
            # 强制刷新所有被动技能
            passiveEff = PassiveEff(gameObj)
            if not passiveEff.RefreshPassiveSkillSet():
            if not passiveEff.RefreshPassiveSkillSet(isCD):
                return
            self.AddPassiveEff(gameObj, passiveEff)
        else:
            passiveEff.RefreshPassiveSkillSet()
            passiveEff.RefreshPassiveSkillSet(isCD)
        return
        
        
@@ -663,6 +783,21 @@
            self.AddPassiveEff(gameObj, passiveEff)
        else:
            passiveEff.RefreshDogzBattleSkill()
        return
    # 人物需同步注册装备技能,技能目前为可触发的被动类,若有定义冲突则可用功能类型划分
    def RegistSuperEquipSkillDict(self, gameObj):
        passiveEff = self.GetPassiveEff(gameObj)
        if not passiveEff:
            # 强制刷新所有被动技能
            passiveEff = PassiveEff(gameObj)
            if not passiveEff.RefreshSuperEquipSkillDict():
                return
            self.AddPassiveEff(gameObj, passiveEff)
        else:
            passiveEff.RefreshSuperEquipSkillDict()
        return
        
        
@@ -688,6 +823,8 @@
                buffSkill = curBuff.GetSkill()
                if not buffSkill:
                    continue
                onwerID, onwerType = curBuff.GetOwnerID(), curBuff.GetOwnerType()
                for effectIndex in range(0, buffSkill.GetEffectCount()):
                    curEffect = buffSkill.GetEffect(effectIndex)
                    effectID = curEffect.GetEffectID()
@@ -698,7 +835,7 @@
                    if triggerType == -1:
                        continue
                    passiveEff = self.InitObjPassiveEff(gameObj)
                    passiveEff.AddBuffInfoByEffect(curEffect, buffSkill.GetSkillID())
                    passiveEff.AddBuffInfoByEffect(curEffect, buffSkill.GetSkillID(), onwerID, onwerType)
        
        return
    
@@ -714,36 +851,6 @@
        PyGameData.g_PassiveEffManager = PassiveEffManager()
    return PyGameData.g_PassiveEffManager
## 当前释放技能 skillData
#def CalcBuffTriggerSkill(attacker, skillData, target, tick):
#    #===========================================================================
#    # passiveEff = GetPassiveEffManager().GetPassiveEff(attacker, False)
#    # if not passiveEff:
#    #    return
#    # #影响技能的BUFF
#    # buffTriggerSkillDict = passiveEff.GetBuffTriggerSkill(skillData.GetSkillID())
#    # if not buffTriggerSkillDict:
#    #    return
#    #
#    # passiveEff.CalcBuffTriggerSkill(attacker, target, skillData, buffTriggerSkillDict, tick)
#    #===========================================================================
#    OnPassiveSkillTrigger(attacker, target, ChConfig.TriggerType_AttackOver, tick)
#===============================================================================
# # 判断PK关系是否可攻击 Def_BattleRelationType_CommNoBoss也可攻击 只是攻击无效果
# def CheckBattleRelationType(skillBattleType, battleRelationType):
#    if skillBattleType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
#        return True
#
#    #if battleRelationType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:
#    #    return True
#
#    if skillBattleType != battleRelationType:
#        # PK模式的判定
#        return False
#    return True
#===============================================================================
# 查找被动技能时的对象
def GetPassiveDefender(attacker, defender):
@@ -766,7 +873,167 @@
        return
    
    return GameWorld.GetObj(curHurt.GetObjID(), curHurt.GetObjType())
# 当前有效被动触发技能, 可用于基础使用判定
def IsValidPassiveSkill(curSkill):
    validMap = SkillShell.GetAttrMapID(curSkill)
    if validMap and validMap != GameWorld.GetMap().GetMapID():
        # 有效地图可触发
        return False
    return True
# 多种被动技能优先触发释放一个,如被动 血量40%触发无敌技能,血量一定是停留在40%
# 先锁血,后触发技能 同 DelayUsePassiveTriggerSkill 使用
def OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False):
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return 0, 0
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if connSkill:
        if not connSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return 0, 0
        if SkillCommon.isPassiveSkill(connSkill):
            stopPassiveSkill = True
        
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
        # 防范被动技能触发的 非被动技能
        stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0, 0
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return 0, 0
    defender = GetPassiveDefender(attacker, defender)
    # 当前战斗关系 pvp pve
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    #GameWorld.DebugLog("OnPriorityPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))
    lockHPPerMax = 0  ## 取有效的最高血量
    lockHPSkillID = 0
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
            # 只有天赋才可以再次被触发
            continue
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
        if not effect:
            continue
        if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
            continue
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
            # PK模式的判定
            continue
        pyName = "PassiveSkill_%s" % effectID
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
        if not callFunc:
            continue
        if not callFunc(attacker, defender, effect, curSkill):
            continue
        # 最终取最高值来决定当前生命值,卡血设定
        if effect.GetEffectValue(0) > lockHPPerMax:
            lockHPPerMax = effect.GetEffectValue(0)
            lockHPSkillID = skillTypeID
    return lockHPSkillID, lockHPPerMax
# 锁血功能的技能 含人物和宠物
def OnObjsPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick,):
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return 0
    lockHPSkillID, lockHPPerMax = OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick)
    rolePet = attacker.GetPetMgr().GetFightPet()
    if rolePet:
        lockHPSkillIDPet, lockHPPerMaxPet = OnPassiveSkillLockHP(rolePet, defender, connSkill, triggerType, tick)
        if lockHPPerMax + lockHPPerMaxPet == 0:
            # 无触发
            return 0
        # 触发宠物技能标志
        if lockHPPerMaxPet > lockHPPerMax:
            rolePet.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillIDPet)
            return lockHPPerMaxPet
    if lockHPPerMax == 0:
        return 0
    # 触发人物技能标志
    attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillID)
    return lockHPPerMax
# 从伤血延后到技能结束触发被动技能
def DelayUsePassiveTriggerSkill(attacker, curSkill, defender, tick):
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    # 检查是宠物还是人物技能
    skillTypeID = attacker.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)
    if not skillTypeID:
        rolePet = attacker.GetPetMgr().GetFightPet()
        if not rolePet:
            return
        skillTypeID = rolePet.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)
        if not skillTypeID:
            return
        attacker = rolePet
        GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----pet")
    # 一定要清标志
    attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, 0)
    curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
    if not curSkill:
        return
    GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----skillTypeID-%s"%skillTypeID)
    # 设置标志避免被动技能触发被动技能, 被动当中可能会触发多种类型技能,故不用isPassiveSkill做屏蔽
    SkillCommon.SetUsingPassiveSkill(attacker, 1)
    if not SkillShell.UsePassiveTriggerSkill(attacker, curSkill, defender, tick):
        # 不管技能是否是否成功都必须进入CD
        SkillCommon.SetSkillRemainTime(curSkill, PlayerControl.GetReduceSkillCDPer(attacker), tick, attacker)
    SkillCommon.SetUsingPassiveSkill(attacker, 0)
    return
# 灵宠部分技能需要通过主人触发,灵宠自己触发的逻辑依然走 OnPassiveSkillTrigger
def OnPetPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick):
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    rolePet = attacker.GetPetMgr().GetFightPet()
    #无出战宠物
    if rolePet == None:
        return
    OnPassiveSkillTrigger(rolePet, defender, connSkill, triggerType, tick)
# 被动技能触发释放
def OnPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False, skillIDSet=None):
@@ -774,28 +1041,17 @@
    if not attacker:
        return False
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if connSkill:
        if not connSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return False
        if SkillCommon.isPassiveSkill(connSkill):
            #GameWorld.DebugLog("被动技能不能再次触发被动技能")
            #return False
            stopPassiveSkill = True
        
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
        # 防范被动技能触发的 非被动技能
        #GameWorld.DebugLog("被动技能释放中不能再次触发被动技能---%s"%triggerType)
        #return
        stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return False
        
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return False
        
@@ -812,9 +1068,8 @@
        if not curSkill:
            continue
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
            # 只有天赋才可以再次被触发
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
        if not effect:
@@ -892,7 +1147,7 @@
    if not passiveEff:
        return 0
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return 0
    
@@ -907,6 +1162,10 @@
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
            # 只有天赋才可以再次被触发
            continue 
@@ -953,7 +1212,7 @@
    if not passiveEff:
        return []
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return []
    
@@ -970,6 +1229,9 @@
        if not curSkill:
            continue
        
        if not IsValidPassiveSkill(curSkill):
            continue
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
        if not effect:
            continue
@@ -999,7 +1261,7 @@
    if not passiveEff:
        return
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return
    
@@ -1013,6 +1275,9 @@
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
@@ -1063,7 +1328,15 @@
    for skillID, effectList in buffDict.items():
        if tagSkillID == skillID:
            continue
        for passiveEffect in effectList:
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
        if not curSkill:
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        for effectInfo in effectList:
            passiveEffect = effectInfo[0]
            # 被动触发的技能
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
            
@@ -1071,7 +1344,7 @@
            if not callFunc:
                continue
            
            if not callFunc(attacker, defender, passiveEffect, tagSkill):
            if not callFunc(attacker, defender, passiveEffect, tagSkill, ownerID=effectInfo[1], ownerType=effectInfo[2]):
                continue
            
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "DoLogic"))
@@ -1122,20 +1395,25 @@
    for skillID, effectList in buffDict.items():
        if skillID == useSkillID:
            continue
        for passiveEffect in effectList:
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
        if not curSkill:
            continue
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
            # 只有天赋才可以再次被触发
            continue
        if not IsValidPassiveSkill(curSkill):
            continue
        for effectInfo in effectList:
            passiveEffect = effectInfo[0]
            # 被动触发的技能
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
            curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
            if not curSkill:
                continue
            if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
                # 只有天赋才可以再次被触发
                continue
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
            if not callFunc:
                continue
            
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill, ownerID=effectInfo[1], ownerType=effectInfo[2]):
                continue
            
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetSkillData"))
@@ -1202,11 +1480,14 @@
        if not curSkill:
            continue
        
        for passiveEffect in effectList:
        if not IsValidPassiveSkill(curSkill):
            continue
        for effectInfo in effectList:
            if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
                # 只有天赋才可以再次被触发
                continue 
            passiveEffect = effectInfo[0]
            # 被动触发的技能
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
            
@@ -1215,7 +1496,7 @@
                continue
            
            # 条件不满足
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill, ownerID=effectInfo[1], ownerType=effectInfo[2]):
                continue
            
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))
@@ -1223,7 +1504,7 @@
                continue
            
            # 如被动技能:千幻冥炎真实伤害从2变4倍
            curValue += GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_PassiveBuffValue)
            #curValue += GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_PassiveBuffValue)
            curValue += callFunc(attacker, defender, passiveEffect)
            
    return curValue
@@ -1291,3 +1572,31 @@
        skills.append(curSkill)
        
    return skills
# 遍历身上装备技能以及各自个数,装备技能不需要学习
# 保证不同的装备技能不会有相同的效果, 效果数值的衰减是根据相同技能个数计算而不是效果个数 1-pow((1-初始值),相同技能个数)
def FindSuperEquipSkills(gameObj):
    skillsDict = {}
    if gameObj.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return skillsDict
    equipPack = gameObj.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
    for i in xrange(equipPack.GetCount()):
        curEquip = equipPack.GetAt(i)
        if not curEquip or curEquip.IsEmpty():
            continue
        if curEquip.GetAddSkill(0) == 0:
            #无技能
            continue
        for j in xrange(curEquip.GetAddSkillCount()):
            skillID = curEquip.GetAddSkill(j)
            if skillID == 0:
                break
            skillsDict[skillID] = skillsDict.get(skillID, 0) + 1
    return skillsDict