ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -38,6 +38,11 @@
    ght = useSkill.GetHurtType() % 10
    if ght == IPY_GameWorld.ghtMag: # 做配置兼容用,优先验证法伤,否则默认物伤
        return IPY_GameWorld.ghtMag
    if ght == 3: # 由触发的技能决定
        bySkill = useSkill.GetBySkill()
        if bySkill:
            #GameWorld.DebugLogEx("物法类型取触发的技能: useSkillID=%s,bySkillID=%s", useSkill.GetSkillID(), bySkill.GetSkillID())
            return GetPMType(batObj, bySkill)
    return IPY_GameWorld.ghtPhy
def IsIgnoreDef(useSkill):
@@ -60,6 +65,19 @@
        return
    
    skillType = useSkill.GetSkillType()
    byBatObj = kwargs.pop("byBatObj", None)
    if useSkill.GetFuncType() == ChConfig.Def_SkillFuncType_MinggeSkill:
        if useSkill.GetSkillType() in ChConfig.Def_HurtSkill_List:
            if not byBatObj:
                return
            GameWorld.DebugLogEx("命格攻击类技能施法方算触发者! mgObjID=%s,byObjID=%s,skillID=%s", curBatObj.GetID(), byBatObj.GetID(), skillID)
            curBatObj = byBatObj
        else:
            # 因为命格攻击类技能修改了施法者,后续如果有子技能触发会变成还是变更后的施法者,导致命格全体buff可能存在多个施法来源,可能导致bug
            batLineup = curBatObj.GetTFBatLineup()
            curBatObj = batLineup.getMinggeObj()
            GameWorld.DebugLogEx("命格非攻击类技能强制施法者为命格自己! mgObjID=%s,skillID=%s", curBatObj.GetID(), skillID)
    byTriggerWay = kwargs["byTriggerWay"] if "byTriggerWay" in kwargs else 0 # 不使用参数名 triggerWay, 防止传递过程中参数混乱
    if not curBatObj.IsAlive():
        if skillType == ChConfig.Def_SkillType_Revive:
@@ -158,6 +176,8 @@
    useSkill.SetBatType(batType)
    useSkill.SetBySkill(bySkill)
    useSkill.SetByBuff(byBuff)
    # 注:理论上原先的 byFriendObj 都可以直接用这个,但是旧的代码先不修改了,后续的累计敌军、友军之类的触发可以统一使用 byBatObj
    useSkill.SetByBatObj(kwargs.pop("byBatObj", None))
    useSkill.SetByTriggerWay(byTriggerWay)
    
    isTurnNormalSkill = SkillCommon.isTurnNormalSkill(useSkill)
@@ -378,13 +398,14 @@
                    colNumList.insert(0, specInColNum)
                    
            GameWorld.DebugLogEx("纵排: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
            posObjIDDict = batLineup.getPosObjIDDict()
            for col in colNumList:
                for row in range(1, 1 + ChConfig.TurnFightRows):
                    pNum = (row - 1) * ChConfig.TurnFightCols + col
                    #GameWorld.DebugLogEx("    col=%s,row=%s,pNum=%s", col, row, pNum)
                    if pNum not in batLineup.posObjIDDict:
                    if pNum not in posObjIDDict:
                        continue
                    tagObjID = batLineup.posObjIDDict[pNum]
                    tagObjID = posObjIDDict[pNum]
                    tagBatObj = batObjMgr.getBatObj(tagObjID)
                    if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
                        continue
@@ -403,13 +424,14 @@
                
            GameWorld.DebugLogEx("全部: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
            # 按前排优先原则
            posObjIDDict = batLineup.getPosObjIDDict()
            for row in range(1, 1 + ChConfig.TurnFightRows):
                for col in colNumList:
                    pNum = (row - 1) * ChConfig.TurnFightCols + col
                    #GameWorld.DebugLogEx("    col=%s,row=%s,pNum=%s", col, row, pNum)
                    if pNum not in batLineup.posObjIDDict:
                    if pNum not in posObjIDDict:
                        continue
                    tagObjID = batLineup.posObjIDDict[pNum]
                    tagObjID = posObjIDDict[pNum]
                    tagBatObj = batObjMgr.getBatObj(tagObjID)
                    if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
                        continue
@@ -541,7 +563,7 @@
    batObjMgr = BattleObj.GetBatObjMgr()
    for num in lineupNumList:
        batLineup = batFaction.getBatlineup(num)
        for tagID in batLineup.posObjIDDict.values():
        for tagID in batLineup.getBatHeroObjIDList():
            tagObj = batObjMgr.getBatObj(tagID)
            if tagObj.IsAlive() and tagObj.CheckInState(checkInStates):
                return lineupNum, changeTagSet
@@ -577,13 +599,14 @@
        
    GameWorld.DebugLogEx("前后排: rowNumList=%s,colNumList=%s,specObjID-PosNum=%s-%s", rowNumList, colNumList, specObjID, specObjPosNum)
    aimObjList = []
    posObjIDDict = batLineup.getPosObjIDDict()
    for row in rowNumList:
        for col in colNumList:
            pNum = (row - 1) * ChConfig.TurnFightCols + col
            #GameWorld.DebugLogEx("    row=%s,col=%s,pNum=%s", row, col, pNum)
            if pNum not in batLineup.posObjIDDict:
            if pNum not in posObjIDDict:
                continue
            tagObjID = batLineup.posObjIDDict[pNum]
            tagObjID = posObjIDDict[pNum]
            tagBatObj = batObjMgr.getBatObj(tagObjID)
            if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
                continue
@@ -608,13 +631,14 @@
    row = inRowNum # 目标玩家所在横排
    
    batObjMgr = BattleObj.GetBatObjMgr()
    batLineup = tagObj.GetBatLineup()
    batLineup = tagObj.GetTFBatLineup()
    aimObjList = []
    posObjIDDict = batLineup.getPosObjIDDict()
    for col in colNumList:
        pNum = (row - 1) * ChConfig.TurnFightCols + col
        if pNum not in batLineup.posObjIDDict:
        if pNum not in posObjIDDict:
            continue
        tagObjID = batLineup.posObjIDDict[pNum]
        tagObjID = posObjIDDict[pNum]
        tagBatObj = batObjMgr.getBatObj(tagObjID)
        if not tagBatObj.IsAlive():
            continue
@@ -637,13 +661,14 @@
    col = inColNum # 目标玩家所在纵排
    
    batObjMgr = BattleObj.GetBatObjMgr()
    batLineup = tagObj.GetBatLineup()
    batLineup = tagObj.GetTFBatLineup()
    aimObjList = []
    posObjIDDict = batLineup.getPosObjIDDict()
    for row in range(1, 1 + ChConfig.TurnFightRows):
        pNum = (row - 1) * ChConfig.TurnFightCols + col
        if pNum not in batLineup.posObjIDDict:
        if pNum not in posObjIDDict:
            continue
        tagObjID = batLineup.posObjIDDict[pNum]
        tagObjID = posObjIDDict[pNum]
        tagBatObj = batObjMgr.getBatObj(tagObjID)
        if not tagBatObj.IsAlive():
            continue
@@ -695,12 +720,13 @@
        colNumList.insert(0, inColNum)
        
    # 按前排优先原则
    posObjIDDict = batLineup.getPosObjIDDict()
    for row in range(ChConfig.TurnFightRows):
        for col in colNumList:
            pNum = row * ChConfig.TurnFightCols + col
            if pNum not in batLineup.posObjIDDict:
            if pNum not in posObjIDDict:
                continue
            tagObjID = batLineup.posObjIDDict[pNum]
            tagObjID = posObjIDDict[pNum]
            tagBatObj = batObjMgr.getBatObj(tagObjID)
            if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf=True):
                continue
@@ -1395,6 +1421,7 @@
    # 优先处理afterLogic,可再预先汇总一些会触发被动的信息
    relatedSkillID = useSkill.GetSkillID()
    delBuffAfterEffList = [] # buff消失后要触发的被动,一般用于后置处理的逻辑
    beControlledHardDict = {} # 受控目标 {objID:buff, ...}
    afterLogicList = useSkill.GetAfterLogicList()
    for logicType, logicData in afterLogicList:
        if logicType == ChConfig.AfterLogic_DelBuff:
@@ -1413,6 +1440,13 @@
            buff = logicData[1]
            TurnBuff.SyncBuffRefresh(turnFight, buffObj, buff, relatedSkillID)
            
        # 统计添加buff需要触发的被动
        elif logicType == ChConfig.AfterLogic_TriggerAddBuff:
            triggerType, batObj, buff, buffOwner = logicData
            if buffOwner.GetID() == curID:
                if triggerType == ChConfig.TriggerWay_BeControlledHard:
                    beControlledHardDict[batObj.GetID()] = buff
    # 统计击杀
    killObjList = [] # 击杀其他阵营目标列表
    dieObjList = [] # 死亡的单位列表,包含友方单位或自己
@@ -1555,7 +1589,7 @@
            batFaction = turnFight.getBatFaction(faction)
            for lineupNum in batFaction.lineupDict.keys():
                batLineup = batFaction.getBatlineup(lineupNum)
                for lineupObjID in batLineup.posObjIDDict.values():
                for lineupObjID in batLineup.getBatHeroObjIDList():
                    lineupObj = batObjMgr.getBatObj(lineupObjID)
                    if not lineupObj.IsAlive():
                        continue
@@ -1581,7 +1615,7 @@
        
    # 曹仁防护触发,暂写死
    for tagObj in caorenProtectList:
        tagBatLineup = tagObj.GetBatLineup()
        tagBatLineup = tagObj.GetTFBatLineup()
        caorenObj = tagBatLineup.getHeroObj(ChConfig.HeroID_Caoren) # 获取被防护目标阵容的曹仁
        if not caorenObj or not caorenObj.IsAlive():
            continue
@@ -1596,7 +1630,8 @@
    triggerOne = False
    batType = useSkill.GetBatType()
    isAttackDirect = (isUseSkill and SkillCommon.isAttackDirectSkill(useSkill)) # 是否直接攻击
    curBatLineup = None
    curBatLineup = curObj.GetTFBatLineup()
    curMGObj = curBatLineup.getMinggeObj()
    for tagObj in tagObjListAll:
        tagID = tagObj.GetID()
        
@@ -1653,6 +1688,14 @@
            TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_Stun, tagObj, connSkill=useSkill)
            TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeStun, curObj, connSkill=useSkill)
            
        # 控制
        if tagID in beControlledHardDict:
            buff = beControlledHardDict[tagID]
            if buff.GetCurBuffState() == ChConfig.BatObjState_Frozen:
                if curMGObj:
                    TurnPassive.OnTriggerPassiveEffect(turnFight, curMGObj, ChConfig.TriggerWay_Frozen, tagObj, connSkill=useSkill, byBatObj=curObj)
            TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeControlledHard, curObj, connSkill=useSkill, connBuff=buff)
        # 暴击
        if tagID in superHitObjIDList:
            TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_SuperHit, tagObj, connSkill=useSkill)
@@ -1676,6 +1719,9 @@
        # 追击
        elif batType == ChConfig.TurnBattleType_Pursue:
            TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_Pursue, tagObj, connSkill=useSkill)
            if isAttackDirect:
                if curMGObj:
                    TurnPassive.OnTriggerPassiveEffect(turnFight, curMGObj, ChConfig.TriggerWay_PursueAtk, tagObj, connSkill=useSkill, byBatObj=curObj)
            TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BePursue, curObj, connSkill=useSkill)
        # 反击
        elif batType == ChConfig.TurnBattleType_AtkBack:
@@ -1684,10 +1730,8 @@
            
            
        # 敌友方
        if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt:
            if not curBatLineup:
                curBatLineup = curObj.GetBatLineup()
            for lineupObjID in curBatLineup.posObjIDDict.values():
        if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt or tagID in beControlledHardDict:
            for lineupObjID in curBatLineup.getBatHeroObjIDList():
                lineupObj = batObjMgr.getBatObj(lineupObjID)
                if not lineupObj.IsAlive():
                    continue
@@ -1703,6 +1747,10 @@
                    if not triggerOne:
                        TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendDotHurt, tagObj, connSkill=useSkill, byFriendObj=curObj)
                        
                # 敌方被控时
                if tagID in beControlledHardDict and lineupObj.GetFaction() != tagObj.GetFaction():
                    TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyBeControlledHard, tagObj, connSkill=useSkill)
                # 连击
                if batType == ChConfig.TurnBattleType_Combo:
                    TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendCombo, tagObj, connSkill=useSkill, byFriendObj=curObj)
@@ -1727,9 +1775,7 @@
    if not batFaction:
        return
    batLineup = batFaction.getBatlineup(1)
    if ChConfig.HeroID_Dongbai not in batLineup.heroObjIDDict:
        return
    dongbaiObj = BattleObj.GetBatObjMgr().getBatObj(batLineup.heroObjIDDict[ChConfig.HeroID_Dongbai])
    dongbaiObj = batLineup.getHeroObj(ChConfig.HeroID_Dongbai)
    if not dongbaiObj or dongbaiObj.IsAlive():
        return
    skill = dongbaiObj.GetSkillManager().FindSkillByID(ChConfig.SkillID_DongbaiRevive)
@@ -2065,8 +2111,8 @@
    '''按公式计算伤害,默认按攻击计算
    '''
    
    #mapID = turnFight.mapID
    skillID = curSkill.GetSkillID()
    #mapID = turnFight.mapID
    pmType = GetPMType(atkObj, curSkill)
    ignoreDef = IsIgnoreDef(curSkill)
    batType = curSkill.GetBatType()
@@ -2091,10 +2137,7 @@
        mustHit = True
        
    angerOverflow = atkObj.GetAngerOverflow() # 怒气溢出值
    if isAngerSkill:
        curXP = atkObj.GetXP()
        GameWorld.DebugLogEx("怒技攻击! curXP=%s,angerOverflow=%s", curXP, angerOverflow)
    #命中公式 攻击方类型不同,公式不同
    if not mustHit and not curSkill.GetEffectByID(ChConfig.SkillEff_MustHit) and not defObj.IsInControlledHard():
        aMissRateDef = atkObj.GetBatAttrValue(ChConfig.AttrID_MissRateDef) #atkObj.GetHit() # 抗闪避率 - 命中
@@ -2289,7 +2332,7 @@
        GameWorld.DebugLogEx("    普攻技能伤害=%s,aNormalSkillPer=%s,dNormalSkillPerDef=%s", hurtValue, aNormalSkillPer, dNormalSkillPerDef)
    elif isAngerSkill:
        hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 2))
        GameWorld.DebugLogEx("    怒气技能伤害=%s,aAngerSkillPer=%s,dAngerSkillPerDef=%s", hurtValue, aAngerSkillPer, dAngerSkillPerDef)
        GameWorld.DebugLogEx("    怒气技能伤害=%s,aAngerSkillPer=%s,dAngerSkillPerDef=%s,angerOverflow=%s,curXP=%s", hurtValue, aAngerSkillPer, dAngerSkillPerDef, angerOverflow, atkObj.GetXP())
    elif isDot:
        hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("DOTFormula", 1))
        GameWorld.DebugLogEx("    持续技能伤害=%s,aDOTPer=%s,dDOTPerDef=%s", hurtValue, aDOTPer, dDOTPerDef)
@@ -2599,12 +2642,10 @@
                         faction, lineupNum, hurtValueDict, immuneHurtDict)
    # 按优先级顺序处理拥有分摊效果的武将
    for effHeroID in effHeroIDList:
        if effHeroID not in batLineup.heroObjIDDict:
            continue
        objID = batLineup.heroObjIDDict[effHeroID]
        batObj = batObjMgr.getBatObj(objID)
        batObj = batLineup.getHeroObj(effHeroID)
        if not batObj or not batObj.IsAlive():
            continue
        objID = batObj.GetID()
        buffMgr = batObj.GetBuffManager()
        
        inHurt = objID in hurtValueDict # 光环里的人员是否有受伤