hch
2019-04-11 6756646e51ad28afa1abf296a28330b34e159e69
6442 子 【2.0】装备莲台 / 【后端】【2.0】装备莲台

优化同buff 不同等级是否可添加逻辑
翻滚特殊处理,实时响应, 由CD 总控制 不受tick影响
7个文件已修改
5个文件已添加
293 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4076.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4077.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4078.py 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4079.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4080.py 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1305,11 +1305,13 @@
                          ChConfig.Def_HurtType_SuperHit:[False, 0, 0],
                          ChConfig.Def_HurtType_Parry:[False, 0, 0],
                          ChConfig.Def_HurtType_Zhuxian:[False, 0, 0],
                          ChConfig.Def_HurtType_DeadlyHit:[False, 0, 0],
                          }
    
    calcTypeList =  []
    if atkObjType == IPY_GameWorld.gotPlayer:
        calcTypeList += [ChConfig.Def_HurtType_LuckyHit, ChConfig.Def_HurtType_SuperHit, ChConfig.Def_HurtType_Zhuxian]
        calcTypeList += [ChConfig.Def_HurtType_LuckyHit, ChConfig.Def_HurtType_SuperHit,
                         ChConfig.Def_HurtType_Zhuxian, ChConfig.Def_HurtType_DeadlyHit]
    if defObjType == IPY_GameWorld.gotPlayer:
        calcTypeList += [ChConfig.Def_HurtType_Parry]
    # 暂时只计算玩家
@@ -1323,6 +1325,7 @@
                  ChConfig.Def_HurtType_SuperHit:lambda aObj, dObj, hState:__HurtTypeHappen_SuperHit(aObj, dObj, hState),
                  ChConfig.Def_HurtType_Parry:lambda aObj, dObj, hState:__HurtTypeHappen_Parry(aObj, dObj, hState),
                  #ChConfig.Def_HurtType_Zhuxian:lambda aObj, dObj, hState:__HurtTypeHappen_Zhuxian(aObj, dObj, hState),
                  ChConfig.Def_HurtType_DeadlyHit:lambda aObj, dObj, hState:__HurtTypeHappen_Deadly(aObj, dObj, hState),
                  }
    
    hadCheckList = [] # 已经处理过的伤害类型列表
@@ -1418,6 +1421,13 @@
#    if GameWorld.CanHappen(rate):
#        return True, PlayerControl.GetZhuXianHurtPer(atkObj), 0
#    return
# 致命一击
def __HurtTypeHappen_Deadly(atkObj, defObj, happenState):
    if PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, None, ChConfig.TriggerType_IsDealy):
        return True, 0, 0
    return
def ChangeSkillHurtPer(atkObj, defObj, curSkill, skillPer):
@@ -1934,6 +1944,7 @@
    isSuperHit, aSuperHit, dSuperHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_SuperHit] # 暴击
    dDamChanceDef = hurtTypeResultDict[ChConfig.Def_HurtType_Parry][2] # 抵御, 大于0代表触发抵御效果
    isZhuxianHit, aZhuxianHurtPer, dZhuxianReducePer = hurtTypeResultDict[ChConfig.Def_HurtType_Zhuxian] # 诛仙一击
    isDeadlyHit = hurtTypeResultDict[ChConfig.Def_HurtType_DeadlyHit][0] # 致命一击
    
    if PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, None, ChConfig.TriggerType_OneDamage):
        return 1, hurtType
@@ -1994,6 +2005,7 @@
    dHP = GameObj.GetHP(defObj)                # 防守方当前血量
    dMaxHP = GameObj.GetMaxHP(defObj)          # 防守方最大血量
    dIceDef = defObj.GetIceDef()        # 冰防, 元素真防, 玩家及NPC通用
    dFinalHurtReducePer = 0             # 最终伤害减少百分比 默认0
    
    # 攻击方
    if atkObjType == IPY_GameWorld.gotPlayer:
@@ -2041,6 +2053,8 @@
        dFinalHurtReduce = PlayerControl.GetFinalHurtReduce(defObj) # 最终固定伤害减少
        dBeHurtPer = PlayerControl.GetBeHurtPer(defObj)      # 加深受到伤害百分比
        dFightPower = defObj.GetFightPower()
        dFinalHurtReducePer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, curSkill, ChConfig.TriggerType_dFinalHurtReducePer)
    else:
        dIgnoreDefRateReduce = 0    # 无视防御比率抗性
        dSkillAtkRateReduce = 0     # 技能攻击力减少
@@ -2050,6 +2064,7 @@
        dBeHurtPer = 0
        dFightPower = NPCCommon.GetSuppressFightPower(defObj)
        
    #攻击字典 { 攻击类型 : '公式' }
    hurtDist = ReadChConfig.GetEvalChConfig('CalcAttackValue')
    
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -753,7 +753,8 @@
Def_HurtType_Zhansha,     # նɱ 12
Def_HurtType_Zhuxian,     # 诛仙一击 13
Def_HurtType_ZhognjiZhansha,     # 终极斩杀 14
) = range(1, 15)
Def_HurtType_DeadlyHit,     # 致命一击 15
) = range(1, 16)
#Def_HurtType_SuckBlood,      # 吸血 
(
@@ -4385,7 +4386,9 @@
TriggerType_SuperHitSkipCD, # 暴击无冷却 68
TriggerType_BuffHurtCnt, # 当持续buff伤害第X次时触发技能 69
TriggerType_4074PerValue, # 特殊效果的加成 70
) = range(1, 71)
TriggerType_dFinalHurtReducePer,    # 防守方的最终伤害减少百分比 71
TriggerType_IsDealy,    # 是否触发致命一击 72 暂且理解为和概率是独立,有新概念产生则重定义
) = range(1, 73)
# NPC功能类型定义
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
@@ -152,6 +152,9 @@
    #刷新所有属性
    playControl = PlayerControl.PlayerControl(curPlayer)
    playControl.RefreshPlayerAttrState()
    #装备的被动触发类技能
    PassiveBuffEffMng.GetPassiveEffManager().RegistSuperEquipSkillDict(curPlayer)
    return True
@@ -366,6 +369,9 @@
    #刷新所有属性
    playControl = PlayerControl.PlayerControl(curPlayer)
    playControl.RefreshPlayerAttrState()
    #装备的被动触发类技能
    PassiveBuffEffMng.GetPassiveEffManager().RegistSuperEquipSkillDict(curPlayer)
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
@@ -193,8 +193,8 @@
        
        if buffReplaceType == ChConfig.Def_Buff_Replace_Better:
            if buffSkillLV > curSkillLV:
                # 只取最好的
                continue
                # 只取最好的, 不可加直接退出
                return False
        
        resultTime = -1 #不改变时间的情况
        if buffRepeatTimeType == ChConfig.Def_BuffTime_Reset:
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
@@ -1688,11 +1688,13 @@
        return True
    
    buffSkill = curObjBuff.GetSkill()
    buffSkillLV = buffSkill.GetSkillLV()
    
    #已存在更强大的效果
    if buffSkillLV > curSkillLV:
        return
    #buff根据情况可以叠加低级,或者低级覆盖高级
#    buffSkillLV = buffSkill.GetSkillLV()
#
#    #已存在更强大的效果
#    if buffSkillLV > curSkillLV:
#        return
        
    if not buffSkill.GetLastTime():
        #GameWorld.DebugLog("无时间限制buff,只要存在buff,则无需重复添加")
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4076.py
New file
@@ -0,0 +1,29 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 承受全职业伤害减少X% (莲台专用叠加衰减)
#
# @author: Alee
# @date 2019-4-11 下午03:09:43
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
import PassiveBuffEffMng
def CheckCanHappen(attacker, defender, effect, curSkill):
    return True
def GetValue(attacker, defender, effect):
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0
    # 已计算根据技能数叠加衰减
    return passiveEff.AffectSuperEquipEffectCntDict.get(effect.GetEffectID(), 0)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4077.py
New file
@@ -0,0 +1,29 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 对全职业伤害增加X% (莲台专用叠加衰减)
#
# @author: Alee
# @date 2019-4-11 下午03:09:43
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
import PassiveBuffEffMng
def CheckCanHappen(attacker, defender, effect, curSkill):
    return True
def GetValue(attacker, defender, effect):
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0
    # 已计算根据技能数叠加衰减
    return passiveEff.AffectSuperEquipEffectCntDict.get(effect.GetEffectID(), 0)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4078.py
New file
@@ -0,0 +1,26 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 攻击有X%的概率造成2秒麻痹效果 (莲台专用叠加衰减)
#
# @author: Alee
# @date 2019-4-11 下午03:26:53
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
import GameWorld
import PassiveBuffEffMng
def CheckCanHappen(attacker, defender, effect, curSkill):
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return False
    value = passiveEff.AffectSuperEquipEffectCntDict.get(effect.GetEffectID(), 0)
    return GameWorld.CanHappen(value)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4079.py
New file
@@ -0,0 +1,29 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 攻击有XX%的概率造成致命一击
#
# @author: Alee
# @date 2019-4-11 下午05:36:35
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
import PassiveBuffEffMng
import GameWorld
def CheckCanHappen(attacker, defender, effect, curSkill):
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return False
    value = passiveEff.AffectSuperEquipEffectCntDict.get(effect.GetEffectID(), 0)
    return GameWorld.CanHappen(value)
def GetValue(attacker, defender, effect):
    return 1
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuff/PassiveSkill_4080.py
New file
@@ -0,0 +1,29 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 受到攻击时,对攻击方造成X%的反射伤害 (莲台专用叠加衰减)
#
# @author: Alee
# @date 2019-4-11 下午05:41:23
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
import PassiveBuffEffMng
def CheckCanHappen(attacker, defender, effect, curSkill):
    return True
def GetValue(attacker, defender, effect):
    passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(attacker)
    if not passiveEff:
        return 0
    # 已计算根据技能数叠加衰减
    return passiveEff.AffectSuperEquipEffectCntDict.get(effect.GetEffectID(), 0)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveBuffEffMng.py
@@ -259,6 +259,8 @@
    # 助战神兽技能
    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)
    GetPassiveEffManager().RegistSuperEquipSkillDict(curPlayer)
#-被动逻辑处理--------------------------------------------------------------------------------------------------
##离开地图处理
@@ -355,6 +357,11 @@
             4073:ChConfig.TriggerType_BuffHurtCnt, # 当持续buff伤害第X次时触发技能 69
             4074:ChConfig.TriggerType_BounceHP,   # 反弹伤害固定值14, 记录值
             4075:ChConfig.TriggerType_4074PerValue,   # 增加4074的反弹比例
             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,
             }
    return tdict.get(effectID, -1) 
    #===========================================================================
@@ -417,6 +424,8 @@
        self.AffectSkillDict = {}    # 被动技能 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectPassiveSkillSetDict = {}    # 被动技能装备 {(触发模式, 被影响的技能ID):[被动技能ID,效果]
        self.AffectDogzSkillDict = {}   # 神兽助战技能
        self.AffectSuperEquipSkillDict = {}   # 特殊装备持有技能,相同技能不重复,数值增长性衰减, 触发使用
        self.AffectSuperEquipEffectCntDict = {}  # 特殊装备技能效果对应的已计算后的数值,直接调用
    
    #记录会影响其他技能或者被动触发释放技能的BUFF
    def AddBuffInfoByEffect(self, effect, skillID):
@@ -500,6 +509,45 @@
                self.AffectDogzSkillDict[key].append((skillTypeID, effectID))
        
        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
    
    
    # 重刷可装备的被动技能
@@ -609,10 +657,13 @@
        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 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的被动效果管理
@@ -686,6 +737,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
        
        
@@ -1471,3 +1537,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
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -965,10 +965,12 @@
        #GameWorld.ErrLog('UseSkill findSkillErr = %s'%(pack_SkillID), curPlayerID)
        return
    if not CheckClientAttackTick(curPlayer, clientTick, tick):
        AttackFailNotify(curPlayer, curSkill, ChConfig.SkillFail_AtkInterval)
        curPlayer.Sync_ClientTick()
        return
    if pack_SkillID != ChConfig.Def_SkillID_Somersault:
        # 翻滚特殊处理,实时响应, 由CD 总控制
        if not CheckClientAttackTick(curPlayer, clientTick, tick):
            AttackFailNotify(curPlayer, curSkill, ChConfig.SkillFail_AtkInterval)
            curPlayer.Sync_ClientTick()
            return
    #已经在攻击中
    if curPlayer.GetPlayerAction() == IPY_GameWorld.paAttack:
@@ -2381,6 +2383,9 @@
        houseSkill = ChConfig.Def_Skill_TypeID_Speed
        curSkillType = curSkill.GetSkillTypeID()
        
        if not SkillCommon.IsBuff(curSkill):
            continue
        if curSkillType in houseSkill:
            #不使用,不添加buff
            if playerVehicle != IPY_GameWorld.pvHorse :