10263 【英文】【BT】【GM】后端支持NPC仿真实玩家战斗和快速战斗(优化释放被动UsePassive计数,防止可能引起的死循环;)
| | |
| | | '''
|
| | |
|
| | | playerID = 0
|
| | | curTime = int(time.time())
|
| | | if curPlayer:
|
| | | if GameWorld.IsCrossServer():
|
| | | GameWorld.DebugLog("跨服服务器中不允许玩家镜像战斗请求!", playerID)
|
| | |
| | | if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID):
|
| | | GameWorld.DebugLog("镜像战斗场景中,无法请求!", playerID)
|
| | | return
|
| | | curTime = int(time.time())
|
| | | # 请求cd验证
|
| | | requestTime = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleTime)
|
| | | if requestTime and (curTime - requestTime) <= 20: # 20秒内不重复请求
|
| | |
| | | def __DoClientUseSkillEx(curPlayer, skillData, tick):
|
| | | #使用技能结果
|
| | | useSkillResult = False
|
| | | SkillCommon.ClearUsingPassiveSkill(curPlayer)
|
| | |
|
| | | #---无目标类技能---
|
| | | aimType = SkillShell.GetSkillFireAim(skillData)
|
| | |
| | | return attacker.GetDictByKey("UsePassive")
|
| | |
|
| | | def SetUsingPassiveSkill(attacker, value):
|
| | | return attacker.SetDict("UsePassive", value)
|
| | | if value > 0:
|
| | | attacker.SetDict("UsePassive", attacker.GetDictByKey("UsePassive") + 1)
|
| | | else:
|
| | | attacker.SetDict("UsePassive", max(0, attacker.GetDictByKey("UsePassive") - 1))
|
| | | return
|
| | |
|
| | | def ClearUsingPassiveSkill(attacker):
|
| | | attacker.SetDict("UsePassive", 0)
|
| | | return
|
| | |
|
| | | def CheckPlayerAtkInterval(curPlayer, skillTypeID, tick):
|
| | | ''' 验证是否基本攻击间隔 '''
|
| | |
| | | skillID = curSkill.GetSkillID()
|
| | | PyGameData.g_singleAtkRecordList.append([atkID, tagID, skillID])
|
| | | #GameWorld.DebugLog("PyGameData.g_singleAtkRecordList: %s, %s" % (len(PyGameData.g_singleAtkRecordList), PyGameData.g_singleAtkRecordList))
|
| | | if len(PyGameData.g_singleAtkRecordList) >= 50:
|
| | | #已修复SetUsingPassiveSkill计数问题,这个记录还是先保留,观察一段时间后没问题可去除
|
| | | if len(PyGameData.g_singleAtkRecordList) >= 100:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | GameWorld.SendGameError("MirrorAIAtkDepthError", "mapID=%s, %s" % (mapID, PyGameData.g_singleAtkRecordList))
|
| | | PyGameData.g_singleAtkRecordList = None
|