hxp
2018-12-06 585487dad792042225906b17a568a5b700f2c0b4
4581 修改机器人NPC类型定义
2个文件已修改
119 ■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_21.py 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4991,10 +4991,11 @@
ntPet,
ntTouchKill, #触碰后自杀类 17
ntUndeath, #不死类型 18
ntRobot, #上古战场机器人类型 19
ntDestructible, #场景内可破坏的 19
ntHelpBattleRobot, #助战机器人 20
ntRobot, #机器人21
ntMax
) = range(22)
) = range(23)
(Def_SkillFuncType_Common, #0为通用技能
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_21.py
@@ -1,28 +1,23 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
##@package AIType_21
#巡逻守卫AI,攻击非本国家玩家,和红名玩家
#-------------------------------------------------------------------------------
#
# @author PanWei
# @date 2010-4-28下午06:01:33
# @version 1.4
##@package NPCAI.AIType_21
#
#模块详细说明.
# @change: "2010-05-12 18:30" zhengyang 添加注释
# @change: "2010-06-09 09:50" zhengyang 守卫npc加入异常状态眩晕判断
# @change: 2010-06-14 16:00 zhengyang 修正普攻参数传错
# @change: "2010-11-22 12:15" Alee 删除异常/沉默判定
#---------------------------------------------------------------------
"""Version = 2010-11-22 12:15"""
#---------------------------------------------------------------------
import IPY_GameWorld
import GameWorld
import NPCCommon
import BaseAttack
# @todo:副本活动机器人
# @author hxp
# @date 2018-12-06
# @version 1.0
#
# 详细描述: 副本活动机器人
#
#-------------------------------------------------------------------------------
#"""Version = 2018-12-06 20:00"""
#-------------------------------------------------------------------------------
import ChConfig
import AICommon
import GameObj
#---------------------------------------------------------------------
## 初始化
#  @param curNPC NPC实例
@@ -30,6 +25,7 @@
#  @remarks 函数详细说明.
def DoInit(curNPC):
    curNPC.GetNPCAngry().Init(ChConfig.Def_BossAngryCount)
    return
#---------------------------------------------------------------------
##正常AI逻辑处理
@@ -38,86 +34,8 @@
#@return 返回值无意义
#@remarks 正常AI逻辑处理
def ProcessAI(curNPC, tick):
    npcControl = NPCCommon.NPCControl(curNPC)
    if curNPC.GetCurAction() == IPY_GameWorld.laNPCDie or not curNPC.IsAlive():
        #NPC死亡, 进入死亡倒计时
        if npcControl.DieTick(tick) == 0:
            return
        
    #刷新自己的buff
    npcControl.RefreshBuffState(tick)
    if GameObj.GetHP(curNPC) == 0 :
        # BUFF刷新中可能会导致NPC死亡
        return
#    #判断异常状态
#    if curNPC.GetAbnormalState() == IPY_GameWorld.sctFaint:
#        return
    curNPCAction = curNPC.GetCurAction()
    #NPC快速奔跑中, 处理
    if curNPCAction == IPY_GameWorld.laNPCMove and curNPC.GetCurMoveType() == IPY_GameWorld.mtRun :
        AICommon.NormalNPCFast_Move(curNPC , tick)
        return
    #刷新自己仇恨度列表
    npcControl.RefreshAngryList(tick)
    curNPCAngry = npcControl.GetMaxAngryTag()
    #仇恨度列表中的人为空
    if curNPCAngry == None :
        AICommon.NormalNPCFree_Move(curNPC , tick)
        return
    #仇恨对象类型,仇恨对象ID
    curNPCAngryType = curNPCAngry.GetObjType()
    curNPCAngryID = curNPCAngry.GetObjID()
    #战斗中回血
    npcControl.ProcessBattleHPRestore(tick)
    #执行攻击逻辑
    __NPCFight(curNPC, curNPCAngryID, curNPCAngryType, tick)
#---------------------------------------------------------------------
## npc攻击战斗
#  @param curNPC 当前npc
#  @param tagID curNPCAngryID
#  @param tagType curNPCAngryType
#  @param tick 当前时间
#  @return None
#  @remarks 战斗逻辑实现
def __NPCFight(curNPC, tagID, tagType, tick):
    #设置进入战斗状态
    NPCCommon.SetNPCInBattleState(curNPC)
    npcControl = NPCCommon.NPCControl(curNPC)
    #NPC的打怪AI
    if not npcControl.IsInRefreshArea():
        #追击返回
        npcControl.MoveBack()
        return
    #开始攻击
    curTag = GameWorld.GetObj(tagID, tagType)
    if curTag == None or GameObj.GetHP(curTag) <= 0:
        return
    tagDist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), curTag.GetPosX(), curTag.GetPosY())
    if tagDist > curNPC.GetAtkDist() :
        npcControl.MoveToObj_Detel(curTag)
        return
    if tick - curNPC.GetAttackTick() < curNPC.GetAtkInterval():
        #攻击间隔没有到, 返回
        return
    if npcControl.FixTagPos(curTag.GetPosX(), curTag.GetPosY()):
        #修正这个NPC的站立位置
        return
    #普通攻击
    BaseAttack.Attack(curNPC, curTag, None, tick)
    return