⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ainpc.h

📁 魔域源代码需要的可以学习一下真么这么麻烦啊
💻 H
📖 第 1 页 / 共 2 页
字号:

	bool	KickBack();

public: // foot print
	void	GetFootPrint	(int& nPosX, int& nPosY);

protected:
	DWORD	m_tFootPrint;
	POINT	m_posFootPrint;

public: // get
	virtual OBJID	GetID()			{ return m_idNpc; }
	virtual int		GetObjType()	{ return CGameObj::GetObjType(); }
	//virtual OBJID	GetMapID()		{ return m_idMap; }
	virtual void	SendShow(IRole* pRole);

public: // get attrib  ------------------------------------
	virtual int		GetType			()		{ return m_pType->GetID(); }
//	virtual int		GetSex			()		{ return 0; }
	virtual bool	IsAlive			();
	virtual bool	IsTalkEnable	()		{ return m_dwStatus == STATUS_NORMAL; }
	virtual bool	IsMonster		()		{ return IsMonsterID(GetID()) && !IsGuard() && !IsPkKiller(); }
	virtual bool	IsDelThis		()		{ return IsDeleted() && m_tDie.IsTimeOut(); }		// ASSERT(!IsAlive()); 
	virtual bool	IsVirtuous()			{ return IsGuard() || IsPkKiller(); }
	virtual bool	IsEvil()				{ return ((m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_RIGHTEOUS) == 0 || QueryStatus(STATUS_CRIME)); }
	virtual bool	IsBowman()				{ return CItem::IsBowSort(GetWeaponRTypeID()); }
	virtual bool	IsShieldEquip()			{ return CItem::IsShield(GetWeaponLTypeID()); }
	virtual bool	IsWing()				{ return (m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_WING) != 0; }
	virtual bool	IsSendBlockInfo()		{ return (!IsCallPet() && !IsEudemon()); }

	static	bool	IsMonsterID(OBJID id)	{ return id>=MONSTERID_FIRST && id<=MONSTERID_LAST; }
	bool		IsGuard()			{ return (m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_GUARD) != 0; }
	bool		IsPkKiller()		{ return (m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_PPKER) != 0; }
	bool		IsDeleted()			{ return m_tDie.IsActive(); }
	void		DelMonster(bool bNow=false);			//? call this mast !IsDeleted()
	bool		IsSynPet()				{ return m_idNpc >= PETID_FIRST && m_idNpc <= PETID_LAST; }
	bool		IsSynMonster()			{ return (m_idNpc >= PETID_FIRST && m_idNpc <= PETID_LAST) && !m_pData; }
	bool		IsCallPet()				{ return m_idNpc >= CALLPETID_FIRST && m_idNpc <= CALLPETID_LAST; }
	OBJID		GetMasterID();
	int			GetData()			{ CHECKF(m_pData); return m_pData->GetInt(PETDATA_DATA); }
	OBJID		GetGenID()			{ return m_idGen; }
	bool		IsTaskMonster()		{ return this->GetType() >= TYPE_TASK_MONSTER; }
	bool		IsMagicAtk()			{ return m_pType->GetInt(NPCTYPEDATA_MAGIC_TYPE) != ID_NONE && m_pType->GetInt(NPCTYPEDATA_MAGIC_HITRATE) ==0; } 
	OBJID		GetMagicType()			{ return m_pType->GetInt(NPCTYPEDATA_MAGIC_TYPE); }
	bool		IsMapRoar()				{ return (m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_ROAR) != 0; }
	bool		IsEquality()			{ return (m_pType->GetInt(NPCTYPEDATA_ATKUSER)&ATKUSER_EQUALITY) != 0; }
	bool		IsEudemon()				{ return (m_idNpc >= EUDEMON_ID_FIRST && m_idNpc <= EUDEMON_ID_LAST); }
	static int	GetNameType(int nAtkerLev, int nMonsterLev);

public:	// modify attrib ------------------------------
	virtual void	SetDir(int nDir)			{ m_nDir = nDir%8; }
	virtual void	SetPose(int nPose)			{ m_nPose=nPose;}
//	virtual void	SetEmotion(int nEmotion)	{ }//m_nEmotin = nEmotion; }

	virtual	void	SetStatus(int nStatus, bool bSynchro=true);
	virtual	void	ClsStatus(int nStatus, bool bSynchro=true);

	virtual bool	AddAttrib(int idxAttr, __int64 i64Data, int nSynchro);
	virtual	void	ProcessOnMove(int nMoveMode);
	virtual void	ProcessAfterMove();
public: // money --------------------------------
//	virtual bool	SpendMoney(DWORD nMoney, bool bSynchro)		{ return true; }
//	virtual bool	GainMoney(DWORD nMoney, bool bSynchro)		{ return true; }

public: // fight ------------------------------
	virtual void	ClrAttackTarget		()									{ SetAttackTarget(NULL); }
	virtual bool	SetAttackTarget(IRole* pTarget);
	virtual bool	AutoSkillAttack(IRole* pTarget);
	virtual bool	AdditionMagic(int nLifeLost, int nDamage);
	virtual int		Attack(IRole* pTarget);		// return : lose life
	virtual bool	BeAttack(bool bMagic, IRole* pTarget, int nPower, bool bReflectEnable=true);
	virtual bool	MagicAttack(int nType, OBJID idTarget, int x, int y)	{ if (m_pMagic) return m_pMagic->MagicAttack(nType, idTarget, x, y); return false; }
	virtual void	Kill(IRole* pTarget, DWORD dwDieWay);
	virtual void	BeKill(IRole* pRole = NULL);	//pTarget = NULL);						// 可能删除NPC对象
	virtual bool	IsAtkable(IRole* pTarget, bool bSendHint=false);
	virtual bool	IsBeAtkable();
	virtual int		GetAttackRange(int nTargetSizeAdd)		{ return m_pType->GetInt(NPCTYPEDATA_ATKRANGE)+(GetSizeAdd()+nTargetSizeAdd+1)/2; }
	virtual int		GetSizeAdd()							{ return m_pType->GetInt(NPCTYPEDATA_SIZEADD); }
	virtual	int		GetLuck				()					{ return 0; }
	virtual void	SendDamageMsg(OBJID idTarget, int nDamage);
	void	ProcessBomb();
	int 	GetDieMode();
	bool	IsInsteadMagic();
	bool	IsImmunity			(IRole* pRole);		

public: // interactive
//	virtual bool	AddItem		(CItem* pItem)				{ CHECKF(pItem); pItem->ReleaseByOwner(); return true; }
//	virtual bool	IsItemFull	()							{ return false; }
	virtual bool	Freeze(int nSecs);							// return false: 解穴不成功

//	virtual CGameMap*		GetMap			()			{ ASSERT(m_pMap); return m_pMap; }

public: // action
	bool	ProcessAction	(CUser* pUser, OBJID idAction, LPCTSTR pszAccept = NULL);

public: // status
public: // user status --------------------------------------------------------------------------------
//	IStatus*	QueryStatus(OBJID idType)		{ CHECKF(m_setStatus); return m_setStatus->GetObj(idType); }
//	IStatusSet*	QueryStatusSet()				{ CHECKF(m_setStatus); return m_setStatus; }
	void		ClearAllStatus	();
protected: // data
//	IStatusSet*	m_setStatus;

public: // common -------------------------------------
//	static int	AdjustData			(int nData, int nAdjust, int nMaxData=0);

public: // pet ----------------------------------------------------
	bool	Create(PROCESS_ID idProcess, IRecordset* pRes);
	void	SaveInfo();			//??? save all when close server!!!

public: // call pet ---------------------------------
	CAutoLink<CMonster>&	QueryLink()			{ return m_link; }
protected:
	CAutoLink<CUser>	m_pOwner;
	CAutoLink<CMonster>	m_link;
	CMagicTypeData*		m_pMagicType;			// may be null
	CTimeOut			m_tMagic;

	CMagic*				m_pMagic;				// may be null 

public:
	DWORD	GetDropMoneyAvg();
	bool	DropMoney	(DWORD dwMoney, OBJID idOwner);
	// modifyed by zlong 2003-11-19
	// 增加设置magic2,magic3的默认参数
	bool	DropItem	(OBJID idItemType, OBJID idOwner, int nMagic2 = 0, int nMagic3 = 0, int nUserLuck = 0,bool bIsAllowDropUnident=false);

protected:
	CPetData*	m_pData;		// NULL: is not pet

protected:
	bool	DropMedicine	(OBJID idOwner);
	bool	DropEquipment	(DWORD dwValue, OBJID idOwner, DWORD dwQuality=0);

protected: // attrib
	OBJID		m_idNpc;
//	int			m_nPosX;
//	int			m_nPosY;
//	int			m_nDir;
	DWORD		m_dwStatus;
	I64			m_i64Effect;
	int			m_nPose;
//	CGameMap*	m_pMap;

	int			m_nCurrLife;
	int			m_nCurrMana;

	int			m_nPotential;		// 潜力值
	DWORD		m_dwMaskData;
public:
	DWORD	GetMaskData()		{ return m_dwMaskData; }
	void	SetMaskData(DWORD dwMask)		{ m_dwMaskData = dwMask; }
	void	AddMaskData(DWORD dwMask)		{ m_dwMaskData |= dwMask; }
	void	ClsMaskData(DWORD dwMask)		{ m_dwMaskData &= ~dwMask; }

public:	// eudemon -------------------------------
	bool DropTrap(TRAP_INFO &trapInfo, UINT ulLifePeriod);
	// 此函数只需要在创建幻兽的时候调用一次即可,由于功能已经改变,以后最好换个函数名
	void	SetEudemonAddi(CItem*	pEudemon);
	DWORD	GetFidelity()		{ IF_NOT (IsEudemon() && m_pEudemonItem) return 0; return m_pEudemonItem->GetInt(ITEMDATA_FIDELITY); }

	OBJID	GetDivineID()		{ IF_NOT (IsEudemon() && m_pEudemonItem) return 0; return m_pEudemonItem->GetDivineID(); }
	UCHAR	GetRelationShip(OBJID idDivine)					{ IF_NOT (IsEudemon() && m_pEudemonItem) return 0; return m_pEudemonItem->GetRelationShip(idDivine); }
	bool	AddRelationShip(OBJID idDivine, int nValue)		{ IF_NOT (IsEudemon() && m_pEudemonItem) return 0; return m_pEudemonItem->AddRelationShip(idDivine, nValue); }

	int		GetAtkMode()		{ ASSERT(IsEudemon()); return m_nAtkMode; }
	bool	ChgAtkMode(int nAtkMode);

protected:
	DWORD	GetEudemonLev()		{ IF_NOT (IsEudemon() && m_pEudemonItem) return 0; return m_pEudemonItem->GetEudemonLevel(); }

protected:
	// 幻兽各属性根据等级、成长计算出来的差值,需要加成到属性中的
/*
	struct {
		int			nMaxAtkAdd;			// 物理攻击
		int			nMinAtkAdd;
		int			nMaxMAtkAdd;		// 魔法攻击
		int			nMinMAtkAdd;
		int			nDefAdd;			// 物理防御
		int			nMDefAdd;			// 魔法防御
		int			nMaxLifeAdd;		// 最大生命

		int			nAtkSpeedAdd;		// 攻击速度
		int			nHitRateAdd;		// 命中率
		int			nDodgeAdd;			// 躲避率

//		int			nEudemonLev;		// 等级
	} m_AddInfo;
*/

	CItem*		m_pEudemonItem;		// refrence

protected: // fight
	CBattleSystem*		m_pBattleSystem;
	CTimeOutMS			m_tFight;
	int					m_nFightPause;						// 僵硬状态时,一次性增加的间隔毫秒数
	
	CTimeOut			m_tSorbReflect;
	int					m_nTotalDamage;
	
	int					m_nKillNum;							// 杀死的目标数
	int					m_nKillNum4Potential;				// 杀死目标数量——为了增加潜力值而做的统计
	int					m_nKillNum4RelationShip;			// 杀死目标数量——为了增加关系值而做的统计

	int					m_nAtkMode;		// 攻击类型

protected: // npctype
	CNpcType*	m_pType;		// refrence

protected: // application
	CTimeOut	m_tDie;
	auto_long	m_bLeaveMap;
	bool		m_bDecRole;

protected: // ctrl
	CTimeOut	m_tAddLife;
	CTimeOut	m_tIncLife;
	OBJID		m_idGen;
//	PROCESS_ID	m_idProcess;

	MYHEAP_DECLARATION(s_heap)
};

#endif // !defined(AFX_AINPC_H__52682938_5D82_4101_B888_6A4A3F30EB51__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -