#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package NPCAI.AIType_56  
 | 
#  
 | 
# @todo:Ëþ·ÀÀàÌØÊâ¹ÖÎïAI, ×Ô±¬¹Ö  
 | 
# @author hxp  
 | 
# @date 2018-03-29  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: Ëþ·ÀÀàÌØÊâ¹ÖÎïAI, ³åÏòÖ¸¶¨Ä¿±êNPCID, È»ºó×Ô±¬, Ö§³ÖÔ¤¾¯×Ô±¬  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2018-03-29 15:30"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import ChConfig  
 | 
import FBDefenseCommon  
 | 
import IPY_GameWorld  
 | 
import GameWorld  
 | 
import NPCCommon  
 | 
import AICommon  
 | 
import FBLogic  
 | 
  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
## ³õʼ»¯  
 | 
#  @param curNPC µ±Ç°npc  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def DoInit(curNPC):  
 | 
    curNPC.GetNPCAngry().Init(ChConfig.Def_NormalNPCAngryCount)  
 | 
    return  
 | 
  
 | 
def OnNPCReborn(curNPC):  
 | 
    curNPC.SetIsNeedProcess(True)  
 | 
    return  
 | 
  
 | 
## »ñÈ¡NPCÊÇ·ñÏÞÖÆ¹¥»÷Ä¿±ê£¬AIÌØÊâ¶îÍâÅÐ¶Ï  
 | 
def GetNPCAttackTagLimit(curNPC, tagObj):  
 | 
    tagNPCIDList = [31704003] # Ö®ºó¿É¸ù¾Ý²»Í¬µÄÐèÇó¿ªÅäÖò»Í¬µÄ¹¥»÷Ä¿±ê£¬Ä¿Ç°Ö»ÓÐÊØÎÀÈ˻ʣ¬ÔÝʱдËÀ  
 | 
    tagObjType = tagObj.GetGameObjType()  
 | 
    if tagObjType == IPY_GameWorld.gotNPC:  
 | 
        if tagObj.GetNPCID() in tagNPCIDList:  
 | 
            #GameWorld.DebugLog("Ö»¹¥»÷Ö¸¶¨Ä¿±êNPCID£¬ÆäËûĬÈÏÏÞÖÆ!")  
 | 
            return False  
 | 
    #GameWorld.DebugLog("¹¥»÷Ä¿±êÊÜÏÞ!tagID=%s" % tagObj.GetID())  
 | 
    return True  
 | 
  
 | 
## Ö´ÐÐAI  
 | 
#  @param curNPC µ±Ç°npc  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def ProcessAI(curNPC, tick):  
 | 
      
 | 
    if not FBDefenseCommon.NormalCheck(curNPC, tick):  
 | 
        return  
 | 
      
 | 
    if curNPC.GetCurAction() == IPY_GameWorld.laNPCMove:  
 | 
        return  
 | 
      
 | 
    npcControl = NPCCommon.NPCControl(curNPC)  
 | 
      
 | 
    #Ô¤¾¯´¦Àí  
 | 
    warningProcessRet = AICommon.DoNPCSkillWarningProcess(curNPC, tick)  
 | 
    if warningProcessRet:  
 | 
        if warningProcessRet == 1:  
 | 
            __DoNPCSelfDestruction(npcControl, curNPC, tick)  
 | 
        return  
 | 
      
 | 
    tagNPC = GameWorld.FindNPCByNPCID(31704003)  
 | 
    if not tagNPC:  
 | 
        return  
 | 
      
 | 
    #»ñµÃ¼¼ÄܹÜÀíÆ÷  
 | 
    skillManager = curNPC.GetSkillManager()  
 | 
    destructSkill = skillManager.GetSkillByIndex(0)  
 | 
      
 | 
    tagDist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), tagNPC.GetPosX(), tagNPC.GetPosY())  
 | 
    if tagDist > 1:  
 | 
        npcControl.MoveToObj_Detel(tagNPC, 1)  
 | 
        return  
 | 
      
 | 
    # Êͷż¼Äܳɹ¦£¬×Ôɱ£¬´¥·¢±¬Õ¨ÌØÐ§¼¼ÄÜ  
 | 
    if AICommon.DoNPCUseSkill(curNPC, tagNPC, destructSkill, tagDist, tick):  
 | 
        if curNPC.GetCurAction() != IPY_GameWorld.laNPCSkillWarning:  
 | 
            __DoNPCSelfDestruction(npcControl, curNPC, tick)  
 | 
              
 | 
    return  
 | 
  
 | 
def __DoNPCSelfDestruction(npcControl, curNPC, tick):  
 | 
    FBLogic.DoFB_NPCSelfDestruction(curNPC, tick)  
 | 
    npcControl.SetKilled()  
 | 
    return  
 | 
  
 |