ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -328,8 +328,16 @@
             4050:ChConfig.TriggerType_OneDamage,   # 伤害降低到1点
             4051:ChConfig.TriggerType_LuckyHit, # 会心一击时增加会心伤害百分比 50
             4052:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
             4053:ChConfig.TriggerType_AddLayer, # BUFF层级增加时 52
             4054:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4055:ChConfig.TriggerType_StormAttackReduceCD, # 类剑刃风暴攻击后触发效果
             4056:ChConfig.TriggerType_PassiveBuffValue, ## 被动buff值计算中二次获取被动值 54
             4057:ChConfig.TriggerType_AttackKillHappen, ## 对被动技能斩杀的概率增强 55
             4058:ChConfig.TriggerType_AddBuffOver, # 添加buff之后触发技能 56
             4059:ChConfig.TriggerType_StormAttackOneByOne, # 类剑刃风暴攻击1对1触发技能  57
             4060:ChConfig.TriggerType_StormAttackOver, # 类剑刃风暴攻击后触发技能  57
             }
    return tdict.get(effectID, -1)
    return tdict.get(effectID, -1)
    #===========================================================================
    # # 此表配置 影响类型
    # ipyData = IpyGameDataPY.GetIpyGameData('SkillEffect', effectID)
@@ -360,6 +368,10 @@
             4513:ChConfig.TriggerType_AttackAddFinalValue,   #攻击增加输出伤害11
             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
             803:ChConfig.TriggerType_BloodShield,  # 血盾
             806:ChConfig.TriggerType_BloodShield,  # 血盾
             808:ChConfig.TriggerType_BloodShield,  # 血盾
@@ -715,18 +727,20 @@
#    #===========================================================================
#    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
#===============================================================================
# # 判断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):
@@ -757,47 +771,58 @@
    if not attacker:
        return False
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if connSkill:
        if not connSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return False
        if SkillCommon.isPassiveSkill(connSkill):
            #GameWorld.DebugLog("被动技能不能再次触发被动技能")
            return False
            #return False
            stopPassiveSkill = True
        
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
        # 防范被动技能触发的 非被动技能
        GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
        return
        #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)
    if not skills:
        return False
    defender = GetPassiveDefender(attacker, defender)
    result = False
    # 当前战斗关系 pvp pve
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    #GameWorld.DebugLog("OnPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not 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
        result = True   # 代表有效触发,但不关系触发结果
        
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
        if not CheckBattleRelationType(skillBattleType, battleRelationType):
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
            # PK模式的判定
            continue
        
@@ -813,8 +838,9 @@
                curSkill.SetRemainTime(0)  # 一次攻击多次调用 ,在外层统一调用CD
                skillIDSet.add(skillTypeID)
        SkillCommon.SetUsingPassiveSkill(attacker, 0)
    return True
    # 代表有效触发,但不关系触发结果, 外层根据需求使用,如减少循环判断
    return result
#ntSummon:(3)普通召唤兽,可继承主人基础属性如攻击 
@@ -853,9 +879,12 @@
    if not attacker:
        return 0
    
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if connSkill and SkillCommon.isPassiveSkill(connSkill):
        #GameWorld.DebugLog("被动技能不能再次触发被动技能")
        return 0
        #return 0
        stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0
@@ -870,9 +899,15 @@
    curValue = 0
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
            # 只有天赋才可以再次被触发
            continue
        if curSkill.GetCoolDownTime() and SkillCommon.RefreshSkillRemainTime(curSkill, tick):
            #有配置CD的才判断
            continue
@@ -881,11 +916,11 @@
        if not effect:
            continue
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
        if not CheckBattleRelationType(skillBattleType, battleRelationType):
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
            continue
        
        pyName = "PassiveSkill_%s" % effectID
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
        
        # 条件不满足
@@ -924,6 +959,8 @@
    #tick = GameWorld.GetGameWorld().GetTick()
    skillList = []
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        #if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
        #    continue
@@ -934,7 +971,7 @@
        if not effect:
            continue
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
        if not CheckBattleRelationType(skillBattleType, battleRelationType):
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
            continue
        
        pyName = "PassiveSkill_%s" % effectID
@@ -969,6 +1006,8 @@
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
@@ -979,7 +1018,7 @@
        if SkillCommon.RefreshSkillRemainTime(curSkill, tick):
            continue
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
        if not CheckBattleRelationType(skillBattleType, battleRelationType):
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
            # PK模式的判定
            continue
            
@@ -997,42 +1036,30 @@
    return False
#------------------------Buff类 被动触发, 并非全是被动技能-----------------------------------------------
#buff类触发释放技能,无CD验证
def OnPassiveBuffTrigger(attacker, defender, useSkill, triggerType, tick):
# 被动技能触发但无需释放,如抵消debuff,只需走CD即可
def OnPassiveBuffHappen(attacker, defender, tagSkill, triggerType, tick):
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return
    if useSkill:
        if not useSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return
        if SkillCommon.isPassiveSkill(useSkill):
            #GameWorld.DebugLog("被动技能不能再次触发被动技能")
            return
    if SkillCommon.GetUsingPassiveSkill(attacker):
        # 防范被动技能触发的 非被动技能
        GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
        return
        return False
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return
        return False
    buffDict = passiveEff.GetBuffsByTriggerType(triggerType)
    if not buffDict:
        return
        return False
    
    defender = GetPassiveDefender(attacker, defender)
    # 当前战斗关系 pvp pve
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    skillBattleType = SkillCommon.GetSkillBattleType(tagSkill)
    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
        return
    tagSkillID = tagSkill.GetSkillID() if tagSkill else 0
    
    for skillID, effectList in buffDict.items():
        if tagSkillID == skillID:
            continue
        for passiveEffect in effectList:
            # 被动触发的技能
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
@@ -1041,7 +1068,71 @@
            if not callFunc:
                continue
            
            if not callFunc(attacker, defender, passiveEffect, skillID):
            if not callFunc(attacker, defender, passiveEffect, tagSkill):
                continue
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "DoLogic"))
            if callFunc:
                callFunc(attacker, defender, passiveEffect, tagSkill, skillID)
            return True
    return False
#------------------------Buff类 被动触发, 并非全是被动技能-----------------------------------------------
#buff类触发释放技能,无CD验证
def OnPassiveBuffTrigger(attacker, defender, useSkill, triggerType, tick):
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if useSkill:
        if not useSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return
        if SkillCommon.isPassiveSkill(useSkill):
            #GameWorld.DebugLog("被动技能不能再次触发被动技能")
            #return
            stopPassiveSkill = True
    if SkillCommon.GetUsingPassiveSkill(attacker):
        # 防范被动技能触发的 非被动技能
        #GameWorld.DebugLog("被动技能不能再次触发被动技能---%s"%triggerType)
        #return
        stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return
    buffDict = passiveEff.GetBuffsByTriggerType(triggerType)
    if not buffDict:
        return
    defender = GetPassiveDefender(attacker, defender)
    # 当前战斗关系 pvp pve
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    useSkillID = useSkill.GetSkillID() if useSkill else 0
    for skillID, effectList in buffDict.items():
        if skillID == useSkillID:
            continue
        for passiveEffect in effectList:
            # 被动触发的技能
            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):
                continue
            
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetSkillData"))
@@ -1053,7 +1144,7 @@
                continue
            skillBattleType = SkillCommon.GetSkillBattleType(skillData)
            if not CheckBattleRelationType(skillBattleType, battleRelationType):
            if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
                # PK模式的判定
                continue
            
@@ -1076,9 +1167,13 @@
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return 0
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if useSkill and SkillCommon.isPassiveSkill(useSkill):
        #GameWorld.DebugLog("被动技能不能再次触发被动技能")
        return 0
        #return 0
        stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
@@ -1090,14 +1185,25 @@
    # 当前战斗关系 pvp pve
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)
    skillBattleType = SkillCommon.GetSkillBattleType(useSkill)
    if not CheckBattleRelationType(skillBattleType, battleRelationType):
    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
        return 0
    useSkillID = useSkill.GetSkillID() if useSkill else 0
    #tick = GameWorld.GetGameWorld().GetTick()
    curValue = 0
    for skillID, effectList in buffDict.items():
        if skillID == useSkillID:
            continue
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
        if not curSkill:
            continue
        for passiveEffect in effectList:
            if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:
                # 只有天赋才可以再次被触发
                continue
            # 被动触发的技能
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()
            
@@ -1105,17 +1211,16 @@
            if not callFunc:
                continue
            
            if not callFunc:
                continue
            # 条件不满足
            if not callFunc(attacker, defender, passiveEffect, skillID):
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):
                continue
            
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))
            if callFunc is None:
                continue
            
            # 如被动技能:千幻冥炎真实伤害从2变4倍
            curValue += GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_PassiveBuffValue)
            curValue += callFunc(attacker, defender, passiveEffect)
            
    return curValue