Files
mir_server/server/LogicServer/ai/AggressorAI.h

64 lines
1.9 KiB
C
Raw Normal View History

2025-01-09 17:45:40 +08:00
#pragma once
/*
*/
#ifdef WIN32
#define PRIORITY_FLAG_ATTACK_MASTER_TARGET (0x8000000000000000ui64)
#else
#define PRIORITY_FLAG_ATTACK_MASTER_TARGET (0x8000000000000000ULL)
#endif
class CAggressorAI:
public CAnimalAI
{
public:
typedef CAnimalAI Inherid;
/**
* Comments:
* @Return void:
*/
virtual bool CheckEnemy();
/*
* Comments:
* Param CAnimal *:
* @Return void:
*/
virtual void MoveInSight(CAnimal *,INT_PTR nPosX,INT_PTR nPosY );
private:
UINT64 ComposePriority(bool bOwnerTarget, bool bPrior, int nPriorLevel, int nDist)
{
UINT64 result = bOwnerTarget ? (UINT64)PRIORITY_FLAG_ATTACK_MASTER_TARGET : 0;
if (bPrior)
result |= ((INT64)1 << 62);
result |= (INT64)nPriorLevel << 32;
result |= nDist;
return result;
}
/*
* Comments:
* Param CEntity * pTarget:
* Param const CVector<int> *priorTargetList
* Param UINT64& priority:
* Param int nSelfX: X坐标
* Param int nSelfY: Y坐标
* @Return bool: truefalse
*
* 63
* 62
* 32-61
* 0-31
*/
bool CalcTargetPrior(CEntity *pTarget, const CVector<int> *priorTargetList, UINT64 &priority, int nSelfX, int nSelfY);
public:
static EntityVector *s_pVisibleEntityList; ///< 主动怪周围实体列表容器,避免获取怪物周围实体列表频繁的分配释放内存
CTimer<3000> m_checkMonsterTimer; ///< 观察怪物的定时器
};