hxp
2023-04-25 ae8371301b81bfae8de95d2ecbe52a50df8c7f06
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package NPCAI.AIType_PriWood
#
# @todo:רÊôľ׮
# @author hxp
# @date 2019-05-23
# @version 1.0
#
# ÏêϸÃèÊö: ¸úËæÖ÷ÈË
#
#-------------------------------------------------------------------------------
#"""Version = 2019-05-23 17:30"""
#-------------------------------------------------------------------------------
 
import IPY_GameWorld
import NPCCommon
import GameWorld
import GameMap
import ChConfig
 
 
##AIÂß¼­´¦Àí
#@param curNPC NPCʵÀý
#@param tick Ê±¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
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)
    
    summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
    if not summonPlayerID:
        return
    owner = GameWorld.GetObj(summonPlayerID, IPY_GameWorld.gotPlayer)
    if not owner:
        return
    
    if GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), owner.GetPosX(), owner.GetPosY()) > 3:
        resetPos = GameMap.GetEmptyPlaceInArea(owner.GetPosX(), owner.GetPosY(), 2)
        curNPC.ResetPos(resetPos.GetPosX(), resetPos.GetPosY())
        
    return