xdh
2019-07-17 fd94cf4a58cb44cc2c34e711a2d48a3ec60789ff
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -50,6 +50,9 @@
             ChConfig.Def_SkillFuncType_NormalAttack:[1,3],
             }
Def_PassiveSkillValueNoCD = [52000, 57000]      # 特殊处理部分技能增强触发不受CD影响
# --------被动功法设置--------------------------------------------------------------------
#===============================================================================
@@ -177,6 +180,11 @@
                                                     ChConfig.Def_PDictType_GFPassive)
        if findSkillID == 0:
            continue
        passiveEff = GetPassiveEffManager().GetPassiveEff(curPlayer)
        if passiveEff:
            findSkillID = passiveEff.ChangeSkillTypeID(findSkillID)
        skills.append(findSkillID)
        
    return skills
@@ -282,6 +290,8 @@
def GetTriggerTypeByEffectID(effectID):
    # 临时配置
    tdict = {
             1304:ChConfig.TriggerType_HitValue,    # 命中记录 89
             2102:ChConfig.TriggerType_BeAttackOver,   # 被攻击后触发 20
             2104:ChConfig.TriggerType_LockHP, # 锁血触发技能 63
             2105:ChConfig.TriggerType_BeLuckyHit, # 被会心一击触发技能 64
@@ -294,7 +304,7 @@
             4004:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4005:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4006:ChConfig.TriggerType_SuperHit, # 暴击时 触发技能6,
             4007:ChConfig.TriggerType_SuperHitValue, # 暴击时 增加暴击值百分比7,
             4007:ChConfig.TriggerType_SuperHitPer, # 暴击时 增加暴击值百分比,
             4008:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4009:ChConfig.TriggerType_HurtObjAddBuff, # 击中玩家(群攻多次触发)8,
             4010:ChConfig.TriggerType_ReduceCD, # 减少CD9, #CD
@@ -316,6 +326,7 @@
             4027:ChConfig.TriggerType_AttackKill,   # նɱ 24
             4028:ChConfig.TriggerType_WillDead,   # 进入濒死状态时触发技能 25
             4029:ChConfig.TriggerType_BuffBoom,   # 中毒后爆炸 26
             4030:ChConfig.TriggerType_ThumpSkillValue, # 重击增加技能固定值伤害 88
             4031:ChConfig.TriggerType_HurtObjAddBuff,   # 在算伤害时群攻1对1加buff,可用于一个伤害多次触发 28
             4032:ChConfig.TriggerType_BeBoomSeed,   # 被动引爆视野内对象的buff种子 29
             4033:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
@@ -371,13 +382,13 @@
             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
             4086:ChConfig.TriggerType_AttackAddSkillPerYinji,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 为了飘字使用
             4087:ChConfig.TriggerType_AttackAddSkillPerYinji,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 为了飘字使用
             4088:ChConfig.TriggerType_AttackAddSkillPerYinji,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 为了飘字使用
             4089:ChConfig.TriggerType_AttackAddSkillPerYinji,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 为了飘字使用
             4090:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4091:ChConfig.TriggerType_SkillOverNoAttack,   # 技能释放后 与TriggerType_AttackOver相反19,
             4092:ChConfig.TriggerType_SkillSuccess,  # 任何技能释放成功都可触发 76  减印记
             4092:ChConfig.TriggerType_SkillSuccessExpend,  # 任何技能释放成功都可触发 76  减印记
             4093:ChConfig.TriggerType_NoControl,   # 使关联技能不受控制 78
             4094:ChConfig.TriggerType_Buff_AddSuperHitRate, # BUFF类:增加暴击率
             4095:ChConfig.TriggerType_SuperHitSuckBloodPer, # BUFF类: 暴击百分比吸血, 79
@@ -388,7 +399,13 @@
             4100:ChConfig.TriggerType_AttackOver,  # 攻击(对敌技能)后被动技能被触发 4
             4101:ChConfig.TriggerType_AttackAddSkillPer,  # 所有攻击伤害(SkillPer)增加,含普攻,计算时 5
             4102:ChConfig.TriggerType_SkillValue,  # 增加技能伤害固定值 82
             4103:ChConfig.TriggerType_Buff_SuckBloodPer,   # 攻击 百分比吸血
             4103:ChConfig.TriggerType_ThumpHitSuckBloodPer,   # 攻击 百分比吸血
             4104:ChConfig.TriggerType_HitSuccess,  # 命中成功率 83
             4106:ChConfig.TriggerType_AddHP,   # 技能回血 84
             4107:ChConfig.TriggerType_SkillValue,   # 增加技能伤害固定值 82
             4108:ChConfig.TriggerType_SkillSuccess,  # 使用技能成功后不触发技能 处理消耗等问题用 87
             4109:ChConfig.TriggerType_SkillValue,   # 增加技能伤害固定值 82
             4110:ChConfig.TriggerType_ChangeSkillEff, # 改变技能特效
             }
    return tdict.get(effectID, -1) 
    #===========================================================================
@@ -433,16 +450,20 @@
             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中对第一目标暴击触发技能
             4532:ChConfig.TriggerType_AttackOver,    # BUFF类:攻击触发新技能
             4533:ChConfig.TriggerType_BurnDisappear, # 灼烧消失触发 81
             4534:ChConfig.TriggerType_DebuffOff,   # BUFF类: 抵消debuff
             4535:ChConfig.TriggerType_BeAttackAddSkillPer, # buff中, 被攻击提高技能伤害
             4536:ChConfig.TriggerType_AddBuffOver, 
             4537:ChConfig.TriggerType_BurnPer, # 灼烧伤害百分比 80
             4538:ChConfig.TriggerType_SkillValue,  # 增加技能伤害固定值 82
             4539:ChConfig.TriggerType_SkillValue,  # 增加技能伤害固定值 82
             4540:ChConfig.TriggerType_SuperHitPer, # 暴击伤害百分比
             4541:ChConfig.TriggerType_AttackAddSkillPer, # BUFF类:提高主动技能的技能伤害
             
             803:ChConfig.TriggerType_BloodShield,  # 血盾
             806:ChConfig.TriggerType_BloodShield,  # 血盾
@@ -466,6 +487,9 @@
        self.AffectDogzSkillDict = {}   # 神兽助战技能
        self.AffectSuperEquipSkillDict = {}   # 特殊装备持有技能,相同技能不重复,数值增长性衰减, 触发使用
        self.AffectSuperEquipEffectCntDict = {}  # 特殊装备技能效果对应的已计算后的数值,直接调用
        self.ChangeSkill = {}   # 改变释放的技能ID,方便处理特效动作表现等问题 {原SkillTypeID: 改变后的SkillTypeID}
        self.IsChangeSkill = False # 当前是否刷新技能替换
    
    #记录会影响其他技能或者被动触发释放技能的BUFF
    def AddBuffInfoByEffect(self, effect, skillID, onwerID, onwerType):
@@ -627,10 +651,45 @@
        
        return self.AffectPassiveSkillSetDict
    
    # 改变技能ID的处理, 先存储释放的时候替换, 并且不登记到被动触发
    def ChangeSkillTypeIDDict(self, curSkill):
        hasEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_ChangeSkillTypeID)
        if not hasEffect:
            return
        changeSkillID = 0
        #找到对应法宝技能
        upIpyData = IpyGameDataPY.GetIpyGameData('TreasureUp', hasEffect.GetEffectValue(0), 1)
        if not upIpyData:
            return
        skillIDList = upIpyData.GetUnLockSkill()
        for skillID in skillIDList:
            skillData = GameWorld.GetGameData().FindSkillByType(skillID, 1)
            if not skillData:
                continue
            if not SkillCommon.CheckSkillJob(self.gameObj, skillData):
                continue
            changeSkillID = skillID
            break
        if changeSkillID == 0:
            return
        self.ChangeSkill[changeSkillID] = curSkill.GetSkillTypeID()
        self.IsChangeSkill = True
        GameWorld.DebugLog("self.ChangeSkill  --- %s"%self.ChangeSkill)
        return True
    # 真实替换技能ID
    def ChangeSkillTypeID(self, skillID):
        return self.ChangeSkill.get(skillID, skillID)
    
    # 重刷被动型技能(含sp,天赋,不含被动技能功能)存储
    def RefreshPassiveSkill(self):
        self.AffectSkillDict = {}
        self.ChangeSkill = {}
        skillManager = self.gameObj.GetSkillManager()
        for i in range(0 , skillManager.GetSkillCount()):
            curSkill = skillManager.GetSkillByIndex(i)
@@ -643,6 +702,10 @@
            if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbPassiveSkill,
                                          ChConfig.Def_SkillFuncType_Dogz]:
                # 被动技能和神兽需设置才有效
                continue
            # 改变技能ID的处理
            if self.ChangeSkillTypeIDDict(curSkill):
                continue
            
            skillTypeID = curSkill.GetSkillTypeID()
@@ -717,7 +780,7 @@
                skillList.extend(self.AffectSuperEquipSkillDict.get((triggerType, funcType), []))
        
        # 被动再触发被动限制为指定
        if connSkill and SkillCommon.isPassiveSkill(connSkill):
        if connSkill and SkillCommon.isPassiveSkill(connSkill) and not PassPassiveLimit(connSkill):
            return skillList
        
        if connSkillID != 0 and connSkillID != ChConfig.Def_SkillID_Somersault:
@@ -768,9 +831,20 @@
                return
            self.AddPassiveEff(gameObj, passiveEff)
        elif skillID:
            curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
            if curSkill and passiveEff.ChangeSkillTypeIDDict(curSkill):
                # 替换技能不添加
                return
            # 单个添加被动技能
            passiveEff.AddPassiveSkill(skillID)
        if passiveEff.IsChangeSkill:
            GameWorld.DebugLog("刷被动----")
            # 存在替换技能 目前需要刷新镶嵌的被动技能,存在多刷现象
            self.RegistPassiveEffSet(gameObj)
            passiveEff.IsChangeSkill = False
            return True
        return
    
    # 人物需同步注册被动技能
@@ -910,7 +984,7 @@
        if not connSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return 0, 0
        if SkillCommon.isPassiveSkill(connSkill):
        if SkillCommon.isPassiveSkill(connSkill) and not PassPassiveLimit(connSkill):
            stopPassiveSkill = True
        
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:
@@ -1156,7 +1230,8 @@
    if connSkill and SkillCommon.isPassiveSkill(connSkill):
        #GameWorld.DebugLog("被动技能不能再次触发被动技能")
        #return 0
        stopPassiveSkill = True
        if not PassPassiveLimit(connSkill):
            stopPassiveSkill = True
        
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
@@ -1185,9 +1260,11 @@
            # 只有天赋才可以再次被触发
            continue 
        
        if curSkill.GetCoolDownTime() and SkillCommon.RefreshSkillRemainTime(curSkill, tick):
            #有配置CD的才判断
            continue
        if skillTypeID not in Def_PassiveSkillValueNoCD:
            # 特殊技能不走CD处理
            if curSkill.GetCoolDownTime() and SkillCommon.RefreshSkillRemainTime(curSkill, tick):
                #有配置CD的才判断
                continue
        
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
        if not effect:
@@ -1209,8 +1286,9 @@
            continue
        
        curValue += callFunc(attacker, defender, effect)
        if curSkill.GetCoolDownTime():
            SkillCommon.SetSkillRemainTime(curSkill, 0, tick, attacker)
        if skillTypeID not in Def_PassiveSkillValueNoCD:
            if curSkill.GetCoolDownTime():
                SkillCommon.SetSkillRemainTime(curSkill, 0, tick, attacker)
        
    return curValue
@@ -1338,11 +1416,8 @@
    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
        return
    tagSkillID = tagSkill.GetSkillID() if tagSkill else 0
    
    for skillID, effectList in buffDict.items():
        if tagSkillID == skillID:
            continue
        
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
        if not curSkill:
@@ -1382,7 +1457,7 @@
        if not useSkill.GetFuncType():
            # 非功能类技能,避免死循环
            return
        if SkillCommon.isPassiveSkill(useSkill):
        if SkillCommon.isPassiveSkill(useSkill) and not PassPassiveLimit(useSkill):
            #GameWorld.DebugLog("被动技能不能再次触发被动技能")
            #return
            stopPassiveSkill = True
@@ -1459,16 +1534,17 @@
# buff 影响的(攻击)行为值
# 返回数值
def GetValueByPassiveBuffTriggerType(attacker, defender, useSkill, triggerType):
def GetValueByPassiveBuffTriggerType(attacker, defender, useSkill, triggerType, isStopPassiveSkill=True):
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return 0
    
    stopPassiveSkill = False   # 被动技能不能再触发被动技能,但可以触发天赋技能
    if useSkill and SkillCommon.isPassiveSkill(useSkill):
    if useSkill and SkillCommon.isPassiveSkill(useSkill) and isStopPassiveSkill:
        #GameWorld.DebugLog("被动技能不能再次触发被动技能")
        #return 0
        stopPassiveSkill = True
        if not PassPassiveLimit(useSkill):
            stopPassiveSkill = True
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
@@ -1615,3 +1691,58 @@
            skillsDict[skillID] = skillsDict.get(skillID, 0) + 1  
            
    return skillsDict
# 默认情况下 被动不应该再触发(或加强)被动技能,会造成额外触发或者死循环
# 但也有一些特殊情况 放在此处过滤
def PassPassiveLimit(useSkill):
    # 如灼烧是被动技能 但可以被不断的强化
    if useSkill.GetSkillType() == ChConfig.Def_SkillType_PassiveLstDepBuff:
        return True
    if useSkill.GetFuncType() == ChConfig.Def_SkillFuncType_PassiveSkillWithSP:
        # 有专精的被动技能,可以再次触发被动效果
        return True
    return False
# 被动技能改变值  无条件限制 纯取值
def GetPassiveSkillValueByTriggerTypeEx(attacker, defender, connSkill, triggerType):
    attacker = FindRealAttacker(attacker)
    if not attacker:
        return 0
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkill)
    if not skills:
        return 0
    curValue = 0
    for skillTypeID, effectID in skills:
        if connSkillID == skillTypeID:
            continue
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
        if not curSkill:
            continue
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)
        if not effect:
            continue
        pyName = "PassiveSkill_%s" % effectID
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))
        # 条件不满足
        if callFunc and not callFunc(attacker, defender, effect, curSkill):
            continue
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))
        if callFunc is None:
            continue
        curValue += callFunc(attacker, defender, effect, skillTypeID)
    return curValue