#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
##@package AIType_61  
 | 
# @todo: ÍòÄê±ùÀεڶþ¹ØBossÕÙ»½ÊÞAI £¨³åÏòÍæ¼Ò×Ô±¬£©  
 | 
#  
 | 
# @author zhangd  
 | 
# @date 2011-07-15 18:00  
 | 
# @version 1.1  
 | 
#  
 | 
# @note:   
 | 
# @change: "2011-07-19 21:00" zhangd ÐÞ¸Äbuff²»Ë¢ÐÂbug  
 | 
#---------------------------------------------------------------------  
 | 
"""Version = 2011-07-19 21:00"""  
 | 
#---------------------------------------------------------------------  
 | 
#µ¼Èë  
 | 
import IPY_GameWorld  
 | 
import GameWorld  
 | 
import NPCCommon  
 | 
import BaseAttack  
 | 
import ChConfig  
 | 
import SkillShell  
 | 
import AICommon  
 | 
import FBDefenseCommon  
 | 
import random  
 | 
import GameObj  
 | 
#---------------------------------------------------------------------  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
## ³õʼ»¯  
 | 
#  @param curNPC µ±Ç°npc  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def DoInit(curNPC):  
 | 
    curNPC.GetNPCAngry().Init(ChConfig.Def_NormalNPCAngryCount)  
 | 
    curNPC.SetIsNeedProcess(True)  
 | 
    return  
 | 
  
 | 
  
 | 
## Ö´ÐÐAI  
 | 
#  @param curNPC µ±Ç°npc  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def ProcessAI(curNPC, tick):  
 | 
      
 | 
    #NPCÒÑËÀÍö£¬Ìø³ö  
 | 
    if curNPC.IsAlive() != True:  
 | 
        return  
 | 
      
 | 
    npcControl = NPCCommon.NPCControl(curNPC)  
 | 
      
 | 
    #ÕÙ»½ÊÞ³¬¹ý´æ»îʱ¼ä, ÉèÖÃËÀÍö  
 | 
    if curNPC.GetLastTime() != 0 and tick - curNPC.GetBornTime() >= curNPC.GetLastTime():  
 | 
        npcControl.SetKilled()  
 | 
        return  
 | 
  
 | 
    #Ë¢ÐÂ×Ô¼ºµÄbuff  
 | 
    npcControl.RefreshBuffState(tick)    
 | 
    if GameObj.GetHP(curNPC) == 0 :  
 | 
        # BUFFË¢ÐÂÖпÉÄܻᵼÖÂNPCËÀÍö  
 | 
        return  
 | 
    #---¹¥»÷Âß¼---  
 | 
    playerList = NPCCommon.GetInSightPlayerList_NPC(curNPC)  
 | 
    if not playerList:  
 | 
        return  
 | 
      
 | 
    tagPlayer = random.choice(playerList)  
 | 
  
 | 
    #»ñµÃ¼¼ÄܹÜÀíÆ÷  
 | 
    skillManager = curNPC.GetSkillManager()  
 | 
    SkillOne = skillManager.GetSkillByIndex(0)      
 | 
#    skillTwo = skillManager.GetSkillByIndex(1)      
 | 
      
 | 
    tagDist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), tagPlayer.GetPosX(), tagPlayer.GetPosY())  
 | 
    if tagDist > SkillOne.GetAtkDist():  
 | 
        npcControl.MoveToObj_Detel(tagPlayer, 1)  
 | 
        return  
 | 
      
 | 
    result = AICommon.DoNPCUseSkill(curNPC, tagPlayer, SkillOne, tagDist, tick)  
 | 
      
 | 
    # Êͷż¼Äܳɹ¦£¬×Ôɱ£¬´¥·¢±¬Õ¨ÌØÐ§¼¼ÄÜ  
 | 
    if result:  
 | 
        npcControl.SetKilled()     
 | 
            
 | 
    return result  
 | 
  
 | 
  
 | 
##ËÀºó·Å±¬Õ¨ÌØÐ§¼¼ÄÜ  
 | 
#  @param curNPC µ±Ç°npc  
 | 
#  @param hurtType É˺¦ÕßµÄobjÀàÐÍ  
 | 
#  @param hurtID É˺¦ÕßµÄobjID  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnDie(curNPC, hurtType, hurtID):  
 | 
    FBDefenseCommon.DeadUseSkillByIndex(curNPC, 1)  
 |