#!/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
|
|