1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/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_HP()
    
    #ËÀÍö
    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