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

📄 gameautofight.h

📁 是一个基于热血战国协议的网络游戏。现在脱机客户端先放出来给大家研究
💻 H
字号:

/*
 * name: GameAutoFight.h
 *
 * desc: 自动战斗,自动打怪的控制,目前只做了战士的自动战斗
 *
*/

#pragma once
#include "StdAfx.h"

class CGameMir;
class CGameAutoFight
{
public:
	CGameAutoFight(CGameMir&game);
	~CGameAutoFight();	

protected:
	static UINT AutoFightThread( LPVOID pParam );
	void _AutoFightThread( void );
	
	static BOOL FindPathAStar(CGameMir& game, const POINT& from, const POINT& to, std::vector<POINT>& path);
	virtual bool DoAttack(DWORD ServerId, const POINT& Position)=0;
	virtual bool InAttackRange(const POINT& self, const POINT& target)=0;

	virtual bool FindTarget()=0;
	virtual void PreAttack(void)=0;
	virtual bool SwitchTarget(void)=0;

private:
	POINT GetCruisePoint(void);

public:
	void Go(void);
	void ActorAppear( void ) { m_HasNewActor = true; }
	void Stop( );	// add by zdl. 2007-10-15
	bool isRunning() const
	{
		return pThread_ != NULL ? true : false;
	}

private:
	CWinThread	*pThread_;

protected:
	CGameMir&m_Game;
	struct
	{
		char type;
		POINT pos;
		DWORD ServerId;
	}m_Target;
	CRITICAL_SECTION m_RunSC;	
	bool m_HasNewActor;
	bool m_EnableAutoFight;
};

/*
 * name:		CAutoFightWarrior.h
 *
 * desc:		战士自动战斗
 *
*/

class CAutoFightWarrior : public CGameAutoFight
{
public:
	CAutoFightWarrior(CGameMir&game) : CGameAutoFight(game) {}

protected:
	virtual bool InAttackRange(const POINT& self, const POINT& target);
	virtual bool DoAttack(DWORD ServerId, const POINT& Position);
	virtual bool FindTarget();
	virtual void PreAttack(void);
	virtual bool SwitchTarget(void);

private:
	itActor HasMonster[0x10];
};

⌨️ 快捷键说明

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