ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -34,7 +34,7 @@
import BuffSkill
import FBCommon
import ItemControler
import PlayerPet
import PassiveBuffEffMng
# 回合战斗流程状态
(
@@ -99,14 +99,10 @@
def DoTrunFight(curPlayer, mapID, funcLineID, tagPlayerID, tick):
    playerID = curPlayer.GetPlayerID()
    PlayerViewCacheTube.UpdPlayerPropPlusCache(curPlayer) # 强制刷一下自己的镜像缓存
    factionInfoA = {"playerID":playerID, "pet":PlayerPet.GetPetCacheInfo(curPlayer)}
    factionInfoB = {}
    factionInfoA = GetPlayerFactionInfoByCache(playerID)
    ipyData = None
    if tagPlayerID:
        PlusData = PlayerViewCacheTube.GetPlayerPropPlusDictByID(tagPlayerID)[1] # 从缓存中获取
        factionInfoB = {"playerID":tagPlayerID, "pet":PlusData.get("Pet")}
        factionInfoB = GetPlayerFactionInfoByCache(tagPlayerID)
    else:
        ipyData = IpyGameDataPY.GetIpyGameData("FBTurn", mapID, funcLineID)
        if not ipyData:
@@ -118,7 +114,10 @@
        petCacheInfo = [] # 从配表中读取组合,技能默认取NPC表配置的
        for state, petNPCID in enumerate(petNPCIDList, 1):
            petCacheInfo.append({"npcID":petNPCID, "state":state, "quality":0})
        factionInfoB = {"npcID":npcID, "pet":petCacheInfo}
        skillIDExList = [] # NPC为附加技能,因为NPC表本身可能有配置技能
        skillIDExList.extend(ipyData.GetElfSkillIDList())
        skillIDExList.extend(ipyData.GetSTSkillIDList())
        factionInfoB = {"npcID":npcID, "pet":petCacheInfo, "skillIDExList":skillIDExList}
        
    ret = ProcessAutoTurnFight(mapID, funcLineID, factionInfoA, factionInfoB, tick, curPlayer)
    if not ret:
@@ -138,6 +137,20 @@
    playbackID and overMsg.update({"playbackID":playbackID})
    SyncTurnFightState(curPlayer, mapID, funcLineID, tagPlayerID, FightState_Award, turnNum, turnMax, overMsg)
    return
def GetPlayerFactionInfoByCache(playerID):
    ## 根据玩家缓存数据获取对阵玩家阵营信息字典
    _, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(playerID, True) # 从缓存中获取,强刷一次最新属性
    skillIDList = []
    SkillInfo = PlusDict.get("SkillInfo", {})
    for _, skillLVDict in SkillInfo.items():
        for skillID, _ in skillLVDict.items():
            skillID = GameWorld.ToIntDef(skillID)
            skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
            if not skillData:
                continue
            skillIDList.append(skillID)
    return {"playerID":playerID, "pet":PlusDict.get("Pet"), "skillIDList":skillIDList}
def ProcessAutoTurnFight(mapID, funcLineID, factionInfoA, factionInfoB, tick, syncPlayer=None, isSavePlayback=False):
    ''' 处理自动回合战斗过程,仅做战斗流程处理,不做及其他功能逻辑
@@ -182,6 +195,8 @@
    # 设置战斗主体
    objA.SetDict(ChConfig.Def_Obj_Dict_TurnFightMainRole, 1)
    objB.SetDict(ChConfig.Def_Obj_Dict_TurnFightMainRole, 1)
    objA.SetDict(ChConfig.Def_Obj_Dict_TurnEnemyID, objB.GetID())
    objB.SetDict(ChConfig.Def_Obj_Dict_TurnEnemyID, objA.GetID())
    
    # 战斗前初始化,可能会改变攻速,所以先初始化
    for faction, factionObjList in enumerate(atkFactionList, 1):
@@ -212,7 +227,11 @@
        
        # 回合开始: 做一些每回合重置逻辑或者某些根据回合触发的效果等
        for gameObj in fightObjList:
            TurnFightObjPerTurnStart(gameObj, turnNum, tick)
            if not gameObj:
                continue
            faction = GameObj.GetFaction(gameObj)
            tagGameObj = objB if faction == 1 else objA
            TurnFightObjPerTurnStart(gameObj, tagGameObj, turnNum, tick)
            
        isWin = CheckIswin(objA, objB)
        if isWin != None:
@@ -298,12 +317,14 @@
    factionSyncInfo = {} # 同步前端的阵营信息,包含主ID、灵宠、其他灵通等
    playerID = factionInfo.get("playerID")
    npcID = factionInfo.get("npcID")
    skillIDList = factionInfo.get("skillIDList") # 技能ID列表
    skillIDExList = factionInfo.get("skillIDExList") # 附加技能ID列表
    if playerID:
        npcID = ChConfig.Def_NPCID_PVP
        mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, mirrorPlayerID=playerID)
        mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, mirrorPlayerID=playerID, skillIDList=skillIDList, skillIDExList=skillIDExList)
        factionSyncInfo["playerID"] = playerID
    elif npcID:
        mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel)
        mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, skillIDList=skillIDList, skillIDExList=skillIDExList)
        factionSyncInfo["npcID"] = npcID
    else:
        return
@@ -360,6 +381,18 @@
    clientPack.ObjType = gameObj.GetGameObjType()
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return True
def GetEnemyCureDefPer(gameObj):
    ## 获取敌对方弱化治疗值
    tagID = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnEnemyID)
    if not tagID:
        return 0
    tagObj = GameWorld.FindNPCByID(tagID)
    if not tagObj:
        return 0
    cureDefPer = GameObj.GetCureDefPer(tagObj)
    #其他的...
    return cureDefPer
def GetRebornTypeInfo(gameObj):
    ''' 获取可复活的方式信息
@@ -476,17 +509,9 @@
    objName = GetObjName(gameObj)
    fightPlaceNum = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_FightPetPlaceNum)
    
    GameWorld.DebugLog("【 %s 初始化 %s 】 objID=%s,npcID=%s,atkSpeed=%s,HP=%s,Atk=%s,Def=%s,isMainRole=%s"
                       % (objName, BaseAttack.GetObjAttackName(gameObj), gameObj.GetID(), npcID,
                          GameObj.GetAtkSpeed(gameObj), GameObj.GetHP(gameObj), gameObj.GetMaxAtk(), gameObj.GetDef(), isMainRole))
    GameWorld.DebugLog("    闪避(%s,%s),暴击(%s,%s),击晕(%s,%s),连击(%s,%s),反击(%s,%s),吸血(%s,%s)"
                       % (GameObj.GetMissRate(gameObj), GameObj.GetMissDefRate(gameObj),
                          GameObj.GetSuperHitRate(gameObj), GameObj.GetSuperHitRateReduce(gameObj),
                          GameObj.GetFaintRate(gameObj), GameObj.GetFaintDefRate(gameObj),
                          GameObj.GetComboRate(gameObj), GameObj.GetComboDefRate(gameObj),
                          GameObj.GetAtkBackRate(gameObj), GameObj.GetAtkBackDefRate(gameObj),
                          GameObj.GetSuckHPPer(gameObj), GameObj.GetSuckHPDefPer(gameObj),
                          ))
    GameWorld.DebugLog("【 %s 初始化 %s 】 objID=%s,npcID=%s,atkSpeed=%s,isMainRole=%s"
                       % (objName, BaseAttack.GetObjAttackName(gameObj), gameObj.GetID(), npcID, GameObj.GetAtkSpeed(gameObj), isMainRole))
    __logGameObjAttr(gameObj)
    
    # 重置技能CD、战斗buff
    if objType == IPY_GameWorld.gotPlayer:            
@@ -512,7 +537,19 @@
        
    return
def TurnFightObjPerTurnStart(gameObj, turnNum, tick):
def __logGameObjAttr(gameObj):
    GameWorld.DebugLog("    HP=%s,Atk=%s,Def=%s,atkSpeed=%s" % (GameObj.GetHP(gameObj), gameObj.GetMaxAtk(), gameObj.GetDef(), GameObj.GetAtkSpeed(gameObj)))
    GameWorld.DebugLog("    闪(%s,%s),暴(%s,%s),晕(%s,%s),连(%s,%s),反(%s,%s),吸(%s,%s)"
                       % (GameObj.GetMissRate(gameObj), GameObj.GetMissDefRate(gameObj),
                          GameObj.GetSuperHitRate(gameObj), GameObj.GetSuperHitRateReduce(gameObj),
                          GameObj.GetFaintRate(gameObj), GameObj.GetFaintDefRate(gameObj),
                          GameObj.GetComboRate(gameObj), GameObj.GetComboDefRate(gameObj),
                          GameObj.GetAtkBackRate(gameObj), GameObj.GetAtkBackDefRate(gameObj),
                          GameObj.GetSuckHPPer(gameObj), GameObj.GetSuckHPDefPer(gameObj),
                          ))
    return
def TurnFightObjPerTurnStart(gameObj, tagObj, turnNum, tick):
    ## 回合制战斗实例 - 每回合开始时处理
    if not gameObj:
        return
@@ -542,6 +579,10 @@
        
    # 刷新定时处理的buff效果
    SkillShell.ProcessPersistBuff(gameObj, tick)
    PassiveBuffEffMng.OnPassiveSkillTrigger(gameObj, tagObj, None, ChConfig.TriggerType_TurnNum, tick)
    __logGameObjAttr(gameObj)
    return
def TurnFightObjPerTurnActionnum(turnNum, actionNum, gameObj, tick):