| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package AIType_200  | 
| # ÈÎÎñ²É¼¯NPC AI  | 
| #    | 
| # @author Alee  | 
| # @date 2010-4-21  | 
| # @version 1.3  | 
| #  | 
| # @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ  | 
| # @change: "2010-06-28 11:10" chenxuewei ¸ü¸Äº¯ÊýÃû  | 
| # @change: "2017-04-10 22:30" hxp »÷ɱ²É¼¯ÎïÇ¿ÖÆÌí¼ÓÒ»´ÎÉËѪ£¬·ÀÖ¹ÎÞ·¨»ñÈ¡µ½»÷ɱÕßÐÅÏ¢  | 
| #  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import IPY_GameWorld  | 
| import NPCCommon  | 
| import AICommon  | 
| import GameWorld  | 
| import ChConfig  | 
| import AttackCommon  | 
| import GameObj  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö  | 
| #---------------------------------------------------------------------  | 
| ##ÈÎÎñ²É¼¯NPC AIÂß¼´¦Àí  | 
| #@param curNPC NPCʵÀý  | 
| #@param tick Ê±¼ä´Á  | 
| #@return ·µ»ØÖµÎÞÒâÒå  | 
| #@remarks ÈÎÎñ²É¼¯NPC AIÂß¼´¦Àí  | 
| def ProcessAI(curNPC, tick):  | 
|     npcControl = NPCCommon.NPCControl(curNPC)  | 
|       | 
|     if curNPC.GetCurAction() == IPY_GameWorld.laNPCDie:  | 
|         #NPCËÀÍö, ½øÈëËÀÍöµ¹¼ÆÊ±  | 
|         if npcControl.DieTick(tick) == 0:  | 
|             return  | 
|       | 
|     #Ë¢ÐÂ×Ô¼ºµÄBuff  | 
|     npcControl.RefreshBuffState(tick)  | 
|       | 
|       | 
| ##²É¼¯½á¹û  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param curNPC µ±Ç°npc  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnCollectEnd(curPlayer, curNPC):  | 
|     dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), curNPC.GetPosX(), curNPC.GetPosY())  | 
|       | 
|     if dist > ChConfig.Def_EventDist:  | 
|         curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())  | 
|         return  | 
|       | 
|     AICommon.ClearPlayerPreparing( curNPC )  | 
|       | 
|     GameObj.SetHP(curNPC, GameObj.GetHP(curNPC) - 1)  | 
|       | 
|     #¹ã²¥Ò»´ÎѪÁ¿  | 
|     curNPC.Notify_HPEx()  | 
|       | 
|     #ËÀÍö  | 
|     if GameObj.GetHP(curNPC) <= 0:  | 
|         #ClearPlayerPreparing»áÇå¿ÕÉËѪÁбí,ÕâÀïÇ¿ÖÆÔÚSetKilled֮ǰÌí¼ÓÉËѪÁбí,·ÀÖ¹ÓÐÐèÒªÓõ½»ñÈ¡²É¼¯Îï»÷ɱÕßʱÎÞ·¨»ñÈ¡µ½µÄÎÊÌâ  | 
|         curNPC_HurtList = curNPC.GetPlayerHurtList()  | 
|         AttackCommon.AddHurtValue(curNPC, curPlayer.GetPlayerID(), ChConfig.Def_NPCHurtTypePlayer, 1)  | 
|         npcControl = NPCCommon.NPCControl(curNPC)  | 
|         npcControl.SetKilled()  | 
|   | 
|     return True  | 
|   |